#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 LoadFileLinesToStrings(const STRING &filename, GenericVector< STRING > *lines)
bool LoadAllEvalData(const STRING &filenames_file)
◆ 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 GenericVector< char > & |
model_data, |
|
|
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_data_ = model_data;
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 GenericVector< char > & |
model_data, |
|
|
int |
training_stage |
|
) |
| |
Definition at line 82 of file lstmtester.cpp.
86 if (!trainer.ReadTrainingDump(model_data, &trainer)) {
87 return "Deserialize failed";
89 int eval_iteration = 0;
90 double char_error = 0.0;
91 double word_error = 0.0;
93 while (error_count < total_pages_) {
94 const ImageData* trainingdata = test_data_.
GetPageBySerial(eval_iteration);
95 trainer.SetIteration(++eval_iteration);
96 NetworkIO fwd_outputs, targets;
97 if (trainer.PrepareForBackward(trainingdata, &fwd_outputs, &targets) !=
104 char_error *= 100.0 / total_pages_;
105 word_error *= 100.0 / total_pages_;
const ImageData * GetPageBySerial(int serial)
void add_str_int(const char *str, int number)
void add_str_double(const char *str, double number)
The documentation for this class was generated from the following files:
- /home/stefan/src/github/tesseract-ocr/tesseract/training/lstmtester.h
- /home/stefan/src/github/tesseract-ocr/tesseract/training/lstmtester.cpp