Instructions to use subash1652007/indian-plate-ocr with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use subash1652007/indian-plate-ocr with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("image-to-text", model="subash1652007/indian-plate-ocr")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("subash1652007/indian-plate-ocr", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Indian plate OCR
Non-commercial research and educational use only. See the Licence section.
Two models for reading Indian vehicle number plates:
| File | What it is |
|---|---|
yolo_best.pt |
YOLO plate detector (Ultralytics, AGPL-3.0) |
trocr_plate/ |
microsoft/trocr-small-printed fine-tuned on Indian plate crops |
Full pipeline (detection, tracking, format correction, voting across video frames): https://github.com/subash9940/indian-number-plate-recognition
Usage
git clone https://github.com/subash9940/indian-number-plate-recognition.git
cd indian-number-plate-recognition
pip install -r requirements.txt
python anpr.py --video your_video.mp4
The script downloads these weights automatically. To use the reader alone on a cropped plate image:
from huggingface_hub import snapshot_download
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
from PIL import Image
path = snapshot_download("subash1652007/indian-plate-ocr")
proc = TrOCRProcessor.from_pretrained(f"{path}/trocr_plate")
model = VisionEncoderDecoderModel.from_pretrained(f"{path}/trocr_plate").eval()
img = Image.open("plate_crop.jpg").convert("RGB")
ids = model.generate(proc(img, return_tensors="pt").pixel_values, max_length=20, num_beams=3)
print(proc.batch_decode(ids, skip_special_tokens=True)[0])
Training
- Reader: fine-tuned on plate crops from the Kaggle dataset Indian vehicle license plate dataset by Sai Sirisha N and collaborators. About 1,500 training crops with ground-truth plate text (8โ11 characters), 15 epochs, lr 4e-5, colour/blur/box-jitter augmentation. Validation split by source video.
- Detector: trained on a Roboflow Universe "Indian License Plate Detection" dataset (YOLO format).
Evaluation
Exact match on 190 held-out plate crops (ground-truth boxes):
| Reader | Exact match |
|---|---|
| EasyOCR (raw) | 22% |
| EasyOCR + format post-processing | 31% |
| This TrOCR model | 67% |
The 67% is the best of 15 epochs, selected on the same small validation set, so it is optimistic (individual epochs ranged from 44% to 67%).
Limitations
- Indian plates only; other formats will be misread.
- Trained on 8โ11 character plates. Two-line, blurred, low-resolution or partly hidden plates are weak spots.
- Outputs can be wrong even when they look like valid plates. Treat results as suggestions, not evidence.
- License plates are personal data in many jurisdictions. Use only on footage you are allowed to process.
Licence
trocr_plate/: trained on a dataset listed on Kaggle as CC BY-NC-ND (Attribution-NonCommercial-NoDerivatives). These weights are shared for non-commercial research and educational use only. Do not use them commercially.yolo_best.pt: AGPL-3.0 (Ultralytics YOLO), trained on a Roboflow dataset with its own terms.- The training images come from various sources and may belong to third parties. No warranty is given for any output.
Model tree for subash1652007/indian-plate-ocr
Base model
microsoft/trocr-small-printed