#include <lstmtester.h>
Definition at line 29 of file lstmtester.h.
◆ LSTMTester()
tesseract::LSTMTester::LSTMTester |
( |
int64_t |
max_memory | ) |
|
Definition at line 26 of file lstmtester.cpp.
27 : test_data_(max_memory), total_pages_(0), async_running_(
false) {}
◆ LoadAllEvalData() [1/2]
Definition at line 45 of file lstmtester.cpp.
bool LoadDocuments(const GenericVector< STRING > &filenames, CachingStrategy cache_strategy, FileReader reader)
◆ LoadAllEvalData() [2/2]
bool tesseract::LSTMTester::LoadAllEvalData |
( |
const STRING & |
filenames_file | ) |
|
Definition at line 32 of file lstmtester.cpp.
35 tprintf(
"Failed to load list of eval filenames from %s\n",
DLLSYM void tprintf(const char *format,...)
bool LoadFileLinesToStrings(const char *filename, GenericVector< STRING > *lines)
const char * c_str() const
const char * string() const
bool LoadAllEvalData(const STRING &filenames_file)
◆ RunEvalAsync()
STRING tesseract::LSTMTester::RunEvalAsync |
( |
int |
iteration, |
|
|
const double * |
training_errors, |
|
|
const TessdataManager & |
model_mgr, |
|
|
int |
training_stage |
|
) |
| |
Definition at line 54 of file lstmtester.cpp.
58 if (total_pages_ == 0) {
59 result.
add_str_int(
"No test data at iteration", iteration);
62 if (!LockIfNotRunning()) {
63 result.
add_str_int(
"Previous test incomplete, skipping test at iteration",
68 STRING prev_result = test_result_;
70 if (training_errors !=
nullptr) {
71 test_iteration_ = iteration;
72 test_training_errors_ = training_errors;
73 test_model_mgr_ = model_mgr;
74 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 84 of file lstmtester.cpp.
88 trainer.InitCharSet(model_mgr);
91 !trainer.DeSerialize(&model_mgr, &fp)) {
92 return "Deserialize failed";
94 int eval_iteration = 0;
95 double char_error = 0.0;
96 double word_error = 0.0;
98 while (error_count < total_pages_) {
99 const ImageData* trainingdata = test_data_.
GetPageBySerial(eval_iteration);
100 trainer.SetIteration(++eval_iteration);
101 NetworkIO fwd_outputs, targets;
103 trainer.PrepareForBackward(trainingdata, &fwd_outputs, &targets);
108 if (verbosity > 1 || (verbosity > 0 && result !=
PERFECT)) {
109 tprintf(
"Truth:%s\n", trainingdata->transcription().string());
112 trainer.LabelsFromOutputs(fwd_outputs, &ocr_labels, &xcoords);
113 STRING ocr_text = trainer.DecodeLabels(ocr_labels);
118 char_error *= 100.0 / total_pages_;
119 word_error *= 100.0 / total_pages_;
const ImageData * GetPageBySerial(int serial)
void add_str_double(const char *str, double number)
The documentation for this class was generated from the following files: