Last modified: January 04, 2015
Contents
In module gamera.toolkits.ocr.classes
This is a callable class that can optionally be passed to the constructor of Page, so that it will be called during the segmentation process.
Its standard definition should generally be sufficient for using a kNN classifier. Should you need to write your own classification function (e.g. one that additionally uses heuristic rules for classification), make sure that you overwrite the __call__ method with the same signature.
For fine tuning the classification, the follwoing attributes can be used:
- knn
- The knn classifier; this is passed in the constructor
- parts_to_group
- Corresponds to max_parts_per_group in kNNInteractive.group_list_automatic. Default value is 3.
- grouping_distance
- Corresponds to the distance argument of the grouping_function in kNNInteractive.group_list_automatic. Only CCs closer than this distance are considered for grouping. Default value is -1, which means that it will be calculated automatically as in __call__.
Signature:
__init__ (knn)
where knn is a kNN classifier which has already loaded training data.
This method will be called in Page.segment. Signature:
__call__ (ccs)
where ccs is the list of glyphs that is to be classified. See the documentation of Gamera's classifier API how the classification result is stored in the glpyhs.
How the classification is done is controled by the following attributes of ClassifyCCs: