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 bool DeSerialize(
bool swap, FILE* fp);
82 void LoadUnicharset(
const char*
filename);
87 feature_map_.
Init(fs);
99 void AddSample(
bool verification,
const char* unichar_str,
105 void LoadPageImages(
const char*
filename);
112 void PostLoadCleanup();
117 void PreTrainingSetup();
121 void SetupMasterShapes();
141 void ReplicateAndRandomizeSamplesIfRequired();
145 bool LoadFontInfo(
const char*
filename);
149 bool LoadXHeights(
const char*
filename);
153 bool AddSpacingInfo(
const char *
filename);
157 int GetFontInfoId(
const char* font_name);
161 int GetBestMatchingFontInfoId(
const char*
filename);
166 return tr_filenames_[index];
170 void SetupFlatShapeTable(
ShapeTable* shape_table);
176 int shape_id,
int* num_samples);
182 void WriteInttempAndPFFMTable(
const UNICHARSET& unicharset,
186 const char* inttemp_file,
187 const char* pffmtable_file);
190 return samples_.unicharset();
196 return master_shapes_;
201 void DebugCanonical(
const char* unichar_str1,
const char* unichar_str2);
202 #ifndef GRAPHICS_DISABLED 213 void DisplaySamples(
const char* unichar_str1,
int cloud_font,
214 const char* unichar_str2,
int canonical_font);
215 #endif // GRAPHICS_DISABLED 217 void TestClassifierVOld(
bool replicate_samples,
223 void TestClassifierOnSamples(
CountTypes error_mode,
225 bool replicate_samples,
243 bool replicate_samples,
251 float ShapeDistance(
const ShapeTable& shapes,
int s1,
int s2);
256 void ReplaceFragmentedSamples();
263 void ClusterShapes(
int min_shapes,
int max_shape_unichars,
290 bool enable_shape_anaylsis_;
292 bool enable_replication_;
296 int prev_unichar_id_;
FEATURE_DEFS_STRUCT feature_defs
ShapeDist(int s1, int s2, float dist)
TrainingSampleSet * GetSamples()
const STRING & GetTRFileName(int index) const
bool operator<(const ShapeDist &other) const
const ShapeTable & master_shapes() const
void Init(uinT8 xbuckets, uinT8 ybuckets, uinT8 thetabuckets)
void ReadTrainingSamples(const FEATURE_DEFS_STRUCT &feature_defs, const char *feature_name, int max_samples, UNICHARSET *unicharset, FILE *file, LIST *training_samples)
void SetFeatureSpace(const IntFeatureSpace &fs)
const UNICHARSET & unicharset() const