MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
MyCaffe.MyCaffeControl< T > Class Template Reference

The MyCaffeControl is the main object used to manage all training, testing and running of the MyCaffe system. More...

Inheritance diagram for MyCaffe.MyCaffeControl< T >:
System.ComponentModel.Component MyCaffe.common.IXMyCaffeState< T > MyCaffe.common.IXMyCaffe< T > MyCaffe.common.IXMyCaffeNoDb< T > MyCaffe.common.IXMyCaffeExtension< T >

Public Member Functions

 MyCaffeControl (SettingsCaffe settings, Log log, CancelEvent evtCancel, AutoResetEvent evtSnapshot=null, AutoResetEvent evtForceTest=null, ManualResetEvent evtPause=null, List< int > rgGpuId=null, string strCudaPath="", bool bCreateCudaDnn=false, ConnectInfo ci=null)
 The MyCaffeControl constructor. More...
 
void dispose ()
 Releases all GPU and Host resources used by the CaffeControl. More...
 
MyCaffeControl< T > Clone (int nGpuID)
 Clone the current instance of the MyCaffeControl creating a second instance. More...
 
void CopyGradientsFrom (MyCaffeControl< T > src)
 Copy the learnable parameter diffs from the source MyCaffeControl into this one. More...
 
void CopyWeightsFrom (MyCaffeControl< T > src)
 Copy the learnable parameter data from the source MyCaffeControl into this one. More...
 
double ApplyUpdate (int nIteration)
 Directs the solver to apply the leanred blob diffs to the weights using the solver's learning rate and update algorithm. More...
 
void Unload (bool bUnloadImageDb=true, bool bIgnoreExceptions=false)
 Unload the currently loaded project, if any. More...
 
bool ReInitializeParameters (WEIGHT_TARGET target, params string[] rgstrLayers)
 Re-initializes each of the specified layers by re-running the filler (if any) specified by the layer.
When the 'rgstr' parameter is null or otherwise empty, the blobs of all layers are re-initialized. More...
 
void SetOnTestOverride (EventHandler< TestArgs > onTest)
 Sets the root solver's onTest event function. More...
 
void SetOnTrainingStartOverride (EventHandler onTrainingStart)
 Sets the root solver's onStart event function triggered on the start of each training pass. More...
 
void SetOnTestingStartOverride (EventHandler onTestingStart)
 Sets the root solver's onTestingStart event function triggered on the start of each testing pass. More...
 
void AddCancelOverrideByName (string strEvtCancel)
 Adds a cancel override. More...
 
void AddCancelOverride (CancelEvent evtCancel)
 Adds a cancel override. More...
 
void RemoveCancelOverrideByName (string strEvtCancel)
 Remove a cancel override. More...
 
void RemoveCancelOverride (CancelEvent evtCancel)
 Remove a cancel override. More...
 
int GetDeviceCount ()
 Returns the total number of devices installed on this computer. More...
 
string GetDeviceName (int nDeviceID)
 Returns the device name of a given device ID. More...
 
void PrepareImageMeans (ProjectEx prj)
 Prepare the testing image mean by copying the training image mean if the testing image mean is missing. More...
 
bool Load (Phase phase, ProjectEx p, DB_LABEL_SELECTION_METHOD? labelSelectionOverride=null, DB_ITEM_SELECTION_METHOD? itemSelectionOverride=null, bool bResetFirst=false, IXDatabaseBase db=null, bool bUseDb=true, bool bCreateRunNet=true, string strStage=null, bool bEnableMemTrace=false)
 Load a project and optionally the MyCaffeImageDatabase. More...
 
bool Load (Phase phase, string strSolver, string strModel, byte[] rgWeights, DB_LABEL_SELECTION_METHOD? labelSelectionOverride=null, DB_ITEM_SELECTION_METHOD? itemSelectionOverride=null, bool bResetFirst=false, IXDatabaseBase db=null, bool bUseDb=true, bool bCreateRunNet=true, string strStage=null, bool bEnableMemTrace=false)
 Load a project and optionally the MyCaffeImageDatabase. More...
 
bool LoadLite (Phase phase, string strSolver, string strModel, byte[] rgWeights=null, bool bResetFirst=false, bool bCreateRunNet=true, SimpleDatum sdMean=null, string strStage=null, bool bEnableMemTrace=false)
 Load a solver and model without using the MyCaffeImageDatabase. More...
 
void LoadToRun (string strModel, byte[] rgWeights, BlobShape shape, SimpleDatum sdMean=null, TransformationParameter transParam=null, bool bForceBackward=false, bool bConvertToRunNet=true)
 The LoadToRun method loads the MyCaffeControl for running only (e.g. deployment). More...
 
bool CompareWeights (Net< T > net1, Net< T > net2)
 The CompareWeights method compares the weights held in two different Net objects. More...
 
void Train (int nIterationOverride=-1, int nTrainingTimeLimitInMinutes=0, TRAIN_STEP step=TRAIN_STEP.NONE, double dfLearningRateOverride=0, bool bReset=false)
 Train the network a set number of iterations. More...
 
double Test (int nIterationOverride=-1)
 Test the network a given number of iterations. More...
 
PropertySet TestMany (PropertySet customInput)
 Test on custom input data. More...
 
BlobCollection< T > TestManyEx (PropertySet customInput)
 Test on custom input data. More...
 
List< Tuple< SimpleDatum, ResultCollection > > TestMany (int nCount, bool bOnTrainingSet, bool bOnTargetSet=false, DB_ITEM_SELECTION_METHOD imgSelMethod=DB_ITEM_SELECTION_METHOD.RANDOM, int nImageStartIdx=0, DateTime? dtImageStartTime=null, double? dfThreshold=null)
 Test on a number of images by selecting random images from the database, running them through the Run network, and then comparing the results with the expected results. More...
 
ResultCollection Run (int nImageIdx, bool bPad=true)
 Run on a given image in the MyCaffeImageDatabase based on its image index. More...
 
List< ResultCollectionRun (List< int > rgImageIdx, ref Blob< T > blob)
 Run on a set of images in the MyCaffeImageDatabase based on their image indexes. More...
 
List< ResultCollectionRun (List< int > rgImageIdx)
 Run on a set of images in the MyCaffeImageDatabase based on their image indexes. More...
 
Blob< T > CreateDataBlob (SimpleDatum d, Blob< T > blob=null, bool bPad=true)
 Create a data blob from a SimpleDatum by transforming the data and placing the results in the blob returned. More...
 
ResultCollection Run (SimpleDatum d, bool bSort, bool bUseSolverNet, bool bPad=true)
 Run on a given Datum. More...
 
List< ResultCollectionRun (List< SimpleDatum > rgSd, ref Blob< T > blob, bool bUseSolverNet=false, int nMax=int.MaxValue)
 Run on a given list of Datum. More...
 
List< ResultCollectionRun (Blob< T > blob, bool bSort=true, bool bUseSolverNet=false, int nMax=int.MaxValue, List< int > rgIgnoreLabels=null)
 Run on a Blob of data. More...
 
ResultCollection Run (Bitmap img, bool bSort=true, bool bPad=true)
 Run on a given bitmap image. More...
 
ResultCollection Run (SimpleDatum d, bool bSort=true, bool bPad=true)
 Run on a given Datum. More...
 
PropertySet RunModel (PropertySet customInput)
 Run the model using data from the model itself - requires a Data layer with the RUN phase. More...
 
BlobCollection< T > RunModelEx (PropertySet customInput)
 Run the model using data from the model itself - requires a Data layer with the RUN phase. More...
 
PropertySet Run (PropertySet customInput, int nK=1, double dfThreshold=0.01, int nMax=80, bool bBeamSearch=false)
 Run the model on custom input data. More...
 
BlobCollection< T > Run (BlobCollection< T > colBottom)
 Run the network forward on the bottom blobs. More...
 
Bitmap GetTestImage (Phase phase, out int nLabel, out string strLabel)
 Retrieves a random image from either the training or test set depending on the Phase specified. More...
 
Bitmap GetTestImage (Phase phase, int nLabel)
 Retrieves a random image from either the training or test set depending on the Phase specified. More...
 
Bitmap GetTargetImage (int nSrcId, int nIdx, out int nLabel, out string strLabel, out byte[] rgCriteria, out SimpleDatum.DATA_FORMAT fmtCriteria)
 Retrives the image at a given index within the Testing data set. More...
 
Bitmap GetTargetImage (int nImageID, out int nLabel, out string strLabel, out byte[] rgCriteria, out SimpleDatum.DATA_FORMAT fmtCriteria)
 Retrives the image with a given ID. More...
 
