Skip to content

About

YOLOv9-based Bangla license plate detection project for accurate vehicle plate localization using deep learning.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

35 Commits

Folders and files

Repository files navigation

Bangla License Plate Detection using YOLOv9

Single-pass detection of Bangladeshi (Bangla) vehicle license plates with YOLOv9-C, trained from scratch on Bangla LPDB-A

Python PyTorch YOLOv9 Ultralytics Kaggle mAP50 License

Abstract

Automatic license plate recognition (ALPR) is a core building block of intelligent transportation systems, but Bangla plates are harder than Latin-script plates: they contain two text lines, Bangla words, letters and digits, and many different layouts and vehicle types. This project trains YOLOv9-C (Wang et al., ECCV 2024) to localise Bangla license plate regions using the public Bangla LPDB-A dataset (Shomee & Sams, DICTA 2021). After merging both parts of the dataset (4,592 images, 24,174 boxes) and training for 50 epochs on a single Tesla T4, the best model reaches precision 0.980, recall 0.976, mAP@50 0.992 and mAP@50-95 0.645 on the validation split, at about 14 ms per image. The repository contains the full Kaggle notebook, reusable scripts for data preparation, training and inference, all training graphs and a critical discussion of the results and their limitations.

Highlights

Task Object detection of Bangla license plate regions (1 class)
Model YOLOv9-C, 25.5 M parameters, 103.7 GFLOPs, trained from scratch
Data Bangla LPDB-A, 4,592 images / 24,174 boxes, split 70 / 20 / 10
Result mAP@50 0.992, mAP@50-95 0.645, F1 0.98 (validation)
Speed 12.7 ms inference per 640 px image on a Tesla T4
Next step OCR of the detected plate for full Bangla ALPR

1. Introduction

License plate detection is the first stage of an ALPR pipeline: detect → crop → recognise characters. Its quality limits everything that follows, because a missed or badly cropped plate cannot be read. Applications include traffic law enforcement, toll collection, smart parking, access control and vehicle tracking.

Bangladeshi plates follow the BRTA standard: the top line holds the city name, "Metro" and a vehicle class letter, and the bottom line holds the class number and vehicle number in Bangla digits. Detection must cope with motion blur, dirty or damaged plates, uneven lighting, varied camera angles and the wide range of vehicles on Bangladeshi roads.

Layout of a BRTA standard Bangladeshi license plate

Research question: how well does a modern single-stage detector, YOLOv9-C trained from scratch, localise Bangla license plate regions on a public benchmark dataset with modest compute (one free Kaggle GPU)?

Related work

Work Approach Notes
Rahman et al., 2018 (arXiv:1809.00905) CNN-based Bangla license plate recognition Early CNN system with its own collected dataset of plate images
Shomee & Sams, DICTA 2021 Multi-step pipeline: YOLOv4 detection → ESRGAN super-resolution → YOLO character recognition Introduced Bangla LPDB-A, the dataset used here
Cognition.ai, 2022 (Zenodo 7110401) Bangla License Plate Dataset 2.5k 2,519 images of legible Bangla plates for detection and recognition
Hasin, 2026 (arXiv:2603.10267) YOLO detection + vision–language OCR Recent work moving recognition to transformer-based OCR
This project YOLOv9-C (PGI + GELAN), single class Newer detector generation than YOLOv4; detection stage only

YOLOv9 introduces Programmable Gradient Information (PGI), an auxiliary reversible branch that keeps gradients reliable through deep networks, and the GELAN backbone for better accuracy per parameter. Both make it attractive for training from scratch on a small domain-specific dataset. See docs/MODEL.md for details.

2. Dataset

Bangla LPDB-A has two parts: (1) full vehicle images with one box per plate, and (2) cropped plates annotated at word, letter and digit level (102 classes). Both parts were merged and all labels were mapped to a single class, license_plate.

Split Images Boxes
Train (70 %) 3,214 17,069
Validation (20 %) 918 4,841
Test (10 %) 460 2,264
Total 4,592 24,174

Images and boxes per split

More details, including an important note on what the merged labels contain: docs/DATASET.md.

3. Methodology

