21#ifndef TESSERACT_TRAINING_MASTERTRAINER_H_
22#define TESSERACT_TRAINING_MASTERTRAINER_H_
76 void LoadUnicharset(
const char *filename);
81 feature_map_.
Init(fs);
92 void AddSample(
bool verification,
const char *unichar_str,
TrainingSample *sample);
97 void LoadPageImages(
const char *filename);
104 void PostLoadCleanup();
109 void PreTrainingSetup();
113 void SetupMasterShapes();
133 void ReplicateAndRandomizeSamplesIfRequired();
137 bool LoadFontInfo(
const char *filename);
141 bool LoadXHeights(
const char *filename);
145 bool AddSpacingInfo(
const char *filename);
149 int GetFontInfoId(
const char *font_name);
153 int GetBestMatchingFontInfoId(
const char *filename);
158 return tr_filenames_[index];
162 void SetupFlatShapeTable(
ShapeTable *shape_table);
176 const char *inttemp_file,
const char *pffmtable_file);
179 return samples_.unicharset();
185 return master_shapes_;
190 void DebugCanonical(
const char *unichar_str1,
const char *unichar_str2);
191#ifndef GRAPHICS_DISABLED
202 void DisplaySamples(
const char *unichar_str1,
int cloud_font,
const char *unichar_str2,
206 void TestClassifierVOld(
bool replicate_samples,
ShapeClassifier *test_classifier,
211 void TestClassifierOnSamples(
CountTypes error_mode,
int report_level,
bool replicate_samples,
226 double TestClassifier(
CountTypes error_mode,
int report_level,
bool replicate_samples,
228 std::string *report_string);
233 float ShapeDistance(
const ShapeTable &shapes,
int s1,
int s2);
238 void ReplaceFragmentedSamples();
245 void ClusterShapes(
int min_shapes,
int max_shape_unichars,
float max_dist,
264 std::vector<int32_t> xheights_;
272 bool enable_shape_analysis_;
274 bool enable_replication_;
278 int prev_unichar_id_;
287 std::vector<Image > page_images_;
289 std::vector<std::string> tr_filenames_;
void ReadTrainingSamples(const FEATURE_DEFS_STRUCT &feature_definitions, const char *feature_name, int max_samples, UNICHARSET *unicharset, FILE *file, LIST *training_samples)
bool Serialize(FILE *fp, const std::vector< T > &data)
FEATURE_DEFS_STRUCT feature_defs
void Init(uint8_t xbuckets, uint8_t ybuckets, uint8_t thetabuckets)
bool operator<(const ShapeDist &other) const
ShapeDist(int s1, int s2, float dist)
const std::string & GetTRFileName(int index) const
TrainingSampleSet * GetSamples()
void SetFeatureSpace(const IntFeatureSpace &fs)
const UNICHARSET & unicharset() const
const ShapeTable & master_shapes() const