SafeGuardian is a smart, responsive, and real-time fall detection system built with YOLOv8, MediaPipe, and Streamlit. It is designed to detect falls in elderly individuals and instantly alert guardians via push notifications using free services like ntfy.sh.
- 🎯 Accurate Fall Detection using YOLOv8 + MediaPipe Pose
- 🖥️ Supports Webcam & Video Upload
- 🔔 Push Notification Alerts via ntfy.sh (Free)
The app shows live detection with badge updates for:
- 🟢 Moving
- 🟡 Standing
- 🚨 Falling
SafeGuardian uses a hybrid computer vision pipeline that combines YOLOv8 for object detection and MediaPipe Pose for body posture analysis.
- YOLOv8 detects people in each frame using bounding boxes.
- Only the
"person"class is passed to the next stage, filtering out noise from other objects.
- For each detected person, MediaPipe Pose extracts 33 key body landmarks (e.g., nose, shoulders, hips, knees).
- These landmarks form a skeleton model representing the person's posture.
The system analyzes:
-
Body Orientation
- Standing → body keypoints form a vertical alignment.
- Fallen → keypoints shift to a horizontal alignment.
-
Bounding Box Ratio
- Tall (height > width) → Standing
- Wide (width > height) → Falling
-
Head Position
- If the head drops below hips/knees → potential fall
-
Sudden Posture Change
- Sharp change in orientation between frames can trigger fall detection.
- To avoid false positives, the system checks that the “Falling” posture is detected consistently across a few frames.
- Once confirmed:
- The status badge changes to
🚨 Fall Detected - A push notification is sent to the guardian using ntfy.sh
- A short toast alert is shown in the app as visual confirmation
- The status badge changes to
pip install -r requirements.txtRequired packages:
- streamlit
- opencv-python
- ultralytics
- mediapipe
- requests
python3 -m streamlit run app.py- Open a browser or the ntfy app
- Visit or subscribe to:
https://ntfy.sh/safeguardian - When a fall is detected, you’ll receive an instant push notification
.
├── app.py # Main Streamlit app UI
├── fall_detection.py # Core YOLO + pose logic
├── notify.py # Push notification logic using ntfy.sh
- Change topic name in
notify.pyto personalize notification channels
- Home elderly safety monitoring
- Hospital patient care
- Independent living support
