Web application tracking and counting vehicles live from one of intersections in Cracow.
Sample.Video.mp4
Web app used to track and count vehicles at an intersection in Cracow.
At home page client receives live-time video of the
intersection after processing.
(There is about 1 to 3 minutes delay compared to the live camera feed.) All processing is done by using YOLOv10s model trained on custom dataset and OpenCV library.
It includes applying bounding boxes on tracked vehicles, predicted type of vehicle and confidence of prediction. In addition center of each vehicle is shown as circle.
When vehicle appears near one of the red lines, the counter is increased and color of the line changes to green. Counter at top left of video is zeroed after every 15min.
The app tracks vehicles only in designated regions of the image, achieved by applying a mask to each video frame.
The mask can be viewed in the "About" section of the website.
VehiclesTracking.mp4
By clicking on plots you can explore plots of how many cars there was at certain time range. Note: If monthly plots lack data, it means the server hasn't been running long enough.
Warning!!! When running app locally plots will be generated from sample data prepared by ChatGPT
Sample plot
In about section on website you can watch sample video and add/remove mask to see in what regions of image vehicles are tracked.

This project is designed for educational and non-comercial use only.
- Docker: Make sure Docker is installed on your system. Follow this guide to install Docker on your platform.
- GPU Support (optional but recommended): For better performance, it's recommended to enable GPU support in Docker. You can find instructions for setting up NVIDIA Docker.
git clone https://github.com/pkacprzak5/TrafficTracking.git
cd <your-path>/TrafficTracking
docker-compose up --build
After everything is set up correctly visit http://localhost:80 to interact with web application.
- Real-time video processing
- Plotting historical data
- Microservice architecture
- GPU support
- The app downloads video from of the specified intersection in Cracow from ToyaGO.
- Mask is added to video before processing it.
- The video is processed using the YOLOv10s model to detect and classify vehicles.
- Vehicles crossing designated lines are counted and displayed in real-time.
- Each frame is published through redis from microservice to backend.
- Backend sends each frame through WebSockets to client.
- Buffer on frontend is created to ensure no stuttering.
- The data is stored and used to generate historical traffic plots.
The Traffic Tracking application uses a microservice-based architecture with the following key components:
- Built using React for user interaction and video display.
- Built using Flask and Flask-SocketIO for real-time video processing and communication.
- Python-based video processing engine using OpenCV for image manipulation and the custom-trained YOLOv10s model for vehicle detection.
- Redis is used as a message broker for communication between services and for caching real-time data.
- The entire application is containerized using Docker, with Docker Compose managing the services.
- GPU Support: Optional GPU acceleration can be enabled using NVIDIA Docker for faster video processing.
Distributed under the MIT License. See LICENSE for more information.