24static STRING_PARAM_FLAG(model,
"",
"Name of model file (training or recognition)");
26 "If model is a training checkpoint, then traineddata must "
27 "be the traineddata file that was given to the trainer");
28static STRING_PARAM_FLAG(eval_listfile,
"",
"File listing sample files in lstmf training format.");
29static INT_PARAM_FLAG(max_image_MB, 2000,
"Max memory to use for images.");
32int main(
int argc,
char **argv) {
33 tesseract::CheckSharedLibraryVersion();
35 if (FLAGS_model.empty()) {
36 tprintf(
"Must provide a --model!\n");
39 if (FLAGS_eval_listfile.empty()) {
40 tprintf(
"Must provide a --eval_listfile!\n");
44 if (!mgr.
Init(FLAGS_model.c_str())) {
45 if (FLAGS_traineddata.empty()) {
46 tprintf(
"Must supply --traineddata to eval a training checkpoint!\n");
49 tprintf(
"%s is not a recognition model, trying training checkpoint...\n", FLAGS_model.c_str());
50 if (!mgr.
Init(FLAGS_traineddata.c_str())) {
51 tprintf(
"Failed to load language model from %s!\n", FLAGS_traineddata.c_str());
54 std::vector<char> model_data;
56 tprintf(
"Failed to load model from: %s\n", FLAGS_model.c_str());
63 tprintf(
"Failed to load eval data from: %s\n", FLAGS_eval_listfile.c_str());
67 std::string result = tester.
RunEvalSync(0, &errs, mgr,
69 tprintf(
"%s\n", result.c_str());
#define INT_PARAM_FLAG(name, val, comment)
#define STRING_PARAM_FLAG(name, val, comment)
int main(int argc, char **argv)
void tprintf(const char *format,...)
void ParseArguments(int *argc, char ***argv)
bool LoadDataFromFile(const char *filename, GenericVector< char > *data)
void OverwriteEntry(TessdataType type, const char *data, int size)
bool Init(const char *data_file_name)
std::string RunEvalSync(int iteration, const double *training_errors, const TessdataManager &model_mgr, int training_stage, int verbosity)
bool LoadAllEvalData(const char *filenames_file)