https://github.com/serhatderya/fall_detection
This project implements a computer vision-based fall detection system using deep learning techniques. The system can detect whether a person has fallen in images or video frames.
https://github.com/serhatderya/fall_detection
ai artificial-intelligence artificial-neural-networks computer-vision deep-learning deep-neural-networks deeplearning falldetection matplo neural-network numpy opencv pil pillow pytorch tensorflow yolo yolov5 yolov8
Last synced: about 1 month ago
JSON representation
This project implements a computer vision-based fall detection system using deep learning techniques. The system can detect whether a person has fallen in images or video frames.
- Host: GitHub
- URL: https://github.com/serhatderya/fall_detection
- Owner: SerhatDerya
- Created: 2025-03-23T10:05:06.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-03-23T10:43:40.000Z (10 months ago)
- Last Synced: 2025-03-23T11:25:00.881Z (10 months ago)
- Topics: ai, artificial-intelligence, artificial-neural-networks, computer-vision, deep-learning, deep-neural-networks, deeplearning, falldetection, matplo, neural-network, numpy, opencv, pil, pillow, pytorch, tensorflow, yolo, yolov5, yolov8
- Language: Python
- Homepage:
- Size: 12.7 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🚑 Fall Detection System
This project implements a **computer vision-based fall detection system** using deep learning techniques. The system can detect whether a person has fallen in images or video frames.
## 📁 Project Structure
- main.py - Main script for running fall detection and evaluation
- data_handler.py - Handles dataset loading and preprocessing
- my_models.py - Contains model definitions
- fall_dataset/ - Directory containing training and validation data
- images/ - Contains input images
- labels/ - Contains corresponding labels
- model_weights/ - Directory containing trained model weight files (.h5 files)
## 📊 Data Source
The dataset used in this project is sourced from **Kaggle**.
### 📄 Dataset Details
- **Name:** Fall Detection Dataset
- **Link:** https://www.kaggle.com/datasets/uttejkumarkandagatla/fall-detection-dataset
- **Size:** 374 samples
- **Description:** *Images of people in various postures including standing, sitting, and fallen states in different environments*
## 🧠 Models
The system uses two main models:
1. **Fall Detection Model (`fall_detection_model`)** - A custom deep learning model that classifies cropped person images as *fallen* or *not fallen*.
2. **YOLO Model (`yolo_model`)** - Uses **YOLOv5** to detect people in images and generate bounding boxes.
## 📦 Dataset Labels
The `Fall_dataset` class processes the dataset with the following label convention:
- `0` - Fallen
- `1` - Standing
- `2` - Sitting
## 🚀 Usage
### 🔍 Running Evaluation
This will:
- Load the fall detection model with pre-trained weights
- Process validation images with YOLO to detect people
- Apply the fall detection model to each detected person
- Calculate performance metrics (accuracy, precision, recall, F1 score)
### 🎓 Training a New Model
The system supports training using the `train` method in the `fall_detection_model` class.
## 📈 Performance Metrics
The system calculates:
- **Accuracy**: (TP + TN) / (TP + FP + TN + FN)
- **Precision**: TP / (TP + FP)
- **Recall**: TP / (TP + FN)
- **F1 Score**: 2 * TP / (2 * TP + FP + FN)
### Where:
- **TP** = True Positives (*Fall - Detected*)
- **FP** = False Positives (*Not Fall - Detected*)
- **TN** = True Negatives (*Not Fall - Not Detected*)
- **FN** = False Negatives (*Fall - Not Detected*)
## 🔧 Requirements
- **TensorFlow**
- **PyTorch**
- **OpenCV**
- **Matplotlib**
- **NumPy**
- **YOLOv5 (via torch hub)**
- **PIL**