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

The MyCaffeImageDatabase provides an enhanced in-memory image database used for quick image retrieval. More...

Inheritance diagram for MyCaffe.db.image.MyCaffeImageDatabase:

Public Member Functions

 MyCaffeImageDatabase (Log log=null, string strId="default", int nSeed=0)
 The MyCaffeImageDatabase constructor. More...
 
 MyCaffeImageDatabase (IContainer container)
 The MyCaffeImageDatabase constructor. More...
 
DB_VERSION GetVersion ()
 Returns the version of the MyCaffe Image Database being used. More...
 
void SetConnection (ConnectInfo ci)
 Set the database connection to use. More...
 
Tuple< DB_LABEL_SELECTION_METHOD, DB_ITEM_SELECTION_METHODGetSelectionMethod ()
 Returns the label and image selection method used. More...
 
void SetSelectionMethod (DB_LABEL_SELECTION_METHOD? lbl, DB_ITEM_SELECTION_METHOD? img)
 Sets the label and image selection methods. More...
 
bool GetLoadItemDataCriteria ()
 Returns whether or not the image data criteria is loaded with each image. More...
 
bool GetLoadItemDebugData ()
 Returns whether or not the image debug data is loaded with each image. More...
 
void Enable (bool bEnable)
 Sets whether or not the image database is enabled. More...
 
bool InitializeWithDsName1 (SettingsCaffe s, string strDs, string strEvtCancel=null, PropertySet prop=null)
 Initializes the image database. More...
 
bool InitializeWithDs1 (SettingsCaffe s, DatasetDescriptor ds, string strEvtCancel=null, PropertySet prop=null)
 Initializes the image database. More...
 
bool InitializeWithDsId1 (SettingsCaffe s, int nDataSetID, string strEvtCancel=null, int nPadW=0, int nPadH=0, PropertySet prop=null)
 Initializes the image database. More...
 
void CleanUp (int nDsId=0, bool bForce=false)
 Releases the image database, and if this is the last instance using the in-memory database, frees all memory used. More...
 
bool LoadNextSet (string strEvtCancel)
 When using a Load Limit that is greater than 0, this function loads the next set of images. More...
 
void UpdateLabelBoosts (int nProjectID, int nSrcID)
 Updates the label boosts for the images based on the label boosts set for the given project. More...
 
int ImageCount (int nSrcId)
 Returns the number of images in a given data source. More...
 
int GetItemCount (int nSrcId, string strFilterVal=null, int? nBoostVal=null, bool bBoostValIsExact=false)
 Returns the number of images in a given data source. More...
 
