21 #ifdef DISABLED_LEGACY_ENGINE 29 INT_MEMBER(classify_debug_level, 0,
"Classify debug level",
33 "Assume the input is numbers [0-9].", this->params()),
36 "Veto ratio between classifier ratings", this->params()),
39 "Veto difference between classifier certainties",
44 Classify::~Classify() {}
48 #else // DISABLED_LEGACY_ENGINE not defined 61 :
BOOL_MEMBER(allow_blob_division, true,
"Use divisible blobs chopping",
64 "Prioritize blob division over chopping", this->params()),
67 BOOL_MEMBER(classify_enable_learning, true,
"Enable adaptive classifier",
69 INT_MEMBER(classify_debug_level, 0,
"Classify debug level",
74 "Character Normalization Range ...", this->params()),
75 double_MEMBER(classify_min_norm_scale_x, 0.0,
"Min char x-norm scale ...",
78 "Max char x-norm scale ...",
80 double_MEMBER(classify_min_norm_scale_y, 0.0,
"Min char y-norm scale ...",
83 "Max char y-norm scale ...",
86 "Veto ratio between classifier ratings", this->params()),
88 "Veto difference between classifier certainties",
90 BOOL_MEMBER(tess_cn_matching, 0,
"Character Normalized Matching",
92 BOOL_MEMBER(tess_bn_matching, 0,
"Baseline Normalized Matching",
95 "Enable adaptive classifier", this->params()),
97 "Use pre-adapted classifier templates", this->params()),
99 "Save adapted templates to a file", this->params()),
100 BOOL_MEMBER(classify_enable_adaptive_debugger, 0,
"Enable match debugger",
103 "Non-linear stroke-density normalization", this->params()),
104 INT_MEMBER(matcher_debug_level, 0,
"Matcher Debug Level", this->params()),
105 INT_MEMBER(matcher_debug_flags, 0,
"Matcher Debug Flags", this->params()),
106 INT_MEMBER(classify_learning_debug_level, 0,
"Learning Debug Level: ",
108 double_MEMBER(matcher_good_threshold, 0.125,
"Good Match (0-1)",
110 double_MEMBER(matcher_reliable_adaptive_result, 0.0,
"Great Match (0-1)",
112 double_MEMBER(matcher_perfect_threshold, 0.02,
"Perfect Match (0-1)",
114 double_MEMBER(matcher_bad_match_pad, 0.15,
"Bad Match Pad (0-1)",
116 double_MEMBER(matcher_rating_margin, 0.1,
"New template margin (0-1)",
118 double_MEMBER(matcher_avg_noise_size, 12.0,
"Avg. noise blob length",
120 INT_MEMBER(matcher_permanent_classes_min, 1,
"Min # of permanent classes",
122 INT_MEMBER(matcher_min_examples_for_prototyping, 3,
123 "Reliable Config Threshold", this->params()),
124 INT_MEMBER(matcher_sufficient_examples_for_prototyping, 5,
125 "Enable adaption even if the ambiguities have not been seen",
128 "Maximum angle delta for prototype clustering",
131 "Penalty to apply when a non-alnum is vertically out of " 132 "its expected textline position",
134 double_MEMBER(rating_scale, 1.5,
"Rating scaling factor", this->params()),
135 double_MEMBER(certainty_scale, 20.0,
"Certainty scaling factor",
138 "Scale factor for features not used", this->params()),
140 classify_adapted_pruning_factor, 2.5,
141 "Prune poor adapted results this much worse than best result",
144 "Threshold at which classify_adapted_pruning_factor starts",
146 INT_MEMBER(classify_adapt_proto_threshold, 230,
147 "Threshold for good protos during adaptive 0-255",
149 INT_MEMBER(classify_adapt_feature_threshold, 230,
150 "Threshold for good features during adaptive 0-255",
153 "Do not include character fragments in the" 154 " results of the classifier",
156 double_MEMBER(classify_character_fragments_garbage_certainty_threshold,
158 "Exclude fragments that do not look like whole" 159 " characters from training and adaption",
162 "Bring up graphical debugging windows for fragments training",
165 "Use two different windows for debugging the matching: " 166 "One for the protos and one for the features.",
168 STRING_MEMBER(classify_learn_debug_str,
"",
"Class str to debug learning",
170 INT_MEMBER(classify_class_pruner_threshold, 229,
171 "Class Pruner Threshold 0-255", this->params()),
172 INT_MEMBER(classify_class_pruner_multiplier, 15,
173 "Class Pruner Multiplier 0-255: ", this->params()),
175 "Class Pruner CutoffStrength: ", this->params()),
177 "Integer Matcher Multiplier 0-255: ", this->params()),
178 EnableLearning(true),
180 "Don't adapt to i/I at beginning of word", this->params()),
182 "Assume the input is numbers [0-9].", this->params()),
183 double_MEMBER(speckle_large_max_size, 0.30,
"Max large speckle size",
186 "Penalty to add to worst rating for noise", this->params()),
187 im_(&classify_debug_level),
188 shape_table_(nullptr),
190 static_classifier_(nullptr) {
208 NumAdaptationsFailed = 0;
210 learn_debug_win_ =
nullptr;
211 learn_fragmented_word_debug_win_ =
nullptr;
212 learn_fragments_debug_win_ =
nullptr;
217 delete learn_debug_win_;
218 delete learn_fragmented_word_debug_win_;
219 delete learn_fragments_debug_win_;
226 delete static_classifier_;
227 static_classifier_ = static_classifier;
234 BLOB_CHOICE_IT bc_it(choices);
239 if (!choices->empty() && blob_length > 0) {
240 bc_it.move_to_last();
250 -1, 0.0f, FLT_MAX, 0,
252 bc_it.add_to_end(blob_choice);
259 return bbox.
width() < speckle_size && bbox.
height() < speckle_size;
264 #endif // def DISABLED_LEGACY_ENGINE
bool LargeSpeckle(const TBLOB &blob)
void SetStaticClassifier(ShapeClassifier *static_classifier)
#define STRING_MEMBER(name, val, comment, vec)
#define INT_MEMBER(name, val, comment, vec)
_ConstTessMemberResultCallback_0_0< false, R, T1 >::base * NewPermanentTessCallback(const T1 *obj, R(T2::*member)() const)
bool CompareFontSet(const FontSet &fs1, const FontSet &fs2)
#define BOOL_MEMBER(name, val, comment, vec)
void AddLargeSpeckleTo(int blob_length, BLOB_CHOICE_LIST *choices)
#define double_MEMBER(name, val, comment, vec)
bool CompareFontInfo(const FontInfo &fi1, const FontInfo &fi2)
INT_TEMPLATES PreTrainedTemplates
double speckle_large_max_size
void FontSetDeleteCallback(FontSet fs)
ADAPT_TEMPLATES BackupAdaptedTemplates
ADAPT_TEMPLATES AdaptedTemplates
TBOX bounding_box() const
void EndAdaptiveClassifier()
void FontInfoDeleteCallback(FontInfo f)
UnicityTable< FontInfo > fontinfo_table_
double speckle_rating_penalty
bool disable_character_fragments
int classify_integer_matcher_multiplier
UnicityTable< FontSet > fontset_table_