Skip to content

A real-time fall detection system using computer vision and machine learning to analyze CCTV footage and alert caregivers.

License

Notifications You must be signed in to change notification settings

FallSafe/FallSafe-yolov8

Repository files navigation

Fall Safe: Real-Time Fall Detection System

Abstract

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.

Features

  • 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.

Getting Started

Prerequisites

  • Python: Latest version
  • NVIDIA GPU (highly recommended): For accelerated processing

Setup and Installation

  1. Install Python

  2. Set Up YOLOv8 Project

    mkdir YOLO_PROJECT/yolov8-python
    cd YOLO_PROJECT/yolov8-python
  3. 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
    • Using conda: For detailed instructions on creating a conda environment, refer to the Official Anaconda Documentation.

  4. Install GPU Drivers and CUDA

    • Install NVIDIA GPU drivers.
  5. 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
  6. 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.

Running the System

  1. 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

  2. Prepare and Get Labelled Dataset from Roboflow

    • Upload images to Roboflow and label them as either fall or nofall.
    • 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
  3. 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
  4. 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
  5. Perform Classification

    yolo detect predict model=runs/classify/yolov8_fallsafe_detection/weights/best.pt source="path/image.jpg" save=True
  6. 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

Contributing

Contributions are welcome! Please open an issue or submit a pull request if you have improvements or suggestions.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For any questions or feedback, please contact us at Issues Pages.

Authors


Fall Safe is developed by the above contributors. For more information, visit our GitHub repository.

About

A real-time fall detection system using computer vision and machine learning to analyze CCTV footage and alert caregivers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published