1. Inspiration: The Battle for System 2

In the current attention economy, mobile interfaces are engineered for System 1 thinking: fast, instinctive, and effortless. This leads to hours of mindless "doom-scrolling."

Niyantran is designed to fight back by forcibly shifting the user into System 2 thinking, the slow, deliberate, and logical part of the brain. We don't just track screen time; we introduce "Productive Friction" and physiological interventions to restore cognitive agency.

2. What it Does

Niyantran monitors usage and physiological fatigue to dynamically alter the user experience:

  • UX Sluggishness: Artificially increases touch latency and slows down animations as the user exceeds healthy limits, making the phone frustrating to use mindlessly.
  • Physiological Guardrails: Uses the front camera to monitor blink rates and eye strain.
  • Cognitive Gatekeeping: To unlock "dopamine-heavy" apps (social media, games), the user must complete randomized logical or mathematical quizzes.
  • Grayscale Intervention: Automatically desaturates the screen to neutralize the psychological "reward" of vibrant UI colors.

3. How We Built It

The architecture is a hybrid system built for low-level interaction and heavy-duty signal processing.

The Stack

  • Backend: Go (for high-concurrency community features) and FastAPI (for ML inference).
  • Mobile: Android (Kotlin/Java) utilizing AccessibilityService for UI manipulation and UsageStatsManager.
  • Security: JWT (JSON Web Tokens) for stateless, secure authentication.

The Dry-Eye Detection Pipeline

We treated eye-fatigue detection as a non-stationary signal problem rather than a simple image classification task:

  1. Preprocessing: Frames are normalized and ocular landmarks extracted.
  2. Relative Inter-Palpebral Height (IPH): We calculate the eye-opening ratio using the formula:

    $$IPH_{relative} = \frac{||P_2 - P_6|| + ||P_3 - P_5||}{2 \cdot ||P_1 - P_4||}$$

    (Where $P_n$ are the Euclidean coordinates of the eye landmarks).

  3. EMD Analysis: We apply Empirical Mode Decomposition to break the IPH signal into Intrinsic Mode Functions (IMFs). This isolates high-frequency blinks from low-frequency fatigue "drifts."

  4. LSTM Classification: These IMFs are fed into a Long Short-Term Memory (LSTM) neural network to predict digital eye strain.

Libraries Used

  • PyTorch: For training and running the LSTM model.
  • NumPy & SciPy: For complex mathematical operations and signal decomposition.
  • GORM: For handling user data and state persistence in the Go backend.
  • OpenCV: For real-time landmark extraction from video feeds.

4. Challenges We Ran Into

The biggest hurdle was the Dataset. There is no publicly available dataset that maps raw mobile usage to specific ocular IMF patterns. We had to build our own data collection pipeline, manually labeling hours of eye-state transitions to ensure the model could generalize across different lighting and facial structures.

5. Accomplishments that We're Proud Of

Completing a functional System 2 intervention from scratch. Without a guided path or pre-made dataset, we successfully engineered a system that moves beyond simple app blocking to actual behavioral modification.

6. What We Learned

We learned the intricacies of Android's internal event loops, the complexity of signal processing for biological data, and how to bridge the gap between high-performance Go services and Python-based ML models.

7. What's Next for Niyantran

  • Kernel-Level Latency: Moving the UX sluggishness deeper into the OS to prevent bypasses.
  • Cross-Device State: Syncing "fatigue levels" across tablets, laptops, and phones.
  • Adaptive Quizzing: Quizzes that adjust in difficulty based on the user's perceived cognitive fatigue.

Built With

Share this project:

Updates