CoolFace
Modelpublic

DFKonHF/yolov11n_car_plates_detector

sourceHugging Faceagpl-3.0updated 6d agoView on Hugging Face
0likes68downloads
Model Card

๐Ÿค– [yolov11ncarplates_detector]

๐Ÿ“ Description

This model is aimed to detect car registration plates and based on ultralytic's yolov11. It can be used as a good start for training a more sophisticated CV system.

๐Ÿ—‚๏ธ Dataset

The custom dataset is based on 7091 open source images that were labeled mostly manually and partly automatically using open-source foundation models. The car plates are mostly from CH, HK, MO regions, but also include a small fraction of other types for diversity. It contains 11.87% images without target objects in order to increase it's ability to distinguish background from the objects. Images were split into train/val/test in 80/10/10 proportion with stratification with respect to the presence or absence of the target objects. The dataset includes photos in challenging situations: multiple plates on a single car, cases when only a fraction of a number is seen (up to a single symbol), motion blurred, and sometimes augmentations where the number is erased or altered.

๐ŸŽฏ Most important metrics

Metrictrainvaltest
Precision0.98740.97540.9743
Recall0.98950.97110.9653
mAP@500.99340.99010.9885
mAP@50-950.92380.88450.8849

๐Ÿ“ˆ Some training curves

<table> <tr> <td align="center"> <img src="lossplot.png" width="95%" alt="train/val total loss versus epoch"> <br><b>Training Loss</b> </td> <td align="center"> <img src="map5095_plot.png" width="95%" alt="mAP50-95 versus epoch"> <br><b>mAP50-95 Metric</b> </td> </tr> </table>

๐Ÿ–ผ๏ธ Examples: prediction during validation

<p align="center"> <img src="valbatch0pred.jpg" width="95%" alt="val batch prediction"> </p>

๐Ÿ“‹ Requirements

Usage Example was tested with:

  • โ€”ultralytics version 8.3.180
  • โ€”huggingface_hub version 0.36.0
  • โ€”cv2 version 4.10.0

Installing dependencies:

bash
pip install -r requirements.txt

๐Ÿš€ Try demo now in Spaces right now! ![Hugging Face Spaces](https://huggingface.co/spaces/DFKonHF/yolov11ncarplatesdetectordemo)

๐Ÿš€ Usage Example

python
from ultralytics import YOLO
from huggingface_hub import hf_hub_download
import cv2 

# downloading weights
weights_path = hf_hub_download(
    repo_id="DFKonHF/yolov11n_car_plates_detector",
    filename="best_n.pt",
    repo_type="model"
)
# instantiating a model
model = YOLO(weights_path)
# setting class name
model.model.names = {0: 'plate'}

# Set input/output image paths
input_img_path = 'your/path/to_image.jpg'
output_img_path = 'annotated_image.jpg'
# Inference
results = model(input_img_path)

# Annotate image with predictions (bbox + label - "{class_name} {conf}")
for result in results:
    # Get annotated image with boxes and labels
    annotated_img = result.plot()
    
    # Saving annotated image
    cv2.imwrite(output_img_path, annotated_img)

โš ๏ธ Limitations

  • โ€”Trained primarily on CH/HK plates; performance may drop on other formats
  • โ€”Extremely small plates may be missed
  • โ€”Heavy motion blur or extreme angles can reduce accuracy
  • โ€”Does not perform OCR โ€” only detects plate location