Inspiration
Growing up in Michigan, we experienced potholes and construction countless times on the roads. We wanted to create a scalable way that takes advantage of existing surveillance to monitor the health of all roads and provide recommendations for future repairs
What it does
Provides a dashboard with live feeds and detailed statistics for roads intersections, using data-driven calculations to proactively inform cities when repairs are needed.
How we built it
We began by reading in the live stream frames and fixing delays in our video. Then, we incorporated OpenCV models to detect vehicles on the frames. Next, we preprocessed historical traffic and weather data with Pandas and created a database. Finally, we created several API routes with FastAPI that use our database to respond to queries and created a frontend dashboard with NextJS.
Challenges we ran into
- Finding good live streams and detection models was challenging!! There are so few quality traffic feeds that are freely accessible. Many of the cameras would either periodically turn off or certain lighting conditions would make vehicle detection quite difficult. Due to this, we faced trouble getting the cv models to work and experimented with many different detection models before settling on YOLO 8s.
- We also had issues with the frame rates (either processing images too slow so that we get behind the live feed, or processing them too quickly the feed constantly lags).
- Finally we found while doing live vehicle detection that we had difficulty only counting unique vehicles across frames (i.e. you have several frames of a car going across the intersection, but we only want to count it once)
Accomplishments that we're proud of -
- Using concurrency to optimize the vehicle detection feature. We created one thread to capture frames from the live stream and a second thread runs our opencv model on fetched frames to detect vehicles
- Coming up with a reliable way to count the number of unique cars across frames and prevent double counting
- Streaming video frames from an API route to the frontend
What we learned
- Even though our API data was too large to complete our deployment on the free tier, we learned how simple it was to get started deploying API’s with Vercel
- Locking and Concurrency with video frames
- How to return a live stream of frames from an API call and display it on the frontend
- How to up and downscale video frame rates
What's next for Traffix
- Get access to traffic live streams from more cities across the world and then web scrape the links for these feeds
- Obtain more historical data on a road’s construction and maintenance to increase the granularity through which we optimize our prediction algorithm
- Storing our database on the cloud in a service like MongoDB or Google Firebase as the quantity of our data scales up
Log in or sign up for Devpost to join the conversation.