openalpr / openalpr

Automatic License Plate Recognition library
http://www.openalpr.com
GNU Affero General Public License v3.0
10.99k stars 2.49k forks source link

Can not recognition with multi lines plates even with new config file #310

Open astrung opened 8 years ago

astrung commented 8 years ago

Something like this: images I have created a new file.conf in runtime_data/config with some changed parameters: multiline = 1 and all specified plate_width,plate_heigth,... But still can not recognition. SO i really need train a new detector?But the different point is only multi lines,and training process( character tiles-detector ) is expensive(with my laptop).

astrung commented 8 years ago

This is my process: 1.Train detector-I cloned train-detector from github,then use EU2 directory for training 2.Copy cascade.xml to runtime/region 3.Create new_country.conf in runtime_data/config with some changed parameters:multiline = 1 and all specified plate_width,plate_heigth,... 4.Set detector_file = cascade.xml in new_country.conf 5.Still use ocr_language = leu But still can not find plate? So can we check for new detector is correct or not??In train-detector repository,i don't know how to check my detector is good or not!

matthill commented 8 years ago

The EU2 detector is incomplete. I couldn't find enough samples to make it work well enough. I have about 450 samples, and I need 2000+. I posted the images hoping that others could contribute to it to make it ready.

if you run OpenALPR with all the debug options set to 1 (in openalpr.conf) that should give you an idea of whether or not the plate region is being detected and processed.

astrung commented 8 years ago

When i turn on debug option,it shows some disqualify reasons: 1.platecorners did not find a left/right edge 2.Low confidence in characteranalysis 3.Low best fit score in characteranalysis 4.Did not detect multiple lines on multi-line plate 5.and sometimes, it break after this line: LBP Time: 8.31321ms. Total Time to process image: 8.99571ms. About 1,5,it seem to be plate detector. About others,can you give some solutions to fix it??()

fgaudenzi commented 8 years ago

HI all, i'm also working on 2rows plates from singapore (even single raw is not such good but it is ok, i'm collecting plates to train the dector). I would like to ask too if only changing the country xml file with the new dimension is enough or i really need to start the training. I'm more than happy if i can contribute with plates from singapore, with 1 or 2 lines.

astrung commented 8 years ago

As matthill said,multi line plate system is is incomplete.And all detector xml file is trained for only one line plate.So you will need specified train detector for singapore(and you can pull your data to this repository : train-detector.I am also happy to use your contributed data :))

Umar-Hassan commented 8 years ago

so, No one's been able to detect a 2-Line plate so far. i thought i was the only one with the failures :-)

fgaudenzi commented 8 years ago

i will work all next week on this issue, trying to figure out if i can train it or do something. I will let you know then..

astrung commented 8 years ago

Now i change to try to find a way which detect plates without data.Has any one been worked it?? > i think that i need to modify code for detecting plates .Can someone give any points for how to modify it???

matthill commented 8 years ago

I added the "kr2" training data and config as an example for 2-line plate training: https://github.com/openalpr/openalpr/blob/master/runtime_data/config/kr2.conf

It's designed to read these types of plates: kr2

fgaudenzi commented 8 years ago

Thanks for the effort @matthill, I'm trying to detect singapore 2 lines plates, which are almost the same as european 2rows plate. I'm wondering, because i didn't understand from the discussion if there is anyway to detect them without to run the training part.

Indeed i've already created my configuration My configuration is sg2.txt

but i always get no found plates, even using this simple one: 7 I turned on the debug but i couldn't find any solution.

If i must run the trainer, tell me if i'm wrong, i should:

  1. cut all my plates like that: 2rowsample
  2. run train detector as explained in https://github.com/openalpr/train-detector
  3. Adding a new Country as explained in https://github.com/openalpr/train-ocr and i've already done
  4. add all files to the openalpr path and start having fun.

isn't it?

Thanks for your help.

matthill commented 8 years ago

Yes, that's right. The first phase is the most work. You'll need to collect 1000+ samples of plate images, then crop them. When I first collected images for US plates, I duct-taped a phone to my window and cruised through busy parking lots at ~2 miles per hour. I had an Android app loaded that snapped a picture every second. This gave me more than enough data to get started, although I did get a lot of funny looks from people walking to their cars.

I use the openalpr-utils-tagplates to tag them because this gives me a metadata file for each image that has the x/y/width/height, and it fixes the aspect ratio. Having the original images along with the metadata is better than just the crops.

Once you're done with that, the rest is easy. I'm happy to help with steps 2-4.

