MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
MyCaffe.db.image.DatasetEx2 Class Reference

[V2 Image Database] The DatasetEx2 class provides the in-memory dataset functionality that is used by the image database to manage data sets.
Both the Testing and Training ImageSet2 objects are managed by the DatasetEx2, which in turn coordinates the loading and usage of each. More...

Inheritance diagram for MyCaffe.db.image.DatasetEx2:

Public Member Functions

 DatasetEx2 (Guid user, DatasetFactory factory, CryptoRandom random)
 The DatasetEx constructor. More...
 
int AddUser (Guid user)
 Adds a user of the dataset. More...
 
int RemoveUser (Guid user)
 Remove a user of the dataset. More...
 
long Initialize (DatasetDescriptor ds, WaitHandle[] rgAbort, int nPadW=0, int nPadH=0, Log log=null, DB_LOAD_METHOD loadMethod=DB_LOAD_METHOD.LOAD_ALL, bool bSkipMeanCheck=false, int nImageDbLoadLimit=0, int nImageDbAutoRefreshScheduledUpdateInMs=0, double dfImageDbAutoRefreshScheduledReplacementPct=0, bool bVerify=false)
 Initialize the DatasetEx by loading the training and testing data sources into memory. More...
 
bool WaitForLoadingToComplete (bool bTraining, bool bTesting, int nWait=int.MaxValue)
 Wait for either the training, testing or both data sources to complete loading. More...
 
bool WaitForRefreshToComplete (bool bTraining, bool bTesting, int nWait=int.MaxValue)
 Wait for either the training, testing or both data sources to complete refreshing. More...
 
bool IsRefreshRunning (bool bTraining, bool bTesting)
 Returns whether or not the refresh is running on the training and/or testing data source. More...
 
void StartRefresh (bool bTraining=true, bool bTesting=true, double dfReplacementPct=0.25)
 Start an image refresh on the training and/or testing data sources. More...
 
void StopRefresh (bool bTraining=true, bool bTesting=true)
 Stop any refresh operation currently running. More...
 
bool StartAutomaticRefreshSchedule (bool bTraining, bool bTesting, int nPeriodInMs, double dfReplacementPct)
 Start the automatic refresh schedule on the training and/or testing data sources. More...
 
bool StopAutomaticRefreshSchedule (bool bTraining, bool bTesting)
 Stop the automatic refresh schedule on the training and/or testing data sources. More...
 
bool GetAutomaticRefreshSchedule (out int nPeriodInMs, out double dfReplacementPct, out int nTrainingRefreshCount, out int nTestingRefreshCount)
 Get the automatic refresh schedule status and its period and replacement percentage. More...
 
void Dispose ()
 Releases all resources used. More...
 
long CreateQueryState (bool bUseUniqueLabelIndexes=true, bool bUseUniqueImageIndexes=true, IMGDB_SORT sort=IMGDB_SORT.NONE)
 Create a new QueryState on the dataset. More...
 
bool SetDefaultQueryState (long lQueryState)
 Set the default query state to a new query state. More...
 
bool FreeQueryState (long lHandle)
 Free an existing query state. More...
 
QueryState FindQueryState (long lQueryState, ImageSet2.TYPE type)
 Returns the query state for a given query state handle and type. More...
 
void ReloadIndexing ()
 Reload the indexing for both the training and testing data sources. More...
 
void Relabel (LabelMappingCollection col)
 Relabels both the testing and training image sets using the label mapping collection. More...
 
void ResetLabels ()
 Resets the labels to their original labels. More...
 
void ResetAllBoosts ()
 Reset all boosts for both the testing and training image sets. More...
 
bool SaveImageMean (int nSrcId, SimpleDatum sd, bool bUpdate)
 Saves the image mean in a SimpleDatum to the database. More...
 
SimpleDatum QueryImageMean (int nSrcId)
 Query the image mean for a data source. More...
 
void Unload (bool bReload)
 Unload the images of the training and testing image sets. More...
 
double GetPercentageLoaded (out double dfTraining, out double dfTesting)
 Returns the total percentage of images loaded for testing, training and combined. More...
 
