# we0091234/crnn_plate_recognition architecture

> Architecture diagram of the GitHub repository we0091234/crnn_plate_recognition, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/we0091234/crnn_plate_recognition
- Repository: https://github.com/we0091234/crnn_plate_recognition

## Overview

This repository implements Chinese license-plate character recognition: labeled plate crops are converted to training manifests, used to train a neural recognizer, and then recognized through image or ONNX inference. It also includes plate-image augmentation and support for preparing double-row plates by merging them into a single row. Plate detection is explicitly outside this project. The README documents several workflows; sampled source confirms dataset loading, model execution, and training/validation, while some integration details are inferred only from the documented entry points and tree.

Main entry points: [`train.py`](https://github.com/we0091234/crnn_plate_recognition/blob/master/train.py) (Training loop), [`demo.py`](https://github.com/we0091234/crnn_plate_recognition/blob/master/demo.py) (Image demo), [`lib/dataset/_360cc.py`](https://github.com/we0091234/crnn_plate_recognition/blob/master/lib/dataset/_360cc.py) (CCPD dataset), [`Text-Image-Augmentation-python-master/demo1.py`](https://github.com/we0091234/crnn_plate_recognition/blob/master/Text-Image-Augmentation-python-master/demo1.py) (Augmentation demo)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_label_tool["Label manifest<br/>[plateLabel.py]"]
  node_alphabet["Character alphabet<br/>[alphabets.py]"]
  node_dataset["CCPD dataset<br/>[_360cc.py]"]
end

subgraph group_train["Model training"]
  node_trainer["Training loop<br/>[train.py]"]
  node_training_ops["Train and validate<br/>[function.py]"]
  node_recognizer["OCR networks<br/>[plateNet.py]"]
  node_crnn["CRNN architecture<br/>[crnn.py]"]
  node_checkpoints["Model checkpoints"]
end

subgraph group_infer["Recognition"]
  node_image_demo["Image demo<br/>[demo.py]"]
  node_onnx_export["ONNX export<br/>[export.py]"]
  node_onnx_runtime["ONNX inference<br/>[onnx_infer.py]"]
  node_plate_result["Plate text"]
  node_plate_merge["Double-row merge<br/>[demo.py]"]
  node_onnx_model["ONNX model"]
end

subgraph group_augment["Image augmentation"]
  node_augment_cli["Augmentation demo<br/>[demo1.py]"]
  node_augment_ops["Image transforms<br/>[augment.py]"]
  node_warp["MLS warp<br/>[warp_mls.py]"]
  node_augmented["Augmented crops"]
end

node_operator(("Dataset operator"))
node_plate_images["Plate crops"]

node_operator -->|"provides crops"| node_plate_images
node_operator -->|"labels images"| node_label_tool
node_label_tool -->|"writes manifests"| node_dataset
node_alphabet -->|"maps characters"| node_dataset
node_plate_images -->|"loads images"| node_dataset
node_dataset -->|"supplies batches"| node_trainer
node_trainer -->|"runs training"| node_recognizer
node_trainer -->|"imports architecture"| node_crnn
node_trainer -->|"calls train and validate"| node_training_ops
node_recognizer -->|"computes predictions"| node_training_ops
node_trainer -->|"saves weights"| node_checkpoints
node_checkpoints -->|"loads weights"| node_image_demo
node_image_demo -->|"runs recognition"| node_recognizer
node_image_demo -->|"decodes text"| node_plate_result
node_checkpoints -->|"loads weights"| node_onnx_export
node_onnx_export -->|"exports model"| node_onnx_model
node_onnx_model -->|"loads model"| node_onnx_runtime
node_onnx_runtime -->|"returns text"| node_plate_result
node_operator -->|"selects source and destination"| node_augment_cli
node_augment_cli -->|"applies transforms"| node_augment_ops
node_augment_ops -->|"uses geometric warp"| node_warp
node_augment_cli -->|"writes crops"| node_augmented
node_plate_images -->|"provides double-row crop"| node_plate_merge
node_plate_merge -.->|"prepares input"| node_image_demo

click node_label_tool "https://github.com/we0091234/crnn_plate_recognition/blob/master/plateLabel.py"
click node_alphabet "https://github.com/we0091234/crnn_plate_recognition/blob/master/alphabets.py"
click node_dataset "https://github.com/we0091234/crnn_plate_recognition/blob/master/lib/dataset/_360cc.py"
click node_trainer "https://github.com/we0091234/crnn_plate_recognition/blob/master/train.py"
click node_training_ops "https://github.com/we0091234/crnn_plate_recognition/blob/master/lib/core/function.py"
click node_recognizer "https://github.com/we0091234/crnn_plate_recognition/blob/master/plateNet.py"
click node_crnn "https://github.com/we0091234/crnn_plate_recognition/blob/master/lib/models/crnn.py"
click node_image_demo "https://github.com/we0091234/crnn_plate_recognition/blob/master/demo.py"
click node_onnx_export "https://github.com/we0091234/crnn_plate_recognition/blob/master/export.py"
click node_onnx_runtime "https://github.com/we0091234/crnn_plate_recognition/blob/master/onnx_infer.py"
click node_augment_cli "https://github.com/we0091234/crnn_plate_recognition/blob/master/Text-Image-Augmentation-python-master/demo1.py"
click node_augment_ops "https://github.com/we0091234/crnn_plate_recognition/blob/master/Text-Image-Augmentation-python-master/augment.py"
click node_warp "https://github.com/we0091234/crnn_plate_recognition/blob/master/Text-Image-Augmentation-python-master/warp_mls.py"
click node_plate_merge "https://github.com/we0091234/crnn_plate_recognition/blob/master/demo.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_label_tool,node_alphabet,node_dataset toneBlue
class node_trainer,node_training_ops,node_recognizer,node_crnn,node_checkpoints toneAmber
class node_image_demo,node_onnx_export,node_onnx_runtime,node_plate_result,node_plate_merge,node_onnx_model toneMint
class node_augment_cli,node_augment_ops,node_warp,node_augmented toneRose
class node_operator,node_plate_images toneIndigo
```

## Components

### Data preparation

- [Label manifest](https://github.com/we0091234/crnn_plate_recognition/blob/master/plateLabel.py): `plateLabel.py`
- [Character alphabet](https://github.com/we0091234/crnn_plate_recognition/blob/master/alphabets.py): `alphabets.py`
- [CCPD dataset](https://github.com/we0091234/crnn_plate_recognition/blob/master/lib/dataset/_360cc.py): `lib/dataset/_360cc.py`

### Model training

- [Training loop](https://github.com/we0091234/crnn_plate_recognition/blob/master/train.py): `train.py`
- [Train and validate](https://github.com/we0091234/crnn_plate_recognition/blob/master/lib/core/function.py): `lib/core/function.py`
- [OCR networks](https://github.com/we0091234/crnn_plate_recognition/blob/master/plateNet.py): `plateNet.py`
- [CRNN architecture](https://github.com/we0091234/crnn_plate_recognition/blob/master/lib/models/crnn.py): `lib/models/crnn.py`
- **Model checkpoints**

### Recognition

- [Image demo](https://github.com/we0091234/crnn_plate_recognition/blob/master/demo.py): `demo.py`
- [ONNX export](https://github.com/we0091234/crnn_plate_recognition/blob/master/export.py): `export.py`
- [ONNX inference](https://github.com/we0091234/crnn_plate_recognition/blob/master/onnx_infer.py): `onnx_infer.py`
- **Plate text**
- [Double-row merge](https://github.com/we0091234/crnn_plate_recognition/blob/master/demo.py): `demo.py`
- **ONNX model**

### Image augmentation

- [Augmentation demo](https://github.com/we0091234/crnn_plate_recognition/blob/master/Text-Image-Augmentation-python-master/demo1.py): `Text-Image-Augmentation-python-master/demo1.py`
- [Image transforms](https://github.com/we0091234/crnn_plate_recognition/blob/master/Text-Image-Augmentation-python-master/augment.py): `Text-Image-Augmentation-python-master/augment.py`
- [MLS warp](https://github.com/we0091234/crnn_plate_recognition/blob/master/Text-Image-Augmentation-python-master/warp_mls.py): `Text-Image-Augmentation-python-master/warp_mls.py`
- **Augmented crops**

### Other components

- **Dataset operator**
- **Plate crops**

## Connections

- Dataset operator → Plate crops: provides crops
- Dataset operator → Label manifest: labels images
- Label manifest → CCPD dataset: writes manifests
- Character alphabet → CCPD dataset: maps characters
- Plate crops → CCPD dataset: loads images
- CCPD dataset → Training loop: supplies batches
- Training loop → OCR networks: runs training
- Training loop → CRNN architecture: imports architecture
- Training loop → Train and validate: calls train and validate
- OCR networks → Train and validate: computes predictions
- Training loop → Model checkpoints: saves weights
- Model checkpoints → Image demo: loads weights
- Image demo → OCR networks: runs recognition
- Image demo → Plate text: decodes text
- Model checkpoints → ONNX export: loads weights
- ONNX export → ONNX model: exports model
- ONNX model → ONNX inference: loads model
- ONNX inference → Plate text: returns text
- Dataset operator → Augmentation demo: selects source and destination
- Augmentation demo → Image transforms: applies transforms
- Image transforms → MLS warp: uses geometric warp
- Augmentation demo → Augmented crops: writes crops
- Plate crops → Double-row merge: provides double-row crop
- Double-row merge → Image demo: prepares input
