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

./train new country code #6

Closed lastessa closed 10 years ago

lastessa commented 10 years ago

Hi, when i try to proceed training, i give follow error. root@ubuntu:/usr/local/src/train-ocr# ./train.py Two-Letter Country Code to Train: ua Processing: ./ua/input/leu.ukraine.exp0.box Executing: /usr/local/src/tesseract-ocr/api/tesseract -l fra ./ua/input/leu.ukraine.exp0.tif leu.ukraine.exp0 box.train.stderr Error opening data file /usr/local/src/tesseract-ocr/tessdata/fra.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory. Failed loading language 'fra' Tesseract couldn't load any languages! Could not initialize tesseract. mv: cannot stat ‘./leu.ukraine.exp0.tr’: No such file or directory mv: cannot stat ‘./leu.ukraine.exp0.txt’: No such file or directory Extracting unicharset from ./ua/input/leu.ukraine.exp0.box Wrote unicharset file ./unicharset. Executing: /usr/local/src/tesseract-ocr/training/mftraining -F ./tmp/fontproperties -U unicharset -O ./tmp/lua.unicharset ./tmp/.tr Warning: No shape table file present: shapetable Reading ./tmp/_.tr ...

Error: Unable to open ./tmp/_.tr! signal_termination_handler:Error:Signal_terminationhandler called:Code 3000 Segmentation fault (core dumped) mv: cannot stat ‘./tmp/lua.unicharset’: No such file or directory cp: cannot stat ‘./ua/input/unicharambigs’: No such file or directory Reading ./tmp/.tr ...

Error: Unable to open ./tmp/*.tr! signal_termination_handler:Error:Signal_termination_handler called:Code 3000 Segmentation fault (core dumped) rm: cannot remove ‘./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 Combining tessdata files Error opening unicharset file Error combining tessdata files into lua.traineddata mv: cannot stat ‘./lua.unicharset’: No such file or directory mv: cannot stat ‘./lua.pffmtable’: No such file or directory mv: cannot stat ‘./lua.inttemp’: No such file or directory mv: cannot stat ‘./lua.normproto’: No such file or directory mv: cannot stat ‘./lua.unicharambigs’: No such file or directory

additional info: echo $TESSDATA_PREFIX //usr/local/src/openalpr/runtime_data/ocr

root@ubuntu:/usr/local/src/train-ocr/ua/input# ls -la total 32 drwxr-xr-x 2 root root 4096 Nov 1 21:38 . drwxr-xr-x 3 root root 4096 Nov 1 21:37 .. -rw-r--r-- 1 root root 1060 Nov 1 21:38 leu.ukraine.exp0.box -rw-r--r-- 1 root root 19298 Nov 1 21:38 leu.ukraine.exp0.tif

lastessa commented 10 years ago

UPD: when i replace fra -> eng in train.py. i got: root@ubuntu:/usr/local/src/openalpr/src# alpr -c ua carma.jpg --(!)Error loading classifier No license plates found.

openalpr.conf: [ua] ; One-line European style plates

; 35-50; 45-60, 55-70, 65-80, 75-90 char_analysis_min_pct = 0.35 char_analysis_height_range = 0.15 char_analysis_height_step_size = 0.10 char_analysis_height_num_steps = 5

segmentation_min_box_width_px = 5 segmentation_min_charheight_percent = 0.4; segmentation_max_segment_width_percent_vs_average = 2.0;

plate_width_mm = 520 plate_height_mm = 110

multiline = 0

char_height_mm = 80 char_width_mm = 53 char_whitespace_top_mm = 10 char_whitespace_bot_mm = 10

template_max_width_px = 184 template_max_height_px = 46

; Higher sensitivity means less lines plateline_sensitivity_vertical = 18 plateline_sensitivity_horizontal = 55

; Regions smaller than this will be disqualified min_plate_size_width_px = 100 min_plate_size_height_px = 20

ocr_language = lua

matthill commented 10 years ago

You need to copy your cascade XML file to the regions directory and name it ua.xml. This error indicates that it can't find your plate detector. Your OCR data could be fine, it hasn't gotten to that part yet.

lastessa commented 10 years ago

ua.xml file generated by train-detector?

matthill commented 10 years ago

After you train the detector there will be an "out" directory with a "cascade.xml" file inside it. Move that to runtime_dir/region/ua.xml

matthill commented 10 years ago

Also, please direct further questions to the forum: https://groups.google.com/forum/#!forum/openalpr

Issues are mainly for bugs or suggestions. You may want to create an issue "Training the detector is too hard, make it easier!" :) But the forum is better for asking questions about how to make it work. Other folks have been down this path as well and you may get help faster -- plus other folks can benefit from these answers.

repletetop commented 6 years ago

I get error like this: Error opening data file /usr/local/src/tesseract-ocr/tessdata/fra.traineddata So Just copy the files from: openalpr/runtime_data/ocr/tessdata to openalpr/runtime_data/ocr/ It works