flowchart LR
    A[Bangla LPDB-A<br/>part 1 + part 2] --> B[Merge and<br/>rename files]
    B --> C[Random split<br/>70 / 20 / 10]
    C --> D[Relabel to class 0<br/>validate boxes]
    D --> E[Train YOLOv9-C<br/>50 epochs, 640 px]
    E --> F[Validate and<br/>select best.pt]
    F --> G[Detect plates<br/>crop regions]
    G -.-> H[OCR<br/>future work]
Loading

Training setup

Setting Value
Framework Ultralytics 8.4.58, PyTorch 2.12, Python 3.12
Hardware Kaggle, NVIDIA Tesla T4 (15 GB)
Model yolov9c.yaml, from scratch
Epochs / image size / batch 50 / 640 / 16
Optimiser AdamW, lr 0.002, momentum 0.9, weight decay 0.0005, 3 warm-up epochs
Augmentation Mosaic (off for the last 10 epochs), horizontal flip 0.5, HSV jitter, translate 0.1, scale 0.5, RandAugment, random erasing 0.4
Mixed precision AMP enabled
Loss CIoU box loss + BCE class loss + Distribution Focal Loss
Training time 2.5 hours

The complete configuration is in results/training_config.yaml.

4. Results

Metrics of the best checkpoint (epoch 46) on the validation split:

Metric Value
Precision 0.980
Recall 0.976
F1 0.978 (best 0.98 at confidence 0.45)
mAP@50 0.992
mAP@50-95 0.645
Inference speed (T4) 12.7 ms / image (~69 FPS end-to-end)

Confusion matrix: 4,777 true positives, 64 false negatives and 142 false positives, so 98.7 % of the ground-truth boxes are detected.

Learning curves

Validation precision, recall and mAP per epoch

mAP@50 crosses 0.95 by epoch 8 and saturates near 0.99; mAP@50-95 keeps rising slowly until the end, which suggests that longer training could still tighten the boxes.

Ultralytics training summary

Evaluation curves

Precision–Recall F1–Confidence
PR curve F1 curve
Precision–Confidence Recall–Confidence
Precision curve Recall curve
Confusion matrix Normalised confusion matrix
Confusion matrix Normalised confusion matrix

Sample plates from the dataset

Sample 1 Sample 2 Sample 3

A full analysis with the per-epoch table is in docs/RESULTS.md.

5. Discussion and Limitations

These results should be read with the following points in mind:

  1. Label granularity. Part 2 of LPDB-A is annotated at word, letter and digit level. Mapping all 102 classes to one license_plate class means most training boxes (about 5.3 per image) are text regions inside a plate, not whole plates. The model therefore learns "plate text region" as well as "plate", and the very high mAP@50 partly reflects these easy, high-contrast regions on cropped plates.
  2. Validation-only evaluation. Reported metrics come from the validation split, which was also used to pick the best epoch. The 460-image test split was created but not evaluated in the notebook. src/train.py now runs a test-split evaluation automatically.
  3. Reproducibility. The notebook split used random.shuffle without a seed. src/prepare_dataset.py uses a fixed seed (42), so its split differs from the original run but is repeatable.
  4. Possible leakage. Part 2 includes plates cropped from part 1 images, so the same physical plate can appear in both train and validation.
  5. Strict-IoU localisation. mAP@50-95 (0.645) is much lower than mAP@50 (0.992): boxes are found but are not always tight, which matters for the OCR stage.
  6. OCR not evaluated. Tesseract (ben+eng) was installed and run on sample plates, but recognition accuracy was not measured.

6. Future Work

  • Train a plate-only detector on part 1 (--plates-only) and compare it with the merged-label model
  • Report metrics on the held-out test split and with grouped splits that keep each plate in one split
  • Start from COCO-pretrained yolov9c.pt and compare with training from scratch
  • Add a second-stage recogniser using part 2's 102 classes or a transformer OCR, and report character / plate accuracy
  • Test robustness on night, rain, blur and low-resolution images
  • Export to ONNX / TensorRT and build a real-time demo with Streamlit or Flask

7. How to Reproduce

