Fast & Lightweight License Plate OCR¶
FastPlateOCR is a lightweight and fast OCR framework for license plate text recognition. You can train models from scratch or use the trained models for inference.
The idea is to use this after a plate object detector, since the OCR expects the cropped plates.
Features¶
- Keras 3 Backend Support: Compatible with TensorFlow, JAX, and PyTorch backends 🧠
- Augmentation Variety: Diverse augmentations via Albumentations library 🖼️
- Efficient Execution: Lightweight models that are cheap to run 💰
- ONNX Runtime Inference: Fast and optimized inference with ONNX runtime ⚡
- User-Friendly CLI: Simplified CLI for training and validating OCR models 🛠️
- Model HUB: Access to a collection of pre-trained models ready for inference 🌟
Model Zoo¶
We currently have the following available models:
Model Name | Time b=1 (ms)[1] |
Throughput (plates/second)[1] |
Dataset | Accuracy[2] | Dataset |
---|---|---|---|---|---|
argentinian-plates-cnn-model |
2.1 | 476 | arg_plate_dataset.zip | 94.05% | Non-synthetic, plates up to 2020. |
argentinian-plates-cnn-synth-model |
2.1 | 476 | arg_plate_dataset.zip | 94.19% | Plates up to 2020 + synthetic plates. |
🆕 european-plates-mobile-vit-v2-model |
2.9 | 344 | - | 92.5%[3] | European plates (+40 countries). |
[1] Inference on Mac M1 chip using CPUExecutionProvider. Utilizing CoreMLExecutionProvider accelerates speed by 5x in the CNN models.
[2] Accuracy is what we refer as plate_acc. See metrics section.
[3] For detailed accuracy for each country see results and the corresponding val split used.
Reproduce results.
Calculate Inference Time:from fast_plate_ocr import ONNXPlateRecognizer
m = ONNXPlateRecognizer("argentinian-plates-cnn-model")
m.benchmark()
pip install fast-plate-ocr[train]
curl -LO https://github.com/ankandrew/fast-plate-ocr/releases/download/arg-plates/arg_cnn_ocr_config.yaml
curl -LO https://github.com/ankandrew/fast-plate-ocr/releases/download/arg-plates/arg_cnn_ocr.keras
curl -LO https://github.com/ankandrew/fast-plate-ocr/releases/download/arg-plates/arg_plate_benchmark.zip
unzip arg_plate_benchmark.zip
fast_plate_ocr valid \
-m arg_cnn_ocr.keras \
--config-file arg_cnn_ocr_config.yaml \
--annotations benchmark/annotations.csv