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

The MasterList is responsible for loading and managing access to the master list of images for a data source. More...

Inheritance diagram for MyCaffe.db.image.MasterList:

Public Member Functions

 MasterList (CryptoRandom random, Log log, SourceDescriptor src, DatasetFactory factory, List< WaitHandle > rgAbort, int nMaxLoadCount=0)
 The constructor. More...
 
void Dispose ()
 Release all resources used. More...
 
void Verify (MasterIndexes idx)
 Verify the loaded images against the master indexes. More...
 
bool Load (bool bSilent=false)
 Start loading the dataset. More...
 
void Unload (bool bReLoad)
 Unload the data source images. More...
 
bool StartRefresh (double dfReplacementPct=0.25)
 Start the refresh thread which will run if the number of images stored in memory is less than the total number of images in the data source, otherwise this function returns false. More...
 
bool WaitForRefreshToComplete (List< WaitHandle > rgAbort, int nWait)
 Wait for the refres to complete. More...
 
void StopRefresh ()
 Stop the refresh thread if running. More...
 
void SetImageMean (SimpleDatum d, bool bSave=false)
 Set the image mean. More...
 
int GetTotalCount ()
 Return the total number of images whether loaded or not, in the data source. More...
 
int GetLoadedCount ()
 Return the currently loaded images in the data source. More...
 
SimpleDatum GetImageMean (Log log, WaitHandle[] rgAbort, bool bQueryOnly)
 Returns the image mean for the ImageSet. More...
 
List< DbItemReloadIndexing ()
 Reload the image indexing. More...
 
List< DbItemResetLabels ()
 Reset the labels of all images to the original labels. More...
 
List< DbItemRelabel (LabelMappingCollection col)
 Relabel the images based on the LabelMappingCollection. More...
 
List< DbItemResetAllBoosts ()
 Reset all image boosts. More...
 
int FindImageIndex (List< DbItem > rgItems, string strDesc)
 Find the image index based by searching the rgItems for an image that contains the description specified. More...
 
SimpleDatum FindImage (int nImageId)
 Find an image based on its image ID (e.g. the image ID in the database). More...
 
SimpleDatum GetImage (int nIdx, bool bLoadDataCriteria, bool bLoadDebugData, DB_LOAD_METHOD loadMethod)
 Get the image with a specific image index. More...
 
int GetCount (QueryState state, string strFilterVal=null, int? nBoostVal=null, bool bBoostValIsExact=false)
 Returns the number of images in the image set, optionally with super-boosted values only. More...
 
List< SimpleDatumGetImages (QueryState state, int nStartIdx, int nQueryCount=int.MaxValue, string strFilterVal=null, int? nBoostVal=null, bool bBoostValIsExact=false, bool bAttemptDirectLoad=false)
 Returns the array of images in the image set, possibly filtered with the filtering parameters. More...
 
List< SimpleDatumGetImages (QueryState state, DateTime dtStart, int nQueryCount=int.MaxValue, string strFilterVal=null, int? nBoostVal=null, bool bBoostValIsExact=false)
 Returns the array of images in the image set, possibly filtered with the filtering parameters. More...
 
List< SimpleDatumGetImages (bool bSuperboostOnly, string strFilterVal, int? nBoostVal, int[] rgIdx)
 Returns the array of images in the image set, possibly filtered with the filtering parameters. More...
 
bool WaitForLoadingToComplete (List< WaitHandle > rgAbort, int nWait=int.MaxValue)
 Wait for the image loading to complete - this is used when performing LOAD_ALL. More...
 

Properties

bool IsLoadLimitEnabled [get]
 Returns true when the database is loaded with LoadLimit > 0, false otherwise. More...
 
bool? IsFull [get]
 Returns true when the master list is fully loaded, false otherwise. More...
 
bool IsRefreshDone [get]
 Returns true after the refresh completes. More...
 
bool IsRefreshRunning [get]
 Returns true if the refresh is running, false otherwise. More...
 

Events

EventHandler< CalculateImageMeanArgsOnCalculateImageMean
 The OnCalculateImageMean event fires when the ImageSet needs to calculate the image mean for the image set. More...
 

Detailed Description

