tesseract  5.0.0-alpha-619-ge9db
classifier_tester.cpp File Reference
#include <algorithm>
#include <cstdio>
#include <tesseract/baseapi.h>
#include "commontraining.h"
#include "mastertrainer.h"
#include "params.h"
#include <tesseract/strngs.h>
#include "tessclassifier.h"
#include "tesseractclass.h"

Go to the source code of this file.

Enumerations

enum  ClassifierName { CN_PRUNER, CN_FULL, CN_COUNT }
 

Functions

int main (int argc, char **argv)
 

Enumeration Type Documentation

◆ ClassifierName

Enumerator
CN_PRUNER 
CN_FULL 
CN_COUNT 

Definition at line 36 of file classifier_tester.cpp.

36  {
37  CN_PRUNER,
38  CN_FULL,
39  CN_COUNT
40 };

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 110 of file classifier_tester.cpp.

110  {
111  tesseract::CheckSharedLibraryVersion();
112  ParseArguments(&argc, &argv);
113  STRING file_prefix;
114  tesseract::MasterTrainer* trainer =
115  tesseract::LoadTrainingData(argc, argv, false, nullptr, &file_prefix);
117  // Decode the classifier string.
118  tesseract::ShapeClassifier* shape_classifier = InitializeClassifier(
119  FLAGS_classifier.c_str(), trainer->unicharset(), argc, argv, &api);
120  if (shape_classifier == nullptr) {
121  fprintf(stderr, "Classifier init failed!:%s\n", FLAGS_classifier.c_str());
122  return 1;
123  }
124 
125  // We want to test junk as well if it is available.
126  // trainer->IncludeJunk();
127  // We want to test with replicated samples too.
129 
131  std::max(3, static_cast<int>(FLAGS_debug_level)), false,
132  shape_classifier, nullptr);
133  delete shape_classifier;
134  delete api;
135  delete trainer;
136 
137  return 0;
138 } /* main */
STRING
Definition: strngs.h:45
CN_PRUNER
Definition: classifier_tester.cpp:37
tesseract::ShapeClassifier
Definition: shapeclassifier.h:43
CN_FULL
Definition: classifier_tester.cpp:38
tesseract::MasterTrainer::unicharset
const UNICHARSET & unicharset() const
Definition: mastertrainer.h:186
tesseract::TessBaseAPI
Definition: baseapi.h:98
tesseract::MasterTrainer
Definition: mastertrainer.h:69
tesseract::LoadTrainingData
MasterTrainer * LoadTrainingData(int argc, const char *const *argv, bool replication, ShapeTable **shape_table, STRING *file_prefix)
Definition: commontraining.cpp:211
ParseArguments
void ParseArguments(int *argc, char ***argv)
Definition: commontraining.cpp:122
tesseract::MasterTrainer::ReplicateAndRandomizeSamplesIfRequired
void ReplicateAndRandomizeSamplesIfRequired()
Definition: mastertrainer.cpp:320
CN_COUNT
Definition: classifier_tester.cpp:39
tesseract::CT_UNICHAR_TOP1_ERR
Definition: errorcounter.h:74
tesseract::MasterTrainer::TestClassifierOnSamples
void TestClassifierOnSamples(CountTypes error_mode, int report_level, bool replicate_samples, ShapeClassifier *test_classifier, STRING *report_string)
Definition: mastertrainer.cpp:760