MyCaffe
1.12.2.41
Deep learning software for Windows C# programmers.
|
[V2 Image Database] The ImageSet2 manages the data source data including the master list of images, and the master indexes that describe the data source layout (e.g. labels, boosts, etc). More...
Public Types | |
enum | TYPE { TRAIN , TEST } |
Defines the type of image set. More... | |
Public Member Functions | |
ImageSet2 (TYPE type, Log log, DatasetFactory factory, SourceDescriptor src, DB_LOAD_METHOD loadMethod, CryptoRandom random, WaitHandle[] rgAbort) | |
The ImageSet2 constructor. More... | |
QueryState | Initialize (bool bSilentLoad, bool bUseUniqueLabelIndexes=true, bool bUseUniqueImageIndexes=true, int nMaxLoadCount=0, bool bVerify=false) |
Initialize the ImageSet by creating the master list of images, starting its background image loading thread, and then creating the master index that maps the organization of the dataset. More... | |
bool | WaitForLoadingToComplete (int nWait=int.MaxValue) |
Wait for the image set to complete loading. More... | |
bool | StartRefresh (double dfReplacementPct=0.25) |
Start the refresh process which only valid when initialized with LoadLimit > 0. More... | |
bool | WaitForRefreshToComplete (int nWait=int.MaxValue) |
Wait for the image refresh to complete loading. More... | |
void | StopRefresh () |
Abort any refresh currently running. More... | |
bool | Load () |
Starts loading the image set on the background thread if it is not already loading. More... | |
void | Unload (bool bReload) |
Unload all images from the master list (freeing memory) and optionally reload the dataset. More... | |
QueryState | CreateQueryState (bool bUseUniqueLabelIndexes=true, bool bUseUniqueImageIndexes=true, IMGDB_SORT sort=IMGDB_SORT.NONE) |
Create a new QueryState and optionally sort the results. More... | |
int | GetTotalCount () |
Get the total number of images in the image set whether loaded or not. More... | |
int | GetLoadedCount () |
Get the total number of images already loaded in the image set. More... | |
SimpleDatum | GetImageMean (Log log, WaitHandle[] rgAbort, bool bQueryOnly) |
Get the image mean for the iamge set, or create one if it does not exist. More... | |
List< DbItem > | ReloadIndexing () |
Reload the indexing for the image set. More... | |
List< DbItem > | ResetLabels () |
Reset all labels of the image set to the original labels. More... | |
List< DbItem > | Relabel (LabelMappingCollection col) |
Reset the image set based on the LabelMappingCollection. More... | |
List< DbItem > | ResetAllBoosts () |
Reset all boosts to their original settings. More... | |
List< LabelDescriptor > | GetLabels () |
Returns a list of all labels used by the data source. More... | |
string | GetLabelName (int nLabel) |
Return the label name of a given label. More... | |
void | SetImageMean (SimpleDatum sd, bool bSave=false) |
Sets the data source image mean. More... | |
int | FindImageIndex (DateTime dt, string strDesc) |
Find the index of an image with the tiven date and (optionally) description. More... | |
SimpleDatum | GetImage (int nImageId) |
Get the image at a given image ID. More... | |
SimpleDatum | GetImage (QueryState state, DB_LABEL_SELECTION_METHOD labelSelectionMethod, DB_ITEM_SELECTION_METHOD imageSelectionMethod, Log log, int? nLabel=null, int nDirectIdx=-1, bool bLoadDataCriteria=false, bool bLoadDebugData=false) |
Returns the image based on its label and image selection method. 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-boost only. More... | |
List< SimpleDatum > | 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. More... | |
List< SimpleDatum > | 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. More... | |
List< SimpleDatum > | GetImages (bool bSuperboostOnly, string strFilterVal, int? nBoostVal, int[] rgIdx) |
Returns the array of images in the image set, possibly filtered with the filtering parameters. More... | |
List< SimpleResult > | GetAllResults (bool bRequireExtraData, int nMax) |
Returns all results from the RawImageResults table. More... | |
Public Member Functions inherited from MyCaffe.db.image.ImageSetBase | |
ImageSetBase (DatasetFactory factory, SourceDescriptor src) | |
The ImageSet constructor. More... | |
void | Dispose () |
Releases the resouces used. 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... | |
Protected Member Functions | |
override void | Dispose (bool bDisposing) |
Releases the resouces used. More... | |
Properties | |
DB_LOAD_METHOD | LoadMethod [get] |
Get the image load method used on initialization. More... | |
bool | IsRefreshRunning [get] |
Returns whether or not the refresh is running. More... | |
TYPE | ImageSetType [get] |
Returns the type of use for the ImageSet. More... | |
Properties inherited from MyCaffe.db.image.ImageSetBase | |
SourceDescriptor | Source [get] |
Returns the data source of the image set. More... | |
Events | |
EventHandler< CalculateImageMeanArgs > | OnCalculateImageMean |
The OnCalculateImageMean event fires when the ImageSet needs to calculate the image mean for the image set. More... | |
Additional Inherited Members | |
Protected Attributes inherited from MyCaffe.db.image.ImageSetBase | |
DatasetFactory | m_factory |
Specifies the DatasetFactory used to work with the underlying database. More... | |
SourceDescriptor | m_src |
Specifies the data source used with this Image Set. More... | |
[V2 Image Database] The ImageSet2 manages the data source data including the master list of images, and the master indexes that describe the data source layout (e.g. labels, boosts, etc).
Definition at line 16 of file ImageSet2.cs.
Defines the type of image set.
Enumerator | |
---|---|
TRAIN | Specifies an image set containing the trianing data source. |
TEST | Specifies an image set containing the testing data source. |
Definition at line 35 of file ImageSet2.cs.
MyCaffe.db.image.ImageSet2.ImageSet2 | ( | TYPE | type, |
Log | log, | ||
DatasetFactory | factory, | ||
SourceDescriptor | src, | ||
DB_LOAD_METHOD | loadMethod, | ||
CryptoRandom | random, | ||
WaitHandle[] | rgAbort | ||
) |
The ImageSet2 constructor.
type | Specifies the type of data source managed. |
log | Specifies the output log. |
factory | Specifies the data factory used to access the database data. |
src | Specifies the data source descriptor. |
loadMethod | Specifies the load method used to load the data. |
random | Specifies the random number generator. |
rgAbort | Specifies the cancellation handles. |
Definition at line 57 of file ImageSet2.cs.
QueryState MyCaffe.db.image.ImageSet2.CreateQueryState | ( | bool | bUseUniqueLabelIndexes = true , |
bool | bUseUniqueImageIndexes = true , |
||
IMGDB_SORT | sort = IMGDB_SORT.NONE |
||
) |
Create a new QueryState and optionally sort the results.
bUseUniqueLabelIndexes | Optionally, specifies to use unique label indexes which is slightly slower, but ensures each label is hit per epoch equally (default = true). |
bUseUniqueImageIndexes | Optionally, specifies to use unique image indexes which is slightly slower, but ensures each image is hit per epoch (default = true). |
sort | Optionally, specifies a sorting method for the query set. |
Definition at line 218 of file ImageSet2.cs.
|
protectedvirtual |
Releases the resouces used.
bDisposing | Set to true when called by Dispose() |
Reimplemented from MyCaffe.db.image.ImageSetBase.
Definition at line 74 of file ImageSet2.cs.
int MyCaffe.db.image.ImageSet2.FindImageIndex | ( | DateTime | dt, |
string | strDesc | ||
) |
Find the index of an image with the tiven date and (optionally) description.
dt | Specifies the date to look for. |
strDesc | Specifies the description to look for. |
Definition at line 339 of file ImageSet2.cs.
List< SimpleResult > MyCaffe.db.image.ImageSet2.GetAllResults | ( | bool | bRequireExtraData, |
int | nMax | ||
) |
Returns all results from the RawImageResults table.
bRequireExtraData | Specifies whether or not the Extra 'target' data is required or not. |
nMax | Optionally, specifies the maximum number of items to load. |
Definition at line 469 of file ImageSet2.cs.
int MyCaffe.db.image.ImageSet2.GetCount | ( | QueryState | state, |
string | strFilterVal = null , |
||
int? | nBoostVal = null , |
||
bool | bBoostValIsExact = false |
||
) |
Returns the number of images in the image set, optionally with super-boost only.
state | Specifies the query state to use. |
strFilterVal | Optionally, specifies the filter value that the description must match (default = null, which ignores this parameter). |
nBoostVal | Optionally, specifies the boost value that the boost must match (default = null, which ignores this parameter). |
bBoostValIsExact | Optionally, specifies whether or the boost value (if specified) is to be used literally (exact = true), or as a minimum boost value. |
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 408 of file ImageSet2.cs.
SimpleDatum MyCaffe.db.image.ImageSet2.GetImage | ( | int | nImageId | ) |
Get the image at a given image ID.
nImageId | Specifies the image ID (within the database) of the image to retrieve. |
Definition at line 353 of file ImageSet2.cs.
SimpleDatum MyCaffe.db.image.ImageSet2.GetImage | ( | QueryState | state, |
DB_LABEL_SELECTION_METHOD | labelSelectionMethod, | ||
DB_ITEM_SELECTION_METHOD | imageSelectionMethod, | ||
Log | log, | ||
int? | nLabel = null , |
||
int | nDirectIdx = -1 , |
||
bool | bLoadDataCriteria = false , |
||
bool | bLoadDebugData = false |
||
) |
Returns the image based on its label and image selection method.
state | Specifies the query state. |
labelSelectionMethod | Specifies the label selection method. |
imageSelectionMethod | Specifies the image selection method. |
log | Specifies the Log for status output. |
nLabel | Optionally, specifies the label (default = null). |
nDirectIdx | Optionally, specifies the image index to use when loading a specific index (default = -1). |
bLoadDataCriteria | Optionally, specifies to load the data criteria data (default = false). |
bLoadDebugData | Optionally, specifies to load the debug data (default = false). |
Definition at line 370 of file ImageSet2.cs.
SimpleDatum MyCaffe.db.image.ImageSet2.GetImageMean | ( | Log | log, |
WaitHandle[] | rgAbort, | ||
bool | bQueryOnly | ||
) |
Get the image mean for the iamge set, or create one if it does not exist.
log | Specifies the output log used when creating the image mean. |
rgAbort | Specifies the cancellation handles used to cancel the creation of the image mean. |
bQueryOnly | Specifies whether or not to only query for the mean and not calculate if missing. |
Definition at line 248 of file ImageSet2.cs.
List< SimpleDatum > MyCaffe.db.image.ImageSet2.GetImages | ( | bool | bSuperboostOnly, |
string | strFilterVal, | ||
int? | nBoostVal, | ||
int[] | rgIdx | ||
) |
Returns the array of images in the image set, possibly filtered with the filtering parameters.
bSuperboostOnly | Specifies whether or not to return images with super-boost. |
strFilterVal | specifies the filter value that the description must match (default = null, which ignores this parameter). |
nBoostVal | specifies the boost value that the boost must match (default = null, which ignores this parameter). |
rgIdx | Specifies a set of indexes to search for where the images returned must have an index greater than or equal to the individual index. |
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 458 of file ImageSet2.cs.
List< SimpleDatum > MyCaffe.db.image.ImageSet2.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.
state | Specifies the query state to use. |
dtStart | Specifies a starting time from which the query is to start within the set of images. |
nQueryCount | Optionally, specifies a number of images to retrieve within the set (default = int.MaxValue). |
strFilterVal | Optionally, specifies the filter value that the description must match (default = null, which ignores this parameter). |
nBoostVal | Optionally, specifies the boost value that the boost must match (default = null, which ignores this parameter). |
bBoostValIsExact | Optionally, specifies whether or the boost value (if specified) is to be used literally (exact = true), or as a minimum boost value. |
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 443 of file ImageSet2.cs.
List< SimpleDatum > MyCaffe.db.image.ImageSet2.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.
state | Specifies the query state to use. |
nStartIdx | Specifies a starting index from which the query is to start within the set of images. |
nQueryCount | Optionally, specifies a number of images to retrieve within the set (default = int.MaxValue). |
strFilterVal | Optionally, specifies the filter value that the description must match (default = null, which ignores this parameter). |
nBoostVal | Optionally, specifies the boost value that the boost must match (default = null, which ignores this parameter). |
bBoostValIsExact | Optionally, specifies whether or the boost value (if specified) is to be used literally (exact = true), or as a minimum boost value. |
bAttemptDirectLoad | Optionaly, specifies to directly load all images not already loaded. |
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 426 of file ImageSet2.cs.
string MyCaffe.db.image.ImageSet2.GetLabelName | ( | int | nLabel | ) |
Return the label name of a given label.
nLabel | Specifies the label. |
Definition at line 312 of file ImageSet2.cs.
List< LabelDescriptor > MyCaffe.db.image.ImageSet2.GetLabels | ( | ) |
Returns a list of all labels used by the data source.
Definition at line 302 of file ImageSet2.cs.
int MyCaffe.db.image.ImageSet2.GetLoadedCount | ( | ) |
Get the total number of images already loaded in the image set.
Definition at line 236 of file ImageSet2.cs.
int MyCaffe.db.image.ImageSet2.GetTotalCount | ( | ) |
Get the total number of images in the image set whether loaded or not.
Definition at line 227 of file ImageSet2.cs.
QueryState MyCaffe.db.image.ImageSet2.Initialize | ( | bool | bSilentLoad, |
bool | bUseUniqueLabelIndexes = true , |
||
bool | bUseUniqueImageIndexes = true , |
||
int | nMaxLoadCount = 0 , |
||
bool | bVerify = false |
||
) |
Initialize the ImageSet by creating the master list of images, starting its background image loading thread, and then creating the master index that maps the organization of the dataset.
bSilentLoad | Specifies to load the data silently without status output. |
bUseUniqueLabelIndexes | Optionally, specifies to use unique label indexes which is slightly slower, but ensures each label is hit per epoch equally (default = true). |
bUseUniqueImageIndexes | Optionally, specifies to use unique image indexes which is slightly slower, but ensures each image is hit per epoch (default = true). |
nMaxLoadCount | Optionally, 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). |
bVerify | Optionally, verify the dataset indexes (only applies when using LOAD_ALL loading method (default = false). |
Definition at line 102 of file ImageSet2.cs.
bool MyCaffe.db.image.ImageSet2.Load | ( | ) |
Starts loading the image set on the background thread if it is not already loading.
Definition at line 197 of file ImageSet2.cs.
List< DbItem > MyCaffe.db.image.ImageSet2.Relabel | ( | LabelMappingCollection | col | ) |
Reset the image set based on the LabelMappingCollection.
col | Specifies the label mapping that defines how to relabel the image set. |
Definition at line 280 of file ImageSet2.cs.
List< DbItem > MyCaffe.db.image.ImageSet2.ReloadIndexing | ( | ) |
Reload the indexing for the image set.
Definition at line 257 of file ImageSet2.cs.
List< DbItem > MyCaffe.db.image.ImageSet2.ResetAllBoosts | ( | ) |
Reset all boosts to their original settings.
Definition at line 291 of file ImageSet2.cs.
List< DbItem > MyCaffe.db.image.ImageSet2.ResetLabels | ( | ) |
Reset all labels of the image set to the original labels.
Definition at line 268 of file ImageSet2.cs.
void MyCaffe.db.image.ImageSet2.SetImageMean | ( | SimpleDatum | sd, |
bool | bSave = false |
||
) |
Sets the data source image mean.
sd | Specifies the iamge mean to set. |
bSave | Optionally, specifies whether or not to save the image mean in the database (default = false). |
Definition at line 328 of file ImageSet2.cs.
bool MyCaffe.db.image.ImageSet2.StartRefresh | ( | double | dfReplacementPct = 0.25 | ) |
Start the refresh process which only valid when initialized with LoadLimit > 0.
dfReplacementPct | Optionally, specifies the replacement percentage (default = 0.25 or 25%). |
Definition at line 162 of file ImageSet2.cs.
void MyCaffe.db.image.ImageSet2.StopRefresh | ( | ) |
Abort any refresh currently running.
Definition at line 180 of file ImageSet2.cs.
void MyCaffe.db.image.ImageSet2.Unload | ( | bool | bReload | ) |
Unload all images from the master list (freeing memory) and optionally reload the dataset.
bReload | When true, the image set starts loading right after it is unloaded causing a refresh. |
Definition at line 206 of file ImageSet2.cs.
bool MyCaffe.db.image.ImageSet2.WaitForLoadingToComplete | ( | int | nWait = int.MaxValue | ) |
Wait for the image set to complete loading.
nWait | Specifies the maximum number of ms to wait (default = int.MaxValue). |
Definition at line 136 of file ImageSet2.cs.
bool MyCaffe.db.image.ImageSet2.WaitForRefreshToComplete | ( | int | nWait = int.MaxValue | ) |
Wait for the image refresh to complete loading.
nWait | Specifies the maximum number of ms to wait (default = int.MaxValue). |
Definition at line 172 of file ImageSet2.cs.
|
get |
Returns the type of use for the ImageSet.
Definition at line 188 of file ImageSet2.cs.
|
get |
Returns whether or not the refresh is running.
Definition at line 152 of file ImageSet2.cs.
|
get |
Get the image load method used on initialization.
Definition at line 144 of file ImageSet2.cs.
EventHandler<CalculateImageMeanArgs> MyCaffe.db.image.ImageSet2.OnCalculateImageMean |
The OnCalculateImageMean event fires when the ImageSet needs to calculate the image mean for the image set.
Definition at line 30 of file ImageSet2.cs.