Video analyticsCLIAGPL-3.0

Fall Detection Alert

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.

The command running end to end: live preview on top, log and events JSON below. Recorded on a laptop CPU, with model loading and processing sped up. Footage: GMDCSA24 (MIT).
falls caught in the fall mix
9 / 9
false alerts on the test clips
0
lying posture before the alert fires
~1 s
training images
0

01Pose keypoints in, explainable alerts out

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.

01 Video frame any MP4 / camera clip frame time t 02 YOLO11n-pose + ByteTrack IDs box + 17 keypoints per person 03 Keypoint gate shoulders / hips conf ≥ 0.5 else box only 04 Features torso angle θ aspect ratio w/h hip velocity v 05 State machine one per track pose gate, id repair time thresholds 06 Outputs annotated MP4 events JSON trace CSV
Fig. 01 · Processing pipeline, from the video frame to the outputs

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.

UPRIGHT standing or walking FALLING fast drop or tilt FALLEN lying posture ALERT event logged v ≥ 0.8 h/s or θ ≥ 45° θ ≥ 60° or w/h ≥ 1.2 held 1.0 s no lying for 2 s upright held 2 s
Fig. 02 · Per-person state machine with the default thresholds
Torso angle θ
Angle of the shoulder-to-hip line from vertical: about 0° standing, about 90° lying.
Aspect ratio w/h
Width over height of the person box; the fallback when shoulders or hips are hidden.
Hip velocity v
Downward speed of the hips in body heights per second, so it does not depend on distance to the camera.

02What the rules see during a fall

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.

UPRIGHT FALLING FALLEN ALERT 0 25 50 75 100 45° falling 60° lying torso angle θ (degrees) -0.5 -0.12 0.25 0.62 1 0.8 h/s hip velocity v (body heights / s) 0 s 1 s 2 s 3 s 4 s 5 s
Fig. 03 · Feature trace of track #1 on GMDCSA24 fall-05, with the state shown as background bands
1.2 s · upright, green box
1.2 s · upright, green box
2.6 s · fallen, red box
2.6 s · fallen, red box
4.2 s · alert banner open
4.2 s · alert banner open
RunHitsMissesFalse alertsAlert delay
imgsz 1280, conf 0.30 (published run, current library versions)9 / 9001.5–2.6 s (one late hit at +4.0 s)
previous code (before the id-switch guard), same settings and library versions7 / 920not tabulated
imgsz 1280, conf 0.35 (earlier run, older library versions)8 / 9101.5–2.6 s (one marginal hit at +4.2 s)
imgsz 640, conf 0.35 (earlier run, older library versions)6 / 9301.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.

Harder footage: slips on ice

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.

Recorded on a laptop CPU, processing sped up. Third-party footage from a public compilation of slips on ice.
Pose modelimgszconfAlerts (3 falls)
yolo11n-pose (default)6400.301 / 3
yolo26s-pose6400.203 / 3
yolo26s-pose12800.202 / 3
yolo26m-pose6400.201 / 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.

03Three steps to try it

install
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 .
run on a sample clip
fall-alert -i samples/gmdcsa24-s1-fall-05.mp4 -o outputs/fall-05.mp4 --events-json outputs/fall-05.json
small or distant people
fall-alert -i input.mp4 -o outputs/out.mp4 --imgsz 1280 --trace-csv outputs/trace.csv

04Why it is built this way

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.

Confirmation time

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.

Velocity in body heights

Normalizing the hip speed by the person's height makes the same threshold work near and far from the camera.

Graceful degradation

When shoulders or hips are not visible, the box aspect ratio takes over, so occlusion does not silence the detector.

Objects are not people

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.

Repairing id switches

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.