AI / Computer Vision

License Plate Recognition (ALPR)

A system that automatically detects and reads license plates from photos - a custom fine-tuned detection model paired with OCR, built to strict software engineering practices.

Year2025
RoleDeveloper
Duration~2-3 weeks
PythonYOLOv8OpenCVEasyOCRONNXComputer Vision
License Plate Recognition (ALPR)
License Plate Recognition (ALPR)overview
Overview

The story behind the project

The challenge
Problem

Reading license plates from ordinary photos is harder than it looks - plates show up at different angles, distances and lighting, and off-the-shelf OCR systems notoriously confuse similar-looking characters (0/O, 1/I, 8/B, 2/Z).

The approach
Solution

I fine-tuned YOLOv8n (starting from COCO-pretrained weights) on the Poland Vehicle License Plate Dataset (Kaggle, by piotrstefaskiue - kaggle.com/datasets/piotrstefaskiue/poland-vehicle-license-plate-dataset) for 30 epochs at 640px to localize plates, then exported the model to ONNX for fast CPU inference. The cropped plate region is read with EasyOCR, and a normalization layer corrects characters OCR commonly confuses (0/O, 1/I, 8/B, 2/Z) before comparing results. A dedicated metrics module measures IoU and OCR accuracy on a 100-image test set.

88%
The result
Outcome

The model reached roughly 88% accuracy on the test set, measured by the custom metrics module combining detection IoU with OCR character accuracy across 100 test images.

Process

How it was designed

Step 01

Fine-Tuning YOLOv8n for Plate Detection

Started from COCO-pretrained weights and fine-tuned YOLOv8n on the Poland Vehicle License Plate Dataset (Kaggle, by piotrstefaskiue) for 30 epochs at 640px resolution to localize plates directly in the image.

  • YOLOv8n fine-tuned from COCO weights
  • 30 epochs at 640×640 resolution
  • Trained on the Poland Vehicle License Plate Dataset (Kaggle)
Step 02

ONNX Export for Fast CPU Inference

Exported the trained detector to ONNX format so it runs efficiently without a GPU, keeping inference fast on standard hardware.

  • Model exported to ONNX
  • Optimized for CPU-only inference
  • No GPU dependency at runtime
Step 03

Text Extraction with EasyOCR

Cropped the detected plate region and passed it through EasyOCR to read the characters, isolating text extraction from the detection step.

  • EasyOCR reads the cropped plate region
  • Decoupled from the detection pipeline
  • Works across varied plate fonts and layouts
Step 04

Character Normalization Layer

Added a normalization step that corrects characters OCR commonly confuses before comparing results, addressing the 0/O, 1/I, 8/B and 2/Z mix-ups that plague raw OCR output.

  • Rule-based correction for commonly confused characters
  • Applied before result comparison
  • Targets 0/O, 1/I, 8/B, 2/Z confusions
Step 05

Metrics Module for Evaluation

Built a dedicated metrics module that computes IoU for detection accuracy and OCR accuracy against ground truth, run across a 100-image test set to validate the full pipeline.

  • Computes IoU for plate localization accuracy
  • Computes OCR character/string accuracy
  • Evaluated on a 100-image test set
Tech Stack

Built with

PythonYOLOv8OpenCVEasyOCRONNXComputer Vision