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

The ImageSet class contains the list of image for a data source as well as a list of LabelSets that map into it. More...

Inheritance diagram for MyCaffe.db.image.ImageSet:

Public Member Functions

 ImageSet (DatasetFactory factory, SourceDescriptor src, DB_LOAD_METHOD loadMethod, int nLoadLimit, CryptoRandom random)
 The ImageSet constructor. More...
 
void Dispose ()
 Releases the resouces used. More...
 
Dictionary< int, ulong > GetQueryLabelCounts ()
 Retrieves the label counts. More...
 
void SetQueryLabelCount (int nLabel, int nBoost)
 Increase the query label count for a specific label. More...
 
string GetQueryBoostHitPrecentsAsText ()
 Get the queried boost hit percents as a string. More...
 
string GetQueryLabelHitPrecentsAsText ()
 Get the queried label hit percents as a string. More...
 
string GetQueryLabelEpocsAsText ()
 Get the queried label epoc per label as a text string. More...
 
List< LabelDescriptorGetLabels ()
 Returns a list of label descriptors used by the image set. More...
 
string GetLabelName (int nLabel)
 Returns the label name of a label. More...
 
void Relabel (LabelMappingCollection col)
 Applies the label mapping to the image set. More...
 
ImageSet Clone ()
 Returns a copy of the ImageSet. More...
 
int FindImageIndex (DateTime dt, string strDesc)
 Searches for an image index based on its time-stamp and description. More...
 
void Reset ()
 Resets the indexes and limited loaded images (if used). More...
 
bool Add (int nIdx, SimpleDatum d)
 Adds a new image to the image set. More...
 
void ReloadLabelSets ()
 Reload the label sets. More...
 
void CompleteLoad (int nLastImageIdx)
 Complete the image loading process. More...
 
int GetCount (bool bSuperboostOnly, string strFilterVal=null, int? nBoostVal=null)
 Returns the number of images in the image set, optionally with super-boost only. More...
 
List< SimpleDatumGetImages (bool bSuperboostOnly, string strFilterVal=null, int? nBoostVal=null, int nStartIdx=0, int nQueryCount=int.MaxValue)
 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...
 
SimpleDatum GetImage (int nIdx, DB_LABEL_SELECTION_METHOD labelSelectionMethod, DB_ITEM_SELECTION_METHOD imageSelectionMethod, Log log, bool bLoadDataCriteria=false, bool bLoadDebugData=false)
 Returns the image based on its label and image selection method. More...
 
SimpleDatum GetImage (int nImageID)
 Returns the SimpleDatum of the image at a given ID. More...
 
LabelSet GetLabelSet (int nLabel)
 Retuns the LabelSet corresponding to a label. More...
 
void SetImageMean (SimpleDatum d)
 Set the image mean on for the ImageSet. More...
 
SimpleDatum GetImageMean (Log log, WaitHandle[] rgAbort)
 Returns the image mean for the ImageSet. More...
 
void UpdateLabelBoosts (int nProjectId)
 Update the label boosts for a project. More...
 
void SetLabelMapping (LabelMapping map)
 Set the label mapping of the ImageSet. More...
 
void UpdateLabelMapping (int nNewLabel, List< int > rgOriginalLabels)
 Update the label mapping on the ImageSet. More...
 
void ResetLabels (int nProjectId)
 Resets the labels for a project. More...
 
void DeleteLabelBoosts (int nProjectId)
 Deletes the label boosts for a project. More...
 
void AddLabelBoost (int nProjectId, int nLabel, double dfBoost)
 Adds a label boost for a project. More...
 
string GetLabelBoostsAsText (int nProjectId)
 Returns the label boosts as text. More...
 
Dictionary< int, int > LoadLabelCounts ()
 Returns the label counts as a dictionary of item pairs (int nLabel, int nCount). More...
 
void UpdateLabelCounts (int nProjectId)
 Updates the label counts for a project. More...
 
string GetLabelCountsAsText ()
 Returns the label counts for the ImageList as text. More...
 
void Unload ()
 Unload all images in the image set. More...
 
int GetLoadedCount ()
 Returns the number of images loaded. More...
 
int GetTotalCount ()
 Returns the total number of images. More...
 
void ResetAllBoosts ()
 Resets all image boosts to the original boost loaded from the physical database. More...
 
List< SimpleDatumGetImages (DateTime dt, int nImageCount, string strFilterVal=null)
 Get a set of images, listed in chronological order starting at the next date greater than or equal to 'dt'. More...
 
bool Sort (IMGDB_SORT method)
 Sort the internal images. More...
 

Protected Member Functions

 ImageSet ()
 The Imageset constructor. More...
 
virtual void Dispose (bool bDisposing)
 Releases the resouces used. More...
 

