66 {
67 CHECK(FLAGS_test_tesseract || FLAGS_test_cube)
68 << "Need to test at least one of Tesseract/Cube!";
69
70 std::vector<std::string> image_files;
71 if (FLAGS_test_tesseract) {
72 int i = 0;
73 while (kTessLangs[i] && kTessTruthText[i] && kTessImages[i]) {
74 langs_.emplace_back(kTessLangs[i]);
75 gt_text_.emplace_back(kTessTruthText[i]);
76 image_files.emplace_back(kTessImages[i]);
77 ++i;
78 }
79 LOG(
INFO) <<
"Testing Tesseract on " << i <<
" languages.";
80 }
81 if (FLAGS_test_cube) {
82 int i = 0;
83 while (kCubeLangs[i] && kCubeTruthText[i] && kCubeImages[i]) {
84 langs_.emplace_back(kCubeLangs[i]);
85 gt_text_.emplace_back(kCubeTruthText[i]);
86 image_files.emplace_back(kCubeImages[i]);
87 ++i;
88 }
89 LOG(
INFO) <<
"Testing Cube on " << i <<
" languages.";
90 }
92
93
94
95
96
98 for (int i = 0; i < n; ++i) {
99 std::string path = TESTING_DIR
"/" + image_files[i %
num_langs_];
100 Image new_pix = pixRead(path.c_str());
101 QCHECK(new_pix != nullptr) << "Could not read " << path;
102 pix_.push_back(new_pix);
103 }
104
105#ifdef INCLUDE_TENSORFLOW
106 pool_size_ = (FLAGS_max_concurrent_instances < 1) ?
num_langs_ * FLAGS_reps
107 : FLAGS_max_concurrent_instances;
108#endif
109 }
static std::vector< std::string > langs_
static std::vector< Image > pix_
static std::vector< std::string > gt_text_