This project utilizes the YOLOv8l model for car detection and implements a Simple Online and real-time tracking (SORT) algorithm for counting the number of cars in a video stream. The system detects cars within a predefined region of interest and tracks them using unique IDs.
- Python 3.x
- OpenCV
- NumPy
- Ultralytics YOLO
- SORT (Simple Online and Realtime Tracking)
- Clone the repository:
git clone https://github.com/rajveersinghcse/Car-Detection-and-Car-Counter.git
- Install the required packages:
pip install -r requirements.txt
- Ensure you have a video file named
cars.mp4
in the project directory. - Download the YOLOv8l model weights (
yolov8l.pt
) from the Ultralytics YOLO repository and place them in the project directory. - Run the following command to start the car detection and counting process:
python car_counter.py
car_counter.py
: This script performs car detection and counting using YOLOv8l for object detection and SORT for object tracking. It reads frames from thecars.mp4
video, applies a mask to isolate the region of interest, detects cars within this region, tracks them using SORT, and counts the total number of unique cars.
- YOLOv8l: Ultralytics YOLO - GitHub Repository
- SORT: Simple Online and Realtime Tracking - GitHub Repository
This project is licensed under the MIT License.