# kvdayananda/realtime-human-detection architecture

> Architecture diagram of the GitHub repository kvdayananda/realtime-human-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kvdayananda/realtime-human-detection
- Repository: https://github.com/kvdayananda/realtime-human-detection

## Overview

This repository supports two related workflows: training a two-class image classifier, and running or assessing person detection with a YOLO model. The primary interactive workflow captures webcam frames, tracks people, detects faces, and displays annotated counts. Separate dataset-check and error-review scripts produce reports and visual review artifacts. The tree also contains an animal-image collection, but the sampled code does not connect it to these workflows. Edges reflect only relationships shown in sampled source; unsampled modules and integrations are not inferred.

Main entry points: [`dataset/human detection dataset`](https://github.com/kvdayananda/realtime-human-detection/tree/main/dataset/human%20detection%20dataset) (Labeled images), [`src/create_error_contact_sheet.py`](https://github.com/kvdayananda/realtime-human-detection/blob/main/src/create_error_contact_sheet.py) (Error contact sheets), [`src/review_errors.py`](https://github.com/kvdayananda/realtime-human-detection/blob/main/src/review_errors.py) (Review errors), [`src/train.py`](https://github.com/kvdayananda/realtime-human-detection/blob/main/src/train.py) (Train classifier)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Classifier training"]
  node_train["Train classifier<br/>[train.py]"]
end

subgraph group_detection["Live detection"]
  node_detect["Webcam detection<br/>[detect.py]"]
end

subgraph group_assessment["Dataset assessment"]
  node_check["Dataset check<br/>[check_dataset.py]"]
  node_inspect_errors["Inspect mismatches<br/>[inspect_errors.py]"]
  node_contact_sheet["Error contact sheets"]
  node_review_errors["Review errors<br/>[review_errors.py]"]
  node_prepare_images["Prepare test images"]
  node_inspect_dataset["Inspect image files<br/>[inspect_dataset.py]"]
  node_view_samples["View image samples<br/>[view_samples.py]"]
end

subgraph group_data["Data and artifacts"]
  node_image_dataset[("Labeled images")]
  node_classifier_weights["Classifier weights"]
  node_classifier_config["Classifier config"]
  node_yolo_model["YOLO model<br/>[yolo11n.pt]"]
  node_report["Agreement report"]
  node_contact_output["Contact sheets"]
  node_review_output["Review detections"]
  node_test_images[("Prepared images")]
end

node_operator(("Operator"))
node_webcam(("Webcam"))

node_operator -->|"starts"| node_detect
node_webcam -->|"provides frames"| node_detect
node_detect -->|"loads and tracks"| node_yolo_model
node_operator -.->|"runs"| node_train
node_train -->|"loads images"| node_image_dataset
node_train -->|"writes weights"| node_classifier_weights
node_train -->|"writes config"| node_classifier_config
node_check -->|"reads images"| node_image_dataset
node_check -->|"loads model"| node_yolo_model
node_check -->|"writes report"| node_report
node_inspect_errors -->|"reads report"| node_report
node_contact_sheet -->|"reads report"| node_report
node_contact_sheet -->|"reads images"| node_image_dataset
node_contact_sheet -->|"loads model"| node_yolo_model
node_contact_sheet -->|"writes sheets"| node_contact_output
node_review_errors -->|"reads report"| node_report
node_review_errors -->|"reads images"| node_image_dataset
node_review_errors -->|"loads model"| node_yolo_model
node_review_errors -->|"saves detections"| node_review_output
node_prepare_images -->|"copies samples"| node_image_dataset
node_prepare_images -->|"writes images"| node_test_images
node_inspect_dataset -->|"reads samples"| node_image_dataset
node_view_samples -->|"reads samples"| node_image_dataset

click node_train "https://github.com/kvdayananda/realtime-human-detection/blob/main/src/train.py"
click node_image_dataset "https://github.com/kvdayananda/realtime-human-detection/tree/main/dataset/human%20detection%20dataset"
click node_classifier_weights "https://github.com/kvdayananda/realtime-human-detection/blob/main/models/human_classifier.safetensors"
click node_classifier_config "https://github.com/kvdayananda/realtime-human-detection/blob/main/models/human_classifier_config.json"
click node_detect "https://github.com/kvdayananda/realtime-human-detection/blob/main/src/detect.py"
click node_yolo_model "https://github.com/kvdayananda/realtime-human-detection/blob/main/models/yolo11n.pt"
click node_check "https://github.com/kvdayananda/realtime-human-detection/blob/main/src/check_dataset.py"
click node_report "https://github.com/kvdayananda/realtime-human-detection/blob/main/runs/full_dataset_check/preliminary_report.csv"
click node_inspect_errors "https://github.com/kvdayananda/realtime-human-detection/blob/main/src/inspect_errors.py"
click node_contact_sheet "https://github.com/kvdayananda/realtime-human-detection/blob/main/src/create_error_contact_sheet.py"
click node_contact_output "https://github.com/kvdayananda/realtime-human-detection/tree/main/runs/error_contact_sheet"
click node_review_errors "https://github.com/kvdayananda/realtime-human-detection/blob/main/src/review_errors.py"
click node_review_output "https://github.com/kvdayananda/realtime-human-detection/tree/main/runs/error_review"
click node_prepare_images "https://github.com/kvdayananda/realtime-human-detection/blob/main/src/prepare_test_images.py"
click node_test_images "https://github.com/kvdayananda/realtime-human-detection/tree/main/dataset/person_detection_test/images"
click node_inspect_dataset "https://github.com/kvdayananda/realtime-human-detection/blob/main/src/inspect_dataset.py"
click node_view_samples "https://github.com/kvdayananda/realtime-human-detection/blob/main/src/view_samples.py"

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_train toneBlue
class node_detect toneAmber
class node_check,node_inspect_errors,node_contact_sheet,node_review_errors,node_prepare_images,node_inspect_dataset,node_view_samples toneMint
class node_image_dataset,node_classifier_weights,node_classifier_config,node_yolo_model,node_report,node_contact_output,node_review_output,node_test_images toneRose
class node_operator,node_webcam toneIndigo
```

## Components

### Classifier training

- [Train classifier](https://github.com/kvdayananda/realtime-human-detection/blob/main/src/train.py): `src/train.py`

### Live detection

- [Webcam detection](https://github.com/kvdayananda/realtime-human-detection/blob/main/src/detect.py): `src/detect.py`

### Dataset assessment

- [Dataset check](https://github.com/kvdayananda/realtime-human-detection/blob/main/src/check_dataset.py): `src/check_dataset.py`
- [Inspect mismatches](https://github.com/kvdayananda/realtime-human-detection/blob/main/src/inspect_errors.py): `src/inspect_errors.py`
- [Error contact sheets](https://github.com/kvdayananda/realtime-human-detection/blob/main/src/create_error_contact_sheet.py): `src/create_error_contact_sheet.py`
- [Review errors](https://github.com/kvdayananda/realtime-human-detection/blob/main/src/review_errors.py): `src/review_errors.py`
- [Prepare test images](https://github.com/kvdayananda/realtime-human-detection/blob/main/src/prepare_test_images.py): `src/prepare_test_images.py`
- [Inspect image files](https://github.com/kvdayananda/realtime-human-detection/blob/main/src/inspect_dataset.py): `src/inspect_dataset.py`
- [View image samples](https://github.com/kvdayananda/realtime-human-detection/blob/main/src/view_samples.py): `src/view_samples.py`

### Data and artifacts

- [Labeled images](https://github.com/kvdayananda/realtime-human-detection/tree/main/dataset/human%20detection%20dataset): `dataset/human detection dataset`
- [Classifier weights](https://github.com/kvdayananda/realtime-human-detection/blob/main/models/human_classifier.safetensors): `models/human_classifier.safetensors`
- [Classifier config](https://github.com/kvdayananda/realtime-human-detection/blob/main/models/human_classifier_config.json): `models/human_classifier_config.json`
- [YOLO model](https://github.com/kvdayananda/realtime-human-detection/blob/main/models/yolo11n.pt): `models/yolo11n.pt`
- [Agreement report](https://github.com/kvdayananda/realtime-human-detection/blob/main/runs/full_dataset_check/preliminary_report.csv): `runs/full_dataset_check/preliminary_report.csv`
- [Contact sheets](https://github.com/kvdayananda/realtime-human-detection/tree/main/runs/error_contact_sheet): `runs/error_contact_sheet`
- [Review detections](https://github.com/kvdayananda/realtime-human-detection/tree/main/runs/error_review): `runs/error_review`
- [Prepared images](https://github.com/kvdayananda/realtime-human-detection/tree/main/dataset/person_detection_test/images): `dataset/person_detection_test/images`

### Other components

- **Operator**
- **Webcam**

## Connections

- Operator → Webcam detection: starts (evidence: `src/detect.py`)
- Webcam → Webcam detection: provides frames (evidence: `src/detect.py`)
- Webcam detection → YOLO model: loads and tracks (evidence: `src/detect.py`)
- Operator → Train classifier: runs
- Train classifier → Labeled images: loads images (evidence: `src/train.py`)
- Train classifier → Classifier weights: writes weights (evidence: `src/train.py`)
- Train classifier → Classifier config: writes config (evidence: `src/train.py`)
- Dataset check → Labeled images: reads images (evidence: `src/check_dataset.py`)
- Dataset check → YOLO model: loads model (evidence: `src/check_dataset.py`)
- Dataset check → Agreement report: writes report (evidence: `src/check_dataset.py`)
- Inspect mismatches → Agreement report: reads report (evidence: `src/inspect_errors.py`)
- Error contact sheets → Agreement report: reads report (evidence: `src/create_error_contact_sheet.py`)
- Error contact sheets → Labeled images: reads images (evidence: `src/create_error_contact_sheet.py`)
- Error contact sheets → YOLO model: loads model (evidence: `src/create_error_contact_sheet.py`)
- Error contact sheets → Contact sheets: writes sheets (evidence: `src/create_error_contact_sheet.py`)
- Review errors → Agreement report: reads report (evidence: `src/review_errors.py`)
- Review errors → Labeled images: reads images (evidence: `src/review_errors.py`)
- Review errors → YOLO model: loads model (evidence: `src/review_errors.py`)
- Review errors → Review detections: saves detections (evidence: `src/review_errors.py`)
- Prepare test images → Labeled images: copies samples (evidence: `src/prepare_test_images.py`)
- Prepare test images → Prepared images: writes images (evidence: `src/prepare_test_images.py`)
- Inspect image files → Labeled images: reads samples (evidence: `src/inspect_dataset.py`)
- View image samples → Labeled images: reads samples (evidence: `src/view_samples.py`)
