111 int fontsize = it->sample_set()->NumFonts();
112 ErrorCounter old_counter(old_classifier->GetUnicharset(), fontsize);
113 ErrorCounter new_counter(new_classifier->GetUnicharset(), fontsize);
116 int total_samples = 0;
117 int error_samples = 25;
118 int total_new_errors = 0;
120 for (it->Begin(); !it->AtEnd(); it->Next()) {
121 TrainingSample* mutable_sample = it->MutableSample();
122 int page_index = mutable_sample->page_num();
123 Pix* page_pix = 0 <= page_index && page_index < page_images.
size()
124 ? page_images[page_index] :
nullptr;
126 old_classifier->UnicharClassifySample(*mutable_sample, page_pix, 0,
127 INVALID_UNICHAR_ID, &results);
128 int correct_id = mutable_sample->class_id();
129 if (correct_id != 0 &&
130 !old_counter.AccumulateErrors(
true, boosting_mode, fontinfo_table,
131 results, mutable_sample)) {
133 new_classifier->UnicharClassifySample(*mutable_sample, page_pix, 0,
134 INVALID_UNICHAR_ID, &results);
135 if (correct_id != 0 &&
136 new_counter.AccumulateErrors(
true, boosting_mode, fontinfo_table,
137 results, mutable_sample)) {
138 tprintf(
"New Error on sample %d: Classifier debug output:\n",
139 it->GlobalSampleIndex());
141 new_classifier->UnicharClassifySample(*mutable_sample, page_pix, 1,
142 correct_id, &results);
143 if (results.size() > 0 && error_samples > 0) {
144 new_classifier->DebugDisplay(*mutable_sample, page_pix, correct_id);
151 tprintf(
"Total new errors = %d\n", total_new_errors);
DLLSYM void tprintf(const char *format,...)