CoolFace
Modelpublic

devxyasir/florence-finetuned-license-plate-detection

sourceHugging Facemitupdated 1y agoView on Hugging Face
1likes52downloads
Model Card

Number Plate Detection & Recognition Model (Florence-2 Fine-Tuned)

Model Overview

This model is a fine-tuned version of Microsoft's Florence-2 Large (florence2-base-ft) adapted for automatic number plate detection and recognition. It processes vehicle images to localize number plates with bounding boxes and applies OCR to extract the license plate text, enabling high-accuracy license plate reading.

The model leverages transformer-based vision-language architectures and is trained on a custom dataset of vehicle images with annotated license plates.


Uses

Intended Use Cases

  • —Real-time traffic monitoring and control systems
  • —Automated toll collection and parking management
  • —Law enforcement for vehicle identification
  • —Smart city infrastructure and vehicle tracking solutions

Potential Downstream Applications

  • —Region-specific fine-tuning to handle various license plate formats worldwide
  • —Integration with object detection pipelines for multi-object recognition tasks
  • —Use in embedded devices with GPU acceleration for rapid inference

Limitations & Out-of-Scope Uses

  • —Not optimized for general object detection beyond license plates
  • —Performance may degrade with poor lighting, motion blur, or occluded plates
  • —Does not reliably recognize handwritten or decorative/customized plates
  • —Model accuracy is affected by the quality and diversity of training data

Dataset Information

  • —Dataset source: Custom-labeled dataset with 6,176 training, 1,765 validation, and 882 test images
  • —Annotations: Each sample includes image metadata, bounding boxes for license plates, and OCR-extracted text labels
  • —Data diversity: Various lighting conditions, vehicle angles, and plate styles
  • —Preprocessing: Images resized and normalized to match Florence-2 input requirements; bounding boxes used to isolate plate regions

Training Details

  • —Base model: florence2-base-ft
  • —Fine-tuning: Combined bounding box detection with OCR text extraction
  • —Hyperparameters:
  • —Epochs: 10 (configurable)
  • —Optimizer: AdamW
  • —Loss: Cross-entropy
  • —Batch size & learning rate: Adjusted per hardware capability
  • —Hardware: GPU-accelerated training (specify GPU model)
  • —Training duration: 6 hrs (Colab GPU)
  • —Model size: 1.08GB

Evaluation

Evaluation Notes

  • —High accuracy on clear, high-quality images
  • —Performance declines on low-resolution, occluded, or angled plates
  • —Future work: augment dataset for robustness and support non-standard plates

Usage

Load and run inference with the model as follows:

python
from transformers import AutoProcessor, AutoModelForObjectDetection
from PIL import Image
import torch

device = "cuda" if torch.cuda.is_available() else "cpu"

model_name = "devxyasir/florence-finetuned-license-plate-detection"
processor = AutoProcessor.from_pretrained(model_name)
model = AutoModelForObjectDetection.from_pretrained(model_name).to(device)

def detect_number_plate(image_path):
    image = Image.open(image_path).convert("RGB")
    inputs = processor(images=image, return_tensors="pt").to(device)
    outputs = model(**inputs)
    # Process outputs (bounding boxes, scores, OCR text) as needed
    return outputs

result = detect_number_plate("path/to/car_image.jpg")
print(result)

Model Limitations and Bias

  • —Model may favor license plate styles prevalent in the training dataset
  • —Not guaranteed to perform equally across all geographic regions
  • —Sensitive to image quality and environmental factors
  • —Bias can be mitigated by expanding training datasets and applying data augmentation

Environmental Impact

  • —Training performed on \[GPU model] over \[total training hours]
  • —Estimated carbon footprint: \[Insert estimate if available]
  • —Recommendations for future improvements include model pruning and mixed-precision training

Citation

If you use this model, please cite:

bibtex
@article{your_paper_2025,
  title={Fine-tuning Florence-2 for License Plate Detection and Recognition},
  author={Muhammad Yasir},
  year={2024}
}

Authors & Contact

Muhammad Yasir AI/ML Engineer | Web & Security Developer 📧 jamyasir0534@gmail.com 🌐 Portfolio 🤖 Hugging Face 💻 GitHub


For further questions, please open an issue or contact the author directly.