MKgoud's picture
Update README.md
afc8888 verified
|
raw
history blame
3.56 kB
metadata
license: mit
metrics:
  - accuracy
  - precision
  - recall
  - confusion_matrix
tags:
  - License-Plate-Character-Detector
  - Character recognition
  - ocr
  - YOLOv8m
pipeline_tag: object-detection

License Plate Character Detection Model

This repository contains a YOLOv8-based model for detecting characters in license plates. The model is trained to identify and localize individual characters on vehicle license plates, which can be useful for various applications such as automated parking systems, traffic monitoring, and vehicle identification.

Model Details

  • Model Architecture: YOLOv8
  • Task: Character detection in license plates
  • Performance Metrics: Accuracy, Precision, Recall

Visual Demonstration

val_batch2_labels.jpg

This image demonstrates the model's ability to detect and localize individual characters on a license plate. The bounding boxes show the detected characters.

Installation

To use this model, you'll need to have Python installed along with the following dependencies:

pip install ultralytics
pip install torch
pip install huggingface_hub

Usage

Here's a basic example of how to use the model:

from ultralytics import YOLO
import cv2
import numpy as np

# Load the YOLOv8 model
model = YOLO('path/to/your/best.pt')  # Load your trained model

# Read the image
image = cv2.imread('path/to/your/image.jpg')

# Run inference on the image
results = model(image)

# Process the results
for result in results:
    boxes = result.boxes.cpu().numpy()  # Get bounding boxes
    for box in boxes:
        # Get box coordinates
        x1, y1, x2, y2 = box.xyxy[0]
        x1, y1, x2, y2 = int(x1), int(y1), int(x2), int(y2)
        
        # Draw bounding box
        cv2.rectangle(image, (x1, y1), (x2, y2), (0, 255, 0), 2)
        
        # If you have class names, you can add them to the image
        if box.cls is not None:
            label = f"{result.names[int(box.cls[0])]} {box.conf[0]:.2f}"
            cv2.putText(image, label, (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0), 2)

# Save or display the result
cv2.imwrite('output_image.jpg', image)
# Or to display (if running in an environment with GUI):
# cv2.imshow('Result', image)
# cv2.waitKey(0)
# cv2.destroyAllWindows()

Training

If you want to train the model on your own dataset:

  1. Prepare your dataset in the appropriate format for YOLOv8.
  2. Use the YOLOv8 training script with your custom configuration.

Model Performance

Accuracy

Our model achieves an overall accuracy of [97.12]% on the test set. Here's a breakdown of accuracy for each character: labels.jpg

Confusion Matrix

Below is the confusion matrix for our model, showing its performance across all characters:

confusion_matrix.png

This matrix provides insights into which characters are most often confused with each other, helping to identify areas for potential improvement.

Additional Metrics

results.png

  • Precision: [99.3]%
  • Recall: [93.45]%
  • mAP (mean Average Precision): [97.544]%

For any questions or feedback, please open an issue in this repository.