License Plate Detection Using Deep Learning and the YOLO Algorithm.
NOTE: Click on the images to view them full-size.
(Train YOLO v5 on a Custom Dataset)
# Clone the License-Plate-Detection Repository
git clone https://github.com/aligh993/License-Plate-Detection
# Navigate to the Cloned Directory
cd License-Plate-Detection
# Install Required Packages
pip install -r requirements.txt
NOTE: For Quick Start you can use
Main.ipynb
.
https://B2n.ir/yn5201
Place the labeled dataset, license_plate_dataset
, you downloaded from Google Drive into ./License-Plate-Detection/Dataset/
.
dataset.yaml
file, which contains the address and information for the dataset (such as train/test/validation image addresses, class names, and number of classes), is located in the main directory of the project.
Train the model on the License Plate Dataset. Pre-trained models download automatically from the latest YOLOv5 release. Alternatively, you can manually download the YOLOv5 Pre-trained Model yolov5l.pt
from Ultralytics YOLOv5 and place it in ./pre_trained_model/
.
# Fine-tuning on a Pre-trained model of yolov5
python ./train.py --img 640 --batch 16 --epochs 60 --data ./dataset.yaml --weights ./pre_trained_model/yolov5l.pt --cache
Test the model on the dataset. Place the weight best.pt
you downloaded from Google Drive into ./runs/train/yolov5-l/weights/
.
# After training, this will provide the trained weights that you can use for testing.
python ./detect.py --source ./test_images/ --weight ./runs/train/yolov5-l/weights/best.pt
Validate the model on the dataset. Place the weight best.pt
you downloaded from Google Drive into ./runs/train/yolov5-l/weights/
.
# After training, this will provide the trained weights that you can use for validating.
python ./val.py --data ./dataset.yaml --weights ./runs/train/yolov5-l/weights/best.pt
To view mAP, loss, confusion matrix, and other metrics, sign in at www.wandb.ai.
pip install wandb
- Fork it (https://github.com/aligh993/License-Plate-Detection)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request