This repository contains a simple, yet functional, prototype for a real-time human anomaly detection and tracking system in crowded environments. The system is designed to identify and follow individuals whose behavior deviates from a learned "normal" pattern.
The project is built on a two-stage pipeline:
- Perception: Detect and track individuals in a video stream.
- Analysis: Analyze their movement for anomalous behavior.
- Object Detection: YOLOv8, a state-of-the-art model for real-time object detection.
- Multi-Object Tracking: DeepSORT, a robust algorithm that maintains unique IDs for individuals across frames, even during occlusions.
- Anomaly Detection: An Autoencoder model, which is a neural network trained to recognize "normal" patterns. It identifies anomalies by failing to reconstruct a pattern it has never seen before, using the reconstruction error as an anomaly score.
- Development Framework: PyTorch for building and training the anomaly detection model.
- Video Processing: OpenCV for handling video I/O.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
First, ensure you have Python 3.8+ installed on your system. It is highly recommended to use a virtual environment to manage project dependencies.
python3 -m venv venvsource venv/bin/activatevenv\Scripts\activateClone this repository to your local machine:
git clone https://github.com/your-username/your-repository-name.git
cd your-repository-nameInstall the required Python packages:
pip install -r requirements.txtTo run the end-to-end prototype, you will need a video file for testing. The code is configured to use a video file named your_video.mp4 in the project directory.
Download a video clip you like to test or you can use the live video footage.
Place the video file in your project's root directory.
Rename the video file to your_video.mp4 or update the cv2.VideoCapture('your_video.mp4') line in the main.py script.
Run the script from your terminal:
python main.pyThe system will open a video window displaying the real-time detection, tracking, and anomaly status for each person. Press q on your keyboard to exit the program.
main.py: The main script that runs the end-to-end prototype.
requirements.txt: Lists all Python dependencies.
.gitignore: Specifies files to be ignored by Git.
README.md: Project description and instructions.##Visuals 

