According to the National Safety Council, nearly 1 out of every 4 car accidents in the United States is caused by distracted driving. Inspired to fight against this, I wanted to create some type of program to keep drivers alert when they are distracted.

Also I wasn't entirely sure what the "add [student] tag" to project meant in the Devpost instructions so I just slapped it right there in the title of my submission-- hope that was alright!

What it does

Essentially, the program takes in a live feed from your main webcam and then uses dlib's facial landmark detector to map out points on a person's face. From there, the program actively looks at the distance between the points on your eyes to determine whether or not your eyes are closed. If your eyes have been closed for a long time, the program will send out an alert to make sure you're not sleeping at the wheel. It also checks if your face is turned beyond a certain point to alert you that you are not keeping your face centered on the road.

How I built it

I didn't really know much about machine learning or computer vision coming into this hackathon, but I figured it would be an excellent opportunity to learn more about it by attempting to do this project. I ended up getting a "working" prototype by the end of the hackathon thanks to a bunch of online tutorials about how to use the OpenCV library with Python (bless your beautiful soul Adrian Rosebrock).

Challenges I ran into

Well for starters, I didn't really know what I was doing the majority of the time as this was my first time working on a machine learning related project. I spent most of the hackathon looking through tutorials and making sure I understood fully what each line of code was doing before I would use it in my project.

Also I was originally going to use the Haar Cascade stuff in OpenCV but it kept saying my nostrils were eyes :(

Accomplishments that I'm proud of

It works! Yay! I'm glad that I was able to add some extra features beyond the online tutorial I followed. Turns out this idea wasn't completely original, because I did some googling and others have done something similar before in the past, but I still think the idea is pretty cool and I'm definitely going to be spending more time after this hackathon to continue making this project even cooler.

What I learned

I learned how to use the OpenCV library and how to use existing datasets/ML models to create something really cool!

What's next for Peacekeeper

  • I'm kinda broke rn and don't have a Raspberry Pi but in the future I'd like to get one and make it possible for my code to work on one
  • Maybe a phone app might be better instead so no one has to buy anything to get this to work
  • Yawning detection
  • Analysis of the movement of the car itself to determine if the driver is incapable of driving in a straight line

Built With

Share this project: