MCPcopy Create free account
hub / github.com/creatale/node-dv / TestClassifier

Method TestClassifier

deps/tesseract/classify/mastertrainer.cpp:798–821  ·  view source on GitHub ↗

Tests the given test_classifier on the given samples. error_mode indicates what counts as an error. report_levels: 0 = no output. 1 = bottom-line error rate. 2 = bottom-line error rate + time. 3 = font-level error rate + time. 4 = list of all errors + short classifier debug output on 16 errors. 5 = list of all errors + short classifier debug output on 25 errors. If replicate_samples is true, then

Source from the content-addressed store, hash-verified

796// If report_string is non-NULL, a summary of the results for each font
797// is appended to the report_string.
798double MasterTrainer::TestClassifier(CountTypes error_mode,
799 int report_level,
800 bool replicate_samples,
801 TrainingSampleSet* samples,
802 ShapeClassifier* test_classifier,
803 STRING* report_string) {
804 SampleIterator sample_it;
805 sample_it.Init(NULL, NULL, replicate_samples, samples);
806 if (report_level > 0) {
807 int num_samples = 0;
808 for (sample_it.Begin(); !sample_it.AtEnd(); sample_it.Next())
809 ++num_samples;
810 tprintf("Iterator has charset size of %d/%d, %d shapes, %d samples\n",
811 sample_it.SparseCharsetSize(), sample_it.CompactCharsetSize(),
812 test_classifier->GetShapeTable()->NumShapes(), num_samples);
813 tprintf("Testing %sREPLICATED:\n", replicate_samples ? "" : "NON-");
814 }
815 double unichar_error = 0.0;
816 ErrorCounter::ComputeErrorRate(test_classifier, report_level,
817 error_mode, fontinfo_table_,
818 page_images_, &sample_it, &unichar_error,
819 NULL, report_string);
820 return unichar_error;
821}
822
823// Returns the average (in some sense) distance between the two given
824// shapes, which may contain multiple fonts and/or unichars.

Callers

nothing calls this directly

Calls 7

AtEndMethod · 0.80
SparseCharsetSizeMethod · 0.80
CompactCharsetSizeMethod · 0.80
InitMethod · 0.45
BeginMethod · 0.45
NextMethod · 0.45
GetShapeTableMethod · 0.45

Tested by

no test coverage detected