# nawaf-rayhan585/lpr-vehicle-license-detection architecture

> Architecture diagram of the GitHub repository nawaf-rayhan585/lpr-vehicle-license-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nawaf-rayhan585/lpr-vehicle-license-detection
- Repository: https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection

## Overview

LPR is a Streamlit app that accepts a traffic video, detects vehicles, reads and deduplicates plate text, then presents results and downloadable outputs. The principal workflow is implemented in one file, so several nodes represent distinct responsibilities within main.py rather than separate modules. The README documents the product capabilities; runtime relationships shown here are supported by the excerpted source.

Main entry points: [`main.py`](https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py) (Video processor), [`yolov8n.pt`](https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/yolov8n.pt) (YOLO weights)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_ui["Streamlit interface<br/>[main.py]"]
  node_staging["Input staging<br/>[main.py]"]
  node_downloads["Download and preview<br/>[main.py]"]
end

subgraph group_recognition["Recognition pipeline"]
  node_loader["Model loader<br/>[main.py]"]
  node_weights["YOLO weights<br/>[yolov8n.pt]"]
  node_video["Video processor<br/>[main.py]"]
  node_detector["Vehicle detection<br/>[main.py]"]
  node_filter["Vehicle class filter<br/>[main.py]"]
  node_crop["Vehicle crop<br/>[main.py]"]
  node_ocr["EasyOCR reader<br/>[main.py]"]
end

subgraph group_results["Results and outputs"]
  node_dedupe["Plate validation and dedupe<br/>[main.py]"]
  node_annotate["Frame annotation<br/>[main.py]"]
  node_videoout["Processed video<br/>[main.py]"]
  node_report["Plate report<br/>[main.py]"]
end

node_user(("Video uploader"))

node_user -->|"uploads video"| node_ui
node_ui -->|"saves upload"| node_staging
node_ui -->|"loads models"| node_loader
node_loader -->|"loads weights"| node_weights
node_ui -->|"runs processing"| node_video
node_video -->|"detects vehicles"| node_detector
node_video -->|"filters classes"| node_filter
node_video -->|"crops vehicles"| node_crop
node_video -->|"calls run_ocr"| node_ocr
node_ocr -->|"yields text"| node_dedupe
node_video -->|"draws boxes and text"| node_annotate
node_video -->|"writes frames"| node_videoout
node_video -->|"returns unique plates"| node_report
node_ui -->|"offers results"| node_downloads
node_downloads -->|"downloads JSON"| node_report
node_downloads -->|"previews and downloads"| node_videoout

click node_ui "https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py"
click node_staging "https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py"
click node_loader "https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py"
click node_weights "https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/yolov8n.pt"
click node_video "https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py"
click node_detector "https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py"
click node_filter "https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py"
click node_crop "https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py"
click node_ocr "https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py"
click node_dedupe "https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py"
click node_annotate "https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py"
click node_videoout "https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py"
click node_report "https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py"
click node_downloads "https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.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_ui,node_staging,node_downloads toneBlue
class node_loader,node_weights,node_video,node_detector,node_filter,node_crop,node_ocr toneAmber
class node_dedupe,node_annotate,node_videoout,node_report toneMint
class node_user toneIndigo
```

## Components

### User interface

- [Streamlit interface](https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py): `main.py`
- [Input staging](https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py): `main.py`
- [Download and preview](https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py): `main.py`

### Recognition pipeline

- [Model loader](https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py): `main.py`
- [YOLO weights](https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/yolov8n.pt): `yolov8n.pt`
- [Video processor](https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py): `main.py`
- [Vehicle detection](https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py): `main.py`
- [Vehicle class filter](https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py): `main.py`
- [Vehicle crop](https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py): `main.py`
- [EasyOCR reader](https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py): `main.py`

### Results and outputs

- [Plate validation and dedupe](https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py): `main.py`
- [Frame annotation](https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py): `main.py`
- [Processed video](https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py): `main.py`
- [Plate report](https://github.com/nawaf-rayhan585/lpr-vehicle-license-detection/blob/main/main.py): `main.py`

### Other components

- **Video uploader**

## Connections

- Video uploader → Streamlit interface: uploads video (evidence: `main.py`)
- Streamlit interface → Input staging: saves upload (evidence: `main.py`)
- Streamlit interface → Model loader: loads models (evidence: `main.py`)
- Model loader → YOLO weights: loads weights (evidence: `main.py`)
- Streamlit interface → Video processor: runs processing (evidence: `main.py`)
- Video processor → Vehicle detection: detects vehicles (evidence: `main.py`)
- Video processor → Vehicle class filter: filters classes (evidence: `main.py`)
- Video processor → Vehicle crop: crops vehicles (evidence: `main.py`)
- Video processor → EasyOCR reader: calls run_ocr (evidence: `main.py`)
- EasyOCR reader → Plate validation and dedupe: yields text (evidence: `main.py`)
- Video processor → Frame annotation: draws boxes and text (evidence: `main.py`)
- Video processor → Processed video: writes frames (evidence: `main.py`)
- Video processor → Plate report: returns unique plates (evidence: `main.py`)
- Streamlit interface → Download and preview: offers results (evidence: `main.py`)
- Download and preview → Plate report: downloads JSON (evidence: `main.py`)
- Download and preview → Processed video: previews and downloads (evidence: `main.py`)
