AI-powered fall detection system using pose estimation on Raspberry Pi 5 with Hailo-10H accelerator (40 TOPS). Features real-time monitoring with web interface and alarm notifications.
- Real-time pose estimation using YOLOv8 Pose on Hailo-10H NPU (40 TOPS)
- Fall detection algorithm based on body orientation and keypoint analysis
- Web interface for remote monitoring (Flask + WebSocket)
- Live video stream with pose skeleton visualization (cyan lines + magenta keypoints)
- Alarm system with configurable duration threshold
- Dual output: Local display (Wayland) + browser stream (MJPEG)
- Raspberry Pi 5 (4GB+ RAM recommended)
- Raspberry Pi AI HAT+ (Hailo-10H, 40 TOPS variant)
- Camera:
- Tested with: ArduCAM 12MP IMX708 Wide-Angle (102° FOV)
- Compatible with: Any Libcamera-supported camera (e.g., RPi Camera v2, v3, HQ)
- Display for local monitoring (optional, Wayland required)
- Raspberry Pi OS Bookworm (64-bit)
- Hailo firmware and drivers installed
- Python 3.13+
Follow the official Raspberry Pi documentation to set up Hailo:
Verify Hailo is working:
hailortcli fw-control identifyThis project depends on hailo-apps for pose estimation pipeline:
cd ~/Documents/hailoProjects
git clone https://github.com/hailo-ai/hailo-apps.git
cd hailo-apps
./install.sh
source setup_env.shCreate and activate virtual environment:
python3 -m venv venv_hailo_apps
source venv_hailo_apps/bin/activate
pip install -r requirements.txtClone this repository:
cd ~/Documents/hailoProjects
git clone <your-repo-url> fall-detection-app
cd fall-detection-appInstall Python dependencies:
# Activate hailo-apps venv
source ../hailo-apps/venv_hailo_apps/bin/activate
# Install web dependencies
pip install flask flask-cors flask-socketio python-socketio opencv-pythonThe application uses YOLOv8s Pose model optimized for Hailo-10H:
# Model should be available at:
ls /usr/share/hailo-models/yolov8s_pose_h10.hefIf not present, download from Hailo Model Zoo.
Edit config.py to customize settings:
# Camera resolution
WIDTH = 640
HEIGHT = 480
# Fall detection thresholds
ALARM_DURATION_SECONDS = 1.5 # Time before triggering alarm
FALL_ASPECT_RATIO = 1.3 # Width/height ratio threshold
KEYPOINT_PROXIMITY_THRESHOLD = 0.15 # Hip-shoulder vertical distance
# Web server
WEB_HOST = "0.0.0.0"
WEB_PORT = 5000
MJPEG_FPS = 30
MJPEG_QUALITY = 85
# Model path
DEFAULT_HEF_PATH = "/usr/share/hailo-models/yolov8s_pose_h10.hef"Run the hybrid app with local display + web interface:
cd ~/Documents/hailoProjects/hailo-apps
source venv_hailo_apps/bin/activate
python3 ../fall-detection-app/fall_detection_web.pyAccess web interface:
- Local:
http://localhost:5000 - Network:
http://<raspberry-pi-ip>:5000
Run GStreamer app with Wayland display:
cd ~/Documents/hailoProjects/hailo-apps
source venv_hailo_apps/bin/activate
python3 ../fall-detection-app/fall_detection.py┌─────────────────────────────────────────────────────────┐
│ Raspberry Pi Camera │
└──────────────────────┬──────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ GStreamer Pipeline (picamera2) │
│ ┌─────────┐ ┌──────────┐ ┌────────────────────┐ │
│ │ Source │ -> │ Hailo-10H│ -> │ Pose Estimation │ |
│ │ │ │ Inference│ │ (YOLOv8 Pose) │ │
│ └─────────┘ └──────────┘ └────────────────────┘ │
└──────────────────────┬──────────────────────────────────┘
│
┌──────────────┴──────────────┐
▼ ▼
┌──────────────────┐ ┌──────────────────┐
│ Local Display │ │ Flask Callback │
│ (hailooverlay) │ │ • Draw skeleton │
│ • Wayland sink │ │ • Detect falls │
└──────────────────┘ │ • Save frames │
└────────┬─────────┘
│
┌────────▼─────────┐
│ Web Interface │
│ • MJPEG stream │
│ • WebSocket │
│ • Alarm UI │
└──────────────────┘
The system detects falls using two criteria:
-
Bounding Box Orientation
- Calculates width/height ratio of detected person
- Fall detected if
width > height × FALL_ASPECT_RATIO
-
Keypoint Analysis
- Compares vertical position of hips vs shoulders
- Fall detected if distance <
KEYPOINT_PROXIMITY_THRESHOLD
Alarm triggers after fall persists for ALARM_DURATION_SECONDS.
- Status Indicator: Green (monitoring) / Orange (observing) / Red (alarm)
- Live Video: MJPEG stream with pose skeleton overlay
- Real-time Notifications: WebSocket-based alarm alerts
- Responsive Design: Works on desktop, tablet, mobile
# Check camera connection
libcamera-hello --list-cameras# Verify firmware
hailortcli fw-control identify
# Check device
ls /dev/hailo*# Source hailo-apps environment
cd ~/Documents/hailoProjects/hailo-apps
source setup_env.shEnsure --input rpi is set in sys.argv (should be automatic in fall_detection_web.py)
This project: Copyright © 2026 - All Rights Reserved
See LICENSE file for details.
Third-party components: This project uses hailo-apps (MIT License).
See NOTICE file for full third-party software attributions.
- Hailo AI for Hailo-10H NPU and hailo-apps framework
- Raspberry Pi Foundation for hardware platform and AI kit
- Ultralytics for YOLOv8 Pose model
For issues related to:
- Hailo setup: See Raspberry Pi AI documentation
- hailo-apps: Visit hailo-apps repository
- This project: Open an issue in this repository
# Enable debug logging
export GST_DEBUG=2
# Run with verbose output
python3 fall_detection_web.pySimulate a fall by:
- Lying horizontally in camera view
- Positioning body so hips are level with shoulders
- Alarm should trigger after configured duration
Built with ❤️ for Raspberry Pi 5 + Hailo-10H