# muhammad-zeerak-khan/automatic-license-plate-recognition-using-yolov8 architecture

> Architecture diagram of the GitHub repository muhammad-zeerak-khan/automatic-license-plate-recognition-using-yolov8, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/muhammad-zeerak-khan/automatic-license-plate-recognition-using-yolov8
- Repository: https://github.com/muhammad-zeerak-khan/automatic-license-plate-recognition-using-yolov8

## Overview

- Video Input Component: Represents the source video (as provided in the README for demo/testing) that will feed into the system.
- Preprocessing & Detection Component (main.py):
- This module is responsible for extracting frames from the video and feeding them into the detection pipeline.
- It utilizes the pre-trained YOLOv8 model, demonstrated by the “license_plate_detector.pt” file (along with the YOLOv8n model for vehicle detection).
- That this component interacts with the external “sort” module, which is used for tracking.
- Data Output Component: The detection results are output (for example, saved as CSV in “test.csv”), which then becomes the input for post-processing.
- Interpolation Module (add_missing_data.py):
- This module processes the CSV data to add missing frames or smooth the detection data.
- Uses the interpolated CSV output to generate visualizations for demonstration.
- Utility Functions (util.py):
- As supporting/helper functions that might be shared among the main modules.

##### Relationships and Data Flow
- Main detection (main.py) interacts with the YOLO models and external dependencies (e.g., the SORT module, if used) to output initial detection results.
- Next, connect the CSV output to the Interpolation Module (add_missing_data.py), which processes and smooths the detection data.

##### Architectural Patterns and Design Principles
- The system follows a pipeline pattern: data flows from input (video) → processing (detection) → post-processing (interpolation) → output (visualization).
- Separation of concerns is evident since each major functionality is decoupled into its own script.
- External dependencies, like the pre-trained YOLO model and SORT module, should be clearly tagged as they are integral to the detection pipeline.

##### Technologies and Frameworks
- Python is the primary technology, with dependencies outlined in requirements.txt.
- YOLOv8 (used for object detection) and a specific license plate detection model (“license_plate_detector.pt”) are central.
- The external “sort” module from Abewley’s repository is required for tracking.

## Diagram (Mermaid)

```mermaid
graph TD
    VIDEO["Video Input (README.md)"]:::video
    DETECTION["Detection & Preprocessing (main.py)"]:::detection
    YOLO["YOLOv8 Model (license_plate_detector.pt)"]:::external
    SORT["SORT Module"]:::external
    OUTPUT["Data Output (CSV)"]:::output
    INTERP["Interpolation Module (add_missing_data.py)"]:::interpolation
    VISUAL["Visualization Module (visualize.py)"]:::visualization
    UTIL["Utility Functions (util.py)"]:::utility

    VIDEO -->|"raw_frames"| DETECTION
    DETECTION -->|"detection_data"| OUTPUT
    DETECTION ---|"uses"| YOLO
    DETECTION ---|"tracks"| SORT
    OUTPUT -->|"csv_data"| INTERP
    INTERP -->|"smoothed_data"| VISUAL

    UTIL ---|"helpers"| DETECTION
    UTIL ---|"helpers"| INTERP
    UTIL ---|"helpers"| VISUAL

    click VIDEO "https://github.com/muhammad-zeerak-khan/automatic-license-plate-recognition-using-yolov8/blob/main/README.md"
    click DETECTION "https://github.com/muhammad-zeerak-khan/automatic-license-plate-recognition-using-yolov8/blob/main/main.py"
    click YOLO "https://github.com/muhammad-zeerak-khan/automatic-license-plate-recognition-using-yolov8/blob/main/license_plate_detector.pt"
    click INTERP "https://github.com/muhammad-zeerak-khan/automatic-license-plate-recognition-using-yolov8/blob/main/add_missing_data.py"
    click VISUAL "https://github.com/muhammad-zeerak-khan/automatic-license-plate-recognition-using-yolov8/blob/main/visualize.py"
    click UTIL "https://github.com/muhammad-zeerak-khan/automatic-license-plate-recognition-using-yolov8/blob/main/util.py"

    classDef video fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef detection fill:#FAD7A0,stroke:#7D6608,stroke-width:2px;
    classDef output fill:#C39BD3,stroke:#6C3483,stroke-width:2px;
    classDef interpolation fill:#ABEBC6,stroke:#1E8449,stroke-width:2px;
    classDef visualization fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
    classDef utility fill:#F0B27A,stroke:#E67E22,stroke-width:2px;
    classDef external fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;
```