Properties

SourceDescriptor Source [get]
 Returns the data source of the image set. More...
 
int SourceID [get]
 Returns the data source ID of the image set. More...
 
string SourceName [get]
 Returns the data source name of the image set. More...
 
bool IsRealData [get]
 Returns whether or not the image set contains real or byte based data. More...
 
int Count [get]
 Returns the number of images in the image set. More...
 
SimpleDatum[] Images [get]
 Get the array of images. 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 ImageSet class contains the list of image for a data source as well as a list of LabelSets that map into it.

Definition at line 16 of file Imageset.cs.

Constructor & Destructor Documentation

◆ ImageSet() [1/2]

MyCaffe.db.image.ImageSet.ImageSet ( DatasetFactory  factory,
SourceDescriptor  src,
DB_LOAD_METHOD  loadMethod,
int  nLoadLimit,
CryptoRandom  random 
)

The ImageSet constructor.

Parameters
factorySpecifies the DatasetFactory.
srcSpecifies the data source.
loadMethodSpecifies the method to use when loading the images.
nLoadLimitSpecifies the image load limit.
randomSpecifies the random number generator.

Definition at line 53 of file Imageset.cs.

◆ ImageSet() [2/2]

MyCaffe.db.image.ImageSet.ImageSet ( )
protected

The Imageset constructor.

Definition at line 80 of file Imageset.cs.

Member Function Documentation

◆ Add()

bool MyCaffe.db.image.ImageSet.Add ( int  nIdx,
SimpleDatum  d 
)

Adds a new image to the image set.

Parameters
nIdxSpecifies the index on where to add the image.
dSpecifies the image data.
Returns
If added successfully within the load limit, true is returned, otherwise false is returned.

Definition at line 307 of file Imageset.cs.

◆ AddLabelBoost()

void MyCaffe.db.image.ImageSet.AddLabelBoost ( int  nProjectId,
int  nLabel,
double  dfBoost 
)

Adds a label boost for a project.

Parameters
nProjectIdSpecifies the ID of the project.
nLabelSpecifies the label.
dfBoostSpecifies the label boost.

Definition at line 818 of file Imageset.cs.

◆ Clone()

ImageSet MyCaffe.db.image.ImageSet.Clone ( )

Returns a copy of the ImageSet.

Returns
The ImageSet copy is returned.

Definition at line 220 of file Imageset.cs.

◆ CompleteLoad()

void MyCaffe.db.image.ImageSet.CompleteLoad ( int  nLastImageIdx)

Complete the image loading process.

Parameters
nLastImageIdxSpecifies the last image index loaded.

Definition at line 377 of file Imageset.cs.

◆ DeleteLabelBoosts()

void MyCaffe.db.image.ImageSet.DeleteLabelBoosts ( int  nProjectId)

Deletes the label boosts for a project.

Parameters
nProjectIdSpecifies the ID of the project.

Definition at line 807 of file Imageset.cs.

◆ Dispose() [1/2]

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

Releases the resouces used.

Definition at line 102 of file Imageset.cs.

◆ Dispose() [2/2]

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

Releases the resouces used.

Parameters
bDisposingSet to true when called by Dispose()

Definition at line 89 of file Imageset.cs.

◆ FindImageIndex()

int MyCaffe.db.image.ImageSet.FindImageIndex ( DateTime  dt,
string  strDesc 
)

Searches for an image index based on its time-stamp and description.

Parameters
dtSpecifies the time-stamp.
strDescSpecifies the description.
Returns
If found the image index is returned, otherwise -1 is returned.

Definition at line 263 of file Imageset.cs.

◆ GetCount()

int MyCaffe.db.image.ImageSet.GetCount ( bool  bSuperboostOnly,
string  strFilterVal = null,
int?  nBoostVal = null 
)

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

Parameters
bSuperboostOnlySpecifies whether or not to only count images with super-boost.
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).
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 479 of file Imageset.cs.

◆ GetImage() [1/2]

SimpleDatum MyCaffe.db.image.ImageSet.GetImage ( int  nIdx,
DB_LABEL_SELECTION_METHOD  labelSelectionMethod,
DB_ITEM_SELECTION_METHOD  imageSelectionMethod,
Log  log,
bool  bLoadDataCriteria = false,
bool  bLoadDebugData = false 
)

Returns the image based on its label and image selection method.

Parameters
nIdxSpecifies the image index to use when loading sequentially.
labelSelectionMethodSpecifies the label selection method.
imageSelectionMethodSpecifies the image selection method.
logSpecifies the Log for status output.
bLoadDataCriteriaSpecifies to load the data criteria data (default = false).
bLoadDebugDataSpecifies to load the debug data (default = false).
Returns
The SimpleDatum containing the image is returned.

