Core Technology: MoveNet
The extension uses TensorFlow.js MoveNet, a fast and accurate pose detection model that runs directly in your browser.MoveNet analyzes your webcam feed in real-time to detect 17 body keypoints, including eyes, shoulders, elbows, and hips. For posture tracking, the extension specifically monitors the position of your right eye.
Model Configuration
The extension uses theSINGLEPOSE_LIGHTNING model variant for optimal performance:
Baseline Detection
When you first start the extension, it establishes your “good posture” baseline automatically.Sit with good posture
Position yourself with proper posture - back straight, shoulders back, head level.
Start camera tracking
The extension begins analyzing your webcam feed and detects your right eye position.
How the Baseline Works
The extension tracks the vertical Y-coordinate of your right eye (keypoint index 2):Posture Deviation Detection
The extension continuously compares your current eye position against the baseline to determine if you’re slouching.Deviation Threshold
By default, the extension allows 25 pixels of deviation from your baseline:Real-time Comparison
Every 100ms, the extension calculates the absolute difference between your current and baseline positions:The Blur Effect
When bad posture is detected, the extension applies a blur filter to all page content, creating an immediate visual cue.How the Blur is Applied
The extension injects a content script that adds CSS classes to the page body: Bad Posture:The blur applies to all page elements except the extension’s own status bar. The blur transitions smoothly - taking 0.6s to apply when slouching and 0.3s to remove when sitting up.
Status Message
When you slouch, a status bar appears in the bottom-right corner displaying “Sit Up Straight!” - another gentle reminder to correct your posture.Architecture Overview
The extension consists of three main components that communicate via Chrome’s messaging API:Options Page (options.html)
Options Page (options.html)
- Runs the webcam and MoveNet model
- Performs pose detection every 100ms
- Establishes and stores the good posture baseline
- Sends posture status to the background script
- Provides camera controls and device selection
Background Script
Background Script
- Relays posture messages from the Options page to active tabs
- Manages the extension badge (shows “ON” or “OFF” status)
- Coordinates communication between components
Content Script
Content Script
- Injected into all web pages
- Listens for posture status messages
- Applies or removes the blur effect via CSS classes
- Displays the “Sit Up Straight!” status bar when needed
Visual Feedback
The Options page provides real-time visual feedback:- Keypoints: Green or red dots overlay your body showing detected pose points
- Baseline line: White horizontal line showing your good posture eye position
- Current position line: Another horizontal line showing where your eye is now
- Delta visualization: A colored rectangle showing the distance between baseline and current position (green when within threshold, red when exceeding it)