Optimization for CNN-based classification for OCR🔗
Since training for CNN-based OCR classification is not available in HALCON, we only take a look at the operators that are used to classify text using the pretrained font Universal.
Adjusting multi-class classification with CNN-based OCR classifiers🔗
With do_ocr_multi_class_cnn multiple characters can be classified in a single call.
Typically, this is faster than successively applying do_ocr_single_class_cnn, which classifies single characters, in a loop.
However, do_ocr_multi_class_cnn can only return the best class of each character.
If the second best class is of interest, do_ocr_single_class_mlp should be used instead.
The following parameters have to be set for do_ocr_multi_class_cnn:
The input parameter Character contains a tuple of regions that have to be classified.
The input parameter Image contains the image that provides the gray value information for the regions that have to be classified.
The input parameter OCRHandle is the handle of the classifier that was read with read_ocr_class_cnn.
The output parameter Class returns the result of the classification, i.e., a tuple of character names that correspond to the input regions that were given in the tuple Character.
Adjusting single-class classification with CNN-based OCR classifiers🔗
Instead of using do_ocr_multi_class_cnn to add all samples in a single call, do_ocr_single_class_cnn can be used to successively add samples.
Then, besides the best class for a region, also the second best (and third best etc.) class can be obtained.
If only the best class for each region is searched for, do_ocr_multi_class_cnn is faster and therefore recommended.
The input parameter Character contains a single region that has to be classified.
The input parameter Image contains the image that provides the gray value information for the region that has to be classified.
The input parameter OCRHandle is the handle of the classifier that was read with read_ocr_class_cnn.
The output parameter Class returns the result of the classification, i.e., the Num best character names that correspond to the input region that was specified in Character.