/License-Plate-Recognition

Licenses plate detection and recognition with yolox

Primary LanguagePythonEclipse Public License 2.0EPL-2.0

License-Plate-Recognition

Licenses plate detection and recognition with yolox

Train

pip install -r requirements.txt
  • Place your own dataset in the data folder with data.yml

  • Run Train with this command

    python3 train.py 
    --img 736 
    --batch 16 
    --epochs 32 
    --data /path/to/data.yml 
    --weights /path/to/weight.pt 
    --cache

Dataset

You can process your own CCPD datasets with the script in pre_process

  • CCPD2YOLO:Transform the CCPD images name into YoLov5txt format and auto generate data.yml
  • RandomSample: Select a mount of sample images from your original datasets.

Predict

You are supposed to modify the parameters in the detect_one_with_wrap.py or detect_batch.pyif you want to predict some images in one batch.

Text Recognition

PaddleOCR

We have chosen PaddleOCR to recognize the text in the license plate. The steps are as follow.

You are supposed to download the pretrained model in the .\pretrain_models folder.

Model Trainning

python3 tools/train.py 
-c configs/rec/ch_PP-OCRv2/ch_PP-OCRv2_rec.yml 
-o Global.pretrained_model=pretrained_model/ch_PP-OCRv2_rec_train/best_accuracy

Infer

python3 yolov5/run.py

We created the interface using pyqt5 and modified predict_rec.py and utility.py in the reg/PaddleOCR/tools/infer folder. If you need to execute commands in the terminal, download the original code from the PaddleOCR official website and execute: python3 tools/infer/predict_rec.py

References