Instructions to use devxyasir/florence-finetuned-license-plate-detection with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use devxyasir/florence-finetuned-license-plate-detection with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="devxyasir/florence-finetuned-license-plate-detection", trust_remote_code=True)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("devxyasir/florence-finetuned-license-plate-detection", trust_remote_code=True) model = AutoModelForMultimodalLM.from_pretrained("devxyasir/florence-finetuned-license-plate-detection", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use devxyasir/florence-finetuned-license-plate-detection with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "devxyasir/florence-finetuned-license-plate-detection" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "devxyasir/florence-finetuned-license-plate-detection", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/devxyasir/florence-finetuned-license-plate-detection
- SGLang
How to use devxyasir/florence-finetuned-license-plate-detection with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "devxyasir/florence-finetuned-license-plate-detection" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "devxyasir/florence-finetuned-license-plate-detection", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "devxyasir/florence-finetuned-license-plate-detection" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "devxyasir/florence-finetuned-license-plate-detection", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use devxyasir/florence-finetuned-license-plate-detection with Docker Model Runner:
docker model run hf.co/devxyasir/florence-finetuned-license-plate-detection
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:
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:
@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.
- Downloads last month
- 54
Model tree for devxyasir/florence-finetuned-license-plate-detection
Base model
microsoft/Florence-2-base-ft