Inspiration

The idea for the Traffic Alert System was born out of the daily frustration that road users experience in Ghana. While existing systems like Google Maps attempt to predict traffic using data from mobile phones, they fall short in accuracy, especially in areas where GPS data is sparse. During my research, I discovered that Ghana has a wide network of surveillance cameras installed across major roads yet these are underutilized. They're mostly used for post-incident review or enforcement, not real-time traffic tracking. I saw an opportunity: Why not tap into these live camera feeds and use them proactively to detect and report congestion? This inspired me to build a system that uses AI and camera data to provide real-time traffic alerts and rerouting suggestions.

What it does

The Traffic Alert System uses real-time camera feeds and AI to detect road traffic conditions. It classifies live images into “Traffic” or “Traffic-Free” using a trained CNN model. If traffic is detected, the system immediately sends an audio alert and displays the affected area on a map interface. It also uses GPS to track the location of both the camera and the user, providing proximity-based warnings and suggesting alternate routes. The system works across multiple devices one acts as the camera, and the other as the receiver making it scalable and practical for use in cities or institutions.

How we built it

To build the Traffic Alert System, I began by collecting road images from Yahoo!, then manually cleaned and labeled them into two categories: Traffic and Traffic-Free. I created a custom data pipeline in PyTorch to handle image preprocessing and batching. I then designed a CNN model with three convolutional and pooling layers followed by a fully connected layer for classification, achieving 98.5% accuracy. The model can run on either CPU or GPU, depending on the hardware available. I used OpenCV and Python to access camera feeds from devices such as smartphones and laptops. The system was structured using Django, with two main URL endpoints. In Camera Mode, one device (like a phone) acts as the live video source, sending real-time footage to the backend. In Receiver Mode, another device (such as a laptop) processes the feed, classifies the image, and displays the result on a map interface with alerts and suggested reroutes. Both devices are geo-located, enabling users to see exactly where traffic is occurring. If traffic is detected, an audio alert is triggered on the receiver device. Despite some challenges with low-light and rainy conditions due to dataset limitations, the system delivers accurate, real-time traffic detection and guidance.

Challenges we ran into

Difficulty in making accurate predictions in low-light or rainy conditions. Limited hardware: I only had access to a phone and laptop, which made it harder to simulate a broader network of devices. Designing a real-time system with only two devices required optimizing the code to handle both camera input and data visualization simultaneously.

Accomplishments that we're proud of

  1. Successfully built a real-time traffic detection system using live camera feeds and AI, tailored for local conditions in Ghana.
  2. Achieved 98.5% classification accuracy with a custom CNN model trained on manually labeled traffic images.
  3. Integrated computer vision (PyTorch + OpenCV) with a full-stack Django application, handling both the backend and frontend.
  4. Enabled real-time alerts and map-based rerouting, enhancing user experience and practicality.
  5. Created a system that can run on limited hardware (just a phone and laptop), demonstrating scalability and accessibility.
  6. Leveraged GPS data to map and locate traffic congestion zones with device-level precision.

What we learned

This project deepened my understanding of integrating AI models into real-world applications. I explored how to merge live computer vision outputs with web-based systems and learned how to build full-stack applications with Django, JavaScript, HTML, and CSS. It also taught me about the challenges of real-time data handling, especially under unpredictable conditions like rain and low-light.

What's next for Traffic Alert System

I aim to expand the system to support multiple live camera feeds displayed on an interactive map. Users will be able to select a destination, and the system will automatically analyze traffic conditions from nearby cameras, then predict and suggest the fastest, least congested route. This upgrade will make the platform smarter, more scalable, and more helpful for daily commuters, emergency services, and delivery operations navigating through traffic in real time.

Share this project:

Updates