ImageSet2 Find (int nSourceID)
 Returns the ImageSet corresponding to a data source ID. More...
 
ImageSet2 Find (string strSource)
 Returns the ImageSet corresponding to a data source name. More...
 

Protected Member Functions

virtual void Dispose (bool bDisposing)
 Releases all resources used. More...
 

Properties

long DefaultQueryState [get]
 Returns the default query state created when first initializing the dataset. More...
 
bool UseTrainingImagesForTesting [getset]
 Get/set whether or not to use the training images when testing. More...
 
DatasetDescriptor Descriptor [get]
 Returns the dataset descriptor of the dataset managesd by the DatasetEx object. More...
 
int? DatasetID [getset]
 Returns the dataset ID of the dataset managesd by the DatasetEx object. More...
 
int OriginalDatasetID [get]
 Returns the original DatsetID if this is a cloned re-organized dataset, otherwise 0 is returned. More...
 
string DatasetName [get]
 Returns the dataset name of the dataset managesd by the DatasetEx object. More...
 

Events

EventHandler< CalculateImageMeanArgsOnCalculateImageMean
 The OnCalculateImageMean event is passed to each image set and fires each time the Image set need to calcualte its image mean. More...
 

Detailed Description

[V2 Image Database] The DatasetEx2 class provides the in-memory dataset functionality that is used by the image database to manage data sets.
Both the Testing and Training ImageSet2 objects are managed by the DatasetEx2, which in turn coordinates the loading and usage of each.

Definition at line 17 of file DatasetEx2.cs.

Constructor & Destructor Documentation

◆ DatasetEx2()

MyCaffe.db.image.DatasetEx2.DatasetEx2 ( Guid  user,
DatasetFactory  factory,
CryptoRandom  random 
)

The DatasetEx constructor.

Parameters
userSpecifies the unique ID of the dataset user.
factorySpecifies the DatasetFactory used to manage the database datasets.
randomSpecifies the random number generator.

Definition at line 54 of file DatasetEx2.cs.

Member Function Documentation

◆ AddUser()

int MyCaffe.db.image.DatasetEx2.AddUser ( Guid  user)

Adds a user of the dataset.

Parameters
userSpecifies the unique ID of the dataset user.
Returns
The number of users is returned.

Definition at line 70 of file DatasetEx2.cs.

◆ CreateQueryState()

long MyCaffe.db.image.DatasetEx2.CreateQueryState ( bool  bUseUniqueLabelIndexes = true,
bool  bUseUniqueImageIndexes = true,
IMGDB_SORT  sort = IMGDB_SORT.NONE 
)

Create a new QueryState on the dataset.

Parameters
bUseUniqueLabelIndexesOptionally, specifies to use unique label indexes which is slightly slower, but ensures each label is hit per epoch (default = true).
bUseUniqueImageIndexesOptionally, specifies to use unique image indexes which is slightly slower, but ensures each image is hit per epoch (default = true).
sortOptionally, specifies an ordering for the query state (default = NONE).
Returns
The new query state is returned.

Definition at line 481 of file DatasetEx2.cs.

◆ Dispose() [1/2]

void MyCaffe.db.image.DatasetEx2.Dispose ( )

Releases all resources used.

Definition at line 469 of file DatasetEx2.cs.

◆ Dispose() [2/2]

virtual void MyCaffe.db.image.DatasetEx2.Dispose ( bool  bDisposing)
protectedvirtual

Releases all resources used.

Parameters
bDisposingSet to true when called by Dispose().

Definition at line 441 of file DatasetEx2.cs.

◆ Find() [1/2]

ImageSet2 MyCaffe.db.image.DatasetEx2.Find ( int  nSourceID)

Returns the ImageSet corresponding to a data source ID.

Parameters
nSourceIDSpecifies the ID of the data source to use.
Returns
The ImageSet of images is returned.

Definition at line 657 of file DatasetEx2.cs.

◆ Find() [2/2]

ImageSet2 MyCaffe.db.image.DatasetEx2.Find ( string  strSource)

