MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
MyCaffe.gym.ModelGym Class Reference

The Model Gym runs a given Project over the dataset specified within the project where each step advanced to another data item within the project's dataset. More...

Inheritance diagram for MyCaffe.gym.ModelGym:
MyCaffe.gym.IXMyCaffeGymData MyCaffe.gym.IXMyCaffeGym

Public Member Functions

 ModelGym (ModelGym gym=null)
 The constructor. More...
 
void Dispose ()
 Release all resources used. More...
 
void Initialize (Log log, PropertySet properties)
 Initialize the gym with the specified properties. More...
 
IXMyCaffeGym Clone (PropertySet properties=null)
 Create a new copy of the gym. More...
 
Dictionary< string, int > GetActionSpace ()
 Returns the action space as a dictionary of name,actionid pairs. More...
 
void Close ()
 Shutdown and close the gym. More...
 
Tuple< Bitmap, SimpleDatumRender (bool bShowUi, int nWidth, int nHeight, bool bGetAction)
 Render the gym's current state on a bitmap and SimpleDatum. More...
 
Tuple< Bitmap, SimpleDatumRender (bool bShowUi, int nWidth, int nHeight, double[] rgData, bool bGetAction)
 Render the gyms specified data. More...
 
Tuple< State, double, bool > Reset (bool bGetLabel, PropertySet props=null)
 Reset the state of the gym. More...
 
Tuple< State, double, bool > Step (int nAction, bool bGetLabel=false, PropertySet extraProp=null)
 Step the gym one step in the data. More...
 
DatasetDescriptor GetDataset (DATA_TYPE dt, Log log=null)
 Returns the dataset descriptor of the dynamic dataset produced by the Gym. More...
 
byte[] ConvertOutput (Stage stage, int nN, float[] rg, out string type)
 Converts the output values into the native type used by the Gym during queries. More...
 

Properties

bool RequiresDisplayImage [get]
 Returns true indicating that this Gym requires a display image. More...
 
DATA_TYPE SelectedDataType [get]
 Returns the selected data type. More...
 
DATA_TYPE[] SupportedDataType [get]
 Returns the data types supported by this gym. More...
 
string Name [get]
 Returns the gym's name. More...
 
int UiDelay [get]
 Returns the delay to use (if any) when the user-display is visible. More...
 
double TestingPercent [get]
 Returns the testinng percent of 0, which will cause the training data to be used during testing. More...
 
Phase ActivePhase [getset]
 Get/set the active phase under which the reset and next run. More...
 
- Properties inherited from MyCaffe.gym.IXMyCaffeGymData
Phase ActivePhase [getset]
 Specifies the active phase under which to get the data reset and next. More...
 
- Properties inherited from MyCaffe.gym.IXMyCaffeGym
string Name [get]
 Returns the name of the gym. More...
 
int UiDelay [get]
 Returns the user-interface delay to use (if any). More...
 
DATA_TYPE SelectedDataType [get]
 Returns the selected data-type. More...
 
DATA_TYPE[] SupportedDataType [get]
 Returns an array of data types supported by the gym. More...
 
bool RequiresDisplayImage [get]
 Returns whether or not the gym requires the display image. More...
 
double TestingPercent [get]
 Returns the percentage of the data to use for testing, or -1 which then uses the default of 0.2. More...
 

Detailed Description

The Model Gym runs a given Project over the dataset specified within the project where each step advanced to another data item within the project's dataset.

Definition at line 28 of file ModelGym.cs.

Constructor & Destructor Documentation

◆ ModelGym()

MyCaffe.gym.ModelGym.ModelGym ( ModelGym  gym = null)

The constructor.

Parameters
gymOptionally, specifies another Gym to copy.

Definition at line 57 of file ModelGym.cs.

Member Function Documentation

◆ Clone()

IXMyCaffeGym MyCaffe.gym.ModelGym.Clone ( PropertySet  properties = null)

Create a new copy of the gym.

Parameters
propertiesOptionally, specifies the properties to initialize the new copy with.
Returns
The new Gym copy is returned.

Implements MyCaffe.gym.IXMyCaffeGym.

Definition at line 142 of file ModelGym.cs.

◆ Close()

void MyCaffe.gym.ModelGym.Close ( )

Shutdown and close the gym.

Implements MyCaffe.gym.IXMyCaffeGym.

Definition at line 207 of file ModelGym.cs.

◆ ConvertOutput()

byte[] MyCaffe.gym.ModelGym.ConvertOutput ( Stage  stage,
int  nN,
float[]  rg,
out string  type 
)

Converts the output values into the native type used by the Gym during queries.

Parameters
stageSpecifies the stage under which the conversion is run.
nNSpecifies the number of outputs.
rgSpecifies the raw output data.
typeReturns the output type.
Returns
The converted output data is returned in a byte stream.

Note: Currently, only data gym's implement this function.

Implements MyCaffe.gym.IXMyCaffeGymData.

Definition at line 462 of file ModelGym.cs.

◆ Dispose()

void MyCaffe.gym.ModelGym.Dispose ( )

Release all resources used.

Definition at line 82 of file ModelGym.cs.

◆ GetActionSpace()

Dictionary< string, int > MyCaffe.gym.ModelGym.GetActionSpace ( )

Returns the action space as a dictionary of name,actionid pairs.

