icarofua / vehicle-rear

Vehicle-Rear: A New Dataset to Explore Feature Fusion For Vehicle Identification Using Convolutional Neural Networks
Apache License 2.0
112 stars 19 forks source link

CNN-Ocr #21

Closed amaadmirza closed 4 years ago

amaadmirza commented 4 years ago

How to retrain CNN-ocr on custom plate..!! Can you please tell me the steps to retrain the model on custom number plate.. Any guide link??

amaadmirza commented 4 years ago

@icarofua ??

raysonlaroca commented 4 years ago

Dear Amaad Mirza,

In order to retrain the CNN-OCR model using custom license plate images, you need to compile the Darknet framework and generate the license plate images with the respective annotations in the Darknet format. Then, you can use the .cfg file we provide to train exactly the same model used by us (models.tgz/OCR/darknet/cfg/cr-net.cfg).

For more detailed information, we recommend that you take a look at this guide, which we also used to train the CNN-OCR model.

luisfgutierrez commented 4 years ago

Hi Rayson. Thank you for sharing your work. Based on your previous answer I understand that the guide I should follow to train the OCR model based on my custom plates is this one:

https://github.com/AlexeyAB/darknet/tree/47c7af1cea5bbdedf1184963355e6418cb8b1b4f#how-to-train-to-detect-your-custom-objects

If that's correct, do I have to transform the annotations you provide, such as:

vehicles: 1 position_vehicle: 1491 100 429 378 type: car plate: AZI4586 position_plate: 1822 436 81 27 char 1: 1828 443 9 16 char 2: 1837 443 11 16 char 3: 1849 444 5 15 char 4: 1860 444 9 16 char 5: 1868 445 11 14 char 6: 1878 445 9 15 char 7: 1887 445 9 15

to the darknet format:

? Do you have the code to do that? Can you share with me the average time of training the "LP detection and Layout Classification Model" you reference in "An Efficient and Layout-Independent Automatic License Plate Recognition System Based on the YOLO detector"? And my last question. I downloaded data.tgz and models.tgz. I untar the files but don`t seem to find the path you mentioned in your previous anwser: "(models.tgz/OCR/darknet/cfg/cr-net.cfg)". Can you share with us the needed files? Or is it safe to use the links provided in the micro-site of the paper "An Efficient and Layout-Independent Automatic License Plate Recognition System Based on the YOLO detector" for that purpose: http://www.inf.ufpr.br/vri/databases/layout-independent-alpr/data/lp-detection-layout-classification.cfg and the others in the same page for the same model? Thank you very much for any advice and pointers in these matters.
raysonlaroca commented 4 years ago

Dear luisfgutierrez,

Exactly, this is the guide you must follow to train any object detector using the Darknet framework (not only the OCR model).

You need to convert the .txt files to the darknet format, which is as follows:

You should do this without any major difficulties using python + regex.

In our experiments (5 different executions), the average time to train the "LP detection and Layout Classification Model" model was 17.8 hours in an AMD Ryzen Threadripper 1920X 3.5GHz CPU, with 32 GB of RAM and an NVIDIA Titan Xp GPU. However, this time may vary according to other processes running simultaneously.

Finally, you were right about the missing files in the path I mentioned in my previous answer. We updated the models.tgz file and now the OCR files are included in it. Thanks for the heads up!

Best regards,