Definition at line 535 of file Imageset.cs.

◆ GetImage() [2/2]

SimpleDatum MyCaffe.db.image.ImageSet.GetImage ( int  nImageID)

Returns the SimpleDatum of the image at a given ID.

Parameters
nImageIDSpecifies the Raw Image ID to get.
Returns
The SimpleDatum of the image is returned.

Definition at line 610 of file Imageset.cs.

◆ GetImageMean()

SimpleDatum MyCaffe.db.image.ImageSet.GetImageMean ( Log  log,
WaitHandle[]  rgAbort 
)

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.
Returns
The SimpleDatum with the image mean is returned.

Definition at line 714 of file Imageset.cs.

◆ GetImages() [1/3]

List< SimpleDatum > MyCaffe.db.image.ImageSet.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 516 of file Imageset.cs.

◆ GetImages() [2/3]

List< SimpleDatum > MyCaffe.db.image.ImageSet.GetImages ( bool  bSuperboostOnly,
string  strFilterVal = null,
int?  nBoostVal = null,
int  nStartIdx = 0,
int  nQueryCount = int.MaxValue 
)

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.
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).
nStartIdxOptionally, specifies a starting index from which the query is to start within the set of images (default = 0).
nQueryCountOptionally, specifies a number of images to retrieve within the set (default = int.MaxValue).
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 496 of file Imageset.cs.

◆ GetImages() [3/3]

List< SimpleDatum > MyCaffe.db.image.ImageSet.GetImages ( DateTime  dt,
int  nImageCount,
string  strFilterVal = null 
)

Get a set of images, listed in chronological order starting at the next date greater than or equal to 'dt'.

Parameters
dtSpecifies the start date of the images sought.
nImageCountSpecifies the number of images to retrieve.
strFilterValOptionally, specifies the filter value that the description must match (default = null, which ignores this parameter).
Returns
The list of SimpleDatum is returned.

IMPORTANT: You must call Sort(ByDesc|ByDate) before using this function to ensure all loaded images are ordered by their descriptions then by their time.

Definition at line 918 of file Imageset.cs.

◆ GetLabelBoostsAsText()

string MyCaffe.db.image.ImageSet.GetLabelBoostsAsText ( int  nProjectId)

Returns the label boosts as text.

Parameters
nProjectIdSpecifies the ID of the project.
Returns
The label boosts are returned.

Definition at line 828 of file Imageset.cs.

◆ GetLabelCountsAsText()

string MyCaffe.db.image.ImageSet.GetLabelCountsAsText ( )

Returns the label counts for the ImageList as text.

Returns
The label counts are retuned.

Definition at line 855 of file Imageset.cs.

◆ GetLabelName()

string MyCaffe.db.image.ImageSet.GetLabelName ( int  nLabel)

Returns the label name of a label.

Parameters
nLabelSpecifies the label.
Returns
Returns the string name of the label.

Definition at line 191 of file Imageset.cs.

◆ GetLabels()

List< LabelDescriptor > MyCaffe.db.image.ImageSet.GetLabels ( )

Returns a list of label descriptors used by the image set.

Returns

Definition at line 174 of file Imageset.cs.

◆ GetLabelSet()

LabelSet MyCaffe.db.image.ImageSet.GetLabelSet ( int  nLabel)

Retuns the LabelSet corresponding to a label.

Parameters
nLabelSpecifies the label.
Returns
The LabelSet is returned.

Definition at line 631 of file Imageset.cs.

◆ GetLoadedCount()

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

Returns the number of images loaded.

Returns

Definition at line 885 of file Imageset.cs.

◆ GetQueryBoostHitPrecentsAsText()

string MyCaffe.db.image.ImageSet.GetQueryBoostHitPrecentsAsText ( )

Get the queried boost hit percents as a string.

Returns
The queried boost hit percent is returned as a string where each % represents the percentage of the queried made for boosted images.

Definition at line 137 of file Imageset.cs.

◆ GetQueryLabelCounts()

Dictionary< int, ulong > MyCaffe.db.image.ImageSet.GetQueryLabelCounts ( )

Retrieves the label counts.

Returns
The label counts is returned.

Definition at line 111 of file Imageset.cs.

◆ GetQueryLabelEpocsAsText()

string MyCaffe.db.image.ImageSet.GetQueryLabelEpocsAsText ( )

Get the queried label epoc per label as a text string.

Returns
The label epoc per label is returned as a string.

Definition at line 161 of file Imageset.cs.

◆ GetQueryLabelHitPrecentsAsText()

string MyCaffe.db.image.ImageSet.GetQueryLabelHitPrecentsAsText ( )

Get the queried label hit percents as a string.