Returns
The action space is returned.

Implements MyCaffe.gym.IXMyCaffeGym.

Definition at line 199 of file ModelGym.cs.

◆ GetDataset()

DatasetDescriptor MyCaffe.gym.ModelGym.GetDataset ( DATA_TYPE  dt,
Log  log = null 
)

Returns the dataset descriptor of the dynamic dataset produced by the Gym.

Parameters
dtSpecifies the data-type to use.
logOptionally, specifies the output log to use (default = null).
Returns
The dataset descriptor is returned.

Implements MyCaffe.gym.IXMyCaffeGym.

Definition at line 422 of file ModelGym.cs.

◆ Initialize()

void MyCaffe.gym.ModelGym.Initialize ( Log  log,
PropertySet  properties 
)

Initialize the gym with the specified properties.

Parameters
logSpecifies the output log to use.
propertiesSpecifies the properties containing Gym specific initialization parameters.

The ModelGym uses the following initialization properties.

'GpuID' - the GPU to run on. 'ModelDescription' - the model description of the model to use. 'Dataset' - the name of the dataset to use. 'Weights' - the model trained weights. 'CudaPath' - the path of the CudaDnnDLL to use. 'BatchSize' - the batch size used when running images through the model (default = 16). 'RecreateData' - when 'True' the data is re-run through the model, otherwise if already run the data is loaded from file (faster).

Implements MyCaffe.gym.IXMyCaffeGym.

Definition at line 103 of file ModelGym.cs.

◆ Render() [1/2]

Tuple< Bitmap, SimpleDatum > MyCaffe.gym.ModelGym.Render ( bool  bShowUi,
int  nWidth,
int  nHeight,
bool  bGetAction 
)

Render the gym's current state on a bitmap and SimpleDatum.

Parameters
bShowUiWhen true the Bitmap is drawn.
nWidthSpecifies the width used to size the Bitmap.
nHeightSpecifies the height used to size the Bitmap.
bGetActionWhen true the action data is returned as a SimpleDatum.
Returns
A tuple optionally containing a Bitmap and/or Simpledatum is returned.

Implements MyCaffe.gym.IXMyCaffeGym.

Definition at line 236 of file ModelGym.cs.

◆ Render() [2/2]

Tuple< Bitmap, SimpleDatum > MyCaffe.gym.ModelGym.Render ( bool  bShowUi,
int  nWidth,
int  nHeight,
double[]  rgData,
bool  bGetAction 
)

Render the gyms specified data.

Parameters
bShowUiWhen true the Bitmap is drawn.
nWidthSpecifies the width used to size the Bitmap.
nHeightSpecifies the height used to size the Bitmap.
rgDataSpecifies the gym data to render.
bGetActionWhen true the action data is returned as a SimpleDatum.
Returns
A tuple optionally containing a Bitmap and/or Simpledatum is returned.

Implements MyCaffe.gym.IXMyCaffeGym.

Definition at line 251 of file ModelGym.cs.

◆ Reset()

Tuple< State, double, bool > MyCaffe.gym.ModelGym.Reset ( bool  bGetLabel,
PropertySet  props = null 
)

Reset the state of the gym.

Parameters
bGetLabelNot used.
propsOptionally, specifies extra properties.
Returns
A tuple containing state data, the reward, and the done state is returned.

Implements MyCaffe.gym.IXMyCaffeGym.

Definition at line 262 of file ModelGym.cs.

◆ Step()

Tuple< State, double, bool > MyCaffe.gym.ModelGym.Step ( int  nAction,
bool  bGetLabel = false,
PropertySet  extraProp = null 
)

Step the gym one step in the data.

Parameters
nActionSpecifies the action to run on the gym.
bGetLabelNot used.
extraPropOptionally, specifies extra properties.
Returns
A tuple containing state data, the reward, and the done state is returned.

Implements MyCaffe.gym.IXMyCaffeGym.

Definition at line 275 of file ModelGym.cs.

Property Documentation

◆ ActivePhase

Phase MyCaffe.gym.ModelGym.ActivePhase
getset

Get/set the active phase under which the reset and next run.

Definition at line 504 of file ModelGym.cs.

◆ Name

string MyCaffe.gym.ModelGym.Name
get

Returns the gym's name.

Definition at line 174 of file ModelGym.cs.

◆ RequiresDisplayImage

bool MyCaffe.gym.ModelGym.RequiresDisplayImage
get

Returns true indicating that this Gym requires a display image.

Definition at line 150 of file ModelGym.cs.

◆ SelectedDataType

DATA_TYPE MyCaffe.gym.ModelGym.SelectedDataType
get

Returns the selected data type.

Definition at line 158 of file ModelGym.cs.

◆ SupportedDataType

DATA_TYPE [] MyCaffe.gym.ModelGym.SupportedDataType
get

Returns the data types supported by this gym.

Definition at line 166 of file ModelGym.cs.

◆ TestingPercent

double MyCaffe.gym.ModelGym.TestingPercent
get

Returns the testinng percent of 0, which will cause the training data to be used during testing.

Definition at line 190 of file ModelGym.cs.

◆ UiDelay

int MyCaffe.gym.ModelGym.UiDelay
get

Returns the delay to use (if any) when the user-display is visible.

Definition at line 182 of file ModelGym.cs.


The documentation for this class was generated from the following file: