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

Segmentation fault if "char_width_mm = 20" #3

Closed Silex closed 10 years ago

Silex commented 10 years ago

Hi,

train-ocr wouldn't recognize the I in http://www.licenseplates.tv/images/swissai.gif, so I reduced char_width_mm to 20 for the [eu] country and ./classifychars now display the I correctly, however when I try to press enter to input which char it is then it segfaults.

matthill commented 10 years ago

I think the setting you want to modify is:

segmentation_min_box_width_px = 8

That's a value in pixels for the minimum possible character width, anything less gets disqualified. Setting it to 4 should pass the "I" through.

I recropped the image before processing it. I assume you're doing this as well. But my crop may have been slightly different, so it may not have hit the exact same logic to reproduce the crash.

swissai-cropped

Silex commented 10 years ago

I confirm that setting it to 4 prevents the segfault. Thanks!

Silex commented 10 years ago

Side question, for train-detector I should give "real-life" images, does the same holds for train-ocr?

Basically my questions are:

matthill commented 10 years ago

You should give the detector the exact type of images that you want it to detect. I usually include a little bit of car bumper/edges -- just an inch or two -- to give it some context (the ALPR stages will filter this stuff out later). For slightly rotated plates, this may not even include the full plate (e.g., a plate rotated counter-clockwise may be missing the a little bit of the bottom left and top right portions).

Here's a video demonstration of how Cascade classification works -- seeing something like this made it much more clear: https://www.youtube.com/watch?v=nVbaNcRldmw

OCR is a little different. You want to give it actual images from actual plates, but you don't want to give it characters that are missing sections or "damaged" in some way. You want the characters to look relatively clean. Tesseract needs a good sample, and it can work out its best guess when actual char images are given and are missing portions.

Silex commented 10 years ago

Alright, so :