Rules instead of a trained classifier
Every threshold has a physical meaning and can be tuned from the CLI, and every alert can be explained from the trace. No fall dataset is needed to start.
Raises an alert about a second after a person ends up lying on the ground. YOLO pose keypoints and multi-person tracking feed a small state machine per person, driven by rules you can read: torso angle, body shape and hip speed. No training data, no GPU: it runs on a laptop CPU and explains every alert it raises.
Each frame goes through a pose model with a tracker, so every person keeps an ID. From the shoulders and hips the pipeline computes three simple features, and a state machine per person turns them into an alert only after a lying posture is held, which filters out bending, sitting and quick crouches.
The state machine is what keeps false alarms down: a fall must be followed by a lying posture held for one second before the alert fires, and the alert closes on its own when the person stands up again.
The chart below is the real trace written by --trace-csv for the clip in the demo. The torso angle jumps past 45° when the person goes down, the state moves to FALLEN almost immediately, and the alert opens one second later, at 3.31 s.



| Run | Hits | Misses | False alerts | Alert delay |
|---|---|---|---|---|
| imgsz 1280, conf 0.30 (published run, current library versions) | 9 / 9 | 0 | 0 | 1.5–2.6 s (one late hit at +4.0 s) |
| previous code (before the id-switch guard), same settings and library versions | 7 / 9 | 2 | 0 | not tabulated |
| imgsz 1280, conf 0.35 (earlier run, older library versions) | 8 / 9 | 1 | 0 | 1.5–2.6 s (one marginal hit at +4.2 s) |
| imgsz 640, conf 0.35 (earlier run, older library versions) | 6 / 9 | 3 | 0 | 1.5–2.4 s |
Fall mix: eight falls from GMDCSA24 (three people, day and night, side, forward and backward falls) plus an outdoor fall in snow. The published run uses the library versions pinned in constraints.txt; with the previous code those versions gave 7 / 9, because a new person at a hard cut was stitched onto the previous person's open alert. Own measurement on one compilation, not a validation.
Doorbell and handheld phone clips, small people, portrait video and snow. With --model yolo26s-pose.pt --conf 0.20 (plus the pose gate and id-switch repair, both on by default), all three slips raise an alert, and each alert closes within 2 s of its person leaving the screen.
| Pose model | imgsz | conf | Alerts (3 falls) |
|---|---|---|---|
| yolo11n-pose (default) | 640 | 0.30 | 1 / 3 |
| yolo26s-pose | 640 | 0.20 | 3 / 3 |
| yolo26s-pose | 1280 | 0.20 | 2 / 3 |
| yolo26m-pose | 640 | 0.20 | 1 / 3 |
Swapping in the newer yolo26s-pose was the biggest win on small, handheld footage: it keeps a person lying on the ground in view far longer than the nano model.
git clone https://github.com/karemdm/fall-detection-alert.git
cd fall-detection-alert
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install -e .git clone https://github.com/karemdm/fall-detection-alert.git
cd fall-detection-alert
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -r requirements.txt
pip install -e .git clone https://github.com/karemdm/fall-detection-alert.git
cd fall-detection-alert
python -m venv .venv
.venv\Scripts\activate.bat
pip install -r requirements.txt
pip install -e .fall-alert -i samples/gmdcsa24-s1-fall-05.mp4 -o outputs/fall-05.mp4 --events-json outputs/fall-05.jsonfall-alert -i input.mp4 -o outputs/out.mp4 --imgsz 1280 --trace-csv outputs/trace.csvEvery threshold has a physical meaning and can be tuned from the CLI, and every alert can be explained from the trace. No fall dataset is needed to start.
An alert needs a lying posture held for 1.0 s, with short gaps tolerated. That removes alarms from bending, tying shoes or sitting down quickly.
Normalizing the hip speed by the person's height makes the same threshold work near and far from the camera.
When shoulders or hips are not visible, the box aspect ratio takes over, so occlusion does not silence the detector.
A track can only fall after it showed a body pose (6 confident keypoints) in some frame. Bins, coats and shadows detected as a person never do, so their wide boxes no longer raise alerts.
When a person falls the box goes from tall to wide and the tracker often starts a new id. A new track that appears within one body height of a track lost moments ago continues its state and alert, unless the lost track was upright or the newcomer is neither tilted nor wide, so a new person walking in starts fresh.