openalpr / train-ocr

Input files and scripts necessary to train the license plate OCR
GNU Affero General Public License v3.0
234 stars 109 forks source link

Issue with mac directories in train.py #19

Open ongunsavas opened 8 years ago

ongunsavas commented 8 years ago

Hello, I am trying to train a sample data set that I acquired on my own to ocr, and I am using OS X 10.11 as operating system. However, when I try to run train.py on shell, I get this error, I think it is an issue with directory, as it is written according to a linux OS, but I dont know how to define TESSERACT_DIR according to mac directory system. Help is much appreciated, please let me know if anyone has a solution! Thank you!!! P.S. here is the error I am getting:

Two-Letter Country Code to Train: us Processing: ./us/input/lus.florida.exp0.box Executing: /storage/projects/alpr/libraries/tesseract-ocr/tesseract -l eng ./us/input/lus.florida.exp0.tif lus.florida.exp0 nobatch box.train.stderr sh: /storage/projects/alpr/libraries/tesseract-ocr/tesseract: No such file or directory mv: rename ./lus.florida.exp0.tr to ./tmp/lus.florida.exp0.tr: No such file or directory mv: rename ./lus.florida.exp0.txt to ./tmp/lus.florida.exp0.txt: No such file or directory sh: /storage/projects/alpr/libraries/tesseract-ocr/training/unicharset_extractor: No such file or directory Executing: /storage/projects/alpr/libraries/tesseract-ocr/training/mftraining -F ./tmp/font_properties -U unicharset -O ./tmp/lus.unicharset ./tmp/*.tr sh: /storage/projects/alpr/libraries/tesseract-ocr/training/mftraining: No such file or directory rm: ./unicharset: No such file or directory mv: rename ./tmp/lus.unicharset to ./lus.unicharset: No such file or directory cp: ./us/input/unicharambigs: No such file or directory sh: /storage/projects/alpr/libraries/tesseract-ocr/training/cntraining: No such file or directory mv: rename ./shapetable to ./lus.shapetable: No such file or directory mv: rename ./pffmtable to ./lus.pffmtable: No such file or directory mv: rename ./inttemp to ./lus.inttemp: No such file or directory mv: rename ./normproto to ./lus.normproto: No such file or directory sh: /storage/projects/alpr/libraries/tesseract-ocr/training/combine_tessdata: No such file or directory mv: rename ./lus.unicharset to ./tmp/lus.unicharset: No such file or directory mv: rename ./lus.shapetable to ./tmp/lus.shapetable: No such file or directory mv: rename ./lus.pffmtable to ./tmp/lus.pffmtable: No such file or directory mv: rename ./lus.inttemp to ./tmp/lus.inttemp: No such file or directory mv: rename ./lus.normproto to ./tmp/lus.normproto: No such file or directory mv: rename ./lus.unicharambigs to ./tmp/lus.unicharambigs: No such file or directory

pxoo commented 7 years ago

I also met the same issue. Could I ask you did you manage to solve this problem? Thanks

ivanhuay commented 7 years ago

+1 same error on ubuntu 16.04

pallocchi commented 7 years ago

I had the same error on OS X 10.2.5. I've solved that doing the following:

  1. Uninstall tesseract brew uninstall tesseract

  2. Install again but with training tools brew install --with-training-tools tesseract

  3. Fix the wrong paths in train.py

    
    # You should verify these paths in your filesystem

TESSERACT_DIR='/usr/local/Cellar/tesseract/'

os.environ["TESSDATA_PREFIX"] = TESSERACT_DIR + '/share'

TESSERACT_BIN=TESSERACT_DIR + '/bin/tesseract' TESSERACT_TRAINDIR= TESSERACT_DIR + '/bin'