The MasterList is responsible for loading and managing access to the master list of images for a data source.

Definition at line 16 of file MasterList.cs.

Constructor & Destructor Documentation

◆ MasterList()

MyCaffe.db.image.MasterList.MasterList ( CryptoRandom  random,
Log  log,
SourceDescriptor  src,
DatasetFactory  factory,
List< WaitHandle >  rgAbort,
int  nMaxLoadCount = 0 
)

The constructor.

Parameters
randomSpecifies the CryptoRandom to use for random selection.
logSpecifies the output log.
srcSpecifies the data source that holds the data on the database.
factorySpecifies the data factory used to access the database data.
rgAbortSpecifies the cancel handles.
nMaxLoadCountOptionally, specifies to automaticall start the image refresh which only applies when the number of images loaded into memory is less than the actual number of images (default = false).

Definition at line 55 of file MasterList.cs.

Member Function Documentation

◆ Dispose()

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

Release all resources used.

Definition at line 82 of file MasterList.cs.

◆ FindImage()

SimpleDatum MyCaffe.db.image.MasterList.FindImage ( int  nImageId)

Find an image based on its image ID (e.g. the image ID in the database).

Parameters
nImageIdSpecifies the image ID in the database.
Returns
If found the image is returned, otherwise null is returned.

Definition at line 469 of file MasterList.cs.

◆ FindImageIndex()

int MyCaffe.db.image.MasterList.FindImageIndex ( List< DbItem rgItems,
string  strDesc 
)

Find the image index based by searching the rgItems for an image that contains the description specified.

Parameters
rgItemsSpecifies the image items to use to search.
strDescSpecifies the image description to look for.
Returns
If found the image index is returned, otherwise -1 is returned.

Definition at line 441 of file MasterList.cs.

◆ GetCount()

int MyCaffe.db.image.MasterList.GetCount ( QueryState  state,
string  strFilterVal = null,
int?  nBoostVal = null,
bool  bBoostValIsExact = false 
)

Returns the number of images in the image set, optionally with super-boosted values only.

Parameters
stateSpecifies the query state to use.
strFilterValOptionally, specifies the filter value that the description must match (default = null, which ignores this parameter).
nBoostValOptionally, specifies the boost value that the boost must match (default = null, which ignores this parameter).
bBoostValIsExactOptionally, specifies whether or the boost value (if specified) is to be used literally (exact = true), or as a minimum boost value.
Returns
The number of images is returned.

When using the 'nBoostValue' negative values are used to test the exact match of the boost value with the absolute value of the 'nBoostValue', ande positive values are used to test for boost values that are greater than or equal to the 'nBoostValue'.

Definition at line 573 of file MasterList.cs.

◆ GetImage()

SimpleDatum MyCaffe.db.image.MasterList.GetImage ( int  nIdx,
bool  bLoadDataCriteria,
bool  bLoadDebugData,
DB_LOAD_METHOD  loadMethod 
)

Get the image with a specific image index.

Parameters
nIdxSpecifies the image index.
bLoadDataCriteriaSpecifies whether or not to load the data criteria along with the image.
bLoadDebugDataSpecifies whether or not to load the debug data with the image.
loadMethodSpecifies the image loading method used.
Returns
If found, the image is returned.

Definition at line 524 of file MasterList.cs.

◆ GetImageMean()

SimpleDatum MyCaffe.db.image.MasterList.GetImageMean ( Log  log,
WaitHandle[]  rgAbort,
bool  bQueryOnly 
)

Returns the image mean for the ImageSet.

Parameters
logSpecifies the Log used to output status.
rgAbortSpecifies a set of wait handles for aborting the operation.
bQueryOnlySpecifies whether or not to only query for the mean and not calculate if missing.
Returns
The SimpleDatum with the image mean is returned.

Definition at line 324 of file MasterList.cs.

◆ GetImages() [1/3]

List< SimpleDatum > MyCaffe.db.image.MasterList.GetImages ( bool  bSuperboostOnly,
string  strFilterVal,
int?  nBoostVal,
int[]  rgIdx 
)

Returns the array of images in the image set, possibly filtered with the filtering parameters.

