ankandrew / fast-plate-ocr

Lightweight & fast OCR models for license plate text recognition.
https://ankandrew.github.io/fast-plate-ocr
MIT License
68 stars 16 forks source link

Issue with new number plates #11

Closed alanacc92 closed 6 months ago

alanacc92 commented 6 months ago

Hi! First of all thank you for your work! I detected with the new Argentinian Plates, for example, those whose start with AG or AF, has very low confidence in the second character, perhaps its because there weren't that kind of plates 4 years ago, so my question is what should we do with these problems. Thank you!!

alanacc92 commented 6 months ago

Hi! First of all thank you for your work! I detected with the new Argentinian Plates, for example, those whose start with AG or AF, has very low confidence in the second character, perhaps its because there weren't that kind of plates 4 years ago, so my question is what should we do with these problems. Thank you!!

Also, its possible to get the dataset that you used in this repo, so I can fine tunning with the new plates? Thanks!

ankandrew commented 6 months ago

Hi @alanacc92!

Yea, the issue you are experiencing with plates that start with A|(G|F|...|Z) is expected. When I trained these models some time ago, those weren't present on my dataset distribution. To detect 'new' ones, you can grab new plates and fine-tune the models with those. Currently I don't have access to the dataset I used to train the models.

alanacc92 commented 6 months ago

OK, so you say that i can do the fine tune without the original dataset? and only with the new plates, that works??

ankandrew commented 6 months ago

It might work depending on how you fine-tune the model. If you want to re-train from scratch, you can grab some cropped plates and generate pseudo-labels with current models (so you don't annotate all from scratch for those that work well) and incorporate new plates that start with AG and AF.

I'm also planning to re-work a bit this OCR so it can recognize these 'new' characters without re-training/fine-tuning.

ankandrew commented 4 months ago

After 0.1.6 release, you can use argentinian-plates-cnn-synth-model enhanced for the above-mentioned cases. Example on a new plate AG329EX:

cropped-plate-0a9b5f02419a46b189c7424c961f6bd7

Old Model

m = ONNXPlateRecognizer("argentinian-plates-cnn-model")
plate, conf = m.run(img, return_confidence=True)
print(f"Old model prediction: {plate} - probs {conf[0]}")

Outputs:

Old model prediction: ['AB329EX'] - probs [0.8348527  0.16994348 0.7916325  0.85870713 0.7046528  0.7430657 
 0.71694964]

New Model

m = ONNXPlateRecognizer("argentinian-plates-cnn-synth-model")
plate, conf = m.run(img, return_confidence=True)
print(f"New model prediction: {plate} - probs {conf[0]}")

Outputs:

New model prediction: ['AG329EX'] - probs [0.8208941  0.51017994 0.74643826 0.7873817  0.7822389  0.77587897
 0.9077101 ]