YOLOFall is a small project that detects people, extracts pose keypoints, tracks individuals across frames, and applies a simple time-based heuristic to detect falls.
- Person detection and pose: uses an ultralytics YOLOv8 pose model (yolov8*-pose.pt) to get bounding boxes and keypoints.
- Multi-object tracking: DeepSORT (deep_sort_realtime) keeps persistent IDs for people so per-person histories can be tracked over time.
- Simple fall detection: a time-windowed heuristic marks a person as FALLEN if they go from standing to laying within a short time window.
- Reattachment: a small cache attempts to reattach recently lost track IDs to new detections using IoU + recency so short occlusions don't break a person's history.
yolofall/
├── data/
│ ├── fall_*.mp4 // sample videos for testing
│ └── ...
├── output/ // saved output videos
│ ├── ...
├── requirements.txt
└── main.py
-
Create a Python environment and install dependencies (example):
python -m venv .venv .\.venv\Scripts\Activate.ps1 pip install -r requirements.txt
-
Run the script on a video or webcam:
python main.py --video "data/fall_5.mp4" --model x --save # or for webcam python main.py --webcam --model s
Note: The videos available in the
data/folder are extracted from this video.
If --save is used, output videos will be saved to the output/ folder with bounding boxes, keypoints, track IDs, and fall status overlaid.
The colors indicate fall status:
- Green: standing position
- Yellow: intermediate position
- Orange: laying position
- Red: fallen position
The model is not perfect and may produce false negatives. The data/fall_5.mp4 video works well with the x model. Feel free to try your webcam, it works better, even with smaller models.