Returns the ImageSet corresponding to a data source name.

Parameters
strSourceSpecifies the name of the data source to use.
Returns
The ImageSet of images is returned.

Definition at line 680 of file DatasetEx2.cs.

◆ FindQueryState()

QueryState MyCaffe.db.image.DatasetEx2.FindQueryState ( long  lQueryState,
ImageSet2.TYPE  type 
)

Returns the query state for a given query state handle and type.

Parameters
lQueryStateSpecifies the handle to the query state.
typeSpecifies the query state type to retrieve.
Returns
The QueryState is returned.

Definition at line 519 of file DatasetEx2.cs.

◆ FreeQueryState()

bool MyCaffe.db.image.DatasetEx2.FreeQueryState ( long  lHandle)

Free an existing query state.

Parameters
lHandleSpecifies the handle to the query state to be freed.
Returns
If found and freed, true is returned, otherwise false.

Definition at line 504 of file DatasetEx2.cs.

◆ GetAutomaticRefreshSchedule()

bool MyCaffe.db.image.DatasetEx2.GetAutomaticRefreshSchedule ( out int  nPeriodInMs,
out double  dfReplacementPct,
out int  nTrainingRefreshCount,
out int  nTestingRefreshCount 
)

Get the automatic refresh schedule status and its period and replacement percentage.

Parameters
nPeriodInMsSpecifies the period in milliseconds over which the auto refresh cycle is to run.
dfReplacementPctSpecifies the percentage of replacement to use on each cycle.
nTrainingRefreshCountReturns the training refrsh count.
nTestingRefreshCountReturns the testing refresh count.
Returns
If successfully stopped, true is returned, otherwise false.

Definition at line 335 of file DatasetEx2.cs.

◆ GetPercentageLoaded()

double MyCaffe.db.image.DatasetEx2.GetPercentageLoaded ( out double  dfTraining,
out double  dfTesting 
)

Returns the total percentage of images loaded for testing, training and combined.

Parameters
dfTrainingReturns the total percentage of training images loaded.
dfTestingReturns the total percentage of testing images loaded.
Returns
Returns the combined total percentage of images loaded for both testing and training.

Definition at line 636 of file DatasetEx2.cs.

◆ Initialize()

long MyCaffe.db.image.DatasetEx2.Initialize ( DatasetDescriptor  ds,
WaitHandle[]  rgAbort,
int  nPadW = 0,
int  nPadH = 0,
Log  log = null,
DB_LOAD_METHOD  loadMethod = DB_LOAD_METHOD.LOAD_ALL,
bool  bSkipMeanCheck = false,
int  nImageDbLoadLimit = 0,
int  nImageDbAutoRefreshScheduledUpdateInMs = 0,
double  dfImageDbAutoRefreshScheduledReplacementPct = 0,
bool  bVerify = false 
)

Initialize the DatasetEx by loading the training and testing data sources into memory.