# 1. Clone and install
git clone https://github.com/feroz-afm/Bangla-License-Plate-Detection-using-YOLOv9.git
cd Bangla-License-Plate-Detection-using-YOLOv9
pip install -r requirements.txt

# 2. Download Bangla LPDB-A (Zenodo 4718238 or Kaggle "bangla-lpdb-a"), then prepare it
python src/prepare_dataset.py --src "path/to/Bangla LPDB - A" --out data/LPDB_split

# 3. Train (same settings as the reported run) and evaluate on the test split
python src/train.py --data configs/data.yaml

# 4. Detect plates (and optionally read them with Tesseract OCR)
python src/predict.py --weights runs/detect/yolov9c_bangla_lp/weights/best.pt --source path/to/images --ocr

# 5. Re-draw the summary graphs
python scripts/plot_metrics.py

Prefer the original workflow? Open notebooks/bangla-license-plate-detection-yolov9.ipynb on Kaggle with a GPU and the bangla-lpdb-a dataset attached.

8. Repository Structure

Bangla-License-Plate-Detection-using-YOLOv9/
├── notebooks/
│   └── bangla-license-plate-detection-yolov9.ipynb   # full Kaggle notebook with outputs
├── src/
│   ├── prepare_dataset.py    # merge, split (seeded) and relabel LPDB-A
│   ├── train.py              # train YOLOv9-C and evaluate on the test split
│   └── predict.py            # detect, crop and optionally OCR plates
├── scripts/
│   └── plot_metrics.py       # draw epoch_metrics, epoch_losses and dataset_split graphs
├── configs/
│   └── data.yaml             # dataset config (1 class: license_plate)
├── results/
│   ├── metrics_per_epoch.csv # validation metrics and training losses for all 50 epochs
│   └── training_config.yaml  # exact settings of the reported run
├── assets/
│   ├── graphs/               # all training and evaluation graphs
│   ├── samples/              # sample plate images
│   └── brta_license_plate_layout.png
├── docs/
│   ├── MODEL.md              # YOLOv9 architecture and configuration
│   ├── DATASET.md            # dataset description and pre-processing
│   └── RESULTS.md            # detailed results and analysis
├── requirements.txt
├── CITATION.cff
└── LICENSE

Technologies Used

Python · PyTorch · Ultralytics YOLOv9 · OpenCV · NumPy · Pandas · Matplotlib · Tesseract OCR · Kaggle Notebooks (Tesla T4)

References

  1. C.-Y. Wang, I-H. Yeh and H.-Y. M. Liao, "YOLOv9: Learning What You Want to Learn Using Programmable Gradient Information," ECCV 2024. arXiv:2402.13616 · code
  2. H. H. Shomee and A. Sams, "License Plate Detection and Recognition System for All Types of Bangladeshi Vehicles Using Multi-step Deep Learning Model," DICTA 2021, pp. 1–7. doi:10.1109/DICTA52665.2021.9647284
  3. Bangla LPDB-A dataset, Zenodo, 2021. zenodo.org/records/4718238
  4. M. M. S. Rahman, M. S. Nasrin, M. Mostakim and M. Z. Alom, "Bangla License Plate Recognition Using Convolutional Neural Networks (CNN)," 2018. arXiv:1809.00905
  5. Cognition.ai, "Bangla License Plate Dataset 2.5k," Zenodo, 2022. zenodo.org/records/7110401
  6. N. Hasin, "A Robust Deep Learning Framework for Bangla License Plate Recognition Using YOLO and Vision–Language OCR," 2026. arXiv:2603.10267
  7. G. Jocher et al., Ultralytics YOLO. github.com/ultralytics/ultralytics

Citation

If this project helps your work, please cite it using CITATION.cff (GitHub's Cite this repository button) and cite the YOLOv9 and Bangla LPDB-A papers above.

License

Code is released under the MIT License. The Bangla LPDB-A dataset belongs to its authors; follow their terms and cite their paper when you use it.

Author

Md Feroz Ahmed · CSE, Pundra University of Science & Technology · GitHub @feroz-afm

⭐ If you find this project useful, please give it a star.

About

YOLOv9-based Bangla license plate detection project for accurate vehicle plate localization using deep learning.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages