Nepali embossed plate character classifier
A small CNN (1.4 MB, 36 classes) that labels single characters on Nepal's embossed licence plates, with a one-file script (read_embossed.py) that cuts a plate crop into characters and reads it.
Nepal's newer embossed plates use Latin letters and digits (B AD 1484). Public Nepali plate models are trained on the older Devanagari plates and read embossed ones as nothing, or as a few misread digits. This model fills that gap.
Use
pip install torch safetensors opencv-python numpy
python read_embossed.py plate.jpg
from read_embossed import Reader
reader = Reader()
print(reader.read(plate_bgr)) # e.g. "BAD1484"
Give it a crop of the plate itself. Finding the plate in a photo is a separate step; any plate detector works. The province word above the number (e.g. BAGMATI) is not read.
How it reads a plate
- Threshold the plate (dark characters on a white plate) and take the dark blobs shaped like characters.
- Drop the red Nepal flag, small stickers and the province word, which are shorter than the registration characters.
- Put the pieces in reading order, allowing for tilted plates and two-line motorcycle plates.
- Label each piece with the CNN, allowing only Latin letters and digits.
Training data
- ishworsubedii/nepalese-license-plate-character-dataset (Apache-2.0)
- kshitizgajurel042/individual-character-images-of-nepali-lp (MIT)
- theciceerguy/embossed-number-plate-detection-nepal-dataset (MIT)
- 399 characters cut from 57 real embossed plates in nepali-private-license-plates (CC-BY-4.0). That dataset boxes each plate but has no plate text, so its 115 embossed photos were transcribed and checked by hand; 110 are usable embossed Nepali plates, split by car into 80 for training and 30 held out for testing. Only the 80 plates that split cleanly into as many pieces as their text has characters give character crops (560 in all): 57 of the 80 training plates (399 crops) and 23 of the 30 test plates (161 crops, used only for testing).
Exact duplicate images were removed. The classes include the Devanagari digits and seven zone syllables (BA, PA, CHA, KHA, KO, ME, PRA) because the public crop sets contain them, but read_embossed.py only allows Latin letters and digits.
Results
Tested on cars that were never in training (the real plates are split by car, since several cars were photographed twice):
| Test | Result |
|---|---|
| Single characters cut from real plates (161) | 92.5% correct |
| Whole plates, cut by their labelled box (30) | 53% read exactly |
| Whole plates, through a full detector pipeline (30) | 50% read exactly, 20% character error rate |
| Clean embossed crops from the theciceerguy test split (559) | 99.6% correct |
Before adding the real plate crops, the same network got 70.8% of real characters and 20% of plates right: models trained only on clean public crops do much worse on real plates than their own test sets suggest.
Limits
- 30 test plates is a small sample; 50% could plausibly be anywhere from about 35% to 65%.
- All real plates are parked private cars in Kathmandu photographed up close, not traffic-camera footage.
- 30 of the 110 real plates still split into the wrong number of pieces; most errors come from that step, not from labelling characters.
- Letters I, O, Q, U, V, W, X and Y never appear in the training data and cannot be predicted.