Back to Adaptive Vision Library website

You are here: Start » Function Reference » Optical Character Recognition Deprecated » InitOcr_MLP_Deprecated

InitOcr_MLP_Deprecated


Creates an OCR multilayer perceptron model.

Syntax

C++
C#
 
void avl::InitOcr_MLP_Deprecated
(
	const avl::Size& inNormalizationSize,
	atl::Optional<const atl::Array<int>& > inHiddenLayerSizes,
	atl::Optional<int> inRandomSeed,
	avl::MlpPreprocessing::Type inPreprocessing,
	const avl::CharacterFeatures& inCharacterFeatures,
	avl::OcrMlpModel& outOcrModel
)

Parameters

Name Type Range Default Description
inNormalizationSize const Size& (Width: 16, Height: 16) The character size after normalization
inHiddenLayerSizes Optional<const Array<int>& > NIL Internal structure of neuron layers used in classifier
inRandomSeed Optional<int> 0 - + NIL Random seed used by MLP classifier
inPreprocessing MlpPreprocessing::Type Input preprocessing method performed before calculations
inCharacterFeatures const CharacterFeatures& (Pixels: True) Character features used to distinguish characters from each other
outOcrModel OcrMlpModel& Result OcrMlpModel used to recognize characters

Description

The filter initializes the MLP classifier and configures its internal structure. As a result, it creates a new OcrMlpModel which must be trained using the TrainOcr_MLP_Deprecated filter.

Parameters inHiddenLayerSizes, inRandomSeed are used in the process of learning of a newly created MLP classifier. For further parameter description please refer to the documentation of the MLP_Init filter.

All the input regions in filters RecognizeCharacters_MLP_Deprecated and TrainOcr_MLP_Deprecated will be resized to the size specified in the inNormalizationSize input parameter. The further character classification will be performed on the normalized images. Therefore, it is important to select the appropriate normalization size. The selection of too small normalization size may result in loss of character details. However, too large value of normalization size increases the classifier learning time. The best character recognition accuracy is obtained when the size of character is nearly the same as the classifier normalization size.

The character classification depends on character features that are selected in the inCharacterFeatures parameter. At least one feature must be selected. By default the feature "Pixels" is selected.

The table below contains the description of each available character feature:

Feature name Description Filter origin Normalized
Pixels Values of the image pixels after normalization. False
NormalizedPixels Values of the image pixels after normalization normalized to range <0, 1.0>. True
Convexity Ratio of the input region area to area of its convex hull. RegionConvexity True
Circularity Ratio of the region area to area of its bounding circle. RegionCircularity True
NumberOfHoles Number of holes found in the input region. RegionHoles True
AspectRatio Ratio of input region width to its height. RegionBoundingBox False
Width Region bounding box width. RegionBoundingBox False
Height Region bounding box height. RegionBoundingBox False
AreaRatio Ratio of the input region area to area of its bounding box. True
DiameterRatio Ratio of the input region diameter to diameter of its bounding box. RegionDiameter True
Elongation Ratio of longer axis of the approximating ellipse to the shorter one. RegionElongation False
Orientation Further details in the filter RegionOrientation documentation. RegionOrientation True
Zoning4x4 Normalized pixel values of region reduced to size 4x4 pixel. True
HorizontalProjection Values of normalized image projection normalized by region height. ImageProjection True
VerticalProjection Values of normalized image projection normalized by region height. ImageProjection True
HoughCircles Count of circles found in the normalized image. True
Moment_11 Character geometric moment type M11. RegionMoment False
Moment_20 Character geometric moment type M20. RegionMoment False
Moment_02 Character geometric moment type M02. RegionMoment False

The table above shows which of the presented character features give normalized results. Learning process of not-normalized data can be a bit slower than learning of normalized data. To reduce this effect the option Normalization should be selected for the input inPreprocessing.

Remarks

It is recommended not to set normalization size greater than 50 pixels in each dimension. That could make learning time too long.

For more remarks about using MLP classifier please refer to the documentation of the MLP_Init filter.

To read more about how to use OCR technique, refer to Machine Vision Guide: Optical Character Recognition

Errors

Error type Description
DomainError Invalid normalization size in InitOcr_MLP_Deprecated.
DomainError Hidden layer should have at least a single hidden layer in InitOcr_MLP_Deprecated.

See Also