YOLOv8 License Plate Detection
This project uses the YOLOv8 object detection model to detect license plates. The dataset used is Keremberke's License Plate Object Detection , and the model is trained using the Ultralytics YOLOv8 framework .
Installation
Ensure you have the required dependencies installed:
pip install datasets ultralytics opencv-python numpy pandas matplotlib
Dataset
The dataset is loaded from Hugging Face's datasets library:
from datasets import load_dataset
ds = load_dataset("keremberke/license-plate-object-detection", "full")
The dataset is split into:
-
Training Set
-
Validation Set
-
Test Set
Data Preprocessing
-
Images are extracted from the dataset and saved locally.
-
Bounding box annotations are converted into YOLO format (normalized coordinates).
-
The dataset is structured into:
dataset/
├── images/
│ ├── train/
│ ├── val/
├── labels/
│ ├── train/
│ ├── val/
Model Training
A pre-trained YOLOv8 model (yolov8n.pt) is fine-tuned on the dataset:
from ultralytics import YOLO
model = YOLO('yolov8n.pt') # Load a small YOLOv8 model
results = model.train(data="dataset.yaml", epochs=75, imgsz=640, batch=16)
Training Configuration
-
Epochs : 75
-
Image Size : 640x640
-
Batch Size : 16