Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- paddlepaddle
|
| 5 |
+
- ocr
|
| 6 |
+
- car-plate-detection
|
| 7 |
+
- ppocr
|
| 8 |
+
- computer-vision
|
| 9 |
+
- object-detection
|
| 10 |
+
datasets:
|
| 11 |
+
- andrewmvd/car-plate-detection
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Car License Plate Detection (PP-OCRv5 Mobile)
|
| 15 |
+
|
| 16 |
+
This repository contains a **PP-OCRv5 Mobile** detection model fine-tuned for **Car License Plate Detection**. The model is built using the [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR) framework and provides improved accuracy and efficiency over v4.
|
| 17 |
+
|
| 18 |
+
## Model Details
|
| 19 |
+
- **Model Type**: Text Detection (optimized for license plates)
|
| 20 |
+
- **Algorithm**: DB (Differentiable Binarization)
|
| 21 |
+
- **Architecture**: PP-OCRv5 Mobile
|
| 22 |
+
- **Backbone**: PPLCNetV3
|
| 23 |
+
- **Training Epochs**: 10
|
| 24 |
+
- **Input Shape**: [3, 640, 640]
|
| 25 |
+
|
| 26 |
+
## Dataset
|
| 27 |
+
The model was trained on the [Car License Plate Detection](https://www.kaggle.com/datasets/andrewmvd/car-plate-detection) dataset from Kaggle, which consists of images with bounding box annotations for license plates.
|
| 28 |
+
|
| 29 |
+
## How to Use
|
| 30 |
+
|
| 31 |
+
### 1. Installation
|
| 32 |
+
To use this model, you need to install `paddlepaddle` and `paddleocr`:
|
| 33 |
+
|
| 34 |
+
```bash
|
| 35 |
+
pip install paddlepaddle paddleocr
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
### 2. Inference Code
|
| 39 |
+
You can use the following snippet to run detection on an image:
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
from paddleocr import PaddleOCR
|
| 43 |
+
from pathlib import Path
|
| 44 |
+
|
| 45 |
+
# Path to the directory containing the downloaded model files
|
| 46 |
+
MODELS_DIR = Path("path/to/models")
|
| 47 |
+
|
| 48 |
+
# Initialize the OCR engine
|
| 49 |
+
pp_v5 = PaddleOCR(
|
| 50 |
+
use_textline_orientation=True,
|
| 51 |
+
lang='en',
|
| 52 |
+
device='cpu',
|
| 53 |
+
text_detection_model_dir=str(MODELS_DIR / "ppocr_v5"),
|
| 54 |
+
text_detection_model_name="PP-OCRv5_mobile_det"
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
img_path = 'car_image.jpg'
|
| 58 |
+
result = pp_v5.ocr(img_path, det=True, rec=False)
|
| 59 |
+
|
| 60 |
+
# Visualize results
|
| 61 |
+
for line in result:
|
| 62 |
+
for box in line:
|
| 63 |
+
print(f"Detected License Plate Box: {box}")
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
## Repository Structure
|
| 67 |
+
- `config.yml`: Training configuration.
|
| 68 |
+
- `inference.pdiparams`: Model weights for inference.
|
| 69 |
+
- `inference.yml`: Inference-specific configuration.
|
| 70 |
+
- `best_accuracy.pdparams`: Best model weights during training.
|
| 71 |
+
- `run_summary.json`: Summary of the training run.
|
| 72 |
+
|
| 73 |
+
## Credits
|
| 74 |
+
- **Original Dataset**: [Andrew MVD (Kaggle)](https://www.kaggle.com/andrewmvd)
|
| 75 |
+
- **Framework**: [PaddleOCR (Baidu)](https://github.com/PaddlePaddle/PaddleOCR)
|