22 #ifndef TESSERACT_TRAINING_MASTERTRAINER_H_ 23 #define TESSERACT_TRAINING_MASTERTRAINER_H_ 47 class ShapeClassifier;
72 bool replicate_samples,
int debug_level);
76 bool Serialize(FILE* fp)
const;
79 void LoadUnicharset(
const char*
filename);
84 feature_map_.
Init(fs);
96 void AddSample(
bool verification,
const char* unichar_str,
102 void LoadPageImages(
const char* filename);
109 void PostLoadCleanup();
114 void PreTrainingSetup();
118 void SetupMasterShapes();
138 void ReplicateAndRandomizeSamplesIfRequired();
142 bool LoadFontInfo(
const char* filename);
146 bool LoadXHeights(
const char* filename);
150 bool AddSpacingInfo(
const char *filename);
154 int GetFontInfoId(
const char* font_name);
158 int GetBestMatchingFontInfoId(
const char* filename);
163 return tr_filenames_[index];
167 void SetupFlatShapeTable(
ShapeTable* shape_table);
173 int shape_id,
int* num_samples);
179 void WriteInttempAndPFFMTable(
const UNICHARSET& unicharset,
183 const char* inttemp_file,
184 const char* pffmtable_file);
187 return samples_.unicharset();
193 return master_shapes_;
198 void DebugCanonical(
const char* unichar_str1,
const char* unichar_str2);
199 #ifndef GRAPHICS_DISABLED 210 void DisplaySamples(
const char* unichar_str1,
int cloud_font,
211 const char* unichar_str2,
int canonical_font);
212 #endif // GRAPHICS_DISABLED 214 void TestClassifierVOld(
bool replicate_samples,
220 void TestClassifierOnSamples(
CountTypes error_mode,
222 bool replicate_samples,
240 bool replicate_samples,
248 float ShapeDistance(
const ShapeTable& shapes,
int s1,
int s2);
253 void ReplaceFragmentedSamples();
260 void ClusterShapes(
int min_shapes,
int max_shape_unichars,
287 bool enable_shape_anaylsis_;
289 bool enable_replication_;
293 int prev_unichar_id_;
309 #endif // TESSERACT_TRAINING_MASTERTRAINER_H_
void SetFeatureSpace(const IntFeatureSpace &fs)
const UNICHARSET & unicharset() const
const STRING & GetTRFileName(int index) const
void Init(uinT8 xbuckets, uinT8 ybuckets, uinT8 thetabuckets)
TrainingSampleSet * GetSamples()
ShapeDist(int s1, int s2, float dist)
void ReadTrainingSamples(const FEATURE_DEFS_STRUCT &feature_defs, const char *feature_name, int max_samples, UNICHARSET *unicharset, FILE *file, LIST *training_samples)
FEATURE_DEFS_STRUCT feature_defs
bool operator<(const ShapeDist &other) const
const ShapeTable & master_shapes() const