SimpleDatum GetItemMean ()
 Returns the item (e.g., image or temporal item) mean used by the solver network used during training. More...
 
DatasetDescriptor GetDataset ()
 Returns the current dataset used when training and testing. More...
 
byte[] GetWeights ()
 Retrieves the weights of the training network. More...
 
void UpdateRunWeights (bool bOutputStatus=false, bool bVerifyWeights=true)
 Loads the weights from the training net into the Net used for running. More...
 
void UpdateWeights (byte[] rgWeights)
 Loads the training Net with new weights. More...
 
Net< T > CreateNet (byte[] rgWeights, CudaDnn< T > cudaOverride=null)
 Creates a new Net, loads the weights specified into it and returns it. More...
 
Net< T > GetInternalNet (Phase phase=Phase.RUN)
 Returns the internal net based on the Phase specified: TRAIN, TEST or RUN. More...
 
Solver< T > GetInternalSolver ()
 Get the internal solver. More...
 
void Snapshot (bool bUpdateDatabase=true)
 The Snapshot function forces a snapshot to occur. More...
 
string GetLicenseText (string strOtherLicenses)
 Returns the license text for MyCaffe. More...
 
bool VerifyCompute (string strExtra=null, int nDeviceID=-1, bool bThrowException=true)
 VerifyCompute compares the current compute of the current device (or device specified) against the required compute of the current CudaDnnDLL.dll used. More...
 
Blob< T > CreateBlob (string strName)
 Create an unsized blob and set its name. More...
 
long CreateExtension (string strExtensionDLLPath)
 Create and load a new extension DLL. More...
 
void FreeExtension (long hExtension)
 Free an existing extension and unload it. More...
 
T[] RunExtension (long hExtension, long lfnIdx, T[] rgParam)
 Run a function on an existing extension. More...
 
double[] RunExtensionD (long hExtension, long lfnIdx, double[] rgParam)
 Run a function on an existing extension using the double base type. More...
 
float[] RunExtensionF (long hExtension, long lfnIdx, float[] rgParam)
 Run a function on an existing extension using the float base type. More...
 
- Public Member Functions inherited from System.ComponentModel.Component
 Component ()
 

Static Public Member Functions

static NetParameter CreateNetParameterForRunning (BlobShape shape, string strModel, out TransformationParameter transform_param, Stage stage=Stage.NONE, bool bSkipLossLayer=false, bool bMaintainBatchSize=false)
 Creates a net parameter for the RUN phase. More...
 
static void ResetDevice (int nDeviceID)
 Reset the device at the given device ID. More...
 
static string GetLicenseTextEx (string strOtherLicenses)
 Returns the license text for MyCaffe. More...
 

Protected Member Functions

NetParameter createNetParameterForRunning (ProjectEx p, out TransformationParameter transform_param)
 Creates a net parameter for the RUN phase. More...
 
NetParameter createNetParameterForRunning (DatasetDescriptor ds, string strModel, out TransformationParameter transform_param, Stage stage=Stage.NONE)
 Creates a net parameter for the RUN phase. More...
 
NetParameter createNetParameterForRunning (BlobShape shape, string strModel, out TransformationParameter transform_param, Stage stage=Stage.NONE)
 Creates a net parameter for the RUN phase. More...
 
NetParameter createNetParameterForRunning (SimpleDatum sdMean, string strModel, out TransformationParameter transform_param, out int nC, out int nH, out int nW, Stage stage=Stage.NONE)
 Creates a net parameter for the RUN phase. More...
 

Protected Attributes

SettingsCaffe m_settings
 The settings used to configure the control. More...
 
Log m_log
 The log used for output. More...
 
IXDatabaseBase m_db = null
 The image database. More...
 
bool m_bDbOwner = true
 Whether or not the control owns the image database. More...
 
CancelEvent m_evtCancel
 The CancelEvent used to cancel training and testing operations. More...
 
AutoResetEvent m_evtForceSnapshot
 An auto-reset event used to force a snapshot. More...
 
AutoResetEvent m_evtForceTest
 An auto-reset event used to force a test cycle. More...
 
ManualResetEvent m_evtPause
 An auto-reset event used to pause training. More...
 
DataTransformer< T > m_dataTransformer = null
 The data transformer used to transform data. More...
 
ProjectEx m_project = null
 The active project (if any). More...
 
DatasetDescriptor m_dataSet = null
 The dataset descriptor of the dataset used in the image database. More...
 
string m_strCudaPath = null
 The low-level path of the underlying CudaDnn DLL. More...
 
List< int > m_rgGpu
 A list of the Device ID's used for training. More...
 

Properties

static FileVersionInfo Version [get]
 Get the file version of the MyCaffe assembly running. More...
 
ConnectInfo DatasetConnectInfo [get]
 Returns the dataset connection information, if used (default = null). More...
 
string CurrentStage [get]
 Returns the stage under which the project was loaded, if any. More...
 
bool EnableTesting [getset]
 Enable/disable testing. For example reinforcement learning does not use testing. More...
 
bool EnableVerboseStatus [getset]
 Get/set whether or not to use verbose status. When enabled, the full status is output when loading a project, otherwise a more minimum (faster) set is output (default = false for disabled). More...
 
bool? EnableBlobDebugging [getset]
 Enable/disable blob debugging. More...
 
bool? EnableBreakOnFirstNaN [getset]
 Enable/disable break training after first detecting a NaN. More...
 
bool? EnableDetailedNanDetection [getset]
 When enabled (requires EnableBlobDebugging = true), the detailed Nan (and Infinity) detection is perofmed on each blob when training Net. More...
 
bool? EnableLayerDebugging [getset]
 Enable/disable layer debugging which causes each layer to check for NAN/INF on each forward/backward pass and throw an exception when found. More...
 
bool? EnableSingleStep [getset]
 Enable/disable single step training. More...
 
DataTransformer< T > DataTransformer [get]
 Returns the DataTransormer used. More...
 
SettingsCaffe Settings [get]
 Returns the settings used to create the control. More...
 
CudaDnn< T > Cuda [get]
 Returns the CudaDnn connection used. More...
 
Log Log [get]
 Returns the Log (for output) used. More...
 
IXPersist< T > Persist [get]
 Returns the persist used to load and save weights. More...
 
IXDatabaseBase Database [get]
 Returns the MyCaffeImageDatabase or MyCaffeTemporalDatabase used. More...
 
CancelEvent CancelEvent [get]
 Returns the CancelEvent used. More...
 
List< int > ActiveGpus [get]
 Returns a list of Active GPU's used by the control. More...
 
string ActiveLabelCounts [get]
 Returns a string describing the active label counts observed during training. More...
 
string LabelQueryHitPercents [get]
 Returns a string describing the label query hit percentages observed during training. More...
 
string LabelQueryEpochs [get]
 Returns a string describing the label query epochs observed during training. More...
 
string CurrentDevice [get]
 Returns the name of the current device used. More...
 
ProjectEx CurrentProject [get]
 Returns the name of the currently loaded project. More...
 
int CurrentIteration [get]
 Returns the current iteration. More...
 
int MaximumIteration [get]
 Returns the maximum iteration. More...
 
Phase LastPhase [get]
 Returns the last phase run (TRAIN, TEST or RUN). More...
 
- Properties inherited from MyCaffe.common.IXMyCaffeState< T >
bool EnableBlobDebugging [getset]
 Enable/disable blob debugging. More...
 
bool EnableBreakOnFirstNaN [getset]
 Enable/disable break training after first detecting a NaN. More...
 
bool EnableDetailedNanDetection [getset]
 When enabled (requires EnableBlobDebugging = true), the detailed Nan (and Infinity) detection is perofmed on each blob when training Net. More...
 
bool EnableSingleStep [getset]
 Enable/disable single step training. More...
 
bool EnableLayerDebugging [getset]
 Enable/disable layer debugging which causes each layer to check for NAN/INF on each forward/backward pass and throw an exception when found. More...
 
IXPersist< T > Persist [get]
 Returns the persist used to load and save weights. More...
 
IXDatabaseBase Database [get]
 Returns the in-memory MyCaffeDatabase used. More...
 
CancelEvent CancelEvent [get]
 Returns the CancelEvent used. More...
 
List< int > ActiveGpus [get]
 Returns a list of Active GPU's used by the control. More...
 
string ActiveLabelCounts [get]
 Returns a string describing the active label counts observed during training. More...
 
