CVB.Net 14.0
ClassifierFactory Class Reference

Learner object that creates a classifier from an image list. More...

Classes

class  LearnProgressEventArgs
 Arguments for the LearnProgress event. More...
 

Public Member Functions

 ClassifierFactory ()
 Construct a learner and initialize it with an image list.
 
Classifier Learn (SampleImageList sampleImageList, out double learnResult)
 Learn a new classifier from a SampleImageList using the currently set parameters. More...
 

Public Attributes

readonly string PreprocessingCodeDefault = string.Empty
 Default preprocessing code used by the learner.
 
DecisionBoundary BOUNDARYDEFAULT = DecisionBoundary.Soft
 Default decision boundary the leaner will use.
 

Static Public Attributes

const InstanceGeneration InstanceGenerationDefault = InstanceGeneration.Random
 The default type of instance generation that the learner uses.
 
const int SamplesPerImageDefault = 1
 The default number of samples per image the learner uses.
 
const Symmetries SymmetriesDefault = Symmetries.Identity
 Default setting for Symmetries that the learner uses.
 
const int RotationRangeDefault = 0
 Default rotation range used by the learner.
 
static readonly Point2D TranslationRangeDefault = new Point2D(0, 0)
 Default translation range used by the learner.
 

Properties

InstanceGeneration InstanceGeneration [get, set]
 Defines/gets the approach to be taken to additional instance generation during the learning phase.
 
int SamplesPerImage [get, set]
 Defines how many samples should be used per sample inside the SampleImageList during classifier generation. Setting this property to a value > 1 will lead to additional temporary images being generated during the learning phase based on the settings of the properties InstanceGeneration, Symmetries, RotationRange and TranslationRange. More...
 
Symmetries Symmetries [get, set]
 Gets or sets whether the images from the SampleImageList property should be mirror on the X axis during learning. More...
 
int RotationRange [get, set]
 Gets/Sets the limit of the range of rotation to be used for automatic temporary instance generation during the learning phase. Rotations may range from -RotationRange to +RotationRange during the learning phase. Note that the actual number of rotations generated during the learning phase depends on the setting of the SamplesPerImage property. RotationRange is measured in degrees. If the rotation range set through this property is bigger than what the SIL provided for learning allows, the maximum allowable rotation will be used during learning. More...
 
Point2D TranslationRange [get, set]
 Gets/Sets the limit of the range of translation to be used for automatic temporary instance generation during the learning phase. Translations may range from -TranslationRange to +TranslationRange during the learning phase. Note that the actual number of translations generated during the learning phase depends on the setting of the SamplesPerImage property. TranslationRange is measured in pixels. If the translation range set through this property is bigger than what the SIL provided for learning allows, the maximum allowable translation will be used during learning. More...
 
string PreprocessingCode [get, set]
 Preprocessing code to be used for the learning phase; valid preprocessing codes consist of characters 'a' and 'p' (or an empty string); the length of the preprocessing code should be compatible with the image list's feature window geometry (this will be checked when the Learn method is invoked). More...
 
DecisionBoundary Boundary [get, set]
 Decision boundary setting to be used for learning the classifier.
 

Events

EventHandler< LearnProgressEventArgsLearnProgress
 Event that will inform about the progress of an ongoing learn operation.
 

Detailed Description

Learner object that creates a classifier from an image list.

Member Function Documentation

◆ Learn()

Classifier Learn ( SampleImageList  sampleImageList,
out double  learnResult 
)

Learn a new classifier from a SampleImageList using the currently set parameters.

Parameters
sampleImageListimage list from which to learn the classifier
learnResultthe learn result; if learning was completed successfully this parameter will contain the learn result which is a measure for the amount of decision boundary_ violation that occurred during the learn process. This value can be interpreted as a measure for the separability of the image list from which the classifier was learned under the parameter conditions with which is was learned; it will not necessarily be a measure for the actual quality of the resulting classifier.
Returns
A new Manto classifier generated based on the ClassifierFactory's settings and the training data provided in sampleImageList .
Exceptions
ObjectDisposedExceptionIf the SampleImageList or the learner has been disposed
ArgumentNullExceptionwhen the sampleImageList parameter is null
ArgumentExceptionIf the currently set PreprocessingCode is not suitable for the feature window size of the sampleImageList

Property Documentation

◆ PreprocessingCode

string PreprocessingCode
getset

Preprocessing code to be used for the learning phase; valid preprocessing codes consist of characters 'a' and 'p' (or an empty string); the length of the preprocessing code should be compatible with the image list's feature window geometry (this will be checked when the Learn method is invoked).

Exceptions
ArgumentExceptionwhen the preprocessing code contains invalid characters
ArgumentNullExceptionwhen trying to set a null value as the preprocessing code

◆ RotationRange

int RotationRange
getset

Gets/Sets the limit of the range of rotation to be used for automatic temporary instance generation during the learning phase. Rotations may range from -RotationRange to +RotationRange during the learning phase. Note that the actual number of rotations generated during the learning phase depends on the setting of the SamplesPerImage property. RotationRange is measured in degrees. If the rotation range set through this property is bigger than what the SIL provided for learning allows, the maximum allowable rotation will be used during learning.

Exceptions
ArgumentExceptionwhen trying to set a value less than 0 or bigger than 180. SampleImageList

◆ SamplesPerImage

int SamplesPerImage
getset

Defines how many samples should be used per sample inside the SampleImageList during classifier generation. Setting this property to a value > 1 will lead to additional temporary images being generated during the learning phase based on the settings of the properties InstanceGeneration, Symmetries, RotationRange and TranslationRange.

Note that for each additional image beyond 1 being used, the amount of memory required during the learning learnStage will effectively be incremented by the the size of one Image List. Or, to put it differently, if 5 samples per image are being used, Manto will need five times the amount of memory (and time) it would take to learn the classifier compared to the use of only 1 sample per image. This consumption multiplies with the requirement generated by the setting of the Symmetries property. SamplesPerImage and Symmetries should therefore be used with caution as you can easily generate a situation where the classifier can no longer be generated from the Image List because Manto runs out of memory during the learning phase.

Exceptions
ArgumentExceptionwhen trying to set a value less than 1

◆ Symmetries

Gets or sets whether the images from the SampleImageList property should be mirror on the X axis during learning.

Exceptions
ArgumentExceptionwhen trying to set the value Symmetries.None

Note that for each symmetry being used, the amount of memory required during the learning learnStage will effectively be incremented by the the size of one Image List. Or, to put it differently, if all symmetries are being used, Manto will need four times the amount of memory (and time) it would take to learn the classifier compared to the size of the image list. This consumption multiplies with the requirement generated by the setting of the SamplesPerImage property. SamplesPerImage and Symmetries should therefore be used with caution as you can easily generate a situation where the classifier can no longer be generated from the Image List because Manto runs out of memory during the learning phase.

◆ TranslationRange

Point2D TranslationRange
getset

Gets/Sets the limit of the range of translation to be used for automatic temporary instance generation during the learning phase. Translations may range from -TranslationRange to +TranslationRange during the learning phase. Note that the actual number of translations generated during the learning phase depends on the setting of the SamplesPerImage property. TranslationRange is measured in pixels. If the translation range set through this property is bigger than what the SIL provided for learning allows, the maximum allowable translation will be used during learning.

Exceptions
ArgumentExceptionwhen trying to set a value less than 0 SampleImageList