This software project is designed to automate traffic counting using YOLOv8, a state-of-the-art object detection model. It can be used to count vehicles in a video stream or a camera feed. The program is written in Python 3.10 and utilizes the Ultralytics package, which includes YOLOv8. This README provides an overview of the project, installation instructions, and usage details.
- Introduction
- Overview
- Getting Started
- Usage
- YOLOv8 Weights
- Output
- Python Version
- Authors
- Acknowledgments
The Traffic Counting Software using YOLOv8 is a versatile tool for traffic analysis. Key features and components include:
- Object Detection: YOLOv8 is used for real-time vehicle detection in video streams.
- Video Sources: You can use either a video file or a connected camera as the input source.
- File Handling: The program handles video files and saves traffic count information to a file.
- YOLO Weights: Pre-trained YOLOv8 weights are provided in the "weights" folder.
These instructions will help you set up the project on your local machine for development and testing purposes.
Before you begin, make sure you have the following prerequisites installed:
- Microsoft Windows® 11 as the operating system (OS).
- Python 3.10 as the development environment.
- Required Python packages (you can install them using
pip install -r requirements.txt
). - Ultralytics package, which contains YOLOv8.
- Access to a video source (file path or attached camera).
-
Clone this repository to your local machine:
git clone https://github.com/anujeshify/Traffic-Counting-Program-using-YOLOv8.git
-
Change your current directory to the project folder:
cd Traffic-Counting-Program-using-YOLOv8
-
Install the required packages using pip:
pip install -r requirements.txt
-
Ensure you have the YOLOv8 weights file (
yolov8m.pt
) in theYolo-Weights
folder.
-
Run the
TrafficCounter.py
script in PyCharm or your preferred Python IDE. -
Modify the video source by changing the file path or using a connected camera. You can do this in the script.
-
The program will detect and count vehicles in the video stream.
-
The vehicle count information will be saved in
vehicle_count.txt
.
This project includes pre-trained YOLOv8 weights (yolov8m.pt
) located in the Yolo-Weights
folder. You can use this file for object detection. You can also experiment with other YOLOv8 weights like yolov8l.pt
and yolov8n.pt
for different model variants.
The program will save the vehicle count in the vehicle_count.txt
file in the project directory.
here: vid - vehicle id
- Python - Front-End Application
- Ultralytics - YOLOv8 Object Detection
- OpenCV - Computer Vision Library
- NumPy - Numerical Computing Library
- Anujesh Bansal - Initial work - your_username
- Inspiration - This project was inspired by the need for accurate traffic analysis and management using concepts of deep learning and neural networks.