string LabelQueryHitPercents [get]
 Returns a string describing the label query hit percentages observed during training. More...
 
string LabelQueryEpochs [get]
 Returns a string describing the label query epochs observed during training. More...
 
string CurrentDevice [get]
 Returns the name of the current device used. More...
 
ProjectEx CurrentProject [get]
 Returns the name of the currently loaded project. More...
 
int CurrentIteration [get]
 Returns the current iteration. More...
 
int MaximumIteration [get]
 Returns the maximum iteration. More...
 

Events

EventHandler< SnapshotArgsOnSnapshot
 The OnSnapshot event fires each time a snap-shot is taken. More...
 
EventHandler< TrainingIterationArgs< T > > OnTrainingIteration
 The OnTrainingIteration event fires at the end of each training iteration. More...
 
EventHandler< TestingIterationArgs< T > > OnTestingIteration
 The OnTestingIteration event fires at the end of each testing iteration. More...
 

Detailed Description

The MyCaffeControl is the main object used to manage all training, testing and running of the MyCaffe system.

Template Parameters
TSpecifies the base type float or double. Using float is recommended to conserve GPU memory.

Definition at line 34 of file MyCaffeControl.cs.

Constructor & Destructor Documentation

◆ MyCaffeControl()

MyCaffe.MyCaffeControl< T >.MyCaffeControl ( SettingsCaffe  settings,
Log  log,
CancelEvent  evtCancel,
AutoResetEvent  evtSnapshot = null,
AutoResetEvent  evtForceTest = null,
ManualResetEvent  evtPause = null,
List< int >  rgGpuId = null,
string  strCudaPath = "",
bool  bCreateCudaDnn = false,
ConnectInfo  ci = null 
)

The MyCaffeControl constructor.

Parameters
settingsSpecifies the setting used to configure the MyCaffeControl.
logSpecifies the Log for all output.
evtCancelSpecifies the CancelEvent used to abort training and testing operations.
evtSnapshotOptionally, specifies an auto reset event used to force a snap-shot.
evtForceTestOptionally, specifies an auto reset event used to force a test cycle.
evtPauseOptionally, specifies an auto reset event used to pause training.
rgGpuIdOptionally, specfies a set of GPU ID's that override those specified in the SettingsCaffe object.
strCudaPathOptionally, specifies the path to the low-lever CudaDnnDll.DLL file. Note, when not set, the system looks in the same directory of the executing assembly for the low-level DLL.
bCreateCudaDnnOptionally, specififies create the connection to CUDA (default = false, causing the creation to occur during Load).
ciOptionally, specifies the connection information used to connect to the dataset.

Definition at line 136 of file MyCaffeControl.cs.

Member Function Documentation

◆ AddCancelOverride()

void MyCaffe.MyCaffeControl< T >.AddCancelOverride ( CancelEvent  evtCancel)

Adds a cancel override.

Parameters
evtCancelSpecifies the new name of the cancel event to add.

Implements MyCaffe.common.IXMyCaffeState< T >.

Definition at line 496 of file MyCaffeControl.cs.

◆ AddCancelOverrideByName()

void MyCaffe.MyCaffeControl< T >.AddCancelOverrideByName ( string  strEvtCancel)

Adds a cancel override.

Parameters
strEvtCancelSpecifies the new name of the cancel event to add.

Implements MyCaffe.common.IXMyCaffeState< T >.

Definition at line 487 of file MyCaffeControl.cs.

◆ ApplyUpdate()

double MyCaffe.MyCaffeControl< T >.ApplyUpdate ( int  nIteration)

Directs the solver to apply the leanred blob diffs to the weights using the solver's learning rate and update algorithm.

Parameters
nIterationSpecifies the current iteration.
Returns
The learning rate used is returned.

Definition at line 359 of file MyCaffeControl.cs.

◆ Clone()

MyCaffeControl< T > MyCaffe.MyCaffeControl< T >.Clone ( int  nGpuID)

Clone the current instance of the MyCaffeControl creating a second instance.

The second instance has the same project loaded and a copy of the first instance's weights.

Parameters
nGpuIDSpecifies the GPUID on which to load the second instance.
Returns
The new MyCaffeControl instance is returned.

Definition at line 285 of file MyCaffeControl.cs.

◆ CompareWeights()

bool MyCaffe.MyCaffeControl< T >.CompareWeights ( Net< T >  net1,
Net< T >  net2 
)

The CompareWeights method compares the weights held in two different Net objects.

Parameters
net1Specifies the first Net to compare.
net2Specifies the second Net to compare.
Returns
If the weights are identical, true is returned, otherwise false.

Definition at line 1800 of file MyCaffeControl.cs.

◆ CopyGradientsFrom()

void MyCaffe.MyCaffeControl< T >.CopyGradientsFrom ( MyCaffeControl< T >  src)

Copy the learnable parameter diffs from the source MyCaffeControl into this one.

Parameters
srcSpecifies the source MyCaffeControl whos gradients (blob diffs) are to be copied.

Definition at line 317 of file MyCaffeControl.cs.

◆ CopyWeightsFrom()

void MyCaffe.MyCaffeControl< T >.CopyWeightsFrom ( MyCaffeControl< T >  src)

Copy the learnable parameter data from the source MyCaffeControl into this one.

Parameters
srcSpecifies the source MyCaffeControl whos gradients (blob data) are to be copied.

Definition at line 337 of file MyCaffeControl.cs.

◆ CreateBlob()

Blob< T > MyCaffe.MyCaffeControl< T >.CreateBlob ( string  strName)

Create an unsized blob and set its name.

Parameters
strNameSpecifies the Blob name.
Returns
The Blob is returned.

Definition at line 3496 of file MyCaffeControl.cs.

◆ CreateDataBlob()

Blob< T > MyCaffe.MyCaffeControl< T >.CreateDataBlob ( SimpleDatum  d,
Blob< T >  blob = null,
bool  bPad = true 
)

Create a data blob from a SimpleDatum by transforming the data and placing the results in the blob returned.

Parameters
dSpecifies the datum to load into the blob.
blobOptionally, specifies a blob to use instead of creating a new one.
bPadOptionally, pad the blob with an extra item (default = false).
Returns
The data blob containing the transformed data is returned.

Implements MyCaffe.common.IXMyCaffeNoDb< T >.

Definition at line 2460 of file MyCaffeControl.cs.

◆ CreateExtension()

long MyCaffe.MyCaffeControl< T >.CreateExtension ( string  strExtensionDLLPath)

Create and load a new extension DLL.

Parameters
strExtensionDLLPathSpecifies the path to the extension DLL.
Returns
The handle to the extension is returned.

Implements MyCaffe.common.IXMyCaffeExtension< T >.

Definition at line 3508 of file MyCaffeControl.cs.

◆ CreateNet()

Net< T > MyCaffe.MyCaffeControl< T >.CreateNet ( byte[]  rgWeights,
CudaDnn< T >  cudaOverride = null 
)

Creates a new Net, loads the weights specified into it and returns it.

Parameters
rgWeightsSpecifies the weights to load.
cudaOverrideOptionally, specifies a different cuda instance for the Net to use.
Returns
The new Net is returned.

Definition at line 3304 of file MyCaffeControl.cs.

◆ createNetParameterForRunning() [1/4]

NetParameter MyCaffe.MyCaffeControl< T >.createNetParameterForRunning ( BlobShape  shape,
string  strModel,
out TransformationParameter  transform_param,
Stage  stage = Stage.NONE 
)
protected

Creates a net parameter for the RUN phase.

This function transforms the training net parameter into a new net parameter suitable to run in the RUN phase.

Parameters
shapeSpecifies the shape of the images that will be used.
strModelSpecifies the model descriptor.
transform_paramSpecifies the TransformationParameter to use.
stageOptionally, specifies the stage to create the run network on.
Returns
The new NetParameter suitable for the RUN phase is returned.

Definition at line 798 of file MyCaffeControl.cs.

◆ CreateNetParameterForRunning()

static NetParameter MyCaffe.MyCaffeControl< T >.CreateNetParameterForRunning ( BlobShape  shape,
string  strModel,
out TransformationParameter  transform_param,
Stage  stage = Stage.NONE,
bool  bSkipLossLayer = false,
bool  bMaintainBatchSize = false 
)
static

Creates a net parameter for the RUN phase.

This function transforms the training net parameter into a new net parameter suitable to run in the RUN phase.

