21#ifdef DISABLED_LEGACY_ENGINE
28 :
INT_MEMBER(classify_debug_level, 0,
"Classify debug level", this->params())
31 BOOL_MEMBER(classify_bln_numeric_mode, 0,
"Assume the input is numbers [0-9].", this->params())
34 double_MEMBER(classify_max_rating_ratio, 1.5,
"Veto ratio between classifier ratings",
39 "Veto difference between classifier certainties", this->params())
44Classify::~Classify() {}
61 :
BOOL_MEMBER(allow_blob_division, true,
"Use divisible blobs chopping", this->params())
62 ,
BOOL_MEMBER(prioritize_division, false,
"Prioritize blob division over chopping",
64 ,
BOOL_MEMBER(classify_enable_learning, true,
"Enable adaptive classifier", this->params())
65 ,
INT_MEMBER(classify_debug_level, 0,
"Classify debug level", this->params())
67 ,
double_MEMBER(classify_char_norm_range, 0.2,
"Character Normalization Range ...",
69 ,
double_MEMBER(classify_max_rating_ratio, 1.5,
"Veto ratio between classifier ratings",
72 "Veto difference between classifier certainties", this->params())
73 ,
BOOL_MEMBER(tess_cn_matching, 0,
"Character Normalized Matching", this->params())
74 ,
BOOL_MEMBER(tess_bn_matching, 0,
"Baseline Normalized Matching", this->params())
76 ,
BOOL_MEMBER(classify_use_pre_adapted_templates, 0,
"Use pre-adapted classifier templates",
78 ,
BOOL_MEMBER(classify_save_adapted_templates, 0,
"Save adapted templates to a file",
80 ,
BOOL_MEMBER(classify_enable_adaptive_debugger, 0,
"Enable match debugger", this->params())
81 ,
BOOL_MEMBER(classify_nonlinear_norm, 0,
"Non-linear stroke-density normalization",
83 ,
INT_MEMBER(matcher_debug_level, 0,
"Matcher Debug Level", this->params())
84 ,
INT_MEMBER(matcher_debug_flags, 0,
"Matcher Debug Flags", this->params())
85 ,
INT_MEMBER(classify_learning_debug_level, 0,
"Learning Debug Level: ", this->params())
86 ,
double_MEMBER(matcher_good_threshold, 0.125,
"Good Match (0-1)", this->params())
87 ,
double_MEMBER(matcher_reliable_adaptive_result, 0.0,
"Great Match (0-1)", this->params())
88 ,
double_MEMBER(matcher_perfect_threshold, 0.02,
"Perfect Match (0-1)", this->params())
89 ,
double_MEMBER(matcher_bad_match_pad, 0.15,
"Bad Match Pad (0-1)", this->params())
90 ,
double_MEMBER(matcher_rating_margin, 0.1,
"New template margin (0-1)", this->params())
91 ,
double_MEMBER(matcher_avg_noise_size, 12.0,
"Avg. noise blob length", this->params())
92 ,
INT_MEMBER(matcher_permanent_classes_min, 1,
"Min # of permanent classes", this->params())
93 ,
INT_MEMBER(matcher_min_examples_for_prototyping, 3,
"Reliable Config Threshold",
95 ,
INT_MEMBER(matcher_sufficient_examples_for_prototyping, 5,
96 "Enable adaption even if the ambiguities have not been seen", this->params())
98 "Maximum angle delta for prototype clustering", this->params())
100 "Penalty to apply when a non-alnum is vertically out of "
101 "its expected textline position",
103 ,
double_MEMBER(rating_scale, 1.5,
"Rating scaling factor", this->params())
104 ,
double_MEMBER(tessedit_class_miss_scale, 0.00390625,
"Scale factor for features not used",
107 "Prune poor adapted results this much worse than best result", this->params())
109 "Threshold at which classify_adapted_pruning_factor starts", this->params())
110 ,
INT_MEMBER(classify_adapt_proto_threshold, 230,
111 "Threshold for good protos during adaptive 0-255", this->params())
112 ,
INT_MEMBER(classify_adapt_feature_threshold, 230,
113 "Threshold for good features during adaptive 0-255", this->params())
115 "Do not include character fragments in the"
116 " results of the classifier",
118 ,
double_MEMBER(classify_character_fragments_garbage_certainty_threshold, -3.0,
119 "Exclude fragments that do not look like whole"
120 " characters from training and adaption",
122 ,
BOOL_MEMBER(classify_debug_character_fragments, false,
123 "Bring up graphical debugging windows for fragments training", this->params())
124 ,
BOOL_MEMBER(matcher_debug_separate_windows, false,
125 "Use two different windows for debugging the matching: "
126 "One for the protos and one for the features.",
128 ,
STRING_MEMBER(classify_learn_debug_str,
"",
"Class str to debug learning", this->params())
129 ,
INT_MEMBER(classify_class_pruner_threshold, 229,
"Class Pruner Threshold 0-255",
131 ,
INT_MEMBER(classify_class_pruner_multiplier, 15,
132 "Class Pruner Multiplier 0-255: ", this->params())
134 "Class Pruner CutoffStrength: ", this->params())
135 ,
INT_MEMBER(classify_integer_matcher_multiplier, 10,
136 "Integer Matcher Multiplier 0-255: ", this->params())
137 ,
BOOL_MEMBER(classify_bln_numeric_mode, 0,
"Assume the input is numbers [0-9].",
139 ,
double_MEMBER(speckle_large_max_size, 0.30,
"Max large speckle size", this->params())
140 ,
double_MEMBER(speckle_rating_penalty, 10.0,
"Penalty to add to worst rating for noise",
142 , im_(&classify_debug_level)
144 using namespace std::placeholders;
152#ifndef GRAPHICS_DISABLED
153 delete learn_debug_win_;
154 delete learn_fragmented_word_debug_win_;
155 delete learn_fragments_debug_win_;
162 delete static_classifier_;
163 static_classifier_ = static_classifier;
170 BLOB_CHOICE_IT bc_it(choices);
173 float certainty = -
getDict().certainty_scale;
174 float rating = rating_scale * blob_length;
175 if (!choices->empty() && blob_length > 0) {
176 bc_it.move_to_last();
179 rating = worst_choice->
rating() + speckle_rating_penalty;
182 certainty = -rating *
getDict().certainty_scale / (rating_scale * blob_length);
186 bc_it.add_to_end(blob_choice);
191 double speckle_size =
kBlnXHeight * speckle_large_max_size;
193 return bbox.
width() < speckle_size && bbox.
height() < speckle_size;
#define INT_MEMBER(name, val, comment, vec)
#define double_MEMBER(name, val, comment, vec)
#define STRING_MEMBER(name, val, comment, vec)
#define BOOL_MEMBER(name, val, comment, vec)
#define classify_enable_adaptive_matcher
void FontInfoDeleteCallback(FontInfo f)
void InitFeatureDefs(FEATURE_DEFS_STRUCT *featuredefs)
TBOX bounding_box() const
TDimension height() const
bool LargeSpeckle(const TBLOB &blob)
FEATURE_DEFS_STRUCT feature_defs_
void SetStaticClassifier(ShapeClassifier *static_classifier)
void EndAdaptiveClassifier()
UnicityTable< FontInfo > fontinfo_table_
void AddLargeSpeckleTo(int blob_length, BLOB_CHOICE_LIST *choices)