# jasonqiuwo/object_detection_windows architecture

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

- Interactive diagram: https://gitdiagram.com/jasonqiuwo/object_detection_windows
- Repository: https://github.com/jasonqiuwo/object_detection_windows

## Overview

##### Project type and purpose
- This is a standalone Python-based computer-vision tool (not a web or full-stack app).
- Purpose: run YOLOv3 object detection on either static images or a live webcam feed, using OpenCV and COCO class labels.

##### File structure
- Top-level scripts:
- Image.py – loads a pre-saved image, runs detection, displays/saves result
- Webcam.py – captures frames from live camera, runs detection, shows live annotated feed
- Configuration files:
- yolov3.cfg – YOLOv3 network architecture definition
- coco.names – mapping of class IDs to human-readable labels
- Not shown but implied: YOLOv3 weights file (downloaded externally)
- Jupyter notebook (WebcamNotes.ipynb) for exploration or prototyping
- README.md for project overview

##### README for additional insights
- Confirms use of OpenCV and YOLOv3 with pre-trained COCO weights
- Describes two usage modes (images vs. webcam)
- No mention of database or external services—purely local processing

##### Main components and their interactions
a. Input Sources
- Static Image Loader (Image.py)
- Live Camera Stream (Webcam.py)
b. Preprocessing
c. Detection Engine
- Load YOLOv3 network: yolov3.cfg + weights file
- Load class labels from coco.names
- Perform forward pass through DNN module
d. Postprocessing & Visualization
- Parse network outputs, apply confidence threshold and non-max suppression
- Or save annotated output
e. External Artifacts
- COCO dataset (for labels)
- Pre-trained weights (from Darknet repo)

##### Architectural patterns and design principles
- Modular separation: input, model, postprocess, output
- Single Responsibility: two scripts each handle one input mode
- Dependency isolation: all model files/configs are external resources loaded at runtime
- Data flow is linear and synchronous—each frame goes through the same pipeline

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Input Modules
    subgraph "Input Sources"
        direction TB
        Image["Image.py\n(Load Static Image)"]:::code
        Webcam["Webcam.py\n(Capture Live Feed)"]:::code
    end

    %% Preprocessing
    Preprocess["Preprocessing\n(OpenCV)"]:::code

    %% Detection Engine and Resources
    subgraph "Detection Engine"
        direction TB
        Detect["YOLOv3 Detection Engine"]:::code
        Cfg["yolov3.cfg"]:::resources
        Names["coco.names"]:::resources
        Weights["YOLOv3 Weights"]:::resources
    end

    %% Postprocessing & Output
    Post["Postprocessing & Visualization"]:::code
    Output["Display Window / Save File"]:::code

    %% Additional Artifacts
    subgraph "Documentation & Notebooks"
        direction TB
        Notebook["WebcamNotes.ipynb"]:::resources
        Readme["README.md"]:::resources
    end

    %% Data Flows
    Image -->|"raw image"| Preprocess
    Webcam -->|"raw frame"| Preprocess
    Preprocess -->|"processed frame"| Detect
    Cfg --> Detect
    Names --> Detect
    Weights --> Detect
    Detect -->|"DNN outputs"| Post
    Post -->|"annotated frame"| Output

    %% Click Events
    click Image "https://github.com/jasonqiuwo/object_detection_windows/blob/main/Image.py"
    click Webcam "https://github.com/jasonqiuwo/object_detection_windows/blob/main/Webcam.py"
    click Cfg "https://github.com/jasonqiuwo/object_detection_windows/blob/main/yolov3.cfg"
    click Names "https://github.com/jasonqiuwo/object_detection_windows/blob/main/coco.names"
    click Notebook "https://github.com/jasonqiuwo/object_detection_windows/blob/main/WebcamNotes.ipynb"
    click Readme "https://github.com/jasonqiuwo/object_detection_windows/blob/main/README.md"

    %% Styles
    classDef code fill:#D6EAF8,stroke:#1B4F72,color:#1B2631;
    classDef resources fill:#D5F5E3,stroke:#145A32,color:#0B5345;
```