Parameters
shapeSpecifies the shape of the images that will be used.
strModelSpecifies the model descriptor.
transform_paramSpecifies the TransformationParameter to use.
stageOptionally, specifies the stage to create the run network on.
bSkipLossLayerOptionally, specifies to skip the loss layer and not output a converted layer to replace it (default = false).
bMaintainBatchSizeOptionally, specifies to keep the batch size, otherwise batch size is set to 1 (default = false).
Returns
The new NetParameter suitable for the RUN phase is returned.

Definition at line 882 of file MyCaffeControl.cs.

◆ createNetParameterForRunning() [2/4]

NetParameter MyCaffe.MyCaffeControl< T >.createNetParameterForRunning ( DatasetDescriptor  ds,
string  strModel,
out TransformationParameter  transform_param,
Stage  stage = Stage.NONE 
)
protected

Creates a net parameter for the RUN phase.

This function transforms the training net parameter into a new net parameter suitable to run in the RUN phase.

Parameters
dsSpecifies a DatasetDescriptor for the dataset used.
strModelSpecifies the model descriptor.
transform_paramSpecifies the TransformationParameter to use.
stageOptionally, specifies the stage to create the run network on.
Returns
The new NetParameter suitable for the RUN phase is returned.

Definition at line 781 of file MyCaffeControl.cs.

◆ createNetParameterForRunning() [3/4]

NetParameter MyCaffe.MyCaffeControl< T >.createNetParameterForRunning ( ProjectEx  p,
out TransformationParameter  transform_param 
)
protected

Creates a net parameter for the RUN phase.

This function transforms the training net parameter into a new net parameter suitable to run in the RUN phase.

Parameters
pSpecifies a project.
transform_paramSpecifies the TransformationParameter to use.
Returns
The new NetParameter suitable for the RUN phase is returned.

Definition at line 765 of file MyCaffeControl.cs.

◆ createNetParameterForRunning() [4/4]

NetParameter MyCaffe.MyCaffeControl< T >.createNetParameterForRunning ( SimpleDatum  sdMean,
string  strModel,
out TransformationParameter  transform_param,
out int  nC,
out int  nH,
out int  nW,
Stage  stage = Stage.NONE 
)
protected

Creates a net parameter for the RUN phase.

This function transforms the training net parameter into a new net parameter suitable to run in the RUN phase.

Parameters
sdMeanSpecifies the mean image data used to size the network and as the mean image when used in the transformation parameter.
strModelSpecifies the model descriptor.
transform_paramReturns the TransformationParameter to use.
nCReturns the discovered channel sizing to use.
nHReturns the discovered height sizing to use.
nWReturns the discovered width sizing to use.
stageOptionally, specifies the stage to create the run network on.
Returns
The new NetParameter suitable for the RUN phase is returned.

Definition at line 819 of file MyCaffeControl.cs.

◆ dispose()

void MyCaffe.MyCaffeControl< T >.dispose ( )

Releases all GPU and Host resources used by the CaffeControl.

Definition at line 191 of file MyCaffeControl.cs.

◆ FreeExtension()

void MyCaffe.MyCaffeControl< T >.FreeExtension ( long  hExtension)

Free an existing extension and unload it.

Parameters
hExtensionSpecifies the handle to the extension to free.

Implements MyCaffe.common.IXMyCaffeExtension< T >.

Definition at line 3517 of file MyCaffeControl.cs.

◆ GetDataset()

Returns the current dataset used when training and testing.

Returns
The DatasetDescriptor is returned.

Implements MyCaffe.common.IXMyCaffe< T >.

Definition at line 3179 of file MyCaffeControl.cs.

◆ GetDeviceCount()

int MyCaffe.MyCaffeControl< T >.GetDeviceCount ( )

Returns the total number of devices installed on this computer.

Returns

Implements MyCaffe.common.IXMyCaffeState< T >.

Definition at line 733 of file MyCaffeControl.cs.

◆ GetDeviceName()

string MyCaffe.MyCaffeControl< T >.GetDeviceName ( int  nDeviceID)

Returns the device name of a given device ID.

Parameters
nDeviceIDSpecifies the device ID.
Returns

Implements MyCaffe.common.IXMyCaffeState< T >.

Definition at line 743 of file MyCaffeControl.cs.

◆ GetInternalNet()

Net< T > MyCaffe.MyCaffeControl< T >.GetInternalNet ( Phase  phase = Phase.RUN)

Returns the internal net based on the Phase specified: TRAIN, TEST or RUN.

Parameters
phaseSpecifies the Phase used to select the Net.
Returns
The internal Net is returned.

The following net is returned under the following conditions: phase = ALL, return the net from the LastPhase run. If the LastPhase run = NONE, return the RUN net. phase = n/a, return the default RUN net. phase = NONE, return the default RUN net. phase = TRAIN, return the training net. phase = TEST, return the testing net.

Definition at line 3328 of file MyCaffeControl.cs.

◆ GetInternalSolver()

Solver< T > MyCaffe.MyCaffeControl< T >.GetInternalSolver ( )

Get the internal solver.

Returns

Definition at line 3349 of file MyCaffeControl.cs.

◆ GetItemMean()

SimpleDatum MyCaffe.MyCaffeControl< T >.GetItemMean ( )

Returns the item (e.g., image or temporal item) mean used by the solver network used during training.

Returns
The image mean is returned as a SimpleDatum.

Implements MyCaffe.common.IXMyCaffe< T >.

Definition at line 3158 of file MyCaffeControl.cs.

◆ GetLicenseText()

string MyCaffe.MyCaffeControl< T >.GetLicenseText ( string  strOtherLicenses)

Returns the license text for MyCaffe.

Parameters
strOtherLicensesSpecifies other licenses to append to the license text.
Returns

Implements MyCaffe.common.IXMyCaffe< T >.

Definition at line 3401 of file MyCaffeControl.cs.

◆ GetLicenseTextEx()

static string MyCaffe.MyCaffeControl< T >.GetLicenseTextEx ( string  strOtherLicenses)
static

Returns the license text for MyCaffe.

Parameters
strOtherLicensesSpecifies other licenses to append to the license text.
Returns

Definition at line 3380 of file MyCaffeControl.cs.

◆ GetTargetImage() [1/2]

Bitmap MyCaffe.MyCaffeControl< T >.GetTargetImage ( int  nImageID,
out int  nLabel,
out string  strLabel,
out byte[]  rgCriteria,
out SimpleDatum.DATA_FORMAT  fmtCriteria 
)

Retrives the image with a given ID.

Parameters
nImageIDSpecifies the Raw Image ID.
nLabelReturns the expected label for the image.
strLabelReturns the expected label name for the image.
rgCriteriaReturns the data criteria if one exists.
fmtCriteriaReturns the format of the data criteria, if one exists.
Returns
The image queried is returned.

Definition at line 3135 of file MyCaffeControl.cs.

◆ GetTargetImage() [2/2]

Bitmap MyCaffe.MyCaffeControl< T >.GetTargetImage ( int  nSrcId,
int  nIdx,
out int  nLabel,
out string  strLabel,
out byte[]  rgCriteria,
out SimpleDatum.DATA_FORMAT  fmtCriteria 
)

Retrives the image at a given index within the Testing data set.

Parameters
nSrcIdSpecifies the Source ID.
nIdxSpecifies the image index.
nLabelReturns the expected label for the image.
strLabelReturns the expected label name for the image.
rgCriteriaReturns the data criteria if one exists.
fmtCriteriaReturns the format of the data criteria, if one exists.
Returns
The image queried is returned.

Definition at line 3106 of file MyCaffeControl.cs.

◆ GetTestImage() [1/2]

Bitmap MyCaffe.MyCaffeControl< T >.GetTestImage ( Phase  phase,
int  nLabel 
)

Retrieves a random image from either the training or test set depending on the Phase specified.

Parameters
phaseSpecifies whether to select images from the training set or testing set.
nLabelReturns the expected label for the image.
Returns
The image queried is returned.

Implements MyCaffe.common.IXMyCaffe< T >.

Definition at line 3084 of file MyCaffeControl.cs.

◆ GetTestImage() [2/2]

Bitmap MyCaffe.MyCaffeControl< T >.GetTestImage ( Phase  phase,
out int  nLabel,
out string  strLabel 
)

Retrieves a random image from either the training or test set depending on the Phase specified.

Parameters
phaseSpecifies whether to select images from the training set or testing set.
nLabelReturns the expected label for the image.
strLabelReturns the expected label name for the image.
Returns
The image queried is returned.

Implements MyCaffe.common.IXMyCaffe< T >.

