Inspiration

We're constantly stuck in traffic, even on the way to this hackathon. We thought that many intersections were inefficient as they did not adjust to the difference in the flow of traffic from the two directions.

What it does

Takes an image of the street and determines how many cars are in each direction, and adjusts the green/red light times to maximize efficiency.

How we built it

yolov3 neural network, python, and an arduino mega

  1. OpenCV takes an image
  2. Image is processed through the yolo v3 network, which is modified to only look for cars
  3. Amount of cars are counted and saved to a temporary text file
  4. Steps 1-3 are repeated for another image(other direction of traffic), and saved to a difference temporary text file
  5. Value in the text files are divided to find the ratio of traffic, which is then uploaded via serial to an arduino
  6. Arduino takes value and uses it to switch 2 digital pins on/off
  7. Digital pins wired to two transistors that switch traffic lights

Challenges we ran into

Yolov3 was very hard to get working, especially in loading the weights, and getting a main python script that combined so many parts, hardware and software.

Built With

Share this project:

Updates