Inspiration
I have always looked at computers and wondered what they saw and how different models could be trained for different things. Like recognizing a car moving or even recognizing different objects. This initial idea and brainstorming got me to research more and more about object detection using Python and eventually, I ran into Yolo v8. A program/model of ultralytics that did image detection. I first started using my webcam to see how it picked up me as a person and different objects like a phone. I then started more and more about what else it could do and I saw some of the objects were cars and trucks. This got me thinking about the Tesla autopilot videos and how I could make something like that which could find how fast cars are going and which way they were going. In addition to this detecting accidents early so first responders can get to the scenes even quicker saves countless lives as most car accidents happen at intersections which usually have a camera. This idea got me interested in making a program to detect cars and details about them like speed, license plate, inflow outflow, and if an accident happen. Then I thought about the business side of this idea/program which can be turned into a product. As state departments of transportation or even just the federal govt general would pay for me to host servers and run this program and more on their CCTV allowing me to detect various accidents or even find cars that law enforcement is looking for. This would be beneficial for the state/govt as accidents can be cleared easier and faster as ems knows the exact locations of accidents and the damage is known (since its capture) so crews can already move debris away. This would allow less traffic to be beneficial for the state's economy and people less likely to die from car accidents as time is the most important factor in most crashes. In addition to this, this service provided to the state department of transport would allow almost insurance as it would be able to show most accidents and record and report them. This would allow the state to spend less on legal cases on the damage of public property as damage is known (since it stays recorded unlike most CCTV). Moreover detecting plates in this program could also help with hit and runs making them become a thing of the past and a recording and the plate number will be saved and sent to enforcement. This product offers the state almost an insurance tool that they can use to help manage and ez traffic while also keeping the streets safe. These immense benefits and the relatively low cost of subscription products this is (servers need to be run) would make this a no-brainer for states and govts to implement, and a profitable tool.
What it does
My project fell short on time so I could only complete a portion of this project/goal. I was able to make a program that not only detects cars but also gets their speed in real-time and counts them as an inflow or outflow. I do hope to expand this in the future and deliver a finished project.
How we built it
To build this I used Python 3.11 and built it with YOLOv8. I used pycharm as the IDE. I did the sole work for this project so I first start by learning about YOLO and went on from there building it out from using a webcam to dedicated video or live videos. To do this I used numerous Python libraries like cv2, ultralytics, pandas, numpy and etc.
Challenges we ran into
The challenge that I ran into was incorporating audio into the program allowing audio to maybe highlight an accident area as I simply couldn't figure it out. I also incorporated a pretty major challenge when trying to be able to determine the speed. Since you need time over the distance that something covered finding out the distance was petty hard. However, using the lines on the highway (since it is standard in us) you can get a pretty good approx of various distances that something covers as lines are 10 feet long on the highways and around 30 feet apart at least in California where I pulled sample videos from. This allowed me to approx a speed for the cars as they crossed a certain area of the highways. Lastly, another challenge that I came across was hardware limitations as running the program in real-time does take a lot, especially for a CPU-heavy machine (limited graphics). This just made using Yolo somewhat hard and made it so I had to use yolov8s which isn't as accurate but is quicker and smoother.
Accomplishments that we're proud of
I'm proud of being able to produce a decent program that uses yolov8 to detect cars and to take those detections and assign it an id which then could be used to calculate various different things about the car like the speed and which direction it is going on the highway (is it an inflow or outflow). Even though the program is pretty simple Im proud of doing something new that I have never tried before and expanding my own horizons.
What we learned
Using Yolo and the basics of object detection and objection ids throughout Python. I also learned especially a lot about the impressive nature of computer vision and the scale that it can have on the world. I learned how to assign objects an id that can be used throughout the program and can be compared to other examples and allow a computer to track objects on any video. I also learned a lot about how I can you computer vision to do even more complex things like speed detection, accident detection, traffic detection, etc. I learned that the future is computer vision as it can review so much data from videos and act according to the data.
What's next for Speed detection using Python and Yolo v8
I would love to continue and expand on this project. I would like to first find a way to implement audio in the recording just so it can easier detect crashes down the road. Then I would love to continue working on this a develop a model/system that can actually detect crashes whether that is from speed, audio, or damage from the car or all combined. I would also like to add a license plate capture so if an accident does happen the plates could be given to the authorities. Lastly, I would like to add a system that would alert anyone of crashes whether that text or email and send them a clip of the accident which can be verified by a human and easily reported to authors, allowing first responders to get to crashes quicker and even simplifying insurance claims as it has video of the crash. I can then advertise this product to different transportation agencies (especially in the states) like MDOT where I live where the pay me a fee a subscription fee to run the server and do autonomous highway protection by reporting crashes and providing the state with videos (insurance) for the roads/highways if someone has an accident that destroys or damages public goods.
Log in or sign up for Devpost to join the conversation.