matthill commented 8 years ago

@astung if you can upload your detector files that you trained, and a few sample images, I can take a look to see why it's not working well.

astrung commented 8 years ago

@fgaudenzi From your xml file: detector_file = eu.xml Why detector_file is eu.xml??? If you have done train detector,you will get a "cascade.xml"-Copy it to runtime/config. let change detector_file=cascade.xml instead of eu. Or it will find only eu single line plate.

astrung commented 8 years ago

Without training data,it look likes less performance.We are trying to improve it and will report and contribute later.And i have an other problems:Using Calibration,can we set up for multi steep angle ?My test data is taken with many steep angles like this: 14b8360aa6146a2ef85918295890a429 or like this: 97bd34393109c492ee293c269b552959

matthill commented 8 years ago

There's a function in the OpenALPR library for updating the prewarp setting: https://github.com/openalpr/openalpr/blob/master/src/openalpr/alpr.h#L144

There's also a function that applies multiple minor prewarp values and picks the best result (this is used to improve accuracy at the expense of slower processing): https://github.com/openalpr/openalpr/blob/master/src/openalpr/result_aggregator.cpp

So, if you had a handful of prewarp configurations, you could try some combination of the above.

degustator commented 8 years ago

Is it possible to use some generated plates to train 2 lines eu plates?

I have written python script (can share if needed) that generates lots of different numbers based on some examples. It takes empty plates (just erased existing numbers) and generates numbers automatically - rotates, changes contrast, add noise etc

But, unfortunately, I couldn't train with train cascade, it doesn't find more than one or two features in training images (generated cascade file is really small) - see attached file to have a view on those images. Whats wrong with those? az.zip

astrung commented 8 years ago

i am not sure that you can not create xml file or your xml file can not detect plates ??? From training cascade,rotate images will not increase detect performances ( by traninig cascade documents)

astrung commented 8 years ago

You can training cascade with any positive examples . It is only changing parameters of cascade

ozkankaya commented 7 years ago

My brothers! Can anybody share eu2.conf and eu2.xml files? I will try these files for Turkey. Turkey has single and multiple lines plate

asifsha11 commented 6 years ago

Hi Frnds , I'm a beginner to this library and I'm a facing an error upon training the model . which says " OpenCV Error: Bad argument (Can not get new positive sample. The most possible reason is insufficient count of samples in given vec-file. "

What I did ? I just took 400 of samples and copied repeatedly to increase the count of samples , so its like #3000 samples . Upon training the detector , i got the above mentioned error . Kindly help to understand this process and What should I do next ?

zhouhao27 commented 6 years ago

@astrung Can you share your conf and xml for sg2? Or provide some advice on how to train for multiline vehicle number plates? Thanks.

grreddy1978 commented 6 years ago

@fgaudenzi,

Did you manage to fix multi line number plates used in Singapore?

If possible can you please share config files?.

Thank you Ravi

Tolegen95 commented 5 years ago

@astrung Did you manage to fix multi line number plates used in Singapore?

muazniwas commented 5 years ago

Is there anyway to train for a region where there are characters of different sizes on the same line?

diegguinholima commented 5 years ago

I'm trying to use the recognition function for 2-line plates, but it does not work correctly. I'm using the br2.xml file that would be for Brazilian plates. Someone has some advancement in the recognition of plates with 2 lines??

WilliamLambertCN commented 5 years ago

HI all, i'm also working on 2rows plates from singapore (even single raw is not such good but it is ok, i'm collecting plates to train the dector). I would like to ask too if only changing the country xml file with the new dimension is enough or i really need to start the training. I'm more than happy if i can contribute with plates from singapore, with 1 or 2 lines.

Hello, I'm working on Singapore plates too, now. But now I truly need you help. When it comes to use region code 'sg' for setting alpr object, there seems no plates can be detected. Would you mind offer your model of sg paltes to me. Please!!!

martonsz85 commented 4 years ago

Hi all, I'm working on two-line EU plates. I already have 1050 samples, CV seems to correctly recognize the plates, but then I always get "Low confidence in characteranalysis". Though, to me it sounds counter-intuitive (I would guess this error is related to Tesseract, not OpenCV), but could this be because I don't have enough samples? Anyone had any success with training two-lines plates? Anyone wants to trade EU2 plates?

WaweTechnologies commented 3 years ago

@martonsz85 kindly share your eu2.xml and eu2.conf files. eu plates are similar to kenyan ones. im getting a similar error as yours.