Car License Plate Detection (PP-OCRv4 Mobile)
This repository contains a PP-OCRv4 Mobile detection model fine-tuned for Car License Plate Detection. The model is built using the PaddleOCR framework and is optimized for mobile and edge deployment.
Model Details
- Model Type: Text Detection (optimized for license plates)
- Algorithm: DB (Differentiable Binarization)
- Architecture: PP-OCRv4 Mobile
- Backbone: PPLCNetV3
- Training Epochs: 10
- Input Shape: [3, 640, 640]
Dataset
The model was trained on the Car License Plate Detection dataset from Kaggle, which consists of images with bounding box annotations for license plates.
How to Use
1. Installation
To use this model, you need to install paddlepaddle and paddleocr:
pip install paddlepaddle paddleocr
2. Inference Code
You can use the following snippet to run detection on an image:
from paddleocr import PaddleOCR
from pathlib import Path
# Path to the directory containing the downloaded model files
MODELS_DIR = Path("path/to/models")
# Initialize the OCR engine
pp_v4 = PaddleOCR(
use_textline_orientation=True,
lang='en',
device='cpu',
text_detection_model_dir=str(MODELS_DIR / "ppocr_v4"),
text_detection_model_name="PP-OCRv4_mobile_det"
)
img_path = 'car_image.jpg'
result = pp_v4.ocr(img_path, det=True, rec=False)
# Visualize results
for line in result:
for box in line:
print(f"Detected License Plate Box: {box}")
Repository Structure
config.yml: Training configuration.inference.pdiparams: Model weights for inference.inference.yml: Inference-specific configuration.best_accuracy.pdparams: Best model weights during training.run_summary.json: Summary of the training run.
Credits
- Original Dataset: Andrew MVD (Kaggle)
- Framework: PaddleOCR (Baidu)