This is a submission for the Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle
What I Built
DrowsyGuard is a React Native app that watches the driver's face through the phone's front camera and sounds an alarm when it detects drowsiness: the phone vibrates, says "Wake up! Pull over and rest," and the screen turns red.
Who would pay: [ride-hailing and delivery drivers, long-haul truckers, small logistics fleets and bus operators]. Fatigue is a real safety and cost problem for them, and dedicated in-cab monitoring hardware is expensive. A phone they already own is a far cheaper option.
How it decides:
- Every frame, it computes the eye aspect ratio (EAR) from the face landmarks.
- It raises the alarm if the eyes stay closed for about 1.5 seconds, or are closed for more than 30% of the last 30 seconds (PERCLOS, a standard fatigue measure).
- It also warns the driver if no face is visible for 3 seconds, meaning they are not looking at the road.
Demo
Code
https://github.com/dimaswahyu-official/drownsy-app-ai.git
How I Built It
-
Open-weight model: MediaPipe Face Landmarker's
face_landmarks_detector.tflite(Apache-2.0). It outputs 478 3D face landmarks per frame. -
Inference: runs fully on the phone through
react-native-fast-tflite, called from a Vision Camera frame processor at about 15 fps. -
App: React Native (Expo dev build) with
react-native-vision-camerav4,vision-camera-resize-pluginandreact-native-worklets-core. -
Detection logic: a small, model-independent TypeScript class (
drowsiness.ts) that computes EAR from six landmarks per eye and applies the eyes-closed duration and PERCLOS rules. Swapping the model doesn't touch the alert logic. -
Alerts: vibration plus text-to-speech (
expo-speech), with the screen kept awake. - Calibration: [describe what you measured, e.g. your EAR for open vs closed eyes, and the threshold you picked].
Why Does Open Innovation Matter?
- Privacy: the driver's face video never leaves the phone. No uploads, no accounts. Drivers and employers don't have to trust a server with facial video.
- Works offline: it works in tunnels, on rural highways and in areas with poor signal, which is exactly where drowsy driving is most dangerous. A cloud API would fail there.
- Zero running cost: there are no per-frame API fees. A closed vision API called about 15 times a second would make a cheap driver app unaffordable. With an open model, the marginal cost per user is zero.
- Tunable and swappable: I can adjust thresholds, retrain, or replace the model for real conditions such as night driving, glasses and helmets, without waiting for a vendor. [Add anything you actually tuned.]
- No lock-in: no vendor can change the pricing or shut off the API my business depends on.

Top comments (0)