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] |
Accuracy[2] | Dataset |
---|---|---|---|---|
argentinian-plates-cnn-model |
2.1 | 476 | 94.05% | Non-synthetic, plates up to 2020. Dataset arg_plate_dataset.zip. |
argentinian-plates-cnn-synth-model |
2.1 | 476 | 94.19% | Plates up to 2020 + synthetic plates. Dataset arg_plate_dataset_plus_synth.zip. |
european-plates-mobile-vit-v2-model |
2.9 | 344 | 92.5%[3] | European plates (from +40 countries, trained on 40k+ plates). |
🆕🔥 global-plates-mobile-vit-v2-model |
2.9 | 344 | 93.3%[4] | Worldwide plates (from +65 countries, trained on 85k+ plates). |
[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.
[4] For detailed accuracy for each country see results.
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