#include <lstmtester.h>
Definition at line 29 of file lstmtester.h.
◆ LSTMTester()
tesseract::LSTMTester::LSTMTester |
( |
inT64 |
max_memory | ) |
|
Definition at line 24 of file lstmtester.cpp.
25 : test_data_(max_memory), total_pages_(0), async_running_(
false) {}
◆ LoadAllEvalData() [1/2]
bool tesseract::LSTMTester::LoadAllEvalData |
( |
const STRING & |
filenames_file | ) |
|
Definition at line 30 of file lstmtester.cpp.
33 tprintf(
"Failed to load list of eval filenames from %s\n",
const char * string() const
bool LoadAllEvalData(const STRING &filenames_file)
bool LoadFileLinesToStrings(const STRING &filename, GenericVector< STRING > *lines)
◆ LoadAllEvalData() [2/2]
Definition at line 43 of file lstmtester.cpp.
bool LoadDocuments(const GenericVector< STRING > &filenames, CachingStrategy cache_strategy, FileReader reader)
◆ RunEvalAsync()
STRING tesseract::LSTMTester::RunEvalAsync |
( |
int |
iteration, |
|
|
const double * |
training_errors, |
|
|
const TessdataManager & |
model_mgr, |
|
|
int |
training_stage |
|
) |
| |
Definition at line 52 of file lstmtester.cpp.
56 if (total_pages_ == 0) {
57 result.
add_str_int(
"No test data at iteration", iteration);
60 if (!LockIfNotRunning()) {
61 result.
add_str_int(
"Previous test incomplete, skipping test at iteration",
66 STRING prev_result = test_result_;
68 if (training_errors !=
nullptr) {
69 test_iteration_ = iteration;
70 test_training_errors_ = training_errors;
71 test_model_mgr_ = model_mgr;
72 test_training_stage_ = training_stage;
void add_str_int(const char *str, int number)
static void StartThread(void *(*func)(void *), void *arg)
Create new thread.
◆ RunEvalSync()
STRING tesseract::LSTMTester::RunEvalSync |
( |
int |
iteration, |
|
|
const double * |
training_errors, |
|
|
const TessdataManager & |
model_mgr, |
|
|
int |
training_stage, |
|
|
int |
verbosity |
|
) |
| |
Definition at line 82 of file lstmtester.cpp.
86 trainer.InitCharSet(model_mgr);
89 !trainer.DeSerialize(&model_mgr, &fp)) {
90 return "Deserialize failed";
92 int eval_iteration = 0;
93 double char_error = 0.0;
94 double word_error = 0.0;
96 while (error_count < total_pages_) {
97 const ImageData* trainingdata = test_data_.
GetPageBySerial(eval_iteration);
98 trainer.SetIteration(++eval_iteration);
99 NetworkIO fwd_outputs, targets;
101 trainer.PrepareForBackward(trainingdata, &fwd_outputs, &targets);
106 if (verbosity > 1 || (verbosity > 0 && result !=
PERFECT)) {
107 tprintf(
"Truth:%s\n", trainingdata->transcription().string());
110 trainer.LabelsFromOutputs(fwd_outputs, &ocr_labels, &xcoords);
111 STRING ocr_text = trainer.DecodeLabels(ocr_labels);
116 char_error *= 100.0 / total_pages_;
117 word_error *= 100.0 / total_pages_;
void add_str_int(const char *str, int number)
const ImageData * GetPageBySerial(int serial)
void add_str_double(const char *str, double number)
const char * string() const
The documentation for this class was generated from the following files:
- /home/stweil/src/github/tesseract-ocr/tesseract/training/lstmtester.h
- /home/stweil/src/github/tesseract-ocr/tesseract/training/lstmtester.cpp