# refa3ey/egyptian-license-plate architecture

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

- Interactive diagram: https://gitdiagram.com/refa3ey/egyptian-license-plate
- Repository: https://github.com/refa3ey/egyptian-license-plate

## Overview

This repository recognizes Egyptian license plates from pre-cropped images and also provides a dataset-preparation and model-training workflow. Inference loads an image, preprocesses and segments it, classifies characters with a CNN, and assembles plate text. The README documents the separate augmentation-to-labeling training workflow; excerpts show training artifacts and inference inputs. Inference preprocessing and segmentation are implemented within predict.py, so they are represented there rather than as unsupported calls to the standalone preparation scripts.

Main entry points: [`predict.py`](https://github.com/refa3ey/egyptian-license-plate/blob/main/predict.py) (Recognition pipeline), [`train.py`](https://github.com/refa3ey/egyptian-license-plate/blob/main/train.py) (CNN training), [`Augmentation.PY`](https://github.com/refa3ey/egyptian-license-plate/blob/main/Augmentation.PY) (Image augmentation), [`labeling.py`](https://github.com/refa3ey/egyptian-license-plate/blob/main/labeling.py) (Manual labeling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_recognition["Plate recognition"]
  node_predict["Recognition pipeline<br/>[predict.py]"]
end

subgraph group_data_prep["Dataset preparation"]
  node_augmentation["Image augmentation<br/>[Augmentation.PY]"]
  node_preprocessing["Image preprocessing<br/>[preprocessing.py]"]
  node_segmentation["Character segmentation<br/>[segmentation.py]"]
end

subgraph group_model_training["Labeling and training"]
  node_labeling["Manual labeling<br/>[labeling.py]"]
  node_training["CNN training<br/>[train.py]"]
end

subgraph group_diagnostics["Diagnostics"]
  node_diagnostic["System diagnostics<br/>[diagnostic.py]"]
  node_debug["Plate debugging<br/>[debug_plate.py]"]
end

node_user(("User"))
node_plate_image["Plate image"]
node_plate_text["Plate text"]
node_source_plates["Original plates"]
node_character_images["Character images"]
node_labels["Character labels"]
node_model["Trained CNN<br/>[model.pth1]"]
node_classes["Class names<br/>[classes.json]"]

node_user -->|"runs recognition"| node_predict
node_plate_image -->|"loads image"| node_predict
node_predict -->|"assembles text"| node_plate_text
node_user -->|"runs preparation"| node_augmentation
node_source_plates -->|"augments images"| node_augmentation
node_augmentation -->|"prepares images"| node_preprocessing
node_preprocessing -->|"feeds plates"| node_segmentation
node_segmentation -->|"writes characters"| node_character_images
node_user -->|"labels characters"| node_labeling
node_character_images -->|"displays images"| node_labeling
node_labeling -->|"writes labels"| node_labels
node_labels -->|"loads labels"| node_training
node_user -->|"runs training"| node_training
node_training -->|"saves weights"| node_model
node_training -->|"writes classes"| node_classes
node_predict -->|"loads weights"| node_model
node_predict -->|"loads classes"| node_classes
node_user -->|"checks health"| node_diagnostic
node_user -->|"inspects plate"| node_debug

click node_predict "https://github.com/refa3ey/egyptian-license-plate/blob/main/predict.py"
click node_augmentation "https://github.com/refa3ey/egyptian-license-plate/blob/main/Augmentation.PY"
click node_preprocessing "https://github.com/refa3ey/egyptian-license-plate/blob/main/preprocessing.py"
click node_segmentation "https://github.com/refa3ey/egyptian-license-plate/blob/main/segmentation.py"
click node_labeling "https://github.com/refa3ey/egyptian-license-plate/blob/main/labeling.py"
click node_training "https://github.com/refa3ey/egyptian-license-plate/blob/main/train.py"
click node_model "https://github.com/refa3ey/egyptian-license-plate/blob/main/model.pth1"
click node_classes "https://github.com/refa3ey/egyptian-license-plate/blob/main/classes.json"
click node_diagnostic "https://github.com/refa3ey/egyptian-license-plate/blob/main/diagnostic.py"
click node_debug "https://github.com/refa3ey/egyptian-license-plate/blob/main/debug_plate.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_predict,node_user toneBlue
class node_augmentation,node_preprocessing,node_segmentation toneAmber
class node_labeling,node_training toneMint
class node_diagnostic,node_debug toneRose
class node_plate_image,node_plate_text,node_source_plates,node_character_images,node_labels toneIndigo
class node_model,node_classes toneTeal
```

## Components

### Plate recognition

- [Recognition pipeline](https://github.com/refa3ey/egyptian-license-plate/blob/main/predict.py): `predict.py`

### Dataset preparation

- [Image augmentation](https://github.com/refa3ey/egyptian-license-plate/blob/main/Augmentation.PY): `Augmentation.PY`
- [Image preprocessing](https://github.com/refa3ey/egyptian-license-plate/blob/main/preprocessing.py): `preprocessing.py`
- [Character segmentation](https://github.com/refa3ey/egyptian-license-plate/blob/main/segmentation.py): `segmentation.py`

### Labeling and training

- [Manual labeling](https://github.com/refa3ey/egyptian-license-plate/blob/main/labeling.py): `labeling.py`
- [CNN training](https://github.com/refa3ey/egyptian-license-plate/blob/main/train.py): `train.py`

### Diagnostics

- [System diagnostics](https://github.com/refa3ey/egyptian-license-plate/blob/main/diagnostic.py): `diagnostic.py`
- [Plate debugging](https://github.com/refa3ey/egyptian-license-plate/blob/main/debug_plate.py): `debug_plate.py`

### Other components

- **User**
- **Plate image**
- **Plate text**
- **Original plates**
- **Character images**
- **Character labels**
- [Trained CNN](https://github.com/refa3ey/egyptian-license-plate/blob/main/model.pth1): `model.pth1`
- [Class names](https://github.com/refa3ey/egyptian-license-plate/blob/main/classes.json): `classes.json`

## Connections

- User → Recognition pipeline: runs recognition (evidence: `README.md`)
- Plate image → Recognition pipeline: loads image (evidence: `predict.py`)
- Recognition pipeline → Plate text: assembles text (evidence: `README.md`)
- User → Image augmentation: runs preparation (evidence: `README.md`)
- Original plates → Image augmentation: augments images (evidence: `Augmentation.PY`)
- Image augmentation → Image preprocessing: prepares images (evidence: `README.md`)
- Image preprocessing → Character segmentation: feeds plates (evidence: `README.md`)
- Character segmentation → Character images: writes characters (evidence: `segmentation.py`)
- User → Manual labeling: labels characters (evidence: `README.md`)
- Character images → Manual labeling: displays images (evidence: `labeling.py`)
- Manual labeling → Character labels: writes labels (evidence: `labeling.py`)
- Character labels → CNN training: loads labels (evidence: `train.py`)
- User → CNN training: runs training (evidence: `README.md`)
- CNN training → Trained CNN: saves weights (evidence: `train.py`)
- CNN training → Class names: writes classes (evidence: `train.py`)
- Recognition pipeline → Trained CNN: loads weights (evidence: `predict.py`)
- Recognition pipeline → Class names: loads classes (evidence: `predict.py`)
- User → System diagnostics: checks health (evidence: `README.md`)
- User → Plate debugging: inspects plate (evidence: `debug_plate.py`)
