This repository provides a machine vision implementation for detecting human motions in real-time.
- YOLOv8 for Person Detection: Utilizes the YOLOv8 model to detect humans in real-time.
- Motion Detection: Detects moving gestures by analyzing motion within the bounding box of detected persons.
- Flexible Input:
- Process live input from a webcam camera.
- Process video files from a folder.
- Process live input from an Intel RealSense camera.
- A computer with a webcam camera.
- Python 3.10+
After cloning, please install the required Python packages by running this command:
pip install -r requirements.txt
Dependencies currently include:
opencv-python
ultralytics
pyrealsense2
numpy
Currently, the script supports the following use cases:
To process a folder of test videos:
- Place your video files in a folder (here it's
test-videos
). - Run the following command:
python with_stock_vid/main.py
The script will iterate through all video files in the specified folder and display the processed frames with motion detection results.
TO BE ADDED: Script for live motion detection from webcam camera.
Currently, the repository structure is as follows:
├── models/ # For classes that use machine learning models
│ ├── motion_detector.py # Contains the MotionDetector class
│ ├── yolov8n.py # The YOLOv8 model for object detection
├── with_stock_vid/
│ ├── main.py # Main script with stock videos
│ ├── test-videos/ # Folder containing test video files
├── with_camera/ # TO BE ADDED
│ ├── main.py # TO BE ADDED: Script for motion detection from webcam camera
├── requirements.txt # Python dependencies
├── README.md # Documentation (this file)
- Motion Detection Sensitivity: Requires further fine-tuning of the motion detection threshold. The algorithm still needs to distinguish actual waving gesture to other motions.
- Deprecated Warnings: Some platforms may show warnings for deprecated camera APIs.
- Intel RealSense SDK Installation: Ensure
pyrealsense2
is installed correctly for live camera input.
- YOLOv8 model by Ultralytics. Key features of YOLOv8 model here
- Intel RealSense SDK for Python