# umair-khan001/safety-compliance-detection architecture

> Architecture diagram of the GitHub repository umair-khan001/safety-compliance-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/umair-khan001/safety-compliance-detection
- Repository: https://github.com/umair-khan001/safety-compliance-detection

## Overview

##### Project Overview & Main Purpose
- The project (named “safety-compliance-detection”) is structured as a modular detection/tracking system. Even though it contains multiple detector variants (YOLOv5 through YOLOv8, YOLOR, YOLOX, etc.), the current operation focuses solely on YOLOv8.
- The system is intended to process video (or image) streams for detection in a safety-compliance context. It also includes web interfaces (using Flask, as indicated by flaskApp.py and template files) for real-time display of detection results.

##### Architecturally Key Components
A. Input & Web Interface:
- Data Source/Input Modules: Could include live camera feeds or video files. The web server (flaskApp.py) accepts incoming video streams or user-uploaded content.
- Frontend/UI: Templates under the “templates” directory (e.g., root.html, video.html) represent the user interface that displays real-time or processed detection results.

B. Core Detection Module – YOLOv8:
- Detector: The active YOLOv8 detector is located at asone/detectors/yolov8/yolov8_detector.py.
- Utilities: Support functions specific to YOLOv8 are in asone/detectors/yolov8/utils/yolov8_utils.py. Although other YOLO variants are present, your design should only include YOLOv8.

C. (Optional) Tracker & Post-Processing:

D. Utility Services & Configuration:
- Utility modules under utils (like image processing, non-max suppression, etc.) support the detection pipeline.
- AWS and Google App Engine related utilities (from utils/aws and utils/google_app_engine) indicate potential deployment or cloud integration points that might be background services for scalability though not the focus in the current YOLOv8-centered design.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A("Client/Web Browser"):::web
    B("Flask Web Server (flaskApp.py)"):::web
    C("Input/Pre-Processing Module"):::web
    D("YOLOv8 Detector"):::detector
    E("YOLOv8 Utilities"):::detector
    F("Frontend UI (Templates)"):::web

    A -->|"HTTP_requests"| B
    B -->|"Extracts_frames"| C
    C -->|"Preprocessed_frames"| D
    D -->|"Uses_utils"| E
    D -->|"Detection_outputs"| B
    B -->|"Renders_results"| F
    B -->|"Loads_config"| G

    subgraph "Utility Services"
        G("General Utilities (utils/)"):::utility
        H("AWS Utility Services"):::utility
        I("Google App Engine Utility Services"):::utility
    end

    %% Click Events
    click B "https://github.com/umair-khan001/safety-compliance-detection/blob/main/flaskApp.py"
    click F "https://github.com/umair-khan001/safety-compliance-detection/blob/main/templates/root.html"
    click D "https://github.com/umair-khan001/safety-compliance-detection/blob/main/asone/detectors/yolov8/yolov8_detector.py"
    click E "https://github.com/umair-khan001/safety-compliance-detection/blob/main/asone/detectors/yolov8/utils/yolov8_utils.py"
    click G "https://github.com/umair-khan001/safety-compliance-detection/tree/main/utils/"
    click H "https://github.com/umair-khan001/safety-compliance-detection/tree/main/utils/aws/"
    click I "https://github.com/umair-khan001/safety-compliance-detection/tree/main/utils/google_app_engine/"

    %% Styles
    classDef web fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef detector fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef utility fill:#FFD580,stroke:#000,stroke-width:2px;
```
