# mwasifanwar/aerovision-ai architecture

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

- Interactive diagram: https://gitdiagram.com/mwasifanwar/aerovision-ai
- Repository: https://github.com/mwasifanwar/aerovision-ai

## Overview

##### Project Type and Purpose
- AeroVision-AI is a specialized computer-vision pipeline with a Streamlit-based frontend. Its purpose is real-time vehicle detection, tracking, and analytics on drone footage using YOLOv8 and OpenCV.

##### File Structure Analysis
- Top level:
- README.md → high-level description
- requirements.txt → Python dependencies
- yolov8n.pt → pre-trained YOLOv8 model
- outputs/ → generated CSVs & processed videos
- reports/ → (placeholder for static reports or summaries)
- src/ → core processing modules
- streamlit_app/ → web UI entry point

- src/ modules indicate a clear separation of concerns:
- detector.py → loads the YOLO model and runs inference
- tracker.py → associates detections across frames (e.g., Deep SORT or custom)

##### README Insights
- Technologies: Python, YOLOv8, OpenCV, Streamlit
- Features: live inference visualization, CSV analytics, dynamic watermarking, video export

##### Main Components and Interactions
a. Components
- Streamlit Frontend (streamlit_app/app.py)
- Inference Engine (src/detector.py with yolov8n.pt)
- Tracking Module (src/tracker.py)
- Visualization & Export (src/viz.py)
- Storage (local file system: inputs, outputs/*.csv, outputs/*.mp4)

b. Data Flows
1) User uploads or streams drone footage via Streamlit UI
2) Frontend calls Detector → processes frames → returns raw detections
3) Tracker ingests detections → produces tracked object IDs
5) Detection & tracking metadata → written to CSV files under outputs/
6) UI reads CSVs for analytics dashboards or downloads

c. Architectural Patterns
- Modular monolith: clear separation into detector / tracker / viz layers
- Pipeline pattern: sequential data processing stages
- MVC-like split between Streamlit “view/controller” and src “model”

d. Key Technologies
- YOLOv8 (Torch-based object detection)
- OpenCV (frame I/O, drawing, video encoding)
- Streamlit (rapid web UI for live feed and charts)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Nodes
    UI["Streamlit Frontend\n(streamlit_app/app.py)"]:::frontend
    Detector["Detector Service\n(src/detector.py)"]:::compute
    Tracker["Tracker Service\n(src/tracker.py)"]:::compute
    Viz["Visualization & Export Service\n(src/viz.py)"]:::compute
    Model["Pre-trained Model\nyolov8n.pt"]:::storage
    Storage["Storage\n(outputs/*.mp4 & *.csv)"]:::storage
    Reports["Static Reports Sink\n(reports/)"]:::storage
    subgraph "Documentation"
        README["Project Description\nREADME.md"]:::storage
        Requirements["Dependencies\nrequirements.txt"]:::storage
    end

    %% Data Flow
    UI -->|"frames"| Detector
    Detector -->|"detections"| Tracker
    Tracker -->|"tracked IDs"| Viz
    Viz -->|"watermarked frames"| UI
    Viz -->|"writes videos"| Storage
    Tracker -->|"writes CSVs"| Storage
    Storage -->|"analytics data"| UI
    Storage -->|"feeds"| Reports

    %% Model Loading
    Model -->|"loaded by"| Detector

    %% Click Events
    click UI "https://github.com/mwasifanwar/aerovision-ai/blob/main/streamlit_app/app.py"
    click Detector "https://github.com/mwasifanwar/aerovision-ai/blob/main/src/detector.py"
    click Tracker "https://github.com/mwasifanwar/aerovision-ai/blob/main/src/tracker.py"
    click Viz "https://github.com/mwasifanwar/aerovision-ai/blob/main/src/viz.py"
    click Model "https://github.com/mwasifanwar/aerovision-ai/blob/main/yolov8n.pt"
    click Storage "https://github.com/mwasifanwar/aerovision-ai/tree/main/outputs/"
    click Reports "https://github.com/mwasifanwar/aerovision-ai/tree/main/reports/"
    click README "https://github.com/mwasifanwar/aerovision-ai/blob/main/README.md"
    click Requirements "https://github.com/mwasifanwar/aerovision-ai/blob/main/requirements.txt"

    %% Styles
    classDef frontend fill:#b8e986,stroke:#333,stroke-width:1px;
    classDef compute fill:#86b8e9,stroke:#333,stroke-width:1px;
    classDef storage fill:#d3d3d3,stroke:#333,stroke-width:1px;
```
