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.
- OR an Intel RealSense camera.
- Python 3.10+
After cloning, please install the required Python packages by running this command:
pip install -r requirements.txtDependencies currently include:
opencv-pythonultralyticspyrealsense2numpy
Currently, the script supports the following use cases:
Run the following command:
python mediapipe_models/hand_gesture_recognizer.pyTo process a folder of test videos (that are used as input to the model), follow these steps:
- Place your video files in a folder (here it's
test-videos). - Run the following command:
python with_stock_vid/main.pyThe script will iterate through all video files in the specified folder and display the processed frames with motion detection results. .
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/
│ ├── main.py # Script to run motion detection from 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
pyrealsense2is installed correctly for live camera input.
- YOLOv8 model by Ultralytics. Key features of YOLOv8 model here
- Intel RealSense SDK for Python
