# surajkrawat/fall-detection-yolo26-pose architecture

> Architecture diagram of the GitHub repository surajkrawat/fall-detection-yolo26-pose, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/surajkrawat/fall-detection-yolo26-pose
- Repository: https://github.com/surajkrawat/fall-detection-yolo26-pose

## Overview

This repository is a video-based human activity and fall-detection application. Its main workflow takes a video through pose inference, per-person tracking, activity classification, and temporal fall-state detection, then produces annotated video and fall-event logs. It also documents a model-training and annotation workflow, including a CVAT-to-YOLO-pose converter. The runtime orchestration is only partially excerpted; edges use the shown source references and README-described behavior, and unsampled implementation details are not inferred.

Main entry points: [`fall_detection.py`](https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/fall_detection.py) (Inference CLI), [`src/pose_detector.py`](https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/src/pose_detector.py) (Pose detection), [`src/visualization.py`](https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/src/visualization.py) (Frame visualization), [`tools/coco_keypoints_to_yolo_pose.py`](https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/tools/coco_keypoints_to_yolo_pose.py) (Pose label converter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Video inference"]
  node_cli["Inference CLI<br/>[fall_detection.py]"]
  node_pose["Pose detection<br/>[pose_detector.py]"]
end

subgraph group_analysis["Person and state analysis"]
  node_tracker["Person tracking<br/>[tracker.py]"]
  node_activity["Activity classification"]
  node_fall["Fall state machine<br/>[fall_detector.py]"]
end

subgraph group_outputs["Results and events"]
  node_visualization["Frame visualization<br/>[visualization.py]"]
  node_annotated_video["Annotated video"]
  node_event_logger["Fall event logging<br/>[fall_detection.py]"]
  node_event_files["CSV and JSON events"]
end

subgraph group_model_prep["Model preparation"]
  node_annotation_guide["Annotation workflow"]
  node_cvat_converter["Pose label converter"]
  node_training_guide["Model training<br/>[TRAINING_GUIDE.md]"]
end

node_video_source(("Input video"))
node_ultralytics["YOLO pose model"]
node_trained_model["Trained pose model"]

node_video_source -->|"provides frames"| node_cli
node_cli -->|"runs inference"| node_pose
node_pose -->|"invokes model"| node_ultralytics
node_trained_model -->|"loads weights"| node_pose
node_cli -->|"updates tracks"| node_tracker
node_cli -->|"classifies tracks"| node_activity
node_cli -->|"checks fall state"| node_fall
node_cli -->|"draws frames"| node_visualization
node_visualization -->|"renders output"| node_annotated_video
node_cli -->|"records events"| node_event_logger
node_event_logger -->|"writes logs"| node_event_files
node_annotation_guide -->|"documents conversion"| node_cvat_converter
node_cvat_converter -->|"prepares labels"| node_training_guide
node_training_guide -->|"trains model"| node_trained_model

click node_cli "https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/fall_detection.py"
click node_pose "https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/src/pose_detector.py"
click node_tracker "https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/src/tracker.py"
click node_activity "https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/src/activity_classifier.py"
click node_fall "https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/src/fall_detector.py"
click node_visualization "https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/src/visualization.py"
click node_event_logger "https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/fall_detection.py"
click node_annotation_guide "https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/docs/ANNOTATION_GUIDE.md"
click node_cvat_converter "https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/tools/coco_keypoints_to_yolo_pose.py"
click node_training_guide "https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/docs/TRAINING_GUIDE.md"

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_cli,node_pose toneBlue
class node_tracker,node_activity,node_fall toneAmber
class node_visualization,node_annotated_video,node_event_logger,node_event_files toneMint
class node_annotation_guide,node_cvat_converter,node_training_guide toneRose
class node_video_source,node_ultralytics,node_trained_model toneIndigo
```

## Components

### Video inference

- [Inference CLI](https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/fall_detection.py): `fall_detection.py`
- [Pose detection](https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/src/pose_detector.py): `src/pose_detector.py`

### Person and state analysis

- [Person tracking](https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/src/tracker.py): `src/tracker.py`
- [Activity classification](https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/src/activity_classifier.py): `src/activity_classifier.py`
- [Fall state machine](https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/src/fall_detector.py): `src/fall_detector.py`

### Results and events

- [Frame visualization](https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/src/visualization.py): `src/visualization.py`
- **Annotated video**
- [Fall event logging](https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/fall_detection.py): `fall_detection.py`
- **CSV and JSON events**

### Model preparation

- [Annotation workflow](https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/docs/ANNOTATION_GUIDE.md): `docs/ANNOTATION_GUIDE.md`
- [Pose label converter](https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/tools/coco_keypoints_to_yolo_pose.py): `tools/coco_keypoints_to_yolo_pose.py`
- [Model training](https://github.com/surajkrawat/fall-detection-yolo26-pose/blob/main/docs/TRAINING_GUIDE.md): `docs/TRAINING_GUIDE.md`

### Other components

- **Input video**
- **YOLO pose model**
- **Trained pose model**

## Connections

- Input video → Inference CLI: provides frames (evidence: `README.md`)
- Inference CLI → Pose detection: runs inference (evidence: `fall_detection.py`)
- Pose detection → YOLO pose model: invokes model (evidence: `src/pose_detector.py`)
- Trained pose model → Pose detection: loads weights (evidence: `src/pose_detector.py`)
- Inference CLI → Person tracking: updates tracks (evidence: `fall_detection.py`)
- Inference CLI → Activity classification: classifies tracks (evidence: `fall_detection.py`)
- Inference CLI → Fall state machine: checks fall state (evidence: `fall_detection.py`)
- Inference CLI → Frame visualization: draws frames (evidence: `README.md`)
- Frame visualization → Annotated video: renders output (evidence: `README.md`)
- Inference CLI → Fall event logging: records events (evidence: `fall_detection.py`)
- Fall event logging → CSV and JSON events: writes logs (evidence: `fall_detection.py`)
- Annotation workflow → Pose label converter: documents conversion (evidence: `tools/coco_keypoints_to_yolo_pose.py`)
- Pose label converter → Model training: prepares labels (evidence: `tools/coco_keypoints_to_yolo_pose.py`)
- Model training → Trained pose model: trains model (evidence: `README.md`)