List< SimpleDatumGetItemsFromIndex (int nSrcId, 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< SimpleDatumGetItemsFromTime (int nSrcId, 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< SimpleDatumGetItems (int nSrcId, int[] rgIdx, 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...
 
bool Sort (int nSrcId, IMGDB_SORT method)
 Sort the internal images. More...
 
int CreateDatasetOranizedByTime (int nDsId)
 Create a dynamic dataset organized by time from a pre-existing dataset. More...
 
bool DeleteCreatedDataset (int nDsId)
 Delete a dataset created with CreateDatasetOrganizedByTime. More...
 
void DeleteAllCreatedDatasets ()
 Delete all datasets created with CreateDatasetOrganizedByTime More...
 
SimpleDatum QueryItem (int nSrcId, int nIdx, DB_LABEL_SELECTION_METHOD? labelSelectionOverride=null, DB_ITEM_SELECTION_METHOD? imageSelectionOverride=null, int? nLabel=null, bool bLoadDataCriteria=false, bool bLoadDebugData=false)
 Query an image in a given data source. More...
 
void ResetQuery (int nDsID)
 Reset the query for the given data set ID. More...
 
SimpleDatum GetItem (int nImageID, params int[] rgSrcId)
 Returns the image with a given Raw Image ID. More...
 
void ResetAllBoosts (int nSrcId)
 Reset all in-memory image boosts. More...
 
List< LabelDescriptorGetLabels (int nSrcId)
 Returns a list of LabelDescriptors associated with the labels within a data source. More...
 
string GetLabelName (int nSrcId, int nLabel)
 Returns the text name of a given label within a data source. More...
 
DatasetDescriptor GetDatasetById (int nDsId)
 Returns the DatasetDescriptor for a given data set ID. More...
 
DatasetDescriptor GetDatasetByName (string strDs)
 Returns the DatasetDescriptor for a given data set name. More...
 
int GetDatasetID (string strDs)
 Returns a data set ID given its name. More...
 
string GetDatasetName (int nDsId)
 Returns a data set name given its ID. More...
 
SourceDescriptor GetSourceById (int nSrcId)
 Returns the SourceDescriptor for a given data source ID. More...
 
SourceDescriptor GetSourceByName (string strSrc)
 Returns the SourceDescriptor for a given data source name. More...
 
int GetSourceID (string strSrc)
 Returns a data source ID given its name. More...
 
string GetSourceName (int nSrcId)
 Returns a data source name given its ID. More...
 
int FindItemIndex (int nSrcId, DateTime dt, string strDescription)
 Searches fro the image index of an image within a data source matching a DateTime/description pattern. More...
 
SimpleDatum GetItemMean (int nSrcId)
 Returns the image mean for a data source. More...
 
void SetImageMean (int nSrcId, SimpleDatum d)
 Sets the image mean for a data source. More...
 
SimpleDatum QueryItemMeanFromDataset (int nDatasetId)
 Returns the image mean for the Training data source of a given data set. More...
 
SimpleDatum QueryItemMeanFromDb (int nSrcId)
 Queries the image mean for a data source from the database on disk. More...
 
void SaveImageMean (int nSrcId, SimpleDatum d, bool bUpdate)
 Saves the image mean to a data source on the database on disk. More...
 
SimpleDatum QueryItemMean (int nSrcId)
 Query the image mean for a data source and mask out (set to 0) all of the image except for the last columns. More...
 
bool DoesImageMeanExists (int nSrcId)
 Returns whether or not the image mean exists in the disk-based database for a given data source. More...
 
void SetLabelMapping (int nSrcId, LabelMapping map)
 Sets the label mapping to the database for a given data source. More...
 
void UpdateLabelMapping (int nSrcId, int nNewLabel, List< int > rgOriginalLabels)
 Updates the label mapping in the database for a given data source. More...
 
void ResetLabels (int nProjectId, int nSrcId)
 Resets all labels within a data source, used by a project, to their original labels. More...
 
void DeleteLabelBoosts (int nProjectId, int nSrcId)
 Delete all label boosts for a given data source associated with a given project. More...
 
void AddLabelBoost (int nProjectID, int nSrcId, int nLabel, double dfBoost)
 Add a label boost for a data source associated with a given project. More...
 
string GetLabelBoostsAsTextFromProject (int nProjectId, int nSrcId)
 Returns the label boosts as a text string for all boosted labels within a data source associated with a given project. More...
 
void UpdateLabelCounts (int nProjectID, int nSrcId)
 Updates the number of images of each label within a data source. More...
 
Dictionary< int, int > LoadLabelCounts (int nSrcId)
 Returns a label lookup of counts for a given data source. More...
 
string GetLabelCountsAsTextFromSourceId (int nSrcId)
 Returns a string with all label counts for a data source. More...
 
string GetLabelCountsAsTextFromSourceName (string strSource)
 Returns a string with all label counts for a data source. More...
 
string GetLabelQueryHitPercentsAsTextFromSourceName (string strSource)
 Returns a string with the query hit percent for each label (e.g. the percentage that each label has been queried). More...
 
string GetLabelQueryEpocsAsTextFromSourceName (string strSource)
 Returns a string with the query epoch counts for each label (e.g. the number of times all images with the label have been queried). More...
 
string GetBoostQueryHitPercentsAsTextFromSourceName (string strSource)
 Returns the percentage of boosted images queried as text. More...
 
bool LoadDatasetByName1 (string strDs, string strEvtCancel=null)
 Load another 'secondary' dataset. More...
 
bool LoadDatasetByID1 (int nDsId, string strEvtCancel=null)
 Load another 'secondary' dataset. More...
 
bool ReloadDataset (int nDsId)
 Reload a data set. More...
 
bool ReloadImageSet (int nSrcID)
 Reloads the images of a data source. More...
 
bool UnloadDatasetByName (string strDataset)
 The UnloadDataset method removes the dataset specified from memory. More...
 
bool UnloadDatasetById (int nDataSetID)
 The UnloadDataset method removes the dataset specified from memory. More...
 
double GetDatasetLoadedPercentByName (string strDataset, out double dfTraining, out double dfTesting)
 Returns the percentage that a dataset is loaded into memory. More...
 
double GetDatasetLoadedPercentById (int nDatasetID, out double dfTraining, out double dfTesting)
 Returns the percentage that a dataset is loaded into memory. More...
 

Static Public Member Functions

static Tuple< DB_LABEL_SELECTION_METHOD, DB_ITEM_SELECTION_METHODGetSelectionMethod (SettingsCaffe s)
 Returns the label/image selection methods based on the SettingsCaffe settings. More...
 
static Tuple< DB_LABEL_SELECTION_METHOD, DB_ITEM_SELECTION_METHODGetSelectionMethod (ProjectEx p)
 Returns the label/image selection methods based on the ProjectEx settings. More...
 
static void CreateDatabase (string strName, string strPath)
 Create the database used by the MyCaffeImageDatabase. More...
 

Protected Member Functions

override void Dispose (bool disposing)
 Clean up any resources being used. More...
 

Properties

Log OutputLog [getset]
 Get/set the output log. More...
 
bool UseTrainingImagesForTesting [getset]
 Get/set whether or not to use training images for the test set (default = false). More...
 
double SuperBoostProbability [getset]
 Get/set the super-boost probability which increases/decreases the probability of selecting a boosted image (default = 0). More...
 
bool SelectFromBoostOnly [get]
 Returns whether or not to select ONLY from boosted images. More...
 
bool IsEnabled [get]
 Returns whether or not the image database is enabled. More...
 
bool IsInitialized [get]
 Returns whether or not the image database is initialized. More...
 

Events

EventHandler< CalculateImageMeanArgsOnCalculateImageMean
 The OnCalculateImageMean event fires each time the MyCaffeImageDatabase wants to access the image mean for a data set. More...
 

Detailed Description

The MyCaffeImageDatabase provides an enhanced in-memory image database used for quick image retrieval.

The MyCaffeImageDatbase manages a set of data sets, where each data sets comprise a pair of data sources: one source for training and another source for testing. Each data source contains a list of images and a list of label sets that point back into the list of images. This organization allows for quick image selection by image or by label set and then by image from within the label set.

Definition at line 26 of file MyCaffeImageDatabase.cs.

Constructor & Destructor Documentation

◆ MyCaffeImageDatabase() [1/2]

MyCaffe.db.image.MyCaffeImageDatabase.MyCaffeImageDatabase ( Log  log = null,
string  strId = "default",
int  nSeed = 0 
)

The MyCaffeImageDatabase constructor.

Parameters
logThe Log for output.
strIdSpecifies an identifier for this in memory database instance (default = "default").
nSeedOptionally, specifies a seed for the random number generator (default = null).

Definition at line 63 of file MyCaffeImageDatabase.cs.

◆ MyCaffeImageDatabase() [2/2]

MyCaffe.db.image.MyCaffeImageDatabase.MyCaffeImageDatabase ( IContainer  container)

The MyCaffeImageDatabase constructor.

Parameters
containerSpecifies a container.

Definition at line 79 of file MyCaffeImageDatabase.cs.

Member Function Documentation

◆ AddLabelBoost()

void MyCaffe.db.image.MyCaffeImageDatabase.AddLabelBoost ( int  nProjectID,
int  nSrcId,
int  nLabel,
double  dfBoost 
)

Add a label boost for a data source associated with a given project.

Parameters
nProjectIDSpecifies the project ID.
nSrcIdSpecifies the ID of the data source.
nLabelSpecifies the label.
dfBoostSpecifies the new boost for the label.

Definition at line 1189 of file MyCaffeImageDatabase.cs.

◆ CleanUp()

void MyCaffe.db.image.MyCaffeImageDatabase.CleanUp ( int  nDsId = 0,
bool  bForce = false 
)

Releases the image database, and if this is the last instance using the in-memory database, frees all memory used.

Parameters
nDsIdOptionally, specifies the dataset previously loaded.
bForceOptionally, force the cleanup even if other users are using the database.

Definition at line 480 of file MyCaffeImageDatabase.cs.

◆ CreateDatabase()

static void MyCaffe.db.image.MyCaffeImageDatabase.CreateDatabase ( string  strName,
string  strPath 
)
static

Create the database used by the MyCaffeImageDatabase.

Parameters
strNameSpecifies the name of the database (recommended value = "DNN").
strPathSpecifies the file path where the database is to be created.

Definition at line 1502 of file MyCaffeImageDatabase.cs.

◆ CreateDatasetOranizedByTime()

int MyCaffe.db.image.MyCaffeImageDatabase.CreateDatasetOranizedByTime ( int  nDsId)

Create a dynamic dataset organized by time from a pre-existing dataset.

Parameters
nDsIdSpecifies the database ID of the dataset to copy.
Returns
The dataset ID of the newly created dataset is returned.

Definition at line 697 of file MyCaffeImageDatabase.cs.

◆ DeleteAllCreatedDatasets()

void MyCaffe.db.image.MyCaffeImageDatabase.DeleteAllCreatedDatasets ( )

Delete all datasets created with CreateDatasetOrganizedByTime

Definition at line 740 of file MyCaffeImageDatabase.cs.

◆ DeleteCreatedDataset()

bool MyCaffe.db.image.MyCaffeImageDatabase.DeleteCreatedDataset ( int  nDsId)

Delete a dataset created with CreateDatasetOrganizedByTime.

Parameters
nDsIdSpecifies the dataset ID of the created dataset.
Returns
If successful, true is returned, otherwise false is returned.

Definition at line 725 of file MyCaffeImageDatabase.cs.

◆ DeleteLabelBoosts()

void MyCaffe.db.image.MyCaffeImageDatabase.DeleteLabelBoosts ( int  nProjectId,
int  nSrcId 
)

Delete all label boosts for a given data source associated with a given project.

Parameters
nProjectIdSpecifies the project ID.
nSrcIdSpecifies the ID of the data source.

Definition at line 1177 of file MyCaffeImageDatabase.cs.

◆ Dispose()

override void MyCaffe.db.image.MyCaffeImageDatabase.Dispose ( bool  disposing)
protected

Clean up any resources being used.

Parameters
disposingtrue if managed resources should be disposed; otherwise, false.

Definition at line 14 of file MyCaffeImageDatabase.Designer.cs.

◆ DoesImageMeanExists()

bool MyCaffe.db.image.MyCaffeImageDatabase.DoesImageMeanExists ( int  nSrcId)

Returns whether or not the image mean exists in the disk-based database for a given data source.

Parameters
nSrcIdSpecifies the ID of the data source.
Returns
Returns true if the image mean exists, false otherwise.

Definition at line 1121 of file MyCaffeImageDatabase.cs.

◆ Enable()

void MyCaffe.db.image.MyCaffeImageDatabase.Enable ( bool  bEnable)

Sets whether or not the image database is enabled.

Parameters
bEnable

Definition at line 304 of file MyCaffeImageDatabase.cs.

◆ FindItemIndex()

int MyCaffe.db.image.MyCaffeImageDatabase.FindItemIndex ( int  nSrcId,
DateTime  dt,
string  strDescription 
)

Searches fro the image index of an image within a data source matching a DateTime/description pattern.

Optionally, images may have a time-stamp and/or description associated with each image. In such cases searching by the time-stamp + description can be useful in some instances.

Parameters
nSrcIdSpecifies the data source ID of the data source to be searched.
dtSpecifies the time-stamp to search for.
strDescriptionSpecifies the description to search for.
Returns
If found the zero-based index of the image is returned, otherwise -1 is returned.

Definition at line 1009 of file MyCaffeImageDatabase.cs.

◆ GetBoostQueryHitPercentsAsTextFromSourceName()

string MyCaffe.db.image.MyCaffeImageDatabase.GetBoostQueryHitPercentsAsTextFromSourceName ( string  strSource)

Returns the percentage of boosted images queried as text.

Parameters
strSourceSpecifies the source to query.
Returns
The query boost percentage hit is returned as text.

Definition at line 1270 of file MyCaffeImageDatabase.cs.

◆ GetDatasetById()

DatasetDescriptor MyCaffe.db.image.MyCaffeImageDatabase.GetDatasetById ( int  nDsId)

Returns the DatasetDescriptor for a given data set ID.

Parameters
nDsIdSpecifies the data set ID.
Returns
The dataset Descriptor is returned.

Definition at line 897 of file MyCaffeImageDatabase.cs.

◆ GetDatasetByName()

DatasetDescriptor MyCaffe.db.image.MyCaffeImageDatabase.GetDatasetByName ( string  strDs)

Returns the DatasetDescriptor for a given data set name.

Parameters
strDsSpecifies the data set name.
Returns
The dataset Descriptor is returned.

Definition at line 908 of file MyCaffeImageDatabase.cs.

◆ GetDatasetID()

int MyCaffe.db.image.MyCaffeImageDatabase.GetDatasetID ( string  strDs)

Returns a data set ID given its name.

Parameters
strDsSpecifies the data set name.
Returns
The data set ID is returned.

Definition at line 919 of file MyCaffeImageDatabase.cs.

◆ GetDatasetLoadedPercentById()

double MyCaffe.db.image.MyCaffeImageDatabase.GetDatasetLoadedPercentById ( int  nDatasetID,
out double  dfTraining,
out double  dfTesting 
)

Returns the percentage that a dataset is loaded into memory.

Parameters
nDatasetIDSpecifies the ID of the dataset.
dfTrainingSpecifies the percent of training images that are loaded.
dfTestingSpecifies the percent of testing images that are loaded.
Returns
The current image load percent for the dataset is returned..

Definition at line 1480 of file MyCaffeImageDatabase.cs.

◆ GetDatasetLoadedPercentByName()

double MyCaffe.db.image.MyCaffeImageDatabase.GetDatasetLoadedPercentByName ( string  strDataset,
out double  dfTraining,
out double  dfTesting 
)

Returns the percentage that a dataset is loaded into memory.

Parameters
strDatasetSpecifies the name of the dataset.
dfTrainingSpecifies the percent of training images that are loaded.
dfTestingSpecifies the percent of testing images that are loaded.
Returns
The current image load percent for the dataset is returned..

Definition at line 1456 of file MyCaffeImageDatabase.cs.

◆ GetDatasetName()

string MyCaffe.db.image.MyCaffeImageDatabase.GetDatasetName ( int  nDsId)

Returns a data set name given its ID.

Parameters
nDsIdSpecifies the data set ID.
Returns
The data set name is returned.

Definition at line 933 of file MyCaffeImageDatabase.cs.

◆ GetItem()

SimpleDatum MyCaffe.db.image.MyCaffeImageDatabase.GetItem ( int  nImageID,
params int[]  rgSrcId 
)

Returns the image with a given Raw Image ID.

Parameters
nImageIDSpecifies the Raw Image ID.
rgSrcIdSpecifies a set of source ID's to query from.
Returns
If found, the SimpleDatum of the Raw Image is returned, otherwise, null is returned.

Definition at line 835 of file MyCaffeImageDatabase.cs.

◆ GetItemCount()

int MyCaffe.db.image.MyCaffeImageDatabase.GetItemCount ( int  nSrcId,
string  strFilterVal = null,
int?  nBoostVal = null,
bool  bBoostValIsExact = false 
)

Returns the number of images in a given data source.

Parameters
nSrcIdSpecifies the data source ID.
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 (Not used for version 1).
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 600 of file MyCaffeImageDatabase.cs.

◆ GetItemMean()

SimpleDatum MyCaffe.db.image.MyCaffeImageDatabase.GetItemMean ( int  nSrcId)

Returns the image mean for a data source.

Parameters
nSrcIdSpecifies the ID of the data source.
Returns
The image mean is returned as a SimpleDatum.

Definition at line 1019 of file MyCaffeImageDatabase.cs.

◆ GetItems()

List< SimpleDatum > MyCaffe.db.image.MyCaffeImageDatabase.GetItems ( int  nSrcId,
int[]  rgIdx,
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
nSrcIdSpecifies the data source ID.
rgIdxSpecifies an array of indexes to query.
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 - not used in Version 1.
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 667 of file MyCaffeImageDatabase.cs.

◆ GetItemsFromIndex()

List< SimpleDatum > MyCaffe.db.image.MyCaffeImageDatabase.GetItemsFromIndex ( int  nSrcId,
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
nSrcIdSpecifies the data source ID.
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).
bBoostValIsExactNot used in version 1, all boost values are treated as inexact (bBoostValIsExact = false).
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', and positive values are used to test for boost values that are greater than or equal to the 'nBoostValue'.

Definition at line 623 of file MyCaffeImageDatabase.cs.

◆ GetItemsFromTime()

List< SimpleDatum > MyCaffe.db.image.MyCaffeImageDatabase.GetItemsFromTime ( int  nSrcId,
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
nSrcIdSpecifies the data source ID.
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).
nBoostValNot used in version 1.
bBoostValIsExactNot used in version 1.
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 647 of file MyCaffeImageDatabase.cs.

◆ GetLabelBoostsAsTextFromProject()

string MyCaffe.db.image.MyCaffeImageDatabase.GetLabelBoostsAsTextFromProject ( int  nProjectId,
int  nSrcId 
)

Returns the label boosts as a text string for all boosted labels within a data source associated with a given project.

Parameters
nProjectIdSpecifies the project ID.
nSrcIdSpecifies the ID of the data source.
Returns
The label boosts are returned as a text string.

Definition at line 1200 of file MyCaffeImageDatabase.cs.

◆ GetLabelCountsAsTextFromSourceId()

string MyCaffe.db.image.MyCaffeImageDatabase.GetLabelCountsAsTextFromSourceId ( int  nSrcId)

Returns a string with all label counts for a data source.

Parameters
nSrcIdSpecifies the ID of the data source.
Returns
A string containing all label counts is returned.

Definition at line 1230 of file MyCaffeImageDatabase.cs.

◆ GetLabelCountsAsTextFromSourceName()

string MyCaffe.db.image.MyCaffeImageDatabase.GetLabelCountsAsTextFromSourceName ( string  strSource)

Returns a string with all label counts for a data source.

Parameters
strSourceSpecifies the name of the data source.
Returns
A string containing all label counts is returned.

Definition at line 1240 of file MyCaffeImageDatabase.cs.

◆ GetLabelName()

string MyCaffe.db.image.MyCaffeImageDatabase.GetLabelName ( int  nSrcId,
int  nLabel 
)

Returns the text name of a given label within a data source.

Parameters
nSrcIdSpecifies the data source ID.
nLabelSpecifies the label.
Returns
The laben name is returned as a string.

Definition at line 887 of file MyCaffeImageDatabase.cs.

◆ GetLabelQueryEpocsAsTextFromSourceName()

string MyCaffe.db.image.MyCaffeImageDatabase.GetLabelQueryEpocsAsTextFromSourceName ( string  strSource)

Returns a string with the query epoch counts for each label (e.g. the number of times all images with the label have been queried).

Parameters
strSourceSpecifies the data source who's query epochs are to be retrieved.
Returns
A string representing the query epoch counts is returned.

Definition at line 1260 of file MyCaffeImageDatabase.cs.

◆ GetLabelQueryHitPercentsAsTextFromSourceName()

string MyCaffe.db.image.MyCaffeImageDatabase.GetLabelQueryHitPercentsAsTextFromSourceName ( string  strSource)

Returns a string with the query hit percent for each label (e.g. the percentage that each label has been queried).

Parameters
strSourceSpecifies the data source who's hit percentages are to be retrieved.
Returns
A string representing the query hit percentages is returned.

Definition at line 1250 of file MyCaffeImageDatabase.cs.

◆ GetLabels()

List< LabelDescriptor > MyCaffe.db.image.MyCaffeImageDatabase.GetLabels ( int  nSrcId)

Returns a list of LabelDescriptors associated with the labels within a data source.

Parameters
nSrcIdSpecifies the data source ID.
Returns
The list of LabelDescriptors is returned.

Definition at line 876 of file MyCaffeImageDatabase.cs.

◆ GetLoadItemDataCriteria()

bool MyCaffe.db.image.MyCaffeImageDatabase.GetLoadItemDataCriteria ( )

Returns whether or not the image data criteria is loaded with each image.

Definition at line 242 of file MyCaffeImageDatabase.cs.

◆ GetLoadItemDebugData()

bool MyCaffe.db.image.MyCaffeImageDatabase.GetLoadItemDebugData ( )

Returns whether or not the image debug data is loaded with each image.

Definition at line 250 of file MyCaffeImageDatabase.cs.

◆ GetSelectionMethod() [1/3]

Tuple< DB_LABEL_SELECTION_METHOD, DB_ITEM_SELECTION_METHOD > MyCaffe.db.image.MyCaffeImageDatabase.GetSelectionMethod ( )

Returns the label and image selection method used.

Returns
A KeyValue containing the Label and Image selection method.

Definition at line 220 of file MyCaffeImageDatabase.cs.

◆ GetSelectionMethod() [2/3]

static Tuple< DB_LABEL_SELECTION_METHOD, DB_ITEM_SELECTION_METHOD > MyCaffe.db.image.MyCaffeImageDatabase.GetSelectionMethod ( ProjectEx  p)
static

Returns the label/image selection methods based on the ProjectEx settings.

Parameters
pSpecifies the project.
Returns
The label/image selection method is returned.

Definition at line 192 of file MyCaffeImageDatabase.cs.

◆ GetSelectionMethod() [3/3]

static Tuple< DB_LABEL_SELECTION_METHOD, DB_ITEM_SELECTION_METHOD > MyCaffe.db.image.MyCaffeImageDatabase.GetSelectionMethod ( SettingsCaffe  s)
static

Returns the label/image selection methods based on the SettingsCaffe settings.

Parameters
sSpecifies the caffe settings.
Returns
The label/image selection method is returned.

Definition at line 160 of file MyCaffeImageDatabase.cs.

◆ GetSourceById()

SourceDescriptor MyCaffe.db.image.MyCaffeImageDatabase.GetSourceById ( int  nSrcId)

Returns the SourceDescriptor for a given data source ID.

Parameters
nSrcIdSpecifies the data source ID.
Returns
The SourceDescriptor is returned.

Definition at line 947 of file MyCaffeImageDatabase.cs.

◆ GetSourceByName()

SourceDescriptor MyCaffe.db.image.MyCaffeImageDatabase.GetSourceByName ( string  strSrc)

Returns the SourceDescriptor for a given data source name.

Parameters
strSrcSpecifies the data source name.
Returns
The SourceDescriptor is returned.

Definition at line 961 of file MyCaffeImageDatabase.cs.

◆ GetSourceID()

int MyCaffe.db.image.MyCaffeImageDatabase.GetSourceID ( string  strSrc)

Returns a data source ID given its name.

Parameters
strSrcSpecifies the data source name.
Returns
The data source ID is returned.

Definition at line 975 of file MyCaffeImageDatabase.cs.

◆ GetSourceName()

string MyCaffe.db.image.MyCaffeImageDatabase.GetSourceName ( int  nSrcId)

Returns a data source name given its ID.

Parameters
nSrcIdSpecifies the data source ID.
Returns
The data source name is returned.

Definition at line 989 of file MyCaffeImageDatabase.cs.

◆ GetVersion()

DB_VERSION MyCaffe.db.image.MyCaffeImageDatabase.GetVersion ( )

Returns the version of the MyCaffe Image Database being used.

Returns
Returns the version.

Definition at line 91 of file MyCaffeImageDatabase.cs.

◆ ImageCount()

int MyCaffe.db.image.MyCaffeImageDatabase.ImageCount ( int  nSrcId)

Returns the number of images in a given data source.

Parameters
nSrcIdSpecifies the data source ID.
Returns
The number of images is returned.

Definition at line 580 of file MyCaffeImageDatabase.cs.

◆ InitializeWithDs1()

bool MyCaffe.db.image.MyCaffeImageDatabase.InitializeWithDs1 ( SettingsCaffe  s,
DatasetDescriptor  ds,
string  strEvtCancel = null,
PropertySet  prop = null 
)

Initializes the image database.

Parameters
sSpecifies the caffe settings.
dsSpecifies the data set to load.
strEvtCancelOptionally, specifies the name of the CancelEvent used to cancel load operations (default = null).
propOptionally, specifies the properties for the initialization (default = null).
Returns
Returns true on success, false otherwise.

Definition at line 338 of file MyCaffeImageDatabase.cs.

◆ InitializeWithDsId1()

bool MyCaffe.db.image.MyCaffeImageDatabase.InitializeWithDsId1 ( SettingsCaffe  s,
int  nDataSetID,
string  strEvtCancel = null,
int  nPadW = 0,
int  nPadH = 0,
PropertySet  prop = null 
)

Initializes the image database.

Parameters
sSpecifies the caffe settings.
nDataSetIDSpecifies the database ID of the data set to load.
strEvtCancelOptionally, specifies the name of the CancelEvent used to cancel load operations (default = null).
nPadWOptionally, specifies the padding to add to each image width (default = 0).
nPadHOptionally, specifies the padding to add to each image height (default = 0).
propOptionally, specifies the properties for the initialization (default = null).
Returns
Returns true on success, false otherwise.

Definition at line 364 of file MyCaffeImageDatabase.cs.

◆ InitializeWithDsName1()

bool MyCaffe.db.image.MyCaffeImageDatabase.InitializeWithDsName1 ( SettingsCaffe  s,
string  strDs,
string  strEvtCancel = null,
PropertySet  prop = null 
)

Initializes the image database.

Parameters
sSpecifies the caffe settings.
strDsSpecifies the data set to load.
strEvtCancelOptionally, specifies the name of the CancelEvent used to cancel load operations (default = null).
propOptionally, specifies the properties for the initialization (default = null).
Returns
Returns true on success, false otherwise.

Definition at line 325 of file MyCaffeImageDatabase.cs.

◆ LoadDatasetByID1()

bool MyCaffe.db.image.MyCaffeImageDatabase.LoadDatasetByID1 ( int  nDsId,
string  strEvtCancel = null 
)

Load another 'secondary' dataset.

The primary dataset should be loaded using one of the 'Initialize' methods. This method is provided to allow for loading multiple datasets.

Parameters
nDsIdSpecifies the ID of the data set.
strEvtCancelSpecifies the name of the CancelEvent used to cancel load operations.
Returns
When the dataset is loaded true is returned, otherwise if the dataset is already loaded false is returned.

Definition at line 1302 of file MyCaffeImageDatabase.cs.

◆ LoadDatasetByName1()

bool MyCaffe.db.image.MyCaffeImageDatabase.LoadDatasetByName1 ( string  strDs,
string  strEvtCancel = null 
)

Load another 'secondary' dataset.

The primary dataset should be loaded using one of the 'Initialize' methods. This method is provided to allow for loading multiple datasets.

Parameters
strDsSpecifies the name of the data set.
strEvtCancelSpecifies the name of the CancelEvent used to cancel load operations.
Returns
When the dataset is loaded true is returned, otherwise if the dataset is already loaded false is returned.

Definition at line 1285 of file MyCaffeImageDatabase.cs.

◆ LoadLabelCounts()

Dictionary< int, int > MyCaffe.db.image.MyCaffeImageDatabase.LoadLabelCounts ( int  nSrcId)

Returns a label lookup of counts for a given data source.

Parameters
nSrcIdSpecifies the ID of the data source.
Returns
A dictionary containing label,count pairs is returned.

Definition at line 1220 of file MyCaffeImageDatabase.cs.

◆ LoadNextSet()

bool MyCaffe.db.image.MyCaffeImageDatabase.LoadNextSet ( string  strEvtCancel)

When using a Load Limit that is greater than 0, this function loads the next set of images.

Parameters
strEvtCancelSpecifies the name of the Cancel Event to abort loading the images.
Returns
Returns true on success, false otherwise.

Definition at line 521 of file MyCaffeImageDatabase.cs.

◆ QueryItem()

SimpleDatum MyCaffe.db.image.MyCaffeImageDatabase.QueryItem ( int  nSrcId,
int  nIdx,
DB_LABEL_SELECTION_METHOD labelSelectionOverride = null,
DB_ITEM_SELECTION_METHOD imageSelectionOverride = null,
int?  nLabel = null,
bool  bLoadDataCriteria = false,
bool  bLoadDebugData = false 
)

Query an image in a given data source.

Parameters
nSrcIdSpecifies the databse ID of the data source.
nIdxSpecifies the image index to query. Note, the index is only used in non-random image queries.
labelSelectionOverrideOptionally, specifies the label selection method override. The default = null, which directs the method to use the label selection method specified during Initialization.
imageSelectionOverrideOptionally, specifies the image selection method override. The default = null, which directs the method to use the image selection method specified during Initialization.
nLabelOptionally, specifies a label set to use for the image selection. When specified only images of this label are returned using the image selection method.
bLoadDataCriteriaSpecifies to load the data criteria data (default = false).
bLoadDebugDataSpecifies to load the debug data (default = false).
Returns
The image SimpleDatum is returned.

Definition at line 756 of file MyCaffeImageDatabase.cs.

◆ QueryItemMean()

SimpleDatum MyCaffe.db.image.MyCaffeImageDatabase.QueryItemMean ( int  nSrcId)

Query the image mean for a data source and mask out (set to 0) all of the image except for the last columns.

Parameters
nSrcIdSpecifies the ID of the data source.
Returns

Definition at line 1108 of file MyCaffeImageDatabase.cs.

◆ QueryItemMeanFromDataset()

SimpleDatum MyCaffe.db.image.MyCaffeImageDatabase.QueryItemMeanFromDataset ( int  nDatasetId)

Returns the image mean for the Training data source of a given data set.

Parameters
nDatasetIdSpecifies the data set to use.
Returns
The image mean is returned as a SimpleDatum.

Definition at line 1060 of file MyCaffeImageDatabase.cs.

◆ QueryItemMeanFromDb()

SimpleDatum MyCaffe.db.image.MyCaffeImageDatabase.QueryItemMeanFromDb ( int  nSrcId)

Queries the image mean for a data source from the database on disk.

If the image mean does not exist in the database, one is created, saved and then returned.

Parameters
nSrcIdSpecifies the ID of the data source.
Returns
The image mean is returned as a SimpleDatum.

Definition at line 1078 of file MyCaffeImageDatabase.cs.

◆ ReloadDataset()

bool MyCaffe.db.image.MyCaffeImageDatabase.ReloadDataset ( int  nDsId)

Reload a data set.

Parameters
nDsIdSpecifies the ID of the data set.
Returns
If the data set is found, true is returned, otherwise false is returned.

Definition at line 1352 of file MyCaffeImageDatabase.cs.

◆ ReloadImageSet()

bool MyCaffe.db.image.MyCaffeImageDatabase.ReloadImageSet ( int  nSrcID)

Reloads the images of a data source.

Parameters
nSrcIDSpecifies the ID of the data source.
Returns
If the data source is found, true is returned, otherwise false is returned.

Definition at line 1369 of file MyCaffeImageDatabase.cs.

◆ ResetAllBoosts()

void MyCaffe.db.image.MyCaffeImageDatabase.ResetAllBoosts ( int  nSrcId)

Reset all in-memory image boosts.

This does not impact the boost setting within the physical database.

Parameters
nSrcIdSpecifies the source ID of the data set to reset.

Definition at line 861 of file MyCaffeImageDatabase.cs.

◆ ResetLabels()

void MyCaffe.db.image.MyCaffeImageDatabase.ResetLabels ( int  nProjectId,
int  nSrcId 
)

Resets all labels within a data source, used by a project, to their original labels.

Parameters
nProjectIdSpecifies the ID of the project.
nSrcIdSpecifies the ID of the data source.

Definition at line 1167 of file MyCaffeImageDatabase.cs.

◆ ResetQuery()

void MyCaffe.db.image.MyCaffeImageDatabase.ResetQuery ( int  nDsID)

Reset the query for the given data set ID.

Parameters
nDsIDSpecifies the data set ID whos query indexes are to be reset.

Definition at line 818 of file MyCaffeImageDatabase.cs.

◆ SaveImageMean()

void MyCaffe.db.image.MyCaffeImageDatabase.SaveImageMean ( int  nSrcId,
SimpleDatum  d,
bool  bUpdate 
)

Saves the image mean to a data source on the database on disk.

Parameters
nSrcIdSpecifies the ID of the data source.
dSpecifies a SimpleDatum containing the image mean.
bUpdateSpecifies whether or not to update the mean image.

Definition at line 1097 of file MyCaffeImageDatabase.cs.

◆ SetConnection()

void MyCaffe.db.image.MyCaffeImageDatabase.SetConnection ( ConnectInfo  ci)

Set the database connection to use.

Parameters
ciSpecifies the dataase connection information to use.

Definition at line 150 of file MyCaffeImageDatabase.cs.

◆ SetImageMean()

void MyCaffe.db.image.MyCaffeImageDatabase.SetImageMean ( int  nSrcId,
SimpleDatum  d 
)

Sets the image mean for a data source.

Parameters
nSrcIdSpecifies the ID of the data source.
dSpecifies a SimpleDatum containing the image mean.

Definition at line 1045 of file MyCaffeImageDatabase.cs.

◆ SetLabelMapping()

void MyCaffe.db.image.MyCaffeImageDatabase.SetLabelMapping ( int  nSrcId,
LabelMapping  map 
)

Sets the label mapping to the database for a given data source.

Parameters
nSrcIdSpecifies the ID of the data source.
mapSpecifies the label mapping to set.

Definition at line 1146 of file MyCaffeImageDatabase.cs.

◆ SetSelectionMethod()

void MyCaffe.db.image.MyCaffeImageDatabase.SetSelectionMethod ( DB_LABEL_SELECTION_METHOD lbl,
DB_ITEM_SELECTION_METHOD img 
)

Sets the label and image selection methods.

Parameters
lblSpecifies the label selection method or null to ignore.
imgSpecifies the image selection method or null to ignore.

Definition at line 230 of file MyCaffeImageDatabase.cs.

◆ Sort()

bool MyCaffe.db.image.MyCaffeImageDatabase.Sort ( int  nSrcId,
IMGDB_SORT  method 
)

Sort the internal images.

Parameters
nSrcIdSpecifies the database ID of the data source.
methodSpecifies the sorting method.
Returns
If the sorting is successful, true is returned, otherwise false is returned.

Definition at line 682 of file MyCaffeImageDatabase.cs.

◆ UnloadDatasetById()

bool MyCaffe.db.image.MyCaffeImageDatabase.UnloadDatasetById ( int  nDataSetID)

The UnloadDataset method removes the dataset specified from memory.

Parameters
nDataSetIDSpecifies the dataset ID to remove.

Specifiying a dataset ID of -1 directs the UnloadDatasetById to unload ALL datasets loaded.

Returns
If found and removed, this function returns true, otherwise false is returned.

Definition at line 1417 of file MyCaffeImageDatabase.cs.

◆ UnloadDatasetByName()

bool MyCaffe.db.image.MyCaffeImageDatabase.UnloadDatasetByName ( string  strDataset)

The UnloadDataset method removes the dataset specified from memory.

Parameters
strDatasetSpecifies the dataset to remove.
Returns
If found and removed, this function returns true, otherwise false is returned.

Definition at line 1386 of file MyCaffeImageDatabase.cs.

◆ UpdateLabelBoosts()

void MyCaffe.db.image.MyCaffeImageDatabase.UpdateLabelBoosts ( int  nProjectID,
int  nSrcID 
)

Updates the label boosts for the images based on the label boosts set for the given project.

Parameters
nProjectIDSpecifies the project ID in the database.
nSrcIDSpecifies the data source ID.

Definition at line 570 of file MyCaffeImageDatabase.cs.

◆ UpdateLabelCounts()

void MyCaffe.db.image.MyCaffeImageDatabase.UpdateLabelCounts ( int  nProjectID,
int  nSrcId 
)

Updates the number of images of each label within a data source.

Parameters
nProjectIDSpecifies a project ID.
nSrcIdSpecifies the ID of the data source.

Definition at line 1210 of file MyCaffeImageDatabase.cs.

◆ UpdateLabelMapping()

void MyCaffe.db.image.MyCaffeImageDatabase.UpdateLabelMapping ( int  nSrcId,
int  nNewLabel,
List< int >  rgOriginalLabels 
)

Updates the label mapping in the database for a given data source.

Parameters
nSrcIdSpecifies the ID of the data source.
nNewLabelSpecifies a new label.
rgOriginalLabelsSpecifies the original lables that are mapped to the new label.

Definition at line 1157 of file MyCaffeImageDatabase.cs.

Property Documentation

◆ IsEnabled

bool MyCaffe.db.image.MyCaffeImageDatabase.IsEnabled
get

Returns whether or not the image database is enabled.

Definition at line 295 of file MyCaffeImageDatabase.cs.

◆ IsInitialized

bool MyCaffe.db.image.MyCaffeImageDatabase.IsInitialized
get

Returns whether or not the image database is initialized.

Definition at line 312 of file MyCaffeImageDatabase.cs.

◆ OutputLog

Log MyCaffe.db.image.MyCaffeImageDatabase.OutputLog
getset

Get/set the output log.

Definition at line 140 of file MyCaffeImageDatabase.cs.

◆ SelectFromBoostOnly

bool MyCaffe.db.image.MyCaffeImageDatabase.SelectFromBoostOnly
get

Returns whether or not to select ONLY from boosted images.

Definition at line 276 of file MyCaffeImageDatabase.cs.

◆ SuperBoostProbability

double MyCaffe.db.image.MyCaffeImageDatabase.SuperBoostProbability
getset

Get/set the super-boost probability which increases/decreases the probability of selecting a boosted image (default = 0).

Definition at line 267 of file MyCaffeImageDatabase.cs.

◆ UseTrainingImagesForTesting

bool MyCaffe.db.image.MyCaffeImageDatabase.UseTrainingImagesForTesting
getset

Get/set whether or not to use training images for the test set (default = false).

Definition at line 258 of file MyCaffeImageDatabase.cs.

Event Documentation

◆ OnCalculateImageMean

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

The OnCalculateImageMean event fires each time the MyCaffeImageDatabase wants to access the image mean for a data set.

Definition at line 55 of file MyCaffeImageDatabase.cs.


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