Parameters
bSuperboostOnlySpecifies whether or not to return images with super-boost.
strFilterValspecifies the filter value that the description must match (default = null, which ignores this parameter).
nBoostValspecifies the boost value that the boost must match (default = null, which ignores this parameter).
rgIdxSpecifies a set of indexes to search for where the images returned must have an index greater than or equal to the individual index.
Returns
The list of images is returned.

When using the 'nBoostValue' negative values are used to test the exact match of the boost value with the absolute value of the 'nBoostValue', ande positive values are used to test for boost values that are greater than or equal to the 'nBoostValue'.

Definition at line 653 of file MasterList.cs.

◆ GetImages() [2/3]

List< SimpleDatum > MyCaffe.db.image.MasterList.GetImages ( QueryState  state,
DateTime  dtStart,
int  nQueryCount = int.MaxValue,
string  strFilterVal = null,
int?  nBoostVal = null,
bool  bBoostValIsExact = false 
)

Returns the array of images in the image set, possibly filtered with the filtering parameters.

Parameters
stateSpecifies the query state to use.
dtStartSpecifies a starting time from which the query is to start within the set of images.
nQueryCountOptionally, specifies a number of images to retrieve within the set (default = int.MaxValue).
strFilterValOptionally, specifies the filter value that the description must match (default = null, which ignores this parameter).
nBoostValOptionally, specifies the boost value that the boost must match (default = null, which ignores this parameter).
bBoostValIsExactOptionally, specifies whether or the boost value (if specified) is to be used literally (exact = true), or as a minimum boost value.
Returns
The list of images is returned.

When using the 'nBoostValue' negative values are used to test the exact match of the boost value with the absolute value of the 'nBoostValue', ande positive values are used to test for boost values that are greater than or equal to the 'nBoostValue'.

Definition at line 633 of file MasterList.cs.

◆ GetImages() [3/3]

List< SimpleDatum > MyCaffe.db.image.MasterList.GetImages ( QueryState  state,
int  nStartIdx,
int  nQueryCount = int.MaxValue,
string  strFilterVal = null,
int?  nBoostVal = null,
bool  bBoostValIsExact = false,
bool  bAttemptDirectLoad = false 
)

Returns the array of images in the image set, possibly filtered with the filtering parameters.

Parameters
stateSpecifies the query state to use.
nStartIdxSpecifies a starting index from which the query is to start within the set of images.
nQueryCountOptionally, specifies a number of images to retrieve within the set (default = int.MaxValue).
strFilterValOptionally, specifies the filter value that the description must match (default = null, which ignores this parameter).
nBoostValOptionally, specifies the boost value that the boost must match (default = null, which ignores this parameter).
bBoostValIsExactOptionally, specifies whether or the boost value (if specified) is to be used literally (exact = true), or as a minimum boost value.
bAttemptDirectLoadOptionaly, specifies to directly load all images not already loaded.
Returns
The list of images is returned.

When using the 'nBoostValue' negative values are used to test the exact match of the boost value with the absolute value of the 'nBoostValue', ande positive values are used to test for boost values that are greater than or equal to the 'nBoostValue'.

Definition at line 592 of file MasterList.cs.

◆ GetLoadedCount()

int MyCaffe.db.image.MasterList.GetLoadedCount ( )

Return the currently loaded images in the data source.

Returns

Definition at line 312 of file MasterList.cs.

◆ GetTotalCount()

int MyCaffe.db.image.MasterList.GetTotalCount ( )

Return the total number of images whether loaded or not, in the data source.

Returns

Definition at line 300 of file MasterList.cs.

◆ Load()

bool MyCaffe.db.image.MasterList.Load ( bool  bSilent = false)

Start loading the dataset.

Parameters
bSilentSpecifies whether or not to output the loading status.
Returns
If the dataset is already loading false is returned.

Definition at line 145 of file MasterList.cs.

◆ Relabel()

List< DbItem > MyCaffe.db.image.MasterList.Relabel ( LabelMappingCollection  col)

Relabel the images based on the LabelMappingCollection.

Parameters
colSpecifies the label mapping collection.
Returns
The new set of DBItems is returned for the images.

Definition at line 403 of file MasterList.cs.

◆ ReloadIndexing()

