An OCR system for cropped Vietnamese license plates using a CNN+BiLSTM+CTC architecture, with training, fine-tuning, inference, and export to ONNX/OpenVINO.

Stars

6

7-day growth

No data

Forks

0

Open issues

0

License

No data

Last updated

2026-07-30

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

Offers a complete pipeline from synthetic data generation to production deployment with automatic hyperparameter tuning and quantization support.

Who it is for

  • Vietnamese license plate recognition developers
  • OCR researchers working with CTC-based models
  • Engineers needing deployable ONNX/OpenVINO models
  • Hobbyists building Vietnamese traffic monitoring systems

Use cases

  • Automated toll collection and parking management
  • Traffic surveillance and enforcement
  • Vietnamese vehicle registration systems
  • Research on CTC-based optical character recognition

Strengths

  • Automatic hyperparameter selection based on dataset size reduces manual tuning
  • Supports fine-tuning (tune.py) to adapt to new data without retraining from scratch
  • Exports to multiple formats (ONNX, OpenVINO FP32/FP16/INT8) for edge deployment
  • Includes synthetic data generator for quick pipeline testing

Considerations

  • No pre-trained model weights are provided; users must train from scratch or find external checkpoints
  • ONNX export is limited to batch size 1 due to LSTM layers
  • No hyperparameter search script for architecture exploration (only manual trial-and-error)

README quick start

K-OCR — OCR biển số xe Việt Nam

Dự án nhận dạng ký tự (OCR) trên ảnh biển số xe đã được crop sẵn, dùng kiến trúc CNN (stem + residual stages) + BiLSTM + CTC, định nghĩa tại plate_recognizer.py.

1. Cấu trúc dự án

K-OCR/
  plate_recognizer.py           # Kiến trúc model (CNN + BiLSTM + CTC)
  charset.py                    # Bảng ký tự + encode/decode CTC
  dataset.py                    # PlateDataset, augmentation, collate_fn cho CTC
  train.py                      # Script train model từ đầu
  tune.py                       # Script fine-tune / train tiếp từ 1 checkpoint có sẵn
  infer.py                      # Script chạy thử / demo inference
  export.py                     # Script export model sang ONNX / OpenVINO (FP32/FP16/INT8)
  generate_dummy_data.py        # Tạo dữ liệu giả lập để test nhanh pipeline
  requirements.txt
  data/
    README.md                  # Hướng dẫn định dạng dữ liệu
    train/{images/, labels.txt}
    val/{images/, labels.txt}
  checkpoints/                  # Nơi lưu model đã train (best_model.pt, last_model.pt)
  exported_models/              # Nơi lưu model đã export (onnx, openvino IR) — tạo bởi export.py

2. Kiến trúc model (tóm tắt)

Input [B, 3, 112, 224] → Stem → 3 Residual stage → AdaptiveAvgPool theo chiều cao → sequence [B, 56, 256] → 2 lớp BiLSTM → Linear classifier → logits [B, 56, num_classes]. Chi tiết đầy đủ xem docstring trong plate_recognizer.py.

num_classes = số ký tự trong charset.py + 1 (lớp blank của CTC).

3. Cài đặt

python -m venv venv
venv\Scripts\activate          # Windows
pip install -r requirements.txt

Nếu chỉ có CPU, có thể cài PyTorch bản CPU theo hướng dẫn tại https://pytorch.org/get-started/locally/ trước khi cài các phần còn lại.

4. Chuẩn bị dữ liệu

Xem chi tiết tại data/README.md.

Chưa có dữ liệu thật? Tạo dữ liệu giả lập để test pipeline trước:

python generate_dummy_data.py --data-dir data --train-samples 200 --val-samples 40

5. Train

python train.py --data-dir data

--epochs, --batch-size, --lr mặc định là tự động — nếu không truyền tay, train.py sẽ đếm số ảnh trong data/train/labels.txt và tự chọn theo bảng dưới (xem auto_hparams() trong train.py). Data ít cần train nhiều epoch hơn để hội tụ nhưng batch nhỏ hơn; d

Description

OCR biển số xe Việt Nam

Related repositories

Similar projects matched by category, topics, and programming language.

MoonshotAI
Featured
MoonshotAI GitHub avatar

Kimi-K3

Kimi K3 is an open-weight, 2.8T-parameter native multimodal agentic model with a 1M-token context window, designed for frontier coding, knowledge work, and reasoning tasks.

AI & Machine LearningAI Agents
3,348
jamesob
Featured
jamesob GitHub avatar

local-llm

A comprehensive guide for building and configuring a high-end local machine to run state-of-the-art LLMs, with detailed hardware choices, BIOS tuning, and Docker-based model serving.

AI & Machine LearningLarge Language Models
1,660
Blaizzy
Featured
Blaizzy GitHub avatar

nativ

Nativ is a native macOS app that lets you run AI models locally on Apple silicon, offering chat, model management, performance analytics, and an OpenAI/Anthropic-compatible API server.

AI & Machine LearningAI Vision & Audio
985