# srey-pov/real-time-object-detection-tracking-and-counting architecture

> Architecture diagram of the GitHub repository srey-pov/real-time-object-detection-tracking-and-counting, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/srey-pov/real-time-object-detection-tracking-and-counting
- Repository: https://github.com/srey-pov/real-time-object-detection-tracking-and-counting

## Overview

This project detects cans and plastic bottles from images, a webcam, or recorded video. Its main processing paths are image inference, live webcam detection, and video tracking/counting; the video path counts ByteTrack identities crossing a virtual line and saves annotated video and a summary. The README also describes comparing five YOLO models, while the shown runtime scripts use YOLO11s. The graph focuses on implemented workflows; comparative evaluation is documented, but no evaluation implementation appears in the tree or excerpts.

Main entry points: [`object_detection/src/detect_image.py`](https://github.com/srey-pov/real-time-object-detection-tracking-and-counting/blob/main/object_detection/src/detect_image.py) (Image detection), [`object_detection/src/count_video.py`](https://github.com/srey-pov/real-time-object-detection-tracking-and-counting/blob/main/object_detection/src/count_video.py) (Tracking and counting), [`object_detection/models`](https://github.com/srey-pov/real-time-object-detection-tracking-and-counting/tree/main/object_detection/models) (Trained YOLO models), [`object_detection/src/real_time.py`](https://github.com/srey-pov/real-time-object-detection-tracking-and-counting/blob/main/object_detection/src/real_time.py) (Live detection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inference["Detection workflows"]
  node_image_detection["Image detection<br/>[detect_image.py]"]
  node_live_detection["Live detection<br/>[real_time.py]"]
end

subgraph group_counting["Video counting"]
  node_video_counting["Tracking and counting<br/>[count_video.py]"]
end

subgraph group_assets["Models and results"]
  node_yolo_models["Trained YOLO models"]
  node_image_results["Annotated images"]
  node_counting_results["Counted video and summary"]
end

node_image_input(("Image input"))
node_webcam(("Webcam"))
node_video_input(("Video input"))

node_image_input -->|"reads image"| node_image_detection
node_image_detection -->|"loads YOLO11s"| node_yolo_models
node_image_detection -->|"writes image"| node_image_results
node_webcam -->|"supplies frames"| node_live_detection
node_live_detection -->|"loads YOLO11s"| node_yolo_models
node_video_input -->|"supplies frames"| node_video_counting
node_video_counting -->|"loads and tracks"| node_yolo_models
node_video_counting -->|"writes video and summary"| node_counting_results

click node_image_detection "https://github.com/srey-pov/real-time-object-detection-tracking-and-counting/blob/main/object_detection/src/detect_image.py"
click node_live_detection "https://github.com/srey-pov/real-time-object-detection-tracking-and-counting/blob/main/object_detection/src/real_time.py"
click node_video_counting "https://github.com/srey-pov/real-time-object-detection-tracking-and-counting/blob/main/object_detection/src/count_video.py"
click node_yolo_models "https://github.com/srey-pov/real-time-object-detection-tracking-and-counting/tree/main/object_detection/models"
click node_image_results "https://github.com/srey-pov/real-time-object-detection-tracking-and-counting/tree/main/object_detection/output"
click node_counting_results "https://github.com/srey-pov/real-time-object-detection-tracking-and-counting/tree/main/object_detection/output/counting"

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_image_detection,node_live_detection toneBlue
class node_video_counting toneAmber
class node_yolo_models,node_image_results,node_counting_results toneMint
class node_image_input,node_webcam,node_video_input toneIndigo
```

## Components

### Detection workflows

- [Image detection](https://github.com/srey-pov/real-time-object-detection-tracking-and-counting/blob/main/object_detection/src/detect_image.py): `object_detection/src/detect_image.py`
- [Live detection](https://github.com/srey-pov/real-time-object-detection-tracking-and-counting/blob/main/object_detection/src/real_time.py): `object_detection/src/real_time.py`

### Video counting

- [Tracking and counting](https://github.com/srey-pov/real-time-object-detection-tracking-and-counting/blob/main/object_detection/src/count_video.py): `object_detection/src/count_video.py`

### Models and results

- [Trained YOLO models](https://github.com/srey-pov/real-time-object-detection-tracking-and-counting/tree/main/object_detection/models): `object_detection/models`
- [Annotated images](https://github.com/srey-pov/real-time-object-detection-tracking-and-counting/tree/main/object_detection/output): `object_detection/output`
- [Counted video and summary](https://github.com/srey-pov/real-time-object-detection-tracking-and-counting/tree/main/object_detection/output/counting): `object_detection/output/counting`

### Other components

- **Image input**
- **Webcam**
- **Video input**

## Connections

- Image input → Image detection: reads image (evidence: `object_detection/src/detect_image.py`)
- Image detection → Trained YOLO models: loads YOLO11s (evidence: `object_detection/src/detect_image.py`)
- Image detection → Annotated images: writes image (evidence: `object_detection/src/detect_image.py`)
- Webcam → Live detection: supplies frames (evidence: `object_detection/src/real_time.py`)
- Live detection → Trained YOLO models: loads YOLO11s (evidence: `object_detection/src/real_time.py`)
- Video input → Tracking and counting: supplies frames (evidence: `object_detection/src/count_video.py`)
- Tracking and counting → Trained YOLO models: loads and tracks (evidence: `object_detection/src/count_video.py`)
- Tracking and counting → Counted video and summary: writes video and summary (evidence: `object_detection/src/count_video.py`)
