A real-time AI-powered fall detection system using OpenAI's vision models and Telegram notifications for hospital environments.
main.py)main_ui.py) - NEW!cd video_understading
pip install -r requirements.txt
cp env_template.txt .env
Edit the .env file with your credentials:
OPENAI_API_KEY=your_openai_api_key_here
USE_TELE_ALERT=true
TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here
TELEGRAM_CHAT_ID=your_telegram_chat_id_here
.env fileUSE_TELE_ALERT=true in your .env file to enable Telegram notificationsUSE_TELE_ALERT=false to disable Telegram (fall detection logs will still appear in terminal)/newbothttps://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdatescamera_index in fall_detection_system.py if needed# Quick start with automatic checks
python start_web_ui.py
# Or run directly
python main_ui.py
Then open http://localhost:7860 in your browser.
# Test the system first
python src/test_system.py
# Run the fall detection system
python main.py
python start_web_ui.pypython src/test_system.py
This will verify:
python main.py
The system uses OpenAI's GPT-4 Vision model to analyze frames for:
video_understading/
βββ main.py # Console version (main system)
βββ main_ui.py # Web UI version (Gradio interface)
βββ start_web_ui.py # Quick start script for Web UI
βββ demo.py # Demo analysis script
βββ requirements.txt # Python dependencies
βββ env_template.txt # Environment configuration template
βββ README.md # Main documentation
βββ README_WEB_UI.md # Web UI specific documentation
βββ src/ # Source code modules
β βββ __init__.py # Configuration and initialization
β βββ utils.py # Utility functions
β βββ alert.py # Telegram notification handling
β βββ setup.py # Setup and configuration
β βββ test_system.py # System testing
βββ evidence/ # Auto-created for evidence images
βββ temp/ # Temporary files (analysis frames)
βββ media/ # Demo videos
βββ bison.mp4 # Test video
Camera not found
OpenAI API errors
Telegram not working
False positives
fall_detection_system.pyanalysis_interval (default: 5 seconds)frames_to_base64()max_frames parameter (default: 5)initialize_camera()The system provides detailed logging:
When falls are detected:
evidence/ folderFeel free to contribute improvements:
This project is for educational and research purposes. Ensure compliance with privacy laws when deploying in healthcare environments.
For issues or questions:
test_system.py to identify problemsA real-time AI-powered fall detection system using OpenAI's vision models and Telegram notifications for hospital environments.
main.py)main_ui.py) - NEW!cd video_understading
pip install -r requirements.txt
cp env_template.txt .env
Edit the .env file with your credentials:
OPENAI_API_KEY=your_openai_api_key_here
USE_TELE_ALERT=true
TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here
TELEGRAM_CHAT_ID=your_telegram_chat_id_here
.env fileUSE_TELE_ALERT=true in your .env file to enable Telegram notificationsUSE_TELE_ALERT=false to disable Telegram (fall detection logs will still appear in terminal)/newbothttps://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdatescamera_index in fall_detection_system.py if needed# Quick start with automatic checks
python start_web_ui.py
# Or run directly
python main_ui.py
Then open http://localhost:7860 in your browser.
# Test the system first
python src/test_system.py
# Run the fall detection system
python main.py
python start_web_ui.pypython src/test_system.py
This will verify:
python main.py
The system uses OpenAI's GPT-4 Vision model to analyze frames for:
video_understading/
βββ main.py # Console version (main system)
βββ main_ui.py # Web UI version (Gradio interface)
βββ start_web_ui.py # Quick start script for Web UI
βββ demo.py # Demo analysis script
βββ requirements.txt # Python dependencies
βββ env_template.txt # Environment configuration template
βββ README.md # Main documentation
βββ README_WEB_UI.md # Web UI specific documentation
βββ src/ # Source code modules
β βββ __init__.py # Configuration and initialization
β βββ utils.py # Utility functions
β βββ alert.py # Telegram notification handling
β βββ setup.py # Setup and configuration
β βββ test_system.py # System testing
βββ evidence/ # Auto-created for evidence images
βββ temp/ # Temporary files (analysis frames)
βββ media/ # Demo videos
βββ bison.mp4 # Test video
Camera not found
OpenAI API errors
Telegram not working
False positives
fall_detection_system.pyanalysis_interval (default: 5 seconds)frames_to_base64()max_frames parameter (default: 5)initialize_camera()The system provides detailed logging:
When falls are detected:
evidence/ folderFeel free to contribute improvements:
This project is for educational and research purposes. Ensure compliance with privacy laws when deploying in healthcare environments.
For issues or questions:
test_system.py to identify problems