This project implements a real-time object detection and tracking system using deep learning models, specifically YOLOv5 and OpenCV. The system captures video from the webcam, detects objects in the video frames, and tracks them using specified algorithms.
- Features
- Requirements
- Installation
- Usage
- Running the Project
- Project Structure
- Notes
- Authors
- License
- Real-Time Object Detection: Utilizes YOLOv5 for fast and accurate object detection.
- Object Tracking: Implements CSRT object tracking to follow detected objects in video feeds.
- Customizable: Easily modifiable to include different models or video sources.
- Python 3.x
- PyTorch (1.7 or higher)
- torchvision
- numpy
- opencv-python
- pandas
-
Clone this repository:
git clone <repository_url> cd Object-Detection-Tracking
-
Install the required packages:
pip install -r requirements.txt
-
Run Object Detection:
- This script captures video from the webcam and detects objects using the YOLOv5 model.
python object_detection.py
-
Run Object Tracking:
- This script uses detected objects from the YOLOv5 model and tracks them using OpenCV’s CSRT tracker.
python tracker.py
-
Exit the Application:
- Press the 'q' key to exit the video stream.
Ensure you have a webcam connected or provide a video file path to the script. The YOLOv5 model will automatically download its weights when the code is run for the first time.
-
Start the webcam and run the object detection:
- Open a terminal window and execute the object detection script:
python object_detection.py
-
Open another terminal window and run the tracking script:
python tracker.py
The project directory typically looks like this:
Object-Detection-Tracking/
├── object_detection.py # Script for real-time object detection using YOLOv5
├── tracker.py # Script for tracking detected objects
├── requirements.txt # List of required Python packages
└── README.md # Project documentation
- You can customize the model used in the detection script by modifying the line where the model is loaded. You can choose between different YOLOv5 model sizes (YOLOv5s, YOLOv5m, etc.) based on your performance needs.
- Ensure that your Python environment has access to a compatible GPU for faster inference.
This project is licensed under the MIT License. See the LICENSE file for more details.
- Zunaid Hasasn
- [email protected]