4using System.Collections.Generic;
10using System.Threading.Tasks;
22 double m_dfLearningRate;
31 m_nIteration = nIteration;
32 m_mycaffeWorker = mycaffeWorker;
40 get {
return m_mycaffeWorker; }
48 get {
return m_nIteration; }
56 get {
return m_dfLearningRate; }
57 set { m_dfLearningRate = value; }
82 get {
return m_nWait; }
92 int m_nOriginalDsId = 0;
108 m_log = mycaffe1.
Log;
114 m_log = mycaffe1.
Log;
124 get {
return m_log; }
132 get {
return m_caffe; }
141 set { m_ci = value; }
149 get {
return m_nOriginalDsId; }
157 get {
return m_nDsID; }
158 set { m_nDsID = value; }
168 int m_nNewFrameCount = 0;
169 int m_nTotalFrames = 0;
170 int m_nMaxFrames = 0;
171 int m_nIteration = 0;
172 double m_dfTotalReward = 0;
173 double m_dfReward = 0;
174 double m_dfExplorationRate = 0;
175 double m_dfOptimalCoeff = 0;
177 double m_dfLearningRate = 0;
178 bool m_bModelUpdated =
false;
194 public GetStatusArgs(
int nIndex,
int nIteration,
int nFrames,
int nMaxFrames,
double dfTotalReward,
double dfReward,
double dfExplorationRate,
double dfOptimalCoeff,
double dfLoss,
double dfLearningRate,
bool bModelUpdated =
false)
197 m_nIteration = nIteration;
198 m_nTotalFrames = nFrames;
199 m_nMaxFrames = nMaxFrames;
200 m_dfTotalReward = dfTotalReward;
201 m_dfReward = dfReward;
202 m_dfExplorationRate = dfExplorationRate;
203 m_dfOptimalCoeff = dfOptimalCoeff;
205 m_dfLearningRate = dfLearningRate;
206 m_bModelUpdated = bModelUpdated;
214 get {
return m_nIndex; }
222 get {
return m_nIteration; }
230 get {
return m_nNewFrameCount; }
231 set { m_nNewFrameCount = value; }
239 get {
return m_nTotalFrames; }
247 get {
return m_nMaxFrames; }
255 get {
return m_bModelUpdated; }
263 get {
return m_dfLoss; }
271 get {
return m_dfLearningRate; }
279 get {
return m_dfTotalReward; }
287 get {
return m_dfReward; }
295 get {
return m_dfExplorationRate; }
303 get {
return m_dfOptimalCoeff; }
315 byte[] m_rgRawOutput;
325 m_rgOutput = rgOutput;
341 get {
return m_rgOutput; }
349 get {
return m_type; }
357 get {
return m_rgRawOutput; }
367 m_rgRawOutput = rgData;
393 get {
return m_bmp; }
394 set { m_bmp = value; }
407 ManualResetEvent m_evtDataReady =
null;
411 bool m_bGetLabel =
false;
430 public GetDataArgs(
Phase phase,
int nIdx,
Component mycaffe,
Log log,
CancelEvent evtCancel,
bool bReset,
int nAction = -1,
bool bAllowUi =
true,
bool bGetLabel =
false,
bool bBatchMode =
false,
IxTrainerGetDataCallback iOnGetData =
null)
433 m_evtDataReady =
new ManualResetEvent(
false);
440 m_evtCancel = evtCancel;
442 m_bGetLabel = bGetLabel;
443 m_iOnGetData = iOnGetData;
451 get {
return m_iOnGetData; }
459 get {
return m_properties; }
460 set { m_properties = value; }
468 get {
return m_phase; }
477 get {
return m_evtDataReady; }
485 get {
return m_nIndex; }
486 set { m_nIndex = value; }
494 get {
return m_bGetLabel; }
502 get {
return m_log; }
510 get {
return m_evtCancel; }
518 get {
return m_state; }
519 set { m_state = value; }
527 get {
return m_nAction; }
528 set { m_nAction = value; }
536 get {
return m_caffe; }
544 get {
return m_bReset; }
545 set { m_bReset = value; }
554 int m_nDetectedLabel;
555 int m_nExpectedLabel;
557 bool m_bHandled =
false;
566 m_nDetectedLabel = nDetectedLabel;
567 m_nExpectedLabel = nExpectedLabel;
568 m_bIsCorrect =
false;
576 get {
return m_nDetectedLabel; }
584 get {
return m_nExpectedLabel; }
592 get {
return m_bIsCorrect; }
595 m_bIsCorrect = value;
605 get {
return m_bHandled; }
The MyCaffeControl is the main object used to manage all training, testing and running of the MyCaffe...
Log Log
Returns the Log (for output) used.
ProjectEx CurrentProject
Returns the name of the currently loaded project.
The CancelEvent provides an extension to the manual cancel event that allows for overriding the manua...
The ConnectInfo class specifies the server, database and username/password used to connect to a datab...
The Log class provides general output in text form.
DatasetDescriptor Dataset
Return the descriptor of the dataset used.
Specifies a key-value pair of properties.
The State class defines an abstract base class for the state information and gym data.
The ApplyUpdateArgs is passed to the OnApplyUpdates event.
int Iteration
Returns the iteration from which the gradients are to be applied.
double LearningRate
Returns the learning rate at the time the gradients were applied.
ApplyUpdateArgs(int nIteration, MyCaffeControl< T > mycaffeWorker)
The constructor.
MyCaffeControl< T > MyCaffeWorker
Returns the MyCaffe worker instance whos gradients are to be applied.
The ConvertOutputArgs is passed to the OnConvertOutput event.
byte[] RawOutput
Specifies the raw output byte stream.
ConvertOutputArgs(int nN, float[] rgOutput)
The constructor.
float[] Output
Specifies the output to convert.
void SetRawOutput(byte[] rgData, string type)
Sets the raw output byte stream and type.
string RawType
Specifies the type of the raw output byte stream.
int ResultCount
Returns the number of results.
The GetDataArgs is passed to the OnGetData event to retrieve data.
Log OutputLog
Returns the output log for general output.
Phase ActivePhase
Returns the active phase under which to get the data.
PropertySet ExtraProperties
Get/set extra properties.
bool GetLabel
Returns whether or not to retrieve the label in addition to the data.
bool Reset
Returns whether or not to reset the observation environment or not.
ManualResetEvent DataReady
Returns the data ready event that is set once the data has been retrieved. This field is only used wh...
int Action
Returns the action to run. If less than zero, this parameter is ignored.
GetDataArgs(Phase phase, int nIdx, Component mycaffe, Log log, CancelEvent evtCancel, bool bReset, int nAction=-1, bool bAllowUi=true, bool bGetLabel=false, bool bBatchMode=false, IxTrainerGetDataCallback iOnGetData=null)
The constructor.
int Index
Returns the index of the thread asking for the gym.
IxTrainerGetDataCallback GetDataCallback
Returns the OnGetData Callback called just after rendering yet before displaying the gym image.
The GetStatusArgs is passed to the OnGetStatus event.
bool ModelUpdated
Returns whether or not the model has been updated or not.
double Loss
Returns the loss value.
double OptimalSelectionCoefficient
Returns the optimal selection coefficient.
int MaxFrames
Returns the maximum frame count.
int Iteration
Returns the number of iterations (steps) run.
int Frames
Returns the total frame count across all agents.
int NewFrameCount
Get/set the new frame count.
double ExplorationRate
Returns the current exploration rate.
double TotalReward
Returns the total rewards.
int Index
Returns the index of the caller.
double Reward
Returns the immediate reward for the current episode.
double LearningRate
Returns the current learning rate.
GetStatusArgs(int nIndex, int nIteration, int nFrames, int nMaxFrames, double dfTotalReward, double dfReward, double dfExplorationRate, double dfOptimalCoeff, double dfLoss, double dfLearningRate, bool bModelUpdated=false)
The constructor.
The InitializeArgs is passed to the OnInitialize event.
int DatasetID
Get/set a new Dataset ID which is actually used.
ConnectInfo DatasetConnectInfo
Specifies the dataset connection information (if provided).
InitializeArgs(Component mycaffe)
The constructor.
int OriginalDatasetID
Returns the original Dataset ID of the open project held by the MyCaffeControl.
Log OutputLog
Returns the output log.
The OverlayArgs is passed ot the OnOverlay event, optionally fired just before displaying a gym image...
OverlayArgs(Bitmap bmp)
The constructor.
Bitmap DisplayImage
Get/set the display image.
The StateBase is the base class for the state of each observation - this is defined by actual trainer...
The TestAccuracyUpdateArgs are passed to the OnTestAccuracyUpdate event.
int ExpectedLabel
Returns the expected label.
bool Handled
Get whether or not the event was handled.
bool IsCorrect
Get/set whether or not the expected and detected label match in a correct way.
TestAccuracyUpdateArgs(int nDetectedLabel, int nExpectedLabel)
The constructor.
int DetectedLabel
Returns the detected label.
The WaitArgs is passed to the OnWait event.
WaitArgs(int nWait)
The constructor.
int Wait
Returns the amount of time to wait in milliseconds.
The Component class is a standard Microsoft.NET class that implements the IComponent interface and is...
The IxTrainerGetDataCallback interface is called right after rendering the output image and just befo...
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
Phase
Defines the Phase under which to run a Net.
The MyCaffe.gym namespace contains all classes related to the Gym's supported by MyCaffe.
The MyCaffe.trainers namespace contains all reinforcement and recurrent learning trainers.
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...