Fall Safe is designed to address fall-related injuries among vulnerable populations by leveraging computer vision and machine learning. The system detects falls in real-time from CCTV footage, analyzing video streams to identify abnormal movements and postures. Alerts are sent to caregivers or emergency services with details about the incident, aiming to improve response times and safety for at-risk individuals.
- Real-Time Fall Detection: Utilizes YOLOv8 for accurate fall detection.
- Integration: Works with existing CCTV setups.
- Alerts: Sends notifications with incident details to caregivers or emergency services.
- Python: Latest version
- NVIDIA GPU (highly recommended): For accelerated processing
-
Install Python
- Download and install from Python's official website.
-
Set Up YOLOv8 Project
mkdir YOLO_PROJECT/yolov8-python cd YOLO_PROJECT/yolov8-python
-
Create a Virtual Environment
-
Using venv:
python -m venv env
Activate the virtual environment:
- On Windows:
.\env\Scripts\activate
- On macOS/Linux:
source env/bin/activate
- On Windows:
-
Using conda: For detailed instructions on creating a conda environment, refer to the Official Anaconda Documentation.
-
-
Install GPU Drivers and CUDA
- Install NVIDIA GPU drivers.
-
Install Required Packages
- Install the packages from the "requirements.txt" file.
pip install -r requirements.txt
- Install pyTorch and its dependencies. Get the architecture, platform and select the latest version of cuda from pyTorch Website
Example:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
-
Verification
- Verify all installations by running the test files from the "TestFiles" folder.
- Run "Test_Camera.py" to get the ids for the camera source.
- Run "Test_Cuda_GPU.py" to check the proper verification of cuda installation and gpu detection.
- Verify all installations by running the test files from the "TestFiles" folder.
-
Test YOLOv8 Inference by downloading the models from Ultralytics
python detection.py --model yolov8n.onnx --source data/images/horses.jpg python detection.py --model yolov8n.onnx --source data/videos/road.mp4 python detection.py --model yolov8n.onnx --source 0
*NOTE: Get the detection.py from ultralytics github page and for yolov8
-
Prepare and Get Labelled Dataset from Roboflow
- Upload images to Roboflow and label them as either
fall
ornofall
. - Discard any images that are not relevant by marking them as null.
- Download the structured dataset from Roboflow and select YOLOv8 for model type when prompted.
- Extract the zip file from roboflow
- Upload images to Roboflow and label them as either
-
Train the Model
- Modify the name for the current operation.
- Adjust the parameters value to properly utilize the GPU.
yolo detect train model=yolov8n.pt data="path/to/dataset" imgsz=224 device=0 workers=2 batch=16 epochs=100 patience=50 name=yolov8_fallsafe_detection
-
Continue Training after Pause OR Further Train model with new/updated Dataset
yolo detect train model=runs/classify/yolov8_fallsafe_detection/weights/last.pt resume=True
-
Perform Classification
yolo detect predict model=runs/classify/yolov8_fallsafe_detection/weights/best.pt source="path/image.jpg" save=True
-
Real-Time Classification via Camera
yolo detect predict model=runs/classify/yolov8_fallsafe_detection/weights/best.pt source="0" save=True conf=0.5 show=True save_txt=True line_thickness=1
Contributions are welcome! Please open an issue or submit a pull request if you have improvements or suggestions.
This project is licensed under the MIT License - see the LICENSE file for details.
For any questions or feedback, please contact us at Issues Pages.
Fall Safe is developed by the above contributors. For more information, visit our GitHub repository.