Inspiration

According to the CDC, in the United States alone, an estimated 300,000 people drive while under the influence of alcohol or drugs every day. This is a serious issue. We were inspired by the Horizontal Gaze Nystagmus (HGN) test used by law enforcement to detect impairment through involuntary eye movements. With the rise of mobile technology and AI, we realized this same test could be performed using just a smartphone camera. Our goal was to create a tool that empowers people to self-assess their fitness to drive — quickly and privately.

What it does

ClearGaze is a mobile app that uses your phone’s front-facing camera to run a quick, AI-powered HGN test. The user follows a dot moving on the screen, while the camera records eye movements. In the background, our backend analyzes for signs of impairment — specifically looking for erratic motion or nystagmus. The entire test takes less than 30 seconds and gives a fast, private assessment of whether you're fit to drive.

How we built it

Frontend: Built using React Native, the app displays a moving dot on the screen for the user to follow, while simultaneously recording video from the front-facing camera. Video Capture: After the 30-second test, the recorded video is packaged and sent to our backend for analysis. Backend: A FastAPI server receives the video and forwards it to the Gemini API, which evaluates the eye movement data to detect signs of nystagmus or irregular tracking behavior.

  • AI Analysis: The Gemini API acts as the core vision intelligence, enabling us to offload motion tracking and pattern recognition to a powerful hosted model — rather than relying on local tools like OpenCV or MediaPipe.
  • Privacy by Design: No video is stored — it’s used only temporarily for inference and then discarded, keeping the experience secure and private.

Challenges we ran into

Transitioning away from local models: We originally planned to use OpenCV and MediaPipe but found them unreliable on mobile for precise eye tracking. Integrating Gemini with video input: Since Gemini typically expects image input, passing video and interpreting results correctly required experimentation and careful pipeline design. Synchronizing video with dot movement: We needed to ensure that the recorded video captured the right part of the test — especially when detecting subtle eye movement patterns. Frontend-backend timing coordination: We faced challenges ensuring smooth communication between React Native’s recording features and the backend analysis workflow.

Accomplishments that we're proud of

  • Successfully implemented a working HGN-style test using only a smartphone.
  • Replaced traditional local tracking tools with Gemini's powerful video analysis.
  • Created a full end-to-end system: video capture → AI analysis → actionable impairment feedback — all within seconds.
  • Maintained a clean and simple user experience while working across multiple tech stacks under tight time constraints.

What we learned

  • How to use the Gemini API for advanced video-based analysis, beyond typical image classification tasks.
  • The strengths and limitations of local vs. cloud-based computer vision models in mobile contexts.
  • How to manage real-time video capture in React Native and build a smooth testing experience that mimics real clinical assessments.
  • The importance of tight frontend-backend synchronization when working with time-sensitive video data.

What's next for ClearGaze

Incorporating eye coloration analysis: We plan to integrate MediaPipe and OpenCV to evaluate redness, discoloration, or other visual indicators that could signal fatigue or substance use — adding another layer to our impairment detection system. Real-world car integration: We envision ClearGaze being linked directly to a user's vehicle, where a failed test would trigger a lockout and prevent the car from starting — adding a proactive layer of safety. Multi-signal detection: By combining both motion (nystagmus) and visual indicators (eye coloration), we aim to create a more robust and medically relevant assessment. Personalization and calibration: Future versions could learn a user’s baseline and adapt thresholds over time, improving accuracy and reducing false positives. Healthcare and fleet expansion: We see potential applications beyond driving — from workplace compliance (e.g., for truckers or heavy machinery operators) to wellness apps that screen for fatigue, burnout, or medical symptoms.

Built With

Share this project:

Updates