Definition at line 3060 of file MyCaffeControl.cs.

◆ GetWeights()

byte[] MyCaffe.MyCaffeControl< T >.GetWeights ( )

Retrieves the weights of the training network.

Returns
The weights are returned.

Implements MyCaffe.common.IXMyCaffe< T >.

Definition at line 3188 of file MyCaffeControl.cs.

◆ Load() [1/2]

bool MyCaffe.MyCaffeControl< T >.Load ( Phase  phase,
ProjectEx  p,
DB_LABEL_SELECTION_METHOD labelSelectionOverride = null,
DB_ITEM_SELECTION_METHOD itemSelectionOverride = null,
bool  bResetFirst = false,
IXDatabaseBase  db = null,
bool  bUseDb = true,
bool  bCreateRunNet = true,
string  strStage = null,
bool  bEnableMemTrace = false 
)

Load a project and optionally the MyCaffeImageDatabase.

This load function uses the MyCaffeImageDatabase.

Parameters
phaseSpecifies the Phase for which the load should focus.
pSpecifies the Project to load.
labelSelectionOverrideOptionally, specifies the label selection override (overides the label selection in SettingsCaffe). The label selection dictates how the label sets are selected.
itemSelectionOverrideOptionally, specifies the item (e.g., image or temporal item) selection override (overides the item selection in SettingsCaffe). The item selection dictates how the items are selected from each label set.
bResetFirstOptionally, resets the device before loading. IMPORTANT: this functionality is only recommendned during testing, for resetting the device will throw off all other users of the device.
dbOptionally, specifies the MyCaffeImageDatabase or MyCaffeTemporalDatabase to use. When null, an instance if the in-memory database is created internally.
bUseDbOptionally, specifies to use the in-memory database based on the DB_VERSION specified in the settings.
bCreateRunNetOptionally, specifies whether or not to create the Run net.
strStageOptionally, specifies a stage under which to load the model.
bEnableMemTraceOptionally, specifies to enable the memory tracing (only available in debug builds).
Returns
If the project is loaded the function returns true, otherwise false is returned.

Implements MyCaffe.common.IXMyCaffe< T >.

Definition at line 1070 of file MyCaffeControl.cs.

◆ Load() [2/2]

bool MyCaffe.MyCaffeControl< T >.Load ( Phase  phase,
string  strSolver,
string  strModel,
byte[]  rgWeights,
DB_LABEL_SELECTION_METHOD labelSelectionOverride = null,
DB_ITEM_SELECTION_METHOD itemSelectionOverride = null,
bool  bResetFirst = false,
IXDatabaseBase  db = null,
bool  bUseDb = true,
bool  bCreateRunNet = true,
string  strStage = null,
bool  bEnableMemTrace = false 
)

Load a project and optionally the MyCaffeImageDatabase.

This load function uses the MyCaffeImageDatabase.

Parameters
phaseSpecifies the Phase for which the load should focus.
strSolverSpecifies the solver descriptor.
strModelSpecifies the model desciptor.
rgWeightsOptionally, specifies the weights to load, or null to ignore.
labelSelectionOverrideOptionally, specifies the label selection override (overides the label selection in SettingsCaffe). The label selection dictates how the label sets are selected.
itemSelectionOverrideOptionally, specifies the item (e.g., image or temporal item) selection override (overides the item selection in SettingsCaffe). The item selection dictates how the item are selected from each label set.
bResetFirstOptionally, resets the device before loading. IMPORTANT: this functionality is only recommendned during testing, for resetting the device will throw off all other users of the device.
dbOptionally, specifies the in-memory MyCaffeDatabase to use. When null, an instance if the MyCaffeImageDatabase or MyCaffeTemporalDatabase is created internally depending on the DB_VERSION used.
bUseDbOptionally, specifies to use the in-memory database based on the DB_VERSION specified in the settings.
bCreateRunNetOptionally, specifies whether or not to create the Run net (default = true).
strStageOptionally, specifies a stage under which to load the model.
bEnableMemTraceOptionally, specifies to enable the memory tracing (only available in debug builds).
Returns
If the project is loaded the function returns true, otherwise false is returned.

Implements MyCaffe.common.IXMyCaffe< T >.

Definition at line 1298 of file MyCaffeControl.cs.

◆ LoadLite()

bool MyCaffe.MyCaffeControl< T >.LoadLite ( Phase  phase,
string  strSolver,
string  strModel,
byte[]  rgWeights = null,
bool  bResetFirst = false,
bool  bCreateRunNet = true,
SimpleDatum  sdMean = null,
string  strStage = null,
bool  bEnableMemTrace = false 
)

Load a solver and model without using the MyCaffeImageDatabase.

This load function is a load lite that does not use the MyCaffeImageDatabase.

Parameters
phaseSpecifies the Phase for which the load should focus.
strSolverSpecifies the solver descriptor.
strModelSpecifies the model desciptor.
rgWeightsOptionally, specifies the weights to load, or null to ignore (default = null).
bResetFirstOptionally, resets the device before loading. IMPORTANT: this functionality is only recommendned during testing, for resetting the device will throw off all other users of the device.
bCreateRunNetOptionally, specifies whether or not to create the Run net (default = true).
sdMeanOptionally, specifies the image mean to use (default = null).
strStageOptionally, specifies a stage under which to load the model.
bEnableMemTraceOptionally, specifies to enable the memory tracing (only available in debug builds).
Returns
If the project is loaded the function returns true, otherwise false is returned.

Definition at line 1512 of file MyCaffeControl.cs.

◆ LoadToRun()

void MyCaffe.MyCaffeControl< T >.LoadToRun ( string  strModel,
byte[]  rgWeights,
BlobShape  shape,
SimpleDatum  sdMean = null,
TransformationParameter  transParam = null,
bool  bForceBackward = false,
bool  bConvertToRunNet = true 
)

The LoadToRun method loads the MyCaffeControl for running only (e.g. deployment).

This method does not use the MyCaffeImageDatabase.

Parameters
strModelSpecifies the model description to load.
rgWeightsSpecifies the trained weights to load.
shapeSpecifies the expected shape to run on.
sdMeanOptionally, specifies the simple datum mean to subtract from input images that are run.
transParamOptionally, specifies the TransformationParameter to use. When using a 'deployment' model that has no data layers, you should supply a transformation parameter that matches the transformation used during training.
bForceBackwardOptionally, specifies to force backward propagation in the event that a backward pass is to be run on the Run net - The DeepDraw functionality uses this setting so that it can view what the trained weights actually see.
bConvertToRunNetWhen true, the 'strModel' is converted from a training model to a run model, otherwise the model is used unaltered (default = true)

Implements MyCaffe.common.IXMyCaffeNoDb< T >.

Definition at line 1637 of file MyCaffeControl.cs.

◆ PrepareImageMeans()

void MyCaffe.MyCaffeControl< T >.PrepareImageMeans ( ProjectEx  prj)

Prepare the testing image mean by copying the training image mean if the testing image mean is missing.

Parameters
prjSpecifies the project whos image mean is to be prepared.

Definition at line 994 of file MyCaffeControl.cs.

◆ ReInitializeParameters()

bool MyCaffe.MyCaffeControl< T >.ReInitializeParameters ( WEIGHT_TARGET  target,
params string[]  rgstrLayers 
)

Re-initializes each of the specified layers by re-running the filler (if any) specified by the layer.
When the 'rgstr' parameter is null or otherwise empty, the blobs of all layers are re-initialized.

Parameters
targetSpecifies the weights to target (e.g. weights, bias or both).
rgstrLayersSpecifies the layers to reinitialize, when null or empty, all layers are re-initialized
Returns
If a layer is specified and found, true is returned, otherwise false is returned.

This method causes the OnTrainingIteration event to fire with the updated values from the re-init.

Implements MyCaffe.common.IXMyCaffeState< T >.

Definition at line 448 of file MyCaffeControl.cs.

◆ RemoveCancelOverride()

void MyCaffe.MyCaffeControl< T >.RemoveCancelOverride ( CancelEvent  evtCancel)

Remove a cancel override.

Parameters
evtCancelSpecifies the new name of the cancel event to remove.

Implements MyCaffe.common.IXMyCaffeState< T >.

Definition at line 514 of file MyCaffeControl.cs.

◆ RemoveCancelOverrideByName()

void MyCaffe.MyCaffeControl< T >.RemoveCancelOverrideByName ( string  strEvtCancel)

Remove a cancel override.

Parameters
strEvtCancelSpecifies the new name of the cancel event to remove.

