1

I'm using Ubuntu 16.04 to run OpenALPR. I installed it and produced font tiles from the TTF font files for my country, but ran into problems using train.py. It's supposed to produce [countrycode].traineddata files, but I get the following errors when I execute it from the terminal window:

Processing: ./ae/input/lae.abudhabi.exp0.box
./ae/input/lae.abudhabi.exp0.tif
Executing: /home/user123/train-ocr/tesseract-ocr/tesseract -l eng ./ae/input/lae.abudhabi.exp0.tif  lae.abudhabi.exp0 nobatch box.train.stderr
sh: 1: /home/user123/train-ocr/tesseract-ocr/tesseract: Permission denied
mv: cannot stat './lae.abudhabi.exp0.tr': No such file or directory
mv: cannot stat './lae.abudhabi.exp0.txt': No such file or directory
sh: 1: /home/user123/train-ocr/tesseract-ocr/tesseract/training/unicharset_extractor: not found
Executing: /home/user123/train-ocr/tesseract-ocr/tesseract/training/mftraining -F   ./tmp/font_properties -U unicharset -O ./tmp/lae.unicharset ./tmp/*.tr
sh: 1: /home/user123/train-ocr/tesseract-ocr/tesseract/training/mftraining: not found
rm: cannot remove './unicharset': No such file or directory
mv: cannot stat './tmp/lae.unicharset': No such file or directory
cp: cannot stat './ae/input/unicharambigs': No such file or directory
sh: 1: /home/user123/train-ocr/tesseract-ocr/tesseract/training/cntraining: not found
mv: cannot stat './shapetable': No such file or directory
mv: cannot stat './pffmtable': No such file or directory
mv: cannot stat './inttemp': No such file or directory
mv: cannot stat './normproto': No such file or directory
sh: 1: /home/user123/train-ocr/tesseract-ocr/tesseract/training/combine_tessdata: not found
./ae/ae.config
Applying config file: ./ae/ae.config
lae.traineddata
sh: 1: /home/user123/train-ocr/tesseract-ocr/tesseract/training/combine_tessdata: not found
config file: /home/user123/train-ocr/tesseract-ocr/tesseract/training/combine_tessdata -o   lae.traineddata ./ae/ae.config
status:  32512
mv: cannot stat './lae.unicharset': No such file or directory
mv: cannot stat './lae.shapetable': No such file or directory
mv: cannot stat './lae.pffmtable': No such file or directory
mv: cannot stat './lae.inttemp': No such file or directory
mv: cannot stat './lae.normproto': No such file or directory
mv: cannot stat './lae.unicharambigs': No such file or directory

I'm not sure what I'm supposed to do, since all the file paths are correct. Additionally the code asks for a .config file in this line, but doesn't specify where I'm supposed to get it from. I have created a .conf file for my country's font, per the instructions here, and produced the .box and .tif files, but there's no mention of .config.

Any help would be greatly appreciated! I'm using the default Python version 2.7.12. My Tesseract files in the user's home directory.

Kaya311
  • 545
  • 2
  • 9
  • 21

2 Answers2

1

First of all you have to make sure that you have tesseract installed. If you are using ubuntu the command is sudo apt install tesseract-ocr

The problem occurs because the default tesseract paths in train.py file is not the same as yours, so you have to change that according to your local path. For example mine is

TESSERACT_DIR='/usr/share/tesseract-ocr/4.00/tessdata'
TESSERACT_BIN='/usr/bin/tesseract'
TESSERACT_TRAINDIR= '/usr/bin'

It should work fine after changing the paths.

chrvin
  • 11
  • 1
0

Please explain why you downvoted my asnwer it if it's still bad after this edit.

I'm trying the same, also with Ubuntu 16.04 LTS, and if I remember those errors, what I did was manually installing Tesseract, OpenCV and Leptonica. I still got errors but I believe I'm in the way up. In any case you might try installing the libraries.

It seems that the tutorial "The Easiest Way" to install OpenALPR installs only the engine of Tesseract (plus OpenALPR), not the complete training set we need, according to TesseractWiki, which says there are two parts of Tesseract: The engine and the training data.

Tesseract compilation guide shows Tesseract installation and then asks for Leptonica. You need to match versions of Tesseract and Leptonica according to the table in the link.

When following Leptonica README, I got errors until I made the library installations below and retried at Leptonica:

sudo apt-get install libgif.dev
sudo apt-get install libgif.dev
sudo apt-get install gnuplot

I've also annotated that I needed to:

sudo apt-get install cv.h

I've opened a question here, which might be your next error if you try the same as me.

May we keep communication?

Good luck.

Youki
  • 33
  • 8