~ubuntu-branches/ubuntu/vivid/tesseract/vivid

« back to all changes in this revision

Viewing changes to classify/mastertrainer.h

  • Committer: Package Import Robot
  • Author(s): Jeff Breidenbach
  • Date: 2014-02-03 11:10:20 UTC
  • mfrom: (1.3.1) (19.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20140203111020-igquodd7pjlp3uri
Tags: 3.03.01-1
* New upstream release, includes critical fix to PDF rendering
* Complete leptonlib transition (see bug #735509)
* Promote from experimental to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include "cluster.h"
30
30
#include "intfx.h"
31
31
#include "elst.h"
 
32
#include "errorcounter.h"
32
33
#include "featdefs.h"
33
34
#include "fontinfo.h"
34
35
#include "indexmapbidi.h"
89
90
  // Reads the samples and their features from the given file,
90
91
  // adding them to the trainer with the font_id from the content of the file.
91
92
  // If verification, then these are verification samples, not training.
92
 
  void ReadTrainingSamples(FILE  *fp,
 
93
  void ReadTrainingSamples(const char* page_name,
93
94
                           const FEATURE_DEFS_STRUCT& feature_defs,
94
95
                           bool verification);
95
96
 
159
160
  // one of the fonts. If more than one is matched, the longest is returned.
160
161
  int GetBestMatchingFontInfoId(const char* filename);
161
162
 
 
163
  // Returns the filename of the tr file corresponding to the command-line
 
164
  // argument with the given index.
 
165
  const STRING& GetTRFileName(int index) const {
 
166
    return tr_filenames_[index];
 
167
  }
 
168
 
162
169
  // Sets up a flat shapetable with one shape per class/font combination.
163
170
  void SetupFlatShapeTable(ShapeTable* shape_table);
164
171
 
207
214
                      const char* unichar_str2, int canonical_font);
208
215
  #endif  // GRAPHICS_DISABLED
209
216
 
 
217
  void TestClassifierVOld(bool replicate_samples,
 
218
                          ShapeClassifier* test_classifier,
 
219
                          ShapeClassifier* old_classifier);
 
220
 
210
221
  // Tests the given test_classifier on the internal samples.
211
222
  // See TestClassifier for details.
212
 
  void TestClassifierOnSamples(int report_level,
 
223
  void TestClassifierOnSamples(CountTypes error_mode,
 
224
                               int report_level,
213
225
                               bool replicate_samples,
214
226
                               ShapeClassifier* test_classifier,
215
227
                               STRING* report_string);
216
228
  // Tests the given test_classifier on the given samples
 
229
  // error_mode indicates what counts as an error.
217
230
  // report_levels:
218
231
  // 0 = no output.
219
232
  // 1 = bottom-line error rate.
225
238
  // sample including replicated and systematically perturbed samples.
226
239
  // If report_string is non-NULL, a summary of the results for each font
227
240
  // is appended to the report_string.
228
 
  double TestClassifier(int report_level,
 
241
  double TestClassifier(CountTypes error_mode,
 
242
                        int report_level,
229
243
                        bool replicate_samples,
230
244
                        TrainingSampleSet* samples,
231
245
                        ShapeClassifier* test_classifier,
263
277
  // Flat shape table has each unichar/font id pair in a separate shape.
264
278
  ShapeTable flat_shapes_;
265
279
  // Font metrics gathered from multiple files.
266
 
  UnicityTable<FontInfo> fontinfo_table_;
 
280
  FontInfoTable fontinfo_table_;
267
281
  // Array of xheights indexed by font ids in fontinfo_table_;
268
 
  GenericVector<int> xheights_;
 
282
  GenericVector<inT32> xheights_;
269
283
 
270
284
  // Non-serialized data initialized by other means or used temporarily
271
285
  // during loading of training samples.
276
290
  bool enable_shape_anaylsis_;
277
291
  // Flag to indicate that sample replication is required.
278
292
  bool enable_replication_;
279
 
  // Flag to indicate that junk should be included in samples_.
280
 
  bool include_junk_;
281
293
  // Array of classids of fragments that replace the correctly segmented chars.
282
294
  int* fragments_;
283
295
  // Classid of previous correctly segmented sample that was added.
291
303
  // Indexed by page_num_ in the samples.
292
304
  // These images are owned by the trainer and need to be pixDestroyed.
293
305
  GenericVector<Pix*> page_images_;
 
306
  // Vector of filenames of loaded tr files.
 
307
  GenericVector<STRING> tr_filenames_;
294
308
};
295
309
 
296
310
}  // namespace tesseract.