/lprs-jp

Japanese license plate recognition project implemented with PyTorch, YOLOv8 and OpenCV. For research purpose only.

Primary LanguagePython

Japanese License Plate Recognition

Example use case Japanese license plate recognition project implemented with PyTorch, YOLOv8 and OpenCV. For research purpose only.

Gradio App

Hugging Face Spaces

Hugging Face Spaces

Check out the Gradio app on Hugging Face Spaces https://huggingface.co/spaces/eepj/lprs-jp.

Japanese License Plate Format

Markings

① Name of Region Registered
② Classification Number
③ Kana Character
④ 4-Digit Designation Number (Leading zeros are shown as .)

Color Scheme

License Plate Type Engine Displacement Marking Color Background Color
Private ≥ 660 cc Green White
Private < 660 cc Black Yellow
Commercial ≥ 660 cc White Green
Commercial < 660 cc Yellow Black
Commemorative Green Multiple
Glowing Neon Green White

Datasets

License Plates Dataset

  • Dataset comprising 350 vehicles and their corresponding license plate bounding boxes for fine-tuning YOLOv8 segmentation model to detect license plates from images.

alpr_jp

  • Dataset comprising 1000+ unlabeled Japanese license plate images for training character recognition models.
  • Google Search images were used to supplement the dataset in case of missing or less common markings.
  • All markings were manually labeled.

Approach

Approach

Training

Model

  • CNN adapted from Chinese License Plate Recognition System Based on Convolutional Neural Network, layer depths adjusted according to specific recognition task.

Hardware

  • Apple M1 with MPS hardware acceleration

Hyperparameters

  • Number of epochs: 100
  • Optimizer: Adam
  • Initial learning rate: 1e-3
  • Learning rate scheduler: StepLR, reduce by factor of 0.1 every 30 epochs
  • Loss function: CrossEntropyLoss
  • Random seed: 42

Data Augmentation

  • Training images were passed to a 7-step augmenetation pipeline to enhance the model's robustness against image quality, camera angles and color variations.

Augmentation pipeline

Performance

Metrics

Recognition Task Convolutional Layer Depths Samples (Classes) Accuracy Weighted F1 Params (×103)
① Region Name 64, 128, 256, 512 412 (134) 0.97573 0.97265 1690
② Classification Number 64, 128, 256 444 (11) 0.98423 0.98426 440
③ Kana Character 64, 128, 256, 512 430 (43) 0.97907 0.97837 680
④ Designation Number 64, 128, 256, 512 547 (11) 0.99817 0.99817 646

Example Test Case

Example

References

alpr_jp
Big thanks to dyama san for sharing the alpr_jp dataset.
https://github.com/dyama/alpr_jp

License Plates Dataset
https://universe.roboflow.com/samrat-sahoo/license-plates-f8vsn

YOLOv8
https://github.com/ultralytics/ultralytics

Chinese License Plate Recognition System Based on Convolutional Neural Network
H. Chen, Y. Lin, and T. Zhao, 'Chinese License Plate Recognition System Based on Convolutional Neural Network', Highlights in Science, Engineering and Technology, vol. 34, pp. 95–102, 2023.
https://www.researchgate.net/publication/369470024

ナンバープレートの見方 (How to Read a Number Plate)
https://wwwtb.mlit.go.jp/tohoku/jg/jg-sub29_1.html

Fun Fact

This repository was created on Leap Day 2024.