--- library_name: transformers tags: [number plate detection, object detection, OCR, fine-tuned] --- # Model Card for Number Plate Detection Model ## Model Details ### Model Description This model is a fine-tuned version of `florence-2-large-nsfw-pretrain` for **automatic number plate detection and recognition**. It is trained on a labeled dataset containing images of vehicles with bounding box annotations for number plates. The model integrates **OCR-based text extraction** to recognize license plate numbers from detected regions. - **Developed by:** [Jam Yasir/DevSecure] - **Shared by [optional]:** [jamyasir] - **Model type:** Vision-Language Transformer (Florence-2 based) - **Language(s) (NLP):** English (for text processing) - **License:** [Specify License, e.g., MIT, Apache 2.0] - **Finetuned from model:** `florence-2-large-nsfw-pretrain` ## Uses ### Direct Use This model is intended for **number plate detection and recognition**. It can be used in: - **Traffic monitoring systems** - **Automated toll collection** - **Law enforcement applications** - **Vehicle tracking systems** - **Smart city applications** ### Downstream Use - Can be fine-tuned for **different regions/countries** to adapt to varying number plate formats. - Can be integrated into **real-time object detection pipelines**. ### Out-of-Scope Use - Not designed for **general object detection** beyond number plates. - Performance may degrade on **blurred, low-resolution, or occluded plates**. - Not suitable for **handwritten or custom number plates**. ## Bias, Risks, and Limitations - **Bias:** Model performance might be biased towards the dataset used for training. - **Limitations:** - May fail under poor lighting conditions. - Might not generalize well to countries with **non-standardized number plate formats**. - **OCR accuracy** can vary based on font style, resolution, and image quality. ### Recommendations - Use **high-quality images** for best results. - Validate OCR outputs against a **secondary verification system**. - Consider **fine-tuning** the model with region-specific datasets. ## How to Get Started with the Model Use the code below to run inference: ```python from transformers import AutoProcessor, AutoModel from PIL import Image import torch # Load model and processor model = AutoModel.from_pretrained("your_model_repo") processor = AutoProcessor.from_pretrained("your_model_repo") def detect_number_plate(image): inputs = processor(images=image, return_tensors="pt").to("cuda" if torch.cuda.is_available() else "cpu") outputs = model(**inputs) return outputs image = Image.open("sample_car.jpg") result = detect_number_plate(image) print("Detected Number Plate:", result) ``` ## Training Details ### Training Data - **Dataset:** Custom-labeled dataset with **6,176 training samples**, **1,765 validation samples**, and **882 test samples**. - **Annotations:** Each image contains: - `image_id` - `image` - `width`, `height` - `objects` (bounding boxes, category, OCR-extracted text) ### Training Procedure #### Preprocessing - Images resized for **Florence-2** model compatibility. - OCR applied to bounding box regions for **auto-labeling**. #### Training Hyperparameters - **Epochs:** 10 (adjustable) - **Batch Size:** [Your batch size] - **Learning Rate:** [Your learning rate] - **Optimizer:** AdamW - **Loss Function:** Cross-entropy loss #### Speeds, Sizes, Times - **Training Duration:** [Total time] - **Model Checkpoint Size:** [Model size in MB] ## Evaluation ### Testing Data, Factors & Metrics #### Testing Data - Separate **test split (882 samples)** used for evaluation. - Datasets include different lighting, angles, and backgrounds. #### Factors - Performance evaluated across **varying image qualities** and **different plate designs**. #### Metrics | Metric | Score | |------------|--------| | Accuracy | [XX.XX%] | | Precision | [XX.XX%] | | Recall | [XX.XX%] | | F1-Score | [XX.XX%] | | mAP50-95 | [XX.XX%] | | mAP50 | [XX.XX%] | ### Results - Model shows **high accuracy** on clear and well-lit images. - Performance drops on **low-resolution and occluded plates**. #### Summary The model effectively detects number plates and extracts text but requires **further fine-tuning** for non-standardized plate formats. ## Model Examination - Interpretability studies to analyze OCR errors. - Further **data augmentation** suggested for robustness. ## Environmental Impact - **Hardware Type:** GPU (Specify Model) - **Hours used:** [Total training time] - **Cloud Provider:** [If applicable] - **Compute Region:** [Region] - **Carbon Emitted:** [Estimated emissions] ## Technical Specifications ### Model Architecture and Objective - Uses **Florence-2 Large** as backbone. - Fine-tuned for **bounding box detection + OCR text extraction**. ### Compute Infrastructure #### Hardware - **GPUs Used:** [Specify GPUs] - **RAM Requirements:** [Specify] #### Software - **Framework:** Hugging Face Transformers - **Training Pipeline:** PyTorch + custom fine-tuning script ## Citation ```bibtex @article{your_paper, title={Your Model Title}, author={Your Name}, journal={ArXiv}, year={2025}, eprint={Your Paper ID}, archivePrefix={arXiv}, primaryClass={cs.CV} } ``` ## More Information For updates and fine-tuning guides, check the [GitHub Repo](your_repo_link). ## Model Card Authors - **Author Name(s)**: [Your Name] - **Contact**: [Your Email/Twitter] --- This model card provides **comprehensive details** about the **number plate detection model**, covering **dataset, training, evaluation, and performance metrics**. 🚀 Let me know if you need further refinements! 🎯