mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 14:41:36 +08:00
Check library version for training executables
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
a6fef12bd6
commit
8c3045f161
@ -24,12 +24,14 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "baseapi.h"
|
||||
#include "commontraining.h" // CheckSharedLibraryVersion
|
||||
#include "helpers.h"
|
||||
#include "strngs.h"
|
||||
#include "dict.h"
|
||||
#include "tesseractclass.h"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
tesseract::CheckSharedLibraryVersion();
|
||||
|
||||
// Parse input arguments.
|
||||
if (argc != 4 && (argc != 6 || strcmp(argv[1], "-l") != 0)) {
|
||||
|
@ -111,6 +111,7 @@ static tesseract::ShapeClassifier* InitializeClassifier(
|
||||
// full : Tesseract full classifier.
|
||||
// with an input trainer.)
|
||||
int main(int argc, char **argv) {
|
||||
tesseract::CheckSharedLibraryVersion();
|
||||
ParseArguments(&argc, &argv);
|
||||
STRING file_prefix;
|
||||
tesseract::MasterTrainer* trainer =
|
||||
|
@ -124,6 +124,8 @@ CLUSTERCONFIG CNConfig =
|
||||
* @note History: Fri Aug 18 08:56:17 1989, DSJ, Created.
|
||||
*/
|
||||
int main(int argc, char *argv[]) {
|
||||
tesseract::CheckSharedLibraryVersion();
|
||||
|
||||
// Set the global Config parameters before parsing the command line.
|
||||
Config = CNConfig;
|
||||
|
||||
|
@ -15,7 +15,9 @@
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "commandlineflags.h"
|
||||
#include "commontraining.h" // CheckSharedLibraryVersion
|
||||
#include "lang_model_helpers.h"
|
||||
#include "tprintf.h"
|
||||
#include "unicharset_training_utils.h"
|
||||
@ -38,6 +40,7 @@ BOOL_PARAM_FLAG(pass_through_recoder, false,
|
||||
" unicharset. Otherwise, potentially a compression of it");
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
tesseract::CheckSharedLibraryVersion();
|
||||
tesseract::ParseCommandLineFlags(argv[0], &argc, &argv, true);
|
||||
|
||||
// Check validity of input flags.
|
||||
|
@ -18,6 +18,7 @@
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "commontraining.h" // CheckSharedLibraryVersion
|
||||
#include "lstmrecognizer.h"
|
||||
#include "tessdatamanager.h"
|
||||
|
||||
@ -65,6 +66,8 @@
|
||||
// components from tessdata/eng.traineddata.
|
||||
//
|
||||
int main(int argc, char **argv) {
|
||||
tesseract::CheckSharedLibraryVersion();
|
||||
|
||||
int i;
|
||||
tesseract::TessdataManager tm;
|
||||
if (argc == 2) {
|
||||
|
@ -14,6 +14,10 @@
|
||||
#ifndef TESSERACT_TRAINING_COMMONTRAINING_H_
|
||||
#define TESSERACT_TRAINING_COMMONTRAINING_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config_auto.h"
|
||||
#include "baseapi.h"
|
||||
#endif
|
||||
#include "cluster.h"
|
||||
#include "commandlineflags.h"
|
||||
#include "featdefs.h"
|
||||
@ -63,6 +67,21 @@ void ParseArguments(int* argc, char*** argv);
|
||||
|
||||
namespace tesseract {
|
||||
|
||||
// Check whether the shared tesseract library is the right one.
|
||||
// This function must be inline because otherwise it would be part of
|
||||
// the shared library, so it could not compare the versions.
|
||||
static inline void CheckSharedLibraryVersion()
|
||||
{
|
||||
#ifdef HAVE_CONFIG_H
|
||||
if (!!strcmp(TESSERACT_VERSION_STR, TessBaseAPI::Version())) {
|
||||
tprintf("ERROR: shared library version mismatch (was %s, expected %s\n"
|
||||
"Did you use a wrong shared tesseract library?\n",
|
||||
TessBaseAPI::Version(), TESSERACT_VERSION_STR);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Helper loads shape table from the given file.
|
||||
ShapeTable* LoadShapeTable(const STRING& file_prefix);
|
||||
// Helper to write the shape_table.
|
||||
|
@ -17,6 +17,7 @@
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "commontraining.h" // CheckSharedLibraryVersion
|
||||
#include "dawg.h"
|
||||
#include "host.h"
|
||||
#include "serialis.h"
|
||||
@ -72,6 +73,8 @@ int WriteDawgAsWordlist(const UNICHARSET &unicharset,
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
tesseract::CheckSharedLibraryVersion();
|
||||
|
||||
if (argc != 4) {
|
||||
tprintf("Print all the words in a given dawg.\n");
|
||||
tprintf("Usage: %s <unicharset> <dawgfile> <wordlistfile>\n",
|
||||
|
@ -36,6 +36,7 @@ INT_PARAM_FLAG(verbosity, 1,
|
||||
"Amount of diagnosting information to output (0-2).");
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
tesseract::CheckSharedLibraryVersion();
|
||||
ParseArguments(&argc, &argv);
|
||||
if (FLAGS_model.empty()) {
|
||||
tprintf("Must provide a --model!\n");
|
||||
|
@ -71,6 +71,7 @@ const int kNumPagesPerBatch = 100;
|
||||
// The program iterates over the inputs, feeding the data to the network,
|
||||
// until the error rate reaches a specified target or max_iterations is reached.
|
||||
int main(int argc, char **argv) {
|
||||
tesseract::CheckSharedLibraryVersion();
|
||||
ParseArguments(&argc, &argv);
|
||||
// Purify the model name in case it is based on the network string.
|
||||
if (FLAGS_model_output.empty()) {
|
||||
|
@ -17,10 +17,12 @@
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <stdio.h>
|
||||
#include "commontraining.h" // CheckSharedLibraryVersion
|
||||
#include "unicharset.h"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
tesseract::CheckSharedLibraryVersion();
|
||||
|
||||
// Print usage
|
||||
if (argc < 4) {
|
||||
printf("Usage: %s unicharset-in-1 ... unicharset-in-n unicharset-out\n",
|
||||
|
@ -228,6 +228,8 @@ static void SetupConfigMap(ShapeTable* shape_table, IndexMapBiDi* config_map) {
|
||||
* @note History: Mon May 18 1998, Christy Russson, Revistion started.
|
||||
*/
|
||||
int main (int argc, char **argv) {
|
||||
tesseract::CheckSharedLibraryVersion();
|
||||
|
||||
ParseArguments(&argc, &argv);
|
||||
|
||||
ShapeTable* shape_table = nullptr;
|
||||
|
@ -12,11 +12,8 @@
|
||||
// object, fills it with properties about the unichars it contains and writes
|
||||
// the result back to a file.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
#include "commandlineflags.h"
|
||||
#include "commontraining.h" // CheckSharedLibraryVersion
|
||||
#include "tprintf.h"
|
||||
#include "unicharset_training_utils.h"
|
||||
|
||||
@ -30,6 +27,7 @@ DECLARE_STRING_PARAM_FLAG(O);
|
||||
DECLARE_STRING_PARAM_FLAG(X);
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
tesseract::CheckSharedLibraryVersion();
|
||||
tesseract::ParseCommandLineFlags(argv[0], &argc, &argv, true);
|
||||
|
||||
// Check validity of input flags.
|
||||
|
@ -45,6 +45,8 @@ STRING_PARAM_FLAG(canonical_class2, "", "Class to show ambigs for");
|
||||
// Otherwise, if FLAGS_canonical_class1 is set, prints a table of font-wise
|
||||
// cluster distances between FLAGS_canonical_class1 and FLAGS_canonical_class2.
|
||||
int main(int argc, char **argv) {
|
||||
tesseract::CheckSharedLibraryVersion();
|
||||
|
||||
ParseArguments(&argc, &argv);
|
||||
|
||||
STRING file_prefix;
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "allheaders.h" // from leptonica
|
||||
#include "boxchar.h"
|
||||
#include "commandlineflags.h"
|
||||
#include "commontraining.h" // CheckSharedLibraryVersion
|
||||
#include "degradeimage.h"
|
||||
#include "errcode.h"
|
||||
#include "fileio.h"
|
||||
@ -672,6 +673,7 @@ static int Main() {
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
tesseract::CheckSharedLibraryVersion();
|
||||
tesseract::ParseCommandLineFlags(argv[0], &argc, &argv, true);
|
||||
return Main();
|
||||
}
|
||||
|
@ -24,11 +24,11 @@
|
||||
#include <cstdlib>
|
||||
#include "boxread.h"
|
||||
#include "commandlineflags.h"
|
||||
#include "commontraining.h" // CheckSharedLibraryVersion
|
||||
#include "genericvector.h"
|
||||
#include "lang_model_helpers.h"
|
||||
#include "normstrngs.h"
|
||||
#include "strngs.h"
|
||||
#include "tprintf.h"
|
||||
#include "unicharset.h"
|
||||
#include "unicharset_training_utils.h"
|
||||
|
||||
@ -95,6 +95,7 @@ static int Main(int argc, char** argv) {
|
||||
} // namespace tesseract
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
tesseract::CheckSharedLibraryVersion();
|
||||
if (argc > 1) {
|
||||
tesseract::ParseCommandLineFlags(argv[0], &argc, &argv, true);
|
||||
}
|
||||
|
@ -20,9 +20,8 @@
|
||||
// Given a file that contains a list of words (one word per line) this program
|
||||
// generates the corresponding squished DAWG file.
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "classify.h"
|
||||
#include "commontraining.h" // CheckSharedLibraryVersion
|
||||
#include "dawg.h"
|
||||
#include "dict.h"
|
||||
#include "emalloc.h"
|
||||
@ -32,6 +31,8 @@
|
||||
#include "unicharset.h"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
tesseract::CheckSharedLibraryVersion();
|
||||
|
||||
if (!(argc == 4 || (argc == 5 && strcmp(argv[1], "-t") == 0) ||
|
||||
(argc == 6 && strcmp(argv[1], "-r") == 0))) {
|
||||
printf("Usage: %s [-t | -r [reverse policy] ] word_list_file"
|
||||
|
Loading…
Reference in New Issue
Block a user