Parameters
dsSpecifies the dataset to load.
rgAbortSpecifies a set of wait handles used to cancel the load.
nPadWOptionally, specifies a pad to apply to the width of each item (default = 0).
nPadHOptionally, specifies a pad to apply to the height of each item (default = 0).
logOptionally, specifies an external Log to output status (default = null).
loadMethodOptionally, specifies the load method to use (default = LOAD_ALL).
bSkipMeanCheckOptionally, specifies to skip the mean check (default = false).
nImageDbLoadLimitOptionally, specifies the load limit (default = 0).
nImageDbAutoRefreshScheduledUpdateInMsOptionally, specifies the scheduled refresh update period in ms (default = 0).
dfImageDbAutoRefreshScheduledReplacementPctOptionally, specifies the scheduled refresh replacement percent (default = 0).
bVerifyOptionally, verify the dataset indexes (only applies when using LOAD_ALL loading method (default = false).
Returns
Upon loading the dataset a handle to the default QueryState is returned, or 0 on cancel.

Definition at line 102 of file DatasetEx2.cs.

◆ IsRefreshRunning()

bool MyCaffe.db.image.DatasetEx2.IsRefreshRunning ( bool  bTraining,
bool  bTesting 
)

Returns whether or not the refresh is running on the training and/or testing data source.

Parameters
bTrainingSpecifies to check the training data source.
bTestingSpecifies to check the testing data source.
Returns
If the refresh is running, true is returned.

Definition at line 214 of file DatasetEx2.cs.

◆ QueryImageMean()

SimpleDatum MyCaffe.db.image.DatasetEx2.QueryImageMean ( int  nSrcId)

Query the image mean for a data source.

Parameters
nSrcIdSpecifies the ID of the data source to use.
Returns
The SimpleDatum containing the image mean is returned.

Definition at line 609 of file DatasetEx2.cs.

◆ Relabel()

void MyCaffe.db.image.DatasetEx2.Relabel ( LabelMappingCollection  col)

Relabels both the testing and training image sets using the label mapping collection.

Parameters
colSpecifies the label mapping collection.

Definition at line 546 of file DatasetEx2.cs.

◆ ReloadIndexing()

void MyCaffe.db.image.DatasetEx2.ReloadIndexing ( )

Reload the indexing for both the training and testing data sources.

Definition at line 533 of file DatasetEx2.cs.

◆ RemoveUser()

int MyCaffe.db.image.DatasetEx2.RemoveUser ( Guid  user)

Remove a user of the dataset.

Parameters
userSpecifies the unique ID of the dataset user.
Returns
The number of users is returned.

Definition at line 81 of file DatasetEx2.cs.

◆ ResetAllBoosts()

void MyCaffe.db.image.DatasetEx2.ResetAllBoosts ( )

Reset all boosts for both the testing and training image sets.

Definition at line 570 of file DatasetEx2.cs.

◆ ResetLabels()

void MyCaffe.db.image.DatasetEx2.ResetLabels ( )

Resets the labels to their original labels.

Definition at line 558 of file DatasetEx2.cs.

◆ SaveImageMean()

bool MyCaffe.db.image.DatasetEx2.SaveImageMean ( int  nSrcId,
SimpleDatum  sd,
bool  bUpdate 
)

Saves the image mean in a SimpleDatum to the database.

Parameters
nSrcIdSpecifies the ID of the data source to use.
sdSpecifies the image mean data.
bUpdateSpecifies whether or not to update the mean image.
Returns
If saved successfully, this method returns true, otherwise false is returned.

Definition at line 595 of file DatasetEx2.cs.

◆ SetDefaultQueryState()

bool MyCaffe.db.image.DatasetEx2.SetDefaultQueryState ( long  lQueryState)

Set the default query state to a new query state.

Parameters
lQueryStateSpecifies the query state to set.
Returns
Returns true on success, false on failure.

Definition at line 493 of file DatasetEx2.cs.

◆ StartAutomaticRefreshSchedule()

bool MyCaffe.db.image.DatasetEx2.StartAutomaticRefreshSchedule ( bool  bTraining,
bool  bTesting,
int  nPeriodInMs,
double  dfReplacementPct 
)

Start the automatic refresh schedule on the training and/or testing data sources.

Parameters
bTrainingOptionally, specifies to stop refreshing the training data source (default = true).
bTestingOptionally, specifies to stop refreshing the testing data source (default = true).
nPeriodInMsSpecifies the period in milliseconds over which the auto refresh cycle is to run.
dfReplacementPctSpecifies the percentage of replacement to use on each cycle.
Returns
If successfully started, true is returned, otherwise false.

Definition at line 273 of file DatasetEx2.cs.

◆ StartRefresh()

void MyCaffe.db.image.DatasetEx2.StartRefresh ( bool  bTraining = true,
bool  bTesting = true,
double  dfReplacementPct = 0.25 
)

Start an image refresh on the training and/or testing data sources.

Note this method is only valid when initializing with LoadLimit > 0.

Parameters
bTrainingOptionally, specifies to refresh the training data source (default = true).
bTestingOptionally, specifies to refresh the testing data source (default = true).
dfReplacementPctOptionally, specifies the percentage of the loaded image set to refresh (default = 0.25 for 25%)

Definition at line 242 of file DatasetEx2.cs.

◆ StopAutomaticRefreshSchedule()

bool MyCaffe.db.image.DatasetEx2.StopAutomaticRefreshSchedule ( bool  bTraining,
bool  bTesting 
)

Stop the automatic refresh schedule on the training and/or testing data sources.

Parameters
bTrainingOptionally, specifies to stop refreshing the training data source (default = true).
bTestingOptionally, specifies to stop refreshing the testing data source (default = true).
Returns
If successfully stopped, true is returned, otherwise false.

Definition at line 311 of file DatasetEx2.cs.

◆ StopRefresh()

void MyCaffe.db.image.DatasetEx2.StopRefresh ( bool  bTraining = true,
bool  bTesting = true 
)

Stop any refresh operation currently running.

Parameters
bTrainingOptionally, specifies to stop refreshing the training data source (default = true).
bTestingOptionally, specifies to stop refreshing the testing data source (default = true).

Definition at line 256 of file DatasetEx2.cs.

◆ Unload()

void MyCaffe.db.image.DatasetEx2.Unload ( bool  bReload)

Unload the images of the training and testing image sets.

Definition at line 621 of file DatasetEx2.cs.

◆ WaitForLoadingToComplete()

bool MyCaffe.db.image.DatasetEx2.WaitForLoadingToComplete ( bool  bTraining,
bool  bTesting,
int  nWait = int.MaxValue 
)

Wait for either the training, testing or both data sources to complete loading.

Parameters
bTrainingSpecifies to wait for the training data source.
bTestingSpecifies to wait for the testing data source.
nWait
Returns
If aborted, false is returned, otherwise true is returned.

Definition at line 167 of file DatasetEx2.cs.

◆ WaitForRefreshToComplete()

bool MyCaffe.db.image.DatasetEx2.WaitForRefreshToComplete ( bool  bTraining,
bool  bTesting,
int  nWait = int.MaxValue 
)

Wait for either the training, testing or both data sources to complete refreshing.

Parameters
bTrainingSpecifies to wait for the training data source.
bTestingSpecifies to wait for the testing data source.
nWait
Returns
If aborted, false is returned, otherwise true is returned.

Definition at line 191 of file DatasetEx2.cs.

Property Documentation

◆ DatasetID

int? MyCaffe.db.image.DatasetEx2.DatasetID
getset

Returns the dataset ID of the dataset managesd by the DatasetEx object.

Definition at line 709 of file DatasetEx2.cs.

◆ DatasetName

string MyCaffe.db.image.DatasetEx2.DatasetName
get

Returns the dataset name of the dataset managesd by the DatasetEx object.

Definition at line 726 of file DatasetEx2.cs.

◆ DefaultQueryState

long MyCaffe.db.image.DatasetEx2.DefaultQueryState
get

Returns the default query state created when first initializing the dataset.

Definition at line 432 of file DatasetEx2.cs.

◆ Descriptor

DatasetDescriptor MyCaffe.db.image.DatasetEx2.Descriptor
get

Returns the dataset descriptor of the dataset managesd by the DatasetEx object.

Definition at line 701 of file DatasetEx2.cs.

◆ OriginalDatasetID

int MyCaffe.db.image.DatasetEx2.OriginalDatasetID
get

Returns the original DatsetID if this is a cloned re-organized dataset, otherwise 0 is returned.

Definition at line 718 of file DatasetEx2.cs.

◆ UseTrainingImagesForTesting

bool MyCaffe.db.image.DatasetEx2.UseTrainingImagesForTesting
getset

Get/set whether or not to use the training images when testing.

Definition at line 582 of file DatasetEx2.cs.

Event Documentation

◆ OnCalculateImageMean

EventHandler<CalculateImageMeanArgs> MyCaffe.db.image.DatasetEx2.OnCalculateImageMean

The OnCalculateImageMean event is passed to each image set and fires each time the Image set need to calcualte its image mean.

Definition at line 46 of file DatasetEx2.cs.


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