Returns
The queried label hit percent is returned as a string where each % represents the percentage of the queried made for that label.

Definition at line 149 of file Imageset.cs.

◆ GetTotalCount()

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

Returns the total number of images.

Returns

Definition at line 894 of file Imageset.cs.

◆ LoadLabelCounts()

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

Returns the label counts as a dictionary of item pairs (int nLabel, int nCount).

Returns
The label counts are returned as item pairs (int nLabel, int nCount).

Definition at line 837 of file Imageset.cs.

◆ Relabel()

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

Applies the label mapping to the image set.

Parameters
col

Definition at line 206 of file Imageset.cs.

◆ ReloadLabelSets()

void MyCaffe.db.image.ImageSet.ReloadLabelSets ( )

Reload the label sets.

Definition at line 343 of file Imageset.cs.

◆ Reset()

void MyCaffe.db.image.ImageSet.Reset ( )

Resets the indexes and limited loaded images (if used).

Definition at line 294 of file Imageset.cs.

◆ ResetAllBoosts()

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

Resets all image boosts to the original boost loaded from the physical database.

Definition at line 902 of file Imageset.cs.

◆ ResetLabels()

void MyCaffe.db.image.ImageSet.ResetLabels ( int  nProjectId)

Resets the labels for a project.

Parameters
nProjectIdSpecifies the ID of the project.

Definition at line 798 of file Imageset.cs.

◆ SetImageMean()

void MyCaffe.db.image.ImageSet.SetImageMean ( SimpleDatum  d)

Set the image mean on for the ImageSet.

Parameters
dSpecifies the image mean.

Definition at line 703 of file Imageset.cs.

◆ SetLabelMapping()

void MyCaffe.db.image.ImageSet.SetLabelMapping ( LabelMapping  map)

Set the label mapping of the ImageSet.

Parameters
mapSpecifies the label map.

Definition at line 779 of file Imageset.cs.

◆ SetQueryLabelCount()

void MyCaffe.db.image.ImageSet.SetQueryLabelCount ( int  nLabel,
int  nBoost 
)

Increase the query label count for a specific label.

Parameters
nLabelSpecifies the label who's query count is to be increased.
nBoostSpecifies the boost of the image, or 0 if not boosted.

Definition at line 124 of file Imageset.cs.

◆ Sort()

bool MyCaffe.db.image.ImageSet.Sort ( IMGDB_SORT  method)

Sort the internal images.

Parameters
methodSpecifies the sorting method.
Returns
If the sorting is successful, true is returned, otherwise false is returned.

NOTE: Sorting only applies to the images currently loaded.

Definition at line 932 of file Imageset.cs.

◆ Unload()

void MyCaffe.db.image.ImageSet.Unload ( )

Unload all images in the image set.

Definition at line 863 of file Imageset.cs.

◆ UpdateLabelBoosts()

void MyCaffe.db.image.ImageSet.UpdateLabelBoosts ( int  nProjectId)

Update the label boosts for a project.

Parameters
nProjectIdSpecifies the ID of the project.

Definition at line 754 of file Imageset.cs.

◆ UpdateLabelCounts()

void MyCaffe.db.image.ImageSet.UpdateLabelCounts ( int  nProjectId)

Updates the label counts for a project.

Parameters
nProjectIdSpecifies the ID of the project.

Definition at line 846 of file Imageset.cs.

◆ UpdateLabelMapping()

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

Update the label mapping on the ImageSet.

Parameters
nNewLabelSpecifies the new label.
rgOriginalLabelsSpecifies the labels to be mapped to the new label.

Definition at line 789 of file Imageset.cs.

Property Documentation

◆ Count

int MyCaffe.db.image.ImageSet.Count
get

Returns the number of images in the image set.

Definition at line 425 of file Imageset.cs.

◆ Images

SimpleDatum [] MyCaffe.db.image.ImageSet.Images
get

Get the array of images.

Definition at line 433 of file Imageset.cs.

◆ IsRealData

bool MyCaffe.db.image.ImageSet.IsRealData
get

Returns whether or not the image set contains real or byte based data.

Definition at line 417 of file Imageset.cs.

◆ Source

SourceDescriptor MyCaffe.db.image.ImageSet.Source
get

Returns the data source of the image set.

Definition at line 393 of file Imageset.cs.

◆ SourceID

int MyCaffe.db.image.ImageSet.SourceID
get

Returns the data source ID of the image set.

Definition at line 401 of file Imageset.cs.

◆ SourceName

string MyCaffe.db.image.ImageSet.SourceName
get

Returns the data source name of the image set.

Definition at line 409 of file Imageset.cs.

Event Documentation

◆ OnCalculateImageMean

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

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

Definition at line 43 of file Imageset.cs.


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