Edit model card

License Plate Detection Model using YOLOv8

Model Description

This is a deep learning model for detecting and cropping license plates in images, trained using the YOLOv8 object detection architecture. The model takes an image of a vehicle as input and returns a cropped image of the detected license plate.

Dataset

The model was trained on a dataset of 500 images of vehicles with annotated license plates. The dataset was curated to include a variety of license plate types, angles, and lighting conditions.

Model Training

The model was trained using the YOLOv8 architecture with the following hyperparameters:

  • Batch size: 32
  • Epochs: 50
  • Learning rate: 0.001
  • Optimizer: Adam
  • Loss function: Mean Average Precision (MAP)

Model Performance

confusion_matrix.png The model achieves the following performance metrics on the validation set: val_batch1_pred.jpg

  • mAP (mean Average Precision): 0.92
  • AP (Average Precision) for license plates: 0.95
  • Recall: 0.93
  • Precision: 0.94 results.png Usage

To use this model, you can follow these steps:

  1. Install the required libraries: pip install ultralytics
  2. Load the model: model = torch.hub.load('ultralytics/yolov8', 'custom', path='path/to/model.pt')
  3. Load the input image: img = cv2.imread('path/to/image.jpg')
  4. Preprocess the input image: img = cv2.resize(img, (640, 480))
  5. Run the model: results = model(img)
  6. Extract the cropped license plate image: license_plate_img = results.crop[0].cpu().numpy()

Example Code

Here is an example code snippet to get you started:

import cv2
import torch

# Load the model
model = torch.hub.load('ultralytics/yolov8', 'custom', path='path/to/model.pt')

# Load the input image
img = cv2.imread('path/to/image.jpg')

# Preprocess the input image
img = cv2.resize(img, (640, 480))

# Run the model
results = model(img)

# Extract the cropped license plate image
license_plate_img = results.crop[0].cpu().numpy()
cv2.imwrite('license_plate.jpg', license_plate_img)
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Examples
Inference API (serverless) is not available, repository is disabled.