A real-time fall detection system using YOLOv8, OpenCV, and SMTP-based email alerts.
Detects human falls in video or webcam feeds and notifies via email with a captured frame.
- 🎯 Accurate Detection using YOLOv8 (
yolov8soryolov8m) - 🧍 Person Tracking with unique IDs & position history
⚠️ Fall Detection Logic based on:- Aspect Ratio (detect lying down)
- Sudden Vertical Motion
- Screen Position (proximity to floor)
- 📸 Email Alert with captured image via Brevo SMTP
- 📹 Video File & Live Webcam Modes
- ⚙️ Configurable Thresholds and detection sensitivity
Install dependencies with:
pip install ultralytics opencv-python cvzone numpypython fall_detection.pypython fall_detection.py live| Key | Action |
|---|---|
| `q` | Quit the program |
| `s` | Switch video/live mode |
| `r` | Reset fall detection |
Uses Brevo SMTP for sending alerts.
In the script, update:
TO_EMAIL = '[email protected]' # Replace with actual emailMake sure SMTP settings (username, password, or app password) are correctly configured.
- Compatible with any YOLOv8 model (`yolov8s.pt`, `yolov8m.pt`, etc.)
- Video will restart automatically after ending.
- Detection thresholds are configurable for sensitivity tuning.
Pull requests, improvements, and feature additions are welcome!