"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/training/unicharset/lstmtester.cpp" between
tesseract-5.0.0-rc2.tar.gz and tesseract-5.0.0-rc3.tar.gz

About: Tesseract is an Optical Character Recognition (OCR) engine. Release candidate.

lstmtester.cpp  (tesseract-5.0.0-rc2):lstmtester.cpp  (tesseract-5.0.0-rc3)
skipping to change at line 109 skipping to change at line 109
word_error += trainer.NewSingleError(tesseract::ET_WORD_RECERR); word_error += trainer.NewSingleError(tesseract::ET_WORD_RECERR);
++error_count; ++error_count;
if (verbosity > 1 || (verbosity > 0 && result != PERFECT)) { if (verbosity > 1 || (verbosity > 0 && result != PERFECT)) {
tprintf("Truth:%s\n", trainingdata->transcription().c_str()); tprintf("Truth:%s\n", trainingdata->transcription().c_str());
std::vector<int> ocr_labels; std::vector<int> ocr_labels;
std::vector<int> xcoords; std::vector<int> xcoords;
trainer.LabelsFromOutputs(fwd_outputs, &ocr_labels, &xcoords); trainer.LabelsFromOutputs(fwd_outputs, &ocr_labels, &xcoords);
std::string ocr_text = trainer.DecodeLabels(ocr_labels); std::string ocr_text = trainer.DecodeLabels(ocr_labels);
tprintf("OCR :%s\n", ocr_text.c_str()); tprintf("OCR :%s\n", ocr_text.c_str());
if (verbosity > 2 || (verbosity > 1 && result != PERFECT)) { if (verbosity > 2 || (verbosity > 1 && result != PERFECT)) {
tprintf("Line Char error rate=%f, Word error rate=%f\n\n", tprintf("Line BCER=%f, BWER=%f\n\n",
trainer.NewSingleError(tesseract::ET_CHAR_ERROR), trainer.NewSingleError(tesseract::ET_CHAR_ERROR),
trainer.NewSingleError(tesseract::ET_WORD_RECERR)); trainer.NewSingleError(tesseract::ET_WORD_RECERR));
} }
} }
} }
} }
char_error *= 100.0 / total_pages_; char_error *= 100.0 / total_pages_;
word_error *= 100.0 / total_pages_; word_error *= 100.0 / total_pages_;
std::string result; std::string result;
result += "At iteration " + std::to_string(iteration); if (iteration != 0 || training_stage != 0) {
result += ", stage " + std::to_string(training_stage); result += "At iteration " + std::to_string(iteration);
result += ", Eval Char error rate=" + std::to_string(char_error); result += ", stage " + std::to_string(training_stage) + ", ";
result += ", Word error rate=" + std::to_string(word_error); }
result += "BCER eval=" + std::to_string(char_error);
result += ", BWER eval=" + std::to_string(word_error);
return result; return result;
} }
// Helper thread function for RunEvalAsync. // Helper thread function for RunEvalAsync.
// LockIfNotRunning must have returned true before calling ThreadFunc, and // LockIfNotRunning must have returned true before calling ThreadFunc, and
// it will call UnlockRunning to release the lock after RunEvalSync completes. // it will call UnlockRunning to release the lock after RunEvalSync completes.
void LSTMTester::ThreadFunc() { void LSTMTester::ThreadFunc() {
test_result_ = test_result_ =
RunEvalSync(test_iteration_, test_training_errors_, test_model_mgr_, test_ training_stage_, RunEvalSync(test_iteration_, test_training_errors_, test_model_mgr_, test_ training_stage_,
/*verbosity*/ 0); /*verbosity*/ 0);
 End of changes. 2 change blocks. 
5 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)