16 #ifndef TESSERACT_TRAINING_TRAININGSAMPLESET_H__ 17 #define TESSERACT_TRAINING_TRAININGSAMPLESET_H__ 33 class IntFeatureSpace;
35 struct UnicharAndFonts;
56 return samples_.size();
59 return num_raw_samples_;
68 return unicharset_size_;
71 return fontinfo_table_;
125 int font_id2,
int class_id2,
130 int font_id2,
int class_id2,
144 int font_id2,
int class_id2,
146 bool thorough)
const;
162 return samples_[index];
167 samples_[index] = NULL;
229 struct FontClassDistance {
235 struct FontClassInfo {
247 inT32 canonical_sample;
249 float canonical_dist;
257 BitVector cloud_features;
270 PointerVector<TrainingSample> samples_;
272 int num_raw_samples_;
276 int unicharset_size_;
280 IndexMapBiDi font_id_map_;
287 const FontInfoTable& fontinfo_table_;
293 #endif // TRAININGSAMPLESETSET_H_
int NumClassSamples(int font_id, int class_id, bool randomize) const
void AddAllFontsForClass(int class_id, Shape *shape) const
void LoadUnicharset(const char *filename)
const TrainingSample * GetSample(int index) const
const FontInfoTable & fontinfo_table() const
bool DeSerialize(bool swap, FILE *fp)
void DisplaySamplesWithFeature(int f_index, const Shape &shape, const IntFeatureSpace &feature_space, ScrollView::Color color, ScrollView *window) const
int GlobalSampleIndex(int font_id, int class_id, int index) const
float ComputeClusterDistance(int font_id1, int class_id1, int font_id2, int class_id2, const IntFeatureMap &feature_map) const
void OrganizeByFontAndClass()
TrainingSample * MutableSample(int font_id, int class_id, int index)
const UNICHARSET & unicharset() const
const GenericVector< int > & GetCanonicalFeatures(int font_id, int class_id) const
const TrainingSample * GetCanonicalSample(int font_id, int class_id) const
STRING SampleToString(const TrainingSample &sample) const
void IndexFeatures(const IntFeatureSpace &feature_space)
virtual int SparseSize() const
float UnicharDistance(const UnicharAndFonts &uf1, const UnicharAndFonts &uf2, bool matched_fonts, const IntFeatureMap &feature_map)
void ComputeCanonicalSamples(const IntFeatureMap &map, bool debug)
const BitVector & GetCloudFeatures(int font_id, int class_id) const
int AddSample(const char *unichar, TrainingSample *sample)
TrainingSample * mutable_sample(int index)
bool DeleteableSample(const TrainingSample *sample)
int ReliablySeparable(int font_id1, int class_id1, int font_id2, int class_id2, const IntFeatureMap &feature_map, bool thorough) const
TrainingSampleSet(const FontInfoTable &fontinfo_table)
float GetCanonicalDist(int font_id, int class_id) const
void KillSample(TrainingSample *sample)
TrainingSample * extract_sample(int index)
bool Serialize(FILE *fp) const
void ReplicateAndRandomizeSamples()
float ClusterDistance(int font_id1, int class_id1, int font_id2, int class_id2, const IntFeatureMap &feature_map)
void DeleteOutliers(const IntFeatureSpace &feature_space, bool debug)
void ComputeCloudFeatures(int feature_space_size)
void ComputeCanonicalFeatures()
int num_raw_samples() const