MyCaffe
1.12.2.41
Deep learning software for Windows C# programmers.
|
The MyCaffePythonGym class provides a simple interface that can easily be used from within Python. More...
Public Member Functions | |
MyCaffePythonGym () | |
The constructor. More... | |
void | Dispose () |
Release resources used. More... | |
int | Initialize (string strGym, string strParam) |
The Initialize method loads the gym specified. More... | |
void | SetActionDistributions (double[][] rgrg) |
Set the action distribution for display. More... | |
List< List< List< double > > > | GetDataAs3D (bool bGrayscale=false, double dfScale=1, SimpleDatum sd=null) |
Returns the data int a 3D form compatible with CV2. More... | |
List< List< List< double > > > | GetDataAsStacked3D (bool bReset, int nFrames=4, int nStacks=4, bool bGrayscale=true, double dfScale=1) |
Returns stacked data in a 3D form compatible with CV2. More... | |
CurrentState | Reset (PropertySet props=null) |
Resets the gym to its initial state. More... | |
CurrentState | Step (int nAction, int nSteps=1, PropertySet props=null) |
Steps the gym one or more steps with a given action. More... | |
DatasetDescriptor | GetDataset (DATA_TYPE type) |
Returns the dataset descriptor of the Gym. More... | |
void | OpenUi (bool bStartRecording=false) |
The OpenUi method opens the user interface to visualize the gym as it progresses. More... | |
void | CloseUi () |
The CloseUi method closes the user interface if it is open. More... | |
void | Closing () |
The Closing method is a call-back method called when the gym closes. More... | |
Properties | |
string | Name [get] |
Returns the name of the gym. More... | |
int[] | Actions [get] |
Returns the action values More... | |
string[] | ActionNames [get] |
Returns the action names More... | |
bool? | IsTerminal [get] |
Returns the terminal state from the last state. More... | |
double? | Reward [get] |
Returns the reward from the last state. More... | |
List< double >? | Data [get] |
Returns the data from the last state. More... | |
The MyCaffePythonGym class provides a simple interface that can easily be used from within Python.
To use within Python first install the PythonNet package with the command:
Next, from within python use the following code to access the MyCaffePythonGym.
NOTE: Using the OpenUi function requires that a UI service host is already running. The MyCaffe Test Application automatically provides a service host - just run this application before running your Python script and the test application will then handle the user interface display.
To get the latest MyCaffe Test Application, see https://github.com/MyCaffe/MyCaffe/releases
Definition at line 45 of file MyCaffePythonGym.cs.
MyCaffe.gym.python.MyCaffePythonGym.MyCaffePythonGym | ( | ) |
The constructor.
Definition at line 61 of file MyCaffePythonGym.cs.
void MyCaffe.gym.python.MyCaffePythonGym.CloseUi | ( | ) |
The CloseUi method closes the user interface if it is open.
Definition at line 605 of file MyCaffePythonGym.cs.
void MyCaffe.gym.python.MyCaffePythonGym.Closing | ( | ) |
The Closing method is a call-back method called when the gym closes.
Implements MyCaffe.gym.IXMyCaffeGymUiCallback.
Definition at line 619 of file MyCaffePythonGym.cs.
void MyCaffe.gym.python.MyCaffePythonGym.Dispose | ( | ) |
Release resources used.
Definition at line 68 of file MyCaffePythonGym.cs.
List< List< List< double > > > MyCaffe.gym.python.MyCaffePythonGym.GetDataAs3D | ( | bool | bGrayscale = false , |
double | dfScale = 1 , |
||
SimpleDatum | sd = null |
||
) |
Returns the data int a 3D form compatible with CV2.
bGrayscale | Optionally, specifies to return gray scale data (one channel). |
dfScale | Optionally, specifies the scale to apply to each item. |
sd | Optionally, specifies the data. |
Definition at line 212 of file MyCaffePythonGym.cs.
List< List< List< double > > > MyCaffe.gym.python.MyCaffePythonGym.GetDataAsStacked3D | ( | bool | bReset, |
int | nFrames = 4 , |
||
int | nStacks = 4 , |
||
bool | bGrayscale = true , |
||
double | dfScale = 1 |
||
) |
Returns stacked data in a 3D form compatible with CV2.
bReset | Specifies to reset the stack or not. |
nFrames | Optionally, specifies the number of frames (default = 4). |
nStacks | Optionally, specifies the number of stacks (default = 4). |
bGrayscale | Optionally, specifies to return gray scale data (default = true, one channel). |
dfScale | Optionally, specifies the scale to apply to each item (default = 1.0). |
Definition at line 341 of file MyCaffePythonGym.cs.
DatasetDescriptor MyCaffe.gym.python.MyCaffePythonGym.GetDataset | ( | DATA_TYPE | type | ) |
Returns the dataset descriptor of the Gym.
type | Specifies the dataset type. |
Definition at line 573 of file MyCaffePythonGym.cs.
int MyCaffe.gym.python.MyCaffePythonGym.Initialize | ( | string | strGym, |
string | strParam | ||
) |
The Initialize method loads the gym specified.
strGym | Specifies the name of the gym to load. |
strParam | Specifies the semi-colon separated parameters passed to the gym. |
The following gyms are supported: 'ATARI', 'Cart-Pole'
Definition at line 96 of file MyCaffePythonGym.cs.
void MyCaffe.gym.python.MyCaffePythonGym.OpenUi | ( | bool | bStartRecording = false | ) |
The OpenUi method opens the user interface to visualize the gym as it progresses.
bStartRecording | Optionally, specifies to open with recording on. |
Definition at line 585 of file MyCaffePythonGym.cs.
CurrentState MyCaffe.gym.python.MyCaffePythonGym.Reset | ( | PropertySet | props = null | ) |
Resets the gym to its initial state.
props | Optionally, specifies a set of properties to use to reset the gym. |
Definition at line 378 of file MyCaffePythonGym.cs.
void MyCaffe.gym.python.MyCaffePythonGym.SetActionDistributions | ( | double | rgrg[][] | ) |
Set the action distribution for display.
rgrg | Specifies the action distribution data where a distribution is provided per action. |
Definition at line 130 of file MyCaffePythonGym.cs.
CurrentState MyCaffe.gym.python.MyCaffePythonGym.Step | ( | int | nAction, |
int | nSteps = 1 , |
||
PropertySet | props = null |
||
) |
Steps the gym one or more steps with a given action.
nAction | Specifies the action to run. |
nSteps | Specifies the number of steps to run the action. |
props | Optionally, specifies properties that may include the 'override_prediction' values used to set the prediction override. |
Definition at line 421 of file MyCaffePythonGym.cs.
|
get |
Returns the action names
Definition at line 162 of file MyCaffePythonGym.cs.
|
get |
Returns the action values
Definition at line 138 of file MyCaffePythonGym.cs.
|
get |
Returns the data from the last state.
Definition at line 200 of file MyCaffePythonGym.cs.
|
get |
Returns the terminal state from the last state.
Definition at line 184 of file MyCaffePythonGym.cs.
|
get |
Returns the name of the gym.
Definition at line 115 of file MyCaffePythonGym.cs.
|
get |
Returns the reward from the last state.
Definition at line 192 of file MyCaffePythonGym.cs.