Implements MyCaffe.common.IXMyCaffeState< T >.

Definition at line 505 of file MyCaffeControl.cs.

◆ ResetDevice()

static void MyCaffe.MyCaffeControl< T >.ResetDevice ( int  nDeviceID)
static

Reset the device at the given device ID.

WARNING! It is recommended that this only be used when testing, for calling this will throw off all other users of the device and may cause unpredictable behavior.

Parameters
nDeviceIDSpecifies the device ID of the device to reset.

Definition at line 3371 of file MyCaffeControl.cs.

◆ Run() [1/10]

ResultCollection MyCaffe.MyCaffeControl< T >.Run ( Bitmap  img,
bool  bSort = true,
bool  bPad = true 
)

Run on a given bitmap image.

This method does not use the MyCaffeImageDatabase.

Parameters
imgSpecifies the input image.
bSortSpecifies whether or not to sort the results.
bPadOptionally, specifies to pad the input by 1.
Returns
The results of the run are returned.

Implements MyCaffe.common.IXMyCaffeNoDb< T >.

Definition at line 2798 of file MyCaffeControl.cs.

◆ Run() [2/10]

List< ResultCollection > MyCaffe.MyCaffeControl< T >.Run ( Blob< T >  blob,
bool  bSort = true,
bool  bUseSolverNet = false,
int  nMax = int.MaxValue,
List< int >  rgIgnoreLabels = null 
)

Run on a Blob of data.

Parameters
blobSpecifies the blob of data.
bSortOptionally, specifies whether or not to sor the results.
bUseSolverNetOptionally, specifies whether or not to use the training net vs. the run net.
nMaxOptionally, specifies a maximum number of SimpleDatums to process (default = int.MaxValue).
rgIgnoreLabelsOptionally, specifies a set of labels to ignore.
Returns
A list of results of the run are returned.

Definition at line 2680 of file MyCaffeControl.cs.

◆ Run() [3/10]

BlobCollection< T > MyCaffe.MyCaffeControl< T >.Run ( BlobCollection< T >  colBottom)

Run the network forward on the bottom blobs.

Parameters
colBottomSpecifies the input blobs.
Returns
The top output blobs are returned.

Definition at line 3032 of file MyCaffeControl.cs.

◆ Run() [4/10]

ResultCollection MyCaffe.MyCaffeControl< T >.Run ( int  nImageIdx,
bool  bPad = true 
)

Run on a given image in the MyCaffeImageDatabase based on its image index.

Parameters
nImageIdxSpecifies the image index.
bPadPAdd the input with an extra input image.
Returns
The result of the run is returned.

Implements MyCaffe.common.IXMyCaffe< T >.

Definition at line 2386 of file MyCaffeControl.cs.

◆ Run() [5/10]

List< ResultCollection > MyCaffe.MyCaffeControl< T >.Run ( List< int >  rgImageIdx)

Run on a set of images in the MyCaffeImageDatabase based on their image indexes.

Parameters
rgImageIdxSpecifies a list of image indexes.
Returns
A list of results from the run is returned - one result per image.

Implements MyCaffe.common.IXMyCaffe< T >.

Definition at line 2418 of file MyCaffeControl.cs.

◆ Run() [6/10]

List< ResultCollection > MyCaffe.MyCaffeControl< T >.Run ( List< int >  rgImageIdx,
ref Blob< T >  blob 
)

Run on a set of images in the MyCaffeImageDatabase based on their image indexes.

Parameters
rgImageIdxSpecifies a list of image indexes.
blobSpecifies a work blob.
Returns
A list of results from the run is returned - one result per image.

Definition at line 2399 of file MyCaffeControl.cs.

◆ Run() [7/10]

List< ResultCollection > MyCaffe.MyCaffeControl< T >.Run ( List< SimpleDatum rgSd,
ref Blob< T >  blob,
bool  bUseSolverNet = false,
int  nMax = int.MaxValue 
)

Run on a given list of Datum.

Parameters
rgSdSpecifies the list of Datum to run.
blobSpecifies a work blob.
bUseSolverNetOptionally, specifies whether or not to use the training net vs. the run net.
nMaxOptionally, specifies a maximum number of SimpleDatums to process (default = int.MaxValue).
Returns
A list of results of the run are returned.

Definition at line 2599 of file MyCaffeControl.cs.

◆ Run() [8/10]

PropertySet MyCaffe.MyCaffeControl< T >.Run ( PropertySet  customInput,
int  nK = 1,
double  dfThreshold = 0.01,
int  nMax = 80,
bool  bBeamSearch = false 
)

Run the model on custom input data.

Parameters
customInputSpecifies the custom input data.
nKOptionally, specifies the number of items to use in the search where nK=1 runs a greedy search and any values > 1 run a beam search with that width.
dfThresholdSpecifies the threshold where detected items with probabilities less than the threshold are ignored (default = 0.01).
nMaxOptionally, specifies the maximum number of outputs (default = 80).
bBeamSearchOptionally, specifies to run a Beam Search.
Returns
The results are returned as in a property set.

Definition at line 2906 of file MyCaffeControl.cs.

◆ Run() [9/10]

ResultCollection MyCaffe.MyCaffeControl< T >.Run ( SimpleDatum  d,
bool  bSort,
bool  bUseSolverNet,
bool  bPad = true 
)

Run on a given Datum.

Parameters
dSpecifies the Datum to run.
bSortSpecifies whether or not to sor the results.
bUseSolverNetOptionally, specifies whether or not to use the training net vs. the run net.
bPadOptionally, specifies to pad the data with a dummy trailing item (default = true).
Returns
The results of the run are returned.

Definition at line 2507 of file MyCaffeControl.cs.

◆ Run() [10/10]

ResultCollection MyCaffe.MyCaffeControl< T >.Run ( SimpleDatum  d,
bool  bSort = true,
bool  bPad = true 
)

Run on a given Datum.

Parameters
dSpecifies the Datum to run.
bSortSpecifies whether or not to sort the results.
bPadOptionally, specifies to pad the data with a dummy item and reshape the net (default = false).
Returns
The results of the run are returned.

Implements MyCaffe.common.IXMyCaffe< T >.

Definition at line 2818 of file MyCaffeControl.cs.

◆ RunExtension()

T[] MyCaffe.MyCaffeControl< T >.RunExtension ( long  hExtension,
long  lfnIdx,
T[]  rgParam 
)

Run a function on an existing extension.

Parameters
hExtensionSpecifies the extension.
lfnIdxSpecifies the function to run on the extension.
rgParamSpecifies the parameters.
Returns
The return values of the function are returned.

Implements MyCaffe.common.IXMyCaffeExtension< T >.

Definition at line 3528 of file MyCaffeControl.cs.

◆ RunExtensionD()

double[] MyCaffe.MyCaffeControl< T >.RunExtensionD ( long  hExtension,
long  lfnIdx,
double[]  rgParam 
)

Run a function on an existing extension using the double base type.

Parameters
hExtensionSpecifies the extension.
lfnIdxSpecifies the function to run on the extension.
rgParamSpecifies the parameters.
Returns
The return values of the function are returned.

Implements MyCaffe.common.IXMyCaffeExtension< T >.

Definition at line 3539 of file MyCaffeControl.cs.

◆ RunExtensionF()

float[] MyCaffe.MyCaffeControl< T >.RunExtensionF ( long  hExtension,
long  lfnIdx,
float[]  rgParam 
)

Run a function on an existing extension using the float base type.

Parameters
hExtensionSpecifies the extension.
lfnIdxSpecifies the function to run on the extension.
rgParamSpecifies the parameters.
Returns
The return values of the function are returned.

Implements MyCaffe.common.IXMyCaffeExtension< T >.

Definition at line 3556 of file MyCaffeControl.cs.

◆ RunModel()

PropertySet MyCaffe.MyCaffeControl< T >.RunModel ( PropertySet  customInput)

Run the model using data from the model itself - requires a Data layer with the RUN phase.

Parameters
customInputSpecifies custom inputs. Properties used: 'Phase' specifies the phase for which to run the model (e.g. which net to use), when missing, the default run net is used.
Returns
The results are returned in a property set, where each blob is stored as a byte array packed with the 'float' values from each blob.

Definition at line 2828 of file MyCaffeControl.cs.

◆ RunModelEx()

BlobCollection< T > MyCaffe.MyCaffeControl< T >.RunModelEx ( PropertySet  customInput)

Run the model using data from the model itself - requires a Data layer with the RUN phase.