List< DbItem > MyCaffe.db.image.MasterList.ReloadIndexing ( )

Reload the image indexing.

Returns
The indexes are returned as a list.

Definition at line 375 of file MasterList.cs.

◆ ResetAllBoosts()

List< DbItem > MyCaffe.db.image.MasterList.ResetAllBoosts ( )

Reset all image boosts.

Returns
The new set of DBItems is returned for the images.

Definition at line 421 of file MasterList.cs.

◆ ResetLabels()

List< DbItem > MyCaffe.db.image.MasterList.ResetLabels ( )

Reset the labels of all images to the original labels.

Returns
The new set of DBItems is returned for the images.

Definition at line 384 of file MasterList.cs.

◆ SetImageMean()

void MyCaffe.db.image.MasterList.SetImageMean ( SimpleDatum  d,
bool  bSave = false 
)

Set the image mean.

Parameters
dSpecifies the image mean.
bSaveOptionally, specifies whether or not to save the image mean in the database (default = false).

Definition at line 288 of file MasterList.cs.

◆ StartRefresh()

bool MyCaffe.db.image.MasterList.StartRefresh ( double  dfReplacementPct = 0.25)

Start the refresh thread which will run if the number of images stored in memory is less than the total number of images in the data source, otherwise this function returns false.

Parameters
dfReplacementPctOptionally, specifies the replacement percentage (default = 0.25 or 25%).
Returns
false is returned if the refresh thread is already running, or if the number of images in memory equal the number of images in the data source.

Definition at line 199 of file MasterList.cs.

◆ StopRefresh()

void MyCaffe.db.image.MasterList.StopRefresh ( )

Stop the refresh thread if running.

Definition at line 274 of file MasterList.cs.

◆ Unload()

void MyCaffe.db.image.MasterList.Unload ( bool  bReLoad)

Unload the data source images.

Parameters
bReLoadRe-load the data source images right after the unload completes.

Definition at line 168 of file MasterList.cs.

◆ Verify()

void MyCaffe.db.image.MasterList.Verify ( MasterIndexes  idx)

Verify the loaded images against the master indexes.

Parameters
idxSpecifies the master indexes.

Definition at line 97 of file MasterList.cs.

◆ WaitForLoadingToComplete()

bool MyCaffe.db.image.MasterList.WaitForLoadingToComplete ( List< WaitHandle >  rgAbort,
int  nWait = int.MaxValue 
)

Wait for the image loading to complete - this is used when performing LOAD_ALL.

Parameters
rgAbortSpecifies one or more cancellation handles.
nWaitOptionally, specifies an amount to wait (default = int.MaxValue).
Returns
If the load is completed true is returned, otherwise false.

Definition at line 671 of file MasterList.cs.

◆ WaitForRefreshToComplete()

bool MyCaffe.db.image.MasterList.WaitForRefreshToComplete ( List< WaitHandle >  rgAbort,
int  nWait 
)

Wait for the refres to complete.

Parameters
rgAbortSpecifies one or more cancellation handles.
nWaitSpecifies an amount of time to wait in milliseconds.
Returns
If the refresh is done running, true is returned, otherwise false.

Definition at line 230 of file MasterList.cs.

Property Documentation

◆ IsFull

bool? MyCaffe.db.image.MasterList.IsFull
get

Returns true when the master list is fully loaded, false otherwise.

Definition at line 132 of file MasterList.cs.

◆ IsLoadLimitEnabled

bool MyCaffe.db.image.MasterList.IsLoadLimitEnabled
get

Returns true when the database is loaded with LoadLimit > 0, false otherwise.

Definition at line 118 of file MasterList.cs.

◆ IsRefreshDone

bool MyCaffe.db.image.MasterList.IsRefreshDone
get

Returns true after the refresh completes.

Definition at line 249 of file MasterList.cs.

◆ IsRefreshRunning

bool MyCaffe.db.image.MasterList.IsRefreshRunning
get

Returns true if the refresh is running, false otherwise.

Definition at line 263 of file MasterList.cs.

Event Documentation

◆ OnCalculateImageMean

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

The OnCalculateImageMean event fires when the ImageSet needs to calculate the image mean for the image set.

Definition at line 44 of file MasterList.cs.


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