MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
Interfaces.cs
1using MyCaffe.basecode;
3using MyCaffe.common;
4using MyCaffe.gym;
5using System;
6using System.Collections.Generic;
8using System.Drawing;
9using System.Linq;
10using System.Text;
11using System.Threading.Tasks;
12
16namespace MyCaffe.trainers
17{
21 public enum ITERATOR_TYPE
22 {
26 ITERATION = 0,
30 EPISODE = 1
31 }
32
37 public interface IXMyCaffeCustomTrainer
38 {
45 void Initialize(string strProperties, IXMyCaffeCustomTrainerCallback icallback);
49 void CleanUp();
53 Stage Stage { get; }
57 string Name { get; }
67 bool GetUpdateSnapshot(out int nIteration, out double dfAccuracy);
78 bool IsTrainingSupported { get; }
82 bool IsTestingSupported { get; }
86 bool IsRunningSupported { get; }
94 void Train(Component mycaffe, int nIterationOverride, ITERATOR_TYPE type = ITERATOR_TYPE.ITERATION, TRAIN_STEP step = TRAIN_STEP.NONE);
101 void Test(Component mycaffe, int nIterationOverride, ITERATOR_TYPE type = ITERATOR_TYPE.ITERATION);
119 double GetProperty(string strName);
123 string Information { get; }
127 void OpenUi();
128 }
129
135 {
142 ResultCollection RunOne(Component mycaffe, int nDelay);
150 byte[] Run(Component mycaffe, int nN, out string type);
151 }
152
158 {
165 float[] Run(Component mycaffe, int nN);
173 byte[] Run(Component mycaffe, int nN, out string type);
183 BucketCollection PreloadData(Log log, CancelEvent evtCancel, int nProjectID, PropertySet propertyOverride = null, ConnectInfo ci = null);
192 string ResizeModel(Log log, string strModel, BucketCollection rgVocabulary);
193 }
194
199 {
205 void Update(TRAINING_CATEGORY cat, Dictionary<string, double> rgValues);
206 }
207
212 {
218 }
219
223 public interface IxTrainer
224 {
235 bool Shutdown(int nWait);
243 bool Train(int nN, ITERATOR_TYPE type, TRAIN_STEP step);
250 bool Test(int nN, ITERATOR_TYPE type);
251 }
252
256 public interface IxTrainerRL : IxTrainer
257 {
263 ResultCollection RunOne(int nDelay = 1000);
264
272 byte[] Run(int nN, PropertySet runProp, out string type);
273 }
274
278 public interface IxTrainerRNN : IxTrainer
279 {
286 float[] Run(int nN, PropertySet runProp);
287
295 byte[] Run(int nN, PropertySet runProp, out string type);
296 }
297
302 public interface IxTrainerCallback
303 {
328 }
329
335 {
341 }
342
348 {
354
360 }
361}
The BucketCollection contains a set of Buckets.
The CancelEvent provides an extension to the manual cancel event that allows for overriding the manua...
Definition: CancelEvent.cs:17
The ConnectInfo class specifies the server, database and username/password used to connect to a datab...
Definition: ConnectInfo.cs:14
The Log class provides general output in text form.
Definition: Log.cs:13
Specifies a key-value pair of properties.
Definition: PropertySet.cs:16
The DatasetDescriptor class describes a dataset which contains both a training data source and testin...
The ResultCollection contains the result of a given CaffeControl::Run.
The ConvertOutputArgs is passed to the OnConvertOutput event.
Definition: EventArgs.cs:311
The GetDataArgs is passed to the OnGetData event to retrieve data.
Definition: EventArgs.cs:402
The GetStatusArgs is passed to the OnGetStatus event.
Definition: EventArgs.cs:166
The InitializeArgs is passed to the OnInitialize event.
Definition: EventArgs.cs:90
The OverlayArgs is passed ot the OnOverlay event, optionally fired just before displaying a gym image...
Definition: EventArgs.cs:376
The TestAccuracyUpdateArgs are passed to the OnTestAccuracyUpdate event.
Definition: EventArgs.cs:553
The WaitArgs is passed to the OnWait event.
Definition: EventArgs.cs:65
The Component class is a standard Microsoft.NET class that implements the IComponent interface and is...
Definition: Component.cs:18
The IXMyCaffeCustomTrainerCallback interface is used to call back to the parent running the custom tr...
Definition: Interfaces.cs:199
void Update(TRAINING_CATEGORY cat, Dictionary< string, double > rgValues)
The Update method updates the parent with the global iteration, reward and loss.
The IXMyCaffeCustomTrainerCallbackRNN interface is used to call back to the parent running the custom...
Definition: Interfaces.cs:212
PropertySet GetRunProperties()
The GetRunProperties method is used to qeury the properties used when Running, if any.
The IXMyCaffeCustomTrainer interface is used by the MyCaffeCustomTraininer components that provide va...
Definition: Interfaces.cs:38
bool IsTrainingSupported
Returns true when the 'Train' method is supported - this should almost always be true.
Definition: Interfaces.cs:78
bool IsRunningSupported
Returns true when the 'Run' method is supported.
Definition: Interfaces.cs:86
TRAINING_CATEGORY TrainingCategory
Returns the training category supported by the implementer of the interface.
Definition: Interfaces.cs:61
string Name
Returns the name of the custom trainer.
Definition: Interfaces.cs:57
string Information
Returns general information about the custom trainer.
Definition: Interfaces.cs:123
void Test(Component mycaffe, int nIterationOverride, ITERATOR_TYPE type=ITERATOR_TYPE.ITERATION)
Test the network using the testing technique implemented by this trainer.
void Initialize(string strProperties, IXMyCaffeCustomTrainerCallback icallback)
Initialize the trainer passing in a set of key-value pairs as properties.
DatasetDescriptor GetDatasetOverride(int nProjectID, ConnectInfo ci=null)
Returns a dataset override to use (if any) instead of the project's dataset. If there is no dataset o...
double GetProperty(string strName)
Returns a specific property value.
bool IsTestingSupported
Returns true when the 'Test' method is supported.
Definition: Interfaces.cs:82
void CleanUp()
Clean-up the trainer by releasing all resources used.
void Train(Component mycaffe, int nIterationOverride, ITERATOR_TYPE type=ITERATOR_TYPE.ITERATION, TRAIN_STEP step=TRAIN_STEP.NONE)
Train the network using the training technique implemented by this trainer.
void OpenUi()
Open the user interface if one exists for the trainer.
bool GetUpdateSnapshot(out int nIteration, out double dfAccuracy)
Returns true when the training is ready for a snap-shot, false otherwise.
The IXMyCaffeCustomTrainer interface is used by the MyCaffeCustomTraininer components that provide va...
Definition: Interfaces.cs:135
ResultCollection RunOne(Component mycaffe, int nDelay)
Run the network using the run technique implemented by this trainer.
byte[] Run(Component mycaffe, int nN, out string type)
Run the network using the run technique implemented by this trainer.
The IXMyCaffeCustomTrainer interface is used by the MyCaffeCustomTraininer components that provide va...
Definition: Interfaces.cs:158
byte[] Run(Component mycaffe, int nN, out string type)
Run the network using the run technique implemented by this trainer.
float[] Run(Component mycaffe, int nN)
Run the network using the run technique implemented by this trainer.
BucketCollection PreloadData(Log log, CancelEvent evtCancel, int nProjectID, PropertySet propertyOverride=null, ConnectInfo ci=null)
The PreloadData method gives the custom trainer an opportunity to pre-load any data.
string ResizeModel(Log log, string strModel, BucketCollection rgVocabulary)
The ResizeModel method gives the custom trainer the opportunity to resize the model if needed.
The IxTrainerCallback provides functions used by each trainer to 'call-back' to the parent for inform...
Definition: Interfaces.cs:303
void OnGetData(GetDataArgs e)
The OnGetData callback fires from within the Train method and is used to get a new observation data.
void OnWait(WaitArgs e)
The OnWait callback fires when waiting for a shutdown.
void OnUpdateStatus(GetStatusArgs e)
The OnGetStatus callback fires on each iteration within the Train method.
void OnInitialize(InitializeArgs e)
The OnIntialize callback fires when initializing the trainer.
void OnShutdown()
The OnShutdown callback fires when shutting down the trainer.
The IxTrainerCallbackRNN provides functions used by each trainer to 'call-back' to the parent for inf...
Definition: Interfaces.cs:348
void OnConvertOutput(ConvertOutputArgs e)
The OnConvertOutput callback fires from within the Run method and is used to convert the network's ou...
void OnTestAccuracyUpdate(TestAccuracyUpdateArgs e)
The OnTestAccuracyUpdate callback fires from within the Run method and is used to give the recipient ...
The IxTrainerGetDataCallback interface is called right after rendering the output image and just befo...
Definition: Interfaces.cs:335
void OnOverlay(OverlayArgs e)
The OnOverlay method is optionally called just before displaying a gym image thus allowing for an ove...
The IxTrainer interface is implemented by each Trainer.
Definition: Interfaces.cs:224
bool Initialize()
Initialize the trainer.
bool Train(int nN, ITERATOR_TYPE type, TRAIN_STEP step)
Train the network.
bool Test(int nN, ITERATOR_TYPE type)
Test the newtork.
bool Shutdown(int nWait)
Shutdown the trainer.
The IxTrainerRL interface is implemented by each RL Trainer.
Definition: Interfaces.cs:257
ResultCollection RunOne(int nDelay=1000)
Run a single cycle on the trainer.
byte[] Run(int nN, PropertySet runProp, out string type)
Run a number of 'nN' samples on the trainer.
The IxTrainerRL interface is implemented by each RL Trainer.
Definition: Interfaces.cs:279
float[] Run(int nN, PropertySet runProp)
Run a number of 'nN' samples on the trainer.
byte[] Run(int nN, PropertySet runProp, out string type)
Run a number of 'nN' samples on the trainer.
The descriptors namespace contains all descriptor used to describe various items stored within the da...
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
Definition: Annotation.cs:12
TRAINING_CATEGORY
Defines the category of training.
Definition: Interfaces.cs:34
Stage
Specifies the stage underwhich to run a custom trainer.
Definition: Interfaces.cs:88
The MyCaffe.common namespace contains common MyCaffe classes.
Definition: BatchInput.cs:8
TRAIN_STEP
Defines the training stepping method (if any).
Definition: Interfaces.cs:131
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.
ITERATOR_TYPE
Specifies the iterator type to use.
Definition: Interfaces.cs:22
@ EPISODE
Use the episode iterator type.
@ ITERATION
Use the iteration iterator type.
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...
Definition: Annotation.cs:12