During this 36 hour Hackathon, between 40 and 41 people died as a result of a drunk driving accident. That's one every 53 minutes. The rate is that high not so much as a result of negligence, but as a result of ignorance. People just can't tell when they've had too much, and currently the only ways to tell if you're over your limit are an expensive and bulky breathalyzer or an invasive and impractical blood test. We wanted to create an app that allowed users a quick and easy way to know whether its time for that next drink or time to call an Uber back home.
What it does
The concept is simple. When you're intoxicated, your reflexes slow down, measurably. One of these impeded reactions is pupillary response to light stimulus, and on first use Toxie takes a 4 second baseline reading of the constriction of the user's pupil using the iPhone flashlight as the light source. Then, when the user feels uncertain about their level of intoxication, they can use Toxie to take that same 4 second video, analyze the video to look for substantial differences in pupillary constriction rate, and let the user know if it's potentially unsafe for them to drive home.
How we built it
We build an iOS app to record the 4 second with flash. We then sent that to a Firebase Google Cloud Storage Platform catalogue that we integrated with flask. Next, we ran a Python script that used the Microsoft Face API as well as OpenCV to return data that then is transferred back to the iOS app where it let's the user know whether or not they are sober.
Challenges we ran into
Integrating Flask with Firebase proved a serious obstacle to overcome. In addition, it was our first time using OpenCV, and we initially struggled using it.
Accomplishments that we're proud of
We're very happy that we did eventually manage to successfully integrate Flask and Firebase and write a working script in OpenCV, while implementing the Microsoft Face API, that ended up giving us accurate data.
What we learned
In addition to realizing that running concurrent JS and Flask is a challenging task, we learned a whole lot about the Microsoft Face API and just how powerful its information is, and we ended up taking a crash course in OpenCV, which was stressful but definitely fun.
What's next for Toxie
The possibilities for pupil reaction measurement and ocular measurement in general extend beyond the scope of drunk driving. Keeping with the alcohol theme, this exact technology can be used by bouncers or chaperones to keep overly intoxicated individuals out of clubs or high school dances. In addition, accurate blink rate measurement and eye tracking detection can be very helpful tools in the diagnosis in various neurodegenerative diseases ranging from ADHD to Parkinson's to Schizophrenia to Autism. That's one potential direction we see this hack taking us.