zjykzj / LPDet

License Plate Detection and Recognition System

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

«LPDet» provides a complete License Plate Detection and Recognition algorithm

Table of Contents

Latest News

  • [2023/10/03]v0.3.0. Support for Automatic Mixed Precision (AMP) training.
  • [2023/10/02]v0.2.0. Support for distributed training with multi-GPUs.
  • [2023/09/29]v0.1.0. Reconstruct the 872699467/CCPD_CNN implementation to adapt to interfaces after Pytorch v1.0.0.

Background

This warehouse provides a complete license plate detection and recognition algorithm, with the goal of perfectly detecting and recognizing all license plates and license plate information.

Prepare Data

Installation

$ pip install -r requirements.txt

Usage

Train

  • Train Dataset: CCPD2019/ccpd_base
  • Validate Dataset: CCPD2019/ccpd_weather

Firstly, train the license plate detection model: wR2

python -m torch.distributed.run --nproc_per_node 4 --master_port 16233 train_wr2.py --device 4,5,6,7 ../datasets/CCPD2019/ccpd_base ../datasets/CCPD2019/ccpd_weather runs/train
_wr2_ddp

Then, train both license plate detection and recognition models simultaneously: RPNet

python -m torch.distributed.run --nproc_per_node 4 --master_port 32312 train_rpnet.py --device 0,1,2,3 --wr2-pretrained runs/train_wr2_ddp/wR2-e95.pth ../datasets/CCPD2019/ccpd_bas
e ../datasets/CCPD2019/ccpd_weather runs/train_rpnet_ddp

Eval

$ python eval_wr2.py runs/train_wr2_ddp/wR2-e100.pth /data/sdd/CCPD2019/ccpd_weather/
args: Namespace(pretrained='runs/train_wr2_ddp/wR2-e100.pth', val_root='/data/sdd/CCPD2019/ccpd_weather/')
Loading wR2 pretrained: runs/train_wr2_ddp/wR2-e100.pth
Get val data: /data/sdd/CCPD2019/ccpd_weather/
Dataset len: 9999
Batch:312 AP:100.000: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 313/313 [00:53<00:00,  5.89it/s]
AP:96.650
$ python eval_rpnet.py runs/train_rpnet_ddp/RPNet-e100.pth ../datasets/CCPD2019/ccpd_weather/
args: Namespace(pretrained='runs/train_rpnet_ddp/RPNet-e100.pth', val_root='../datasets/CCPD2019/ccpd_weather/')
Loading RPNet pretrained: runs/train_rpnet_ddp/RPNet-e100.pth
Get train data: ../datasets/CCPD2019/ccpd_weather/
Dataset len: 9999
Batch:312 AP:100.000 ACC: 100.000: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 313/313 [00:52<00:00,  5.94it/s]
AP:97.400 ACC: 97.930

Predict

$ python predict_wr2.py runs/train_wr2_ddp/wR2-e100.pth assets/eval/4.jpg 
args: Namespace(image='assets/eval/4.jpg', wr2='runs/train_wr2_ddp/wR2-e100.pth')
Loading wR2 pretrained: runs/train_wr2_ddp/wR2-e100.pth
torch.Size([1, 4])
Save to runs/4_wr2.jpg

$ python predict_rpnet.py runs/train_rpnet_ddp/RPNet-e100.pth assets/eval/4.jpg 
args: Namespace(image='assets/eval/4.jpg', rpnet='runs/train_rpnet_ddp/RPNet-e100.pth')
Loading RPNet pretrained: runs/train_rpnet_ddp/RPNet-e100.pth
torch.Size([1, 242])
lp_name: 皖A256R2
Save to runs/4_rpnet.jpg

Maintainers

  • zhujian - Initial work - zjykzj

Thanks

Contributing

Anyone's participation is welcome! Open an issue or submit PRs.

Small note:

License

Apache License 2.0 © 2023 zjykzj

About

License Plate Detection and Recognition System

License:Apache License 2.0


Languages

Language:Python 100.0%