Parameters
customInputSpecifies custom inputs. Properties used: 'Phase' specifies the phase for which to run the model (e.g. which net to use), when missing, the default run net is used.
Returns
The results are returned in a property set, where each blob is stored as a byte array packed with the 'float' values from each blob.

Definition at line 2872 of file MyCaffeControl.cs.

◆ SetOnTestingStartOverride()

void MyCaffe.MyCaffeControl< T >.SetOnTestingStartOverride ( EventHandler  onTestingStart)

Sets the root solver's onTestingStart event function triggered on the start of each testing pass.

Parameters
onTestingStartSpecifies the event handler called when testing.

Definition at line 477 of file MyCaffeControl.cs.

◆ SetOnTestOverride()

void MyCaffe.MyCaffeControl< T >.SetOnTestOverride ( EventHandler< TestArgs onTest)

Sets the root solver's onTest event function.

Parameters
onTestSpecifies the event handler called when testing.

Implements MyCaffe.common.IXMyCaffeState< T >.

Definition at line 459 of file MyCaffeControl.cs.

◆ SetOnTrainingStartOverride()

void MyCaffe.MyCaffeControl< T >.SetOnTrainingStartOverride ( EventHandler  onTrainingStart)

Sets the root solver's onStart event function triggered on the start of each training pass.

Parameters
onTrainingStartSpecifies the event handler called when testing.

Definition at line 468 of file MyCaffeControl.cs.

◆ Snapshot()

void MyCaffe.MyCaffeControl< T >.Snapshot ( bool  bUpdateDatabase = true)

The Snapshot function forces a snapshot to occur.

Parameters
bUpdateDatabaseOptionally, specifies to update the database (default = true).

Definition at line 3358 of file MyCaffeControl.cs.

◆ Test()

double MyCaffe.MyCaffeControl< T >.Test ( int  nIterationOverride = -1)

Test the network a given number of iterations.

Parameters
nIterationOverrideOptionally, specifies number of iterations to run that override the iterations specified in the solver desctiptor.
Returns
The accuracy value from the test is returned.

Implements MyCaffe.common.IXMyCaffe< T >.

Definition at line 1942 of file MyCaffeControl.cs.

◆ TestMany() [1/2]

List< Tuple< SimpleDatum, ResultCollection > > MyCaffe.MyCaffeControl< T >.TestMany ( int  nCount,
bool  bOnTrainingSet,
bool  bOnTargetSet = false,
DB_ITEM_SELECTION_METHOD  imgSelMethod = DB_ITEM_SELECTION_METHOD.RANDOM,
int  nImageStartIdx = 0,
DateTime?  dtImageStartTime = null,
double?  dfThreshold = null 
)

Test on a number of images by selecting random images from the database, running them through the Run network, and then comparing the results with the expected results.

Parameters
nCountSpecifies the number of cycles to run.
bOnTrainingSetSpecifies on whether to select images from the training set, or when false the testing set of data.
bOnTargetSetOptionally, specifies to test on the target dataset (if exists) as opposed to the source dataset. The default is false, which tests on the default (source) dataset.
imgSelMethodOptionally, specifies the image selection method (default = RANDOM).
nImageStartIdxOptionally, specifies the image start index (default = 0).
dtImageStartTimeOptionally, specifies the image start time (default = null). Note either the 'nImageStartIdx' or 'dtImageStartTime' may be used, but not both.
dfThresholdOptionally, specifies a threshold where the winning selection must also be above the threshold in score.
Returns
The list of SimpleDatum and their ResultCollections (after running the model on each) is returned.

Implements MyCaffe.common.IXMyCaffe< T >.

Definition at line 2023 of file MyCaffeControl.cs.

◆ TestMany() [2/2]

PropertySet MyCaffe.MyCaffeControl< T >.TestMany ( PropertySet  customInput)

Test on custom input data.

Parameters
customInputSpecifies the custom input data separated by ';' characters.
Returns
A property set containing the results is returned.

Running test many on custom data requires a MODEL dataset, where the data is queried from the model itself.

Implements MyCaffe.common.IXMyCaffe< T >.

Definition at line 1961 of file MyCaffeControl.cs.

◆ TestManyEx()

BlobCollection< T > MyCaffe.MyCaffeControl< T >.TestManyEx ( PropertySet  customInput)

Test on custom input data.

Parameters
customInputSpecifies the custom input data separated by ';' characters.
Returns
A property set containing the results is returned.

Running test many on custom data requires a MODEL dataset, where the data is queried from the model itself.

Definition at line 1995 of file MyCaffeControl.cs.

◆ Train()

void MyCaffe.MyCaffeControl< T >.Train ( int  nIterationOverride = -1,
int  nTrainingTimeLimitInMinutes = 0,
TRAIN_STEP  step = TRAIN_STEP.NONE,
double  dfLearningRateOverride = 0,
bool  bReset = false 
)

Train the network a set number of iterations.

Parameters
nIterationOverrideOptionally, specifies number of iterations to run that override the iterations specified in the solver desctiptor.
nTrainingTimeLimitInMinutesOptionally, specifies a maximum number of minutes to train. When set to 0, this parameter is ignored and no time limit is imposed.
stepOptionally, specifies whether or not to single step the training on the forward pass, backward pass or both. The default is TRAIN_STEP.NONE which runs the training to the maximum number of iterations specified.
dfLearningRateOverrideOptionally, specifies a learning rate override (default = 0 which ignores this parameter)
bResetOptionally, reset the iterations to zero.

Note when single stepping, no testing cycles are performed. Currently, the single-step parameter is only suppored when running in single GPU mode.

Implements MyCaffe.common.IXMyCaffe< T >.

Definition at line 1876 of file MyCaffeControl.cs.

◆ Unload()

void MyCaffe.MyCaffeControl< T >.Unload ( bool  bUnloadImageDb = true,
bool  bIgnoreExceptions = false 
)

Unload the currently loaded project, if any.

Parameters
bUnloadImageDbOptionally, specifies to unload the image database (default = true).
bIgnoreExceptionsOptionally, specifies to ignore exceptions on error (default = false).

Implements MyCaffe.common.IXMyCaffe< T >.

Definition at line 387 of file MyCaffeControl.cs.

◆ UpdateRunWeights()

void MyCaffe.MyCaffeControl< T >.UpdateRunWeights ( bool  bOutputStatus = false,
bool  bVerifyWeights = true 
)

Loads the weights from the training net into the Net used for running.

Parameters
bOutputStatusOptionally, specifies to output status as the weights are updated (default = false).
bVerifyWeightsOptionally, specifies to verify the run weights copied (default = true).

Implements MyCaffe.common.IXMyCaffe< T >.

Definition at line 3206 of file MyCaffeControl.cs.

◆ UpdateWeights()

void MyCaffe.MyCaffeControl< T >.UpdateWeights ( byte[]  rgWeights)

Loads the training Net with new weights.

Parameters
rgWeightsSpecifies the weights to load.

Implements MyCaffe.common.IXMyCaffe< T >.

Definition at line 3277 of file MyCaffeControl.cs.

◆ VerifyCompute()

bool MyCaffe.MyCaffeControl< T >.VerifyCompute ( string  strExtra = null,
int  nDeviceID = -1,
bool  bThrowException = true 
)

VerifyCompute compares the current compute of the current device (or device specified) against the required compute of the current CudaDnnDLL.dll used.

Parameters
strExtraOptionally, specifies extra information for the exception if one is thrown.
nDeviceIDOptionally, specifies a specific device ID to check, otherwise uses the current device used (default = -1, which uses the current device).
bThrowExceptionOptionally, specifies whether or not to throw an exception on a compute mis-match (default = true).
Returns
If the device's compute is >= to the required compute fo the CudaDnnDll.dll used, true is returned, otherwise false is returned.

Implements MyCaffe.common.IXMyCaffeState< T >.

Definition at line 3413 of file MyCaffeControl.cs.

Member Data Documentation

◆ m_bDbOwner

bool MyCaffe.MyCaffeControl< T >.m_bDbOwner = true
protected

Whether or not the control owns the image database.

Definition at line 51 of file MyCaffeControl.cs.

◆ m_dataSet

DatasetDescriptor MyCaffe.MyCaffeControl< T >.m_dataSet = null
protected

The dataset descriptor of the dataset used in the image database.

Definition at line 79 of file MyCaffeControl.cs.

◆ m_dataTransformer

DataTransformer<T> MyCaffe.MyCaffeControl< T >.m_dataTransformer = null
protected

The data transformer used to transform data.

Definition at line 71 of file MyCaffeControl.cs.

◆ m_db

IXDatabaseBase MyCaffe.MyCaffeControl< T >.m_db = null
protected

The image database.

Definition at line 47 of file MyCaffeControl.cs.

◆ m_evtCancel

CancelEvent MyCaffe.MyCaffeControl< T >.m_evtCancel
protected

The CancelEvent used to cancel training and testing operations.

Definition at line 55 of file MyCaffeControl.cs.

◆ m_evtForceSnapshot

AutoResetEvent MyCaffe.MyCaffeControl< T >.m_evtForceSnapshot
protected

An auto-reset event used to force a snapshot.

Definition at line 59 of file MyCaffeControl.cs.

◆ m_evtForceTest

AutoResetEvent MyCaffe.MyCaffeControl< T >.m_evtForceTest
protected

An auto-reset event used to force a test cycle.

Definition at line 63 of file MyCaffeControl.cs.

◆ m_evtPause

ManualResetEvent MyCaffe.MyCaffeControl< T >.m_evtPause
protected

An auto-reset event used to pause training.

Definition at line 67 of file MyCaffeControl.cs.

◆ m_log

Log MyCaffe.MyCaffeControl< T >.m_log
protected

The log used for output.

Definition at line 43 of file MyCaffeControl.cs.

◆ m_project

ProjectEx MyCaffe.MyCaffeControl< T >.m_project = null
protected

The active project (if any).

Definition at line 75 of file MyCaffeControl.cs.

◆ m_rgGpu

List<int> MyCaffe.MyCaffeControl< T >.m_rgGpu
protected

A list of the Device ID's used for training.

Definition at line 87 of file MyCaffeControl.cs.

◆ m_settings

SettingsCaffe MyCaffe.MyCaffeControl< T >.m_settings
protected

The settings used to configure the control.

Definition at line 39 of file MyCaffeControl.cs.

◆ m_strCudaPath

string MyCaffe.MyCaffeControl< T >.m_strCudaPath = null
protected

The low-level path of the underlying CudaDnn DLL.

Definition at line 83 of file MyCaffeControl.cs.

Property Documentation

◆ ActiveGpus

List<int> MyCaffe.MyCaffeControl< T >.ActiveGpus
get

Returns a list of Active GPU's used by the control.

Definition at line 655 of file MyCaffeControl.cs.

◆ ActiveLabelCounts

string MyCaffe.MyCaffeControl< T >.ActiveLabelCounts
get

Returns a string describing the active label counts observed during training.

This string can help diagnose label balancing issue.

Definition at line 666 of file MyCaffeControl.cs.

◆ CancelEvent

Returns the CancelEvent used.

Definition at line 647 of file MyCaffeControl.cs.

◆ Cuda

CudaDnn<T> MyCaffe.MyCaffeControl< T >.Cuda
get

Returns the CudaDnn connection used.

Definition at line 615 of file MyCaffeControl.cs.

◆ CurrentDevice

string MyCaffe.MyCaffeControl< T >.CurrentDevice
get

Returns the name of the current device used.

Definition at line 696 of file MyCaffeControl.cs.

◆ CurrentIteration

int MyCaffe.MyCaffeControl< T >.CurrentIteration
get

Returns the current iteration.

Definition at line 716 of file MyCaffeControl.cs.

◆ CurrentProject

ProjectEx MyCaffe.MyCaffeControl< T >.CurrentProject
get

Returns the name of the currently loaded project.

Definition at line 708 of file MyCaffeControl.cs.

◆ CurrentStage

string MyCaffe.MyCaffeControl< T >.CurrentStage
get

Returns the stage under which the project was loaded, if any.

Definition at line 272 of file MyCaffeControl.cs.

◆ Database

Returns the MyCaffeImageDatabase or MyCaffeTemporalDatabase used.

Definition at line 639 of file MyCaffeControl.cs.

◆ DatasetConnectInfo

ConnectInfo MyCaffe.MyCaffeControl< T >.DatasetConnectInfo
get

Returns the dataset connection information, if used (default = null).

Definition at line 264 of file MyCaffeControl.cs.

◆ DataTransformer

Returns the DataTransormer used.

Definition at line 599 of file MyCaffeControl.cs.

◆ EnableBlobDebugging

bool? MyCaffe.MyCaffeControl< T >.EnableBlobDebugging
getset

Enable/disable blob debugging.

Note, when enabled, training will dramatically slow down.

Definition at line 525 of file MyCaffeControl.cs.

◆ EnableBreakOnFirstNaN

bool? MyCaffe.MyCaffeControl< T >.EnableBreakOnFirstNaN
getset

Enable/disable break training after first detecting a NaN.

This option requires that EnableBlobDebugging == true.

Definition at line 541 of file MyCaffeControl.cs.

◆ EnableDetailedNanDetection

bool? MyCaffe.MyCaffeControl< T >.EnableDetailedNanDetection
getset

When enabled (requires EnableBlobDebugging = true), the detailed Nan (and Infinity) detection is perofmed on each blob when training Net.

Definition at line 554 of file MyCaffeControl.cs.

◆ EnableLayerDebugging

bool? MyCaffe.MyCaffeControl< T >.EnableLayerDebugging
getset

Enable/disable layer debugging which causes each layer to check for NAN/INF on each forward/backward pass and throw an exception when found.

This option dramatically slows down training and is only recommended during debugging.

Definition at line 570 of file MyCaffeControl.cs.

◆ EnableSingleStep

bool? MyCaffe.MyCaffeControl< T >.EnableSingleStep
getset

Enable/disable single step training.

This option requires that EnableBlobDebugging == true.

Definition at line 586 of file MyCaffeControl.cs.

◆ EnableTesting

bool MyCaffe.MyCaffeControl< T >.EnableTesting
getset

Enable/disable testing. For example reinforcement learning does not use testing.

Definition at line 367 of file MyCaffeControl.cs.

◆ EnableVerboseStatus

bool MyCaffe.MyCaffeControl< T >.EnableVerboseStatus
getset

Get/set whether or not to use verbose status. When enabled, the full status is output when loading a project, otherwise a more minimum (faster) set is output (default = false for disabled).

Definition at line 376 of file MyCaffeControl.cs.

◆ LabelQueryEpochs

string MyCaffe.MyCaffeControl< T >.LabelQueryEpochs
get

Returns a string describing the label query epochs observed during training.

This string can help diagnose label balancing issue.

Definition at line 688 of file MyCaffeControl.cs.

◆ LabelQueryHitPercents

string MyCaffe.MyCaffeControl< T >.LabelQueryHitPercents
get

Returns a string describing the label query hit percentages observed during training.

This string can help diagnose label balancing issue.

Definition at line 677 of file MyCaffeControl.cs.

◆ LastPhase

Phase MyCaffe.MyCaffeControl< T >.LastPhase
get

Returns the last phase run (TRAIN, TEST or RUN).

Definition at line 751 of file MyCaffeControl.cs.

◆ Log

Returns the Log (for output) used.

Definition at line 623 of file MyCaffeControl.cs.

◆ MaximumIteration

int MyCaffe.MyCaffeControl< T >.MaximumIteration
get

Returns the maximum iteration.

Definition at line 724 of file MyCaffeControl.cs.

◆ Persist

IXPersist<T> MyCaffe.MyCaffeControl< T >.Persist
get

Returns the persist used to load and save weights.

Definition at line 631 of file MyCaffeControl.cs.

◆ Settings

Returns the settings used to create the control.

Definition at line 607 of file MyCaffeControl.cs.

◆ Version

FileVersionInfo MyCaffe.MyCaffeControl< T >.Version
staticget

Get the file version of the MyCaffe assembly running.

Definition at line 252 of file MyCaffeControl.cs.

Event Documentation

◆ OnSnapshot

EventHandler<SnapshotArgs> MyCaffe.MyCaffeControl< T >.OnSnapshot

The OnSnapshot event fires each time a snap-shot is taken.

Definition at line 112 of file MyCaffeControl.cs.

◆ OnTestingIteration

EventHandler<TestingIterationArgs<T> > MyCaffe.MyCaffeControl< T >.OnTestingIteration

The OnTestingIteration event fires at the end of each testing iteration.

Definition at line 120 of file MyCaffeControl.cs.

◆ OnTrainingIteration

EventHandler<TrainingIterationArgs<T> > MyCaffe.MyCaffeControl< T >.OnTrainingIteration

The OnTrainingIteration event fires at the end of each training iteration.

Definition at line 116 of file MyCaffeControl.cs.


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