An offline, privacy-focused desktop application that uses AI to monitor your sitting posture in real-time and alerts you when you slouch.
- π 100% Offline & Private: All processing happens locally on your device
- π€ AI-Powered Detection: Uses TensorFlow.js MoveNet for real-time pose tracking
- π Personal Calibration: Adapts to your unique body type and sitting style
β οΈ Smart Alerts: Audio alerts after 3 seconds of bad posture- π Session Statistics: Track good vs. bad posture time
- π Personalized Training: Create a custom AI model trained on YOUR posture
- π¨ Modern UI: Beautiful interface with live webcam feed and skeleton overlay
- Node.js (v16 or higher) - Download here
- macOS (tested on macOS 10.15+) or Windows/Linux
- Webcam with permissions granted
-
Clone or download this repository
git clone git@github.com:nttssv/posture_monitor.git cd posture_monitor -
Install dependencies
npm install
Note: On first run, TensorFlow.js will download the AI model (~12MB). This requires internet connection only once. After that, the app works completely offline.
-
Add alert sound (included:
beep.mp3)The repository includes a beep sound file. If you want to customize it, replace
beep.mp3with your own audio file (1-2 seconds recommended). -
Run the application
npm start
That's it! The app will launch automatically.
- Grant Camera Permission: When prompted, allow the app to access your webcam
- Wait for AI Model: "Loading AI model..." will appear (10-30 seconds)
- Position Yourself: Sit in front of the webcam in good lighting
- Quick Calibration: Click "Calibrate Posture" while sitting with good posture
You're now monitoring your posture!
Good Posture Checklist:
- β Head aligned over shoulders
- β Shoulders relaxed and level
- β Straight spine (natural curve)
- β 90Β° angle at hips and knees
- β Feet flat on floor
Common Bad Posture Mistakes:
- β Forward head ("tech neck")
- β Rounded shoulders
- β Curved/hunched spine
- β Leaning to one side
Status Indicator (top-right overlay):
- β Green = Good Posture
β οΈ Red = Bad Posture (with pulsing animation and audio alert)
Control Panel:
- Calibrate Posture: Quick baseline setup (5 seconds)
- Start Training: Create personalized AI model (2-3 minutes)
- Sound Alerts: Toggle audio on/off
- Log to CSV: Save posture data for analysis
Live Metrics:
- Shoulder angle deviation
- Neck angle deviation
- Overall posture score
Session Statistics:
- Time in good posture
- Time in bad posture
- Number of alerts triggered
For best results, train a personalized model:
- Adapts to YOUR body: Everyone sits differently
- More accurate: Custom thresholds based on your posture
- Better alerts: Fewer false positives
- Learns continuously: Improves with feedback
-
Click "Start Training" in the control panel
-
Capture Good Posture Samples (5-10 samples):
- Sit in your ideal posture
- Click "Capture Sample"
- Move slightly between samples
- Click "Next Step"
-
Capture Bad Posture Samples (5-10 samples):
- Slouch or lean forward (intentionally bad)
- Click "Capture Sample"
- Vary your bad posture slightly
- Click "Next Step"
-
Complete Training:
- Click "Finish Training"
- Your custom model is now active!
| Feature | Quick Calibration | Personalized Training |
|---|---|---|
| Time | 5 seconds | 2-3 minutes |
| Samples | 1 | 10-20 |
| Accuracy | Good | Excellent |
| Learning | No | Yes (with feedback) |
| Best For | Quick setup | Daily use |
Recommendation: Use Quick Calibration for immediate setup, then train a Personalized Model for best accuracy.
You can adjust sensitivity in posture.js:
// Alert timing (lines 18-19)
this.alertDelay = 3000; // Wait 3 seconds before alert
this.alertCooldown = 5000; // 5 seconds between alerts
// Posture thresholds (lines 12-14)
this.shoulderAngleThreshold = 15; // degrees
this.neckAngleThreshold = 10; // degrees
this.deviationThreshold = 12; // overall deviationposter_monitor_2/
βββ main.js # Electron main process
βββ renderer.js # Webcam & AI inference
βββ posture.js # Posture analysis & alerts
βββ training.js # Personalized training system
βββ index.html # UI layout
βββ styles.css # Modern UI styles
βββ beep.mp3 # Alert sound
βββ assets/ # Visual guides
β βββ good-posture.svg
β βββ bad-posture.svg
β βββ posture-comparison.svg
βββ package.json # Dependencies
βββ README.md # This file
- macOS: System Preferences β Security & Privacy β Camera β Enable for Electron
- Windows: Settings β Privacy β Camera β Allow apps to access camera
- Restart the app after granting permissions
- Ensure internet connection on first run only
- Check console for errors: View β Toggle Developer Tools β Console
- Delete
node_modulesand runnpm installagain
- Ensure you're fully visible in the camera frame
- Improve lighting (face a window or turn on lights)
- Make sure head, shoulders, and hips are visible
- Try moving closer/farther from camera
- Check lighting conditions
- Ensure upper body is in frame
- Remove clutter from background
- Try different camera angles
- Check system volume
- Verify
beep.mp3exists in project directory - Test audio file separately
- Check DevTools console for errors
- No internet required after initial setup
- No data collection or analytics
- No external API calls
- All processing happens locally on your device
- Webcam feed never leaves your computer
- Training data stored locally in
~/Library/Application Support/PostureMonitor/
Your data never leaves your Mac!
npm run dev- electron: Desktop app framework
- @tensorflow-models/pose-detection: AI pose estimation
- @tensorflow/tfjs-core: TensorFlow.js core
- @tensorflow/tfjs-backend-webgl: GPU acceleration
- @tensorflow/tfjs-converter: Model converter
npm install --save-dev electron-builder
npm run build- Lighting: Ensure good, even lighting
- Camera Position: Eye level, 2-3 feet away
- Background: Clear, uncluttered background
- Consistency: Use the same setup daily
- Recalibrate: If you change desk/chair height
- Take Breaks: Stand up and stretch every 30 minutes!
Enable "Log to CSV" to save posture data:
- Logs every frame with timestamp
- Exports to
posture_log_YYYY-MM-DD_HH-MM-SS.csv - Useful for tracking progress over time
CSV Format:
timestamp,status,shoulderAngle,neckAngle,spineAngle,overallDeviation
2025-10-13T10:30:00.000Z,good,2.34,3.45,1.23,2.50- CPU Usage: ~15-25% on modern MacBooks
- Memory: ~200-400MB
- GPU: Uses Metal (via WebGL) for acceleration
- Speed: 30-60 FPS real-time detection
MIT License - Feel free to modify and distribute
- Built with Electron
- AI powered by TensorFlow.js
- Pose detection using MoveNet
Remember: This app is a tool to build awareness. Take regular breaks, stretch, and consult a healthcare professional for persistent posture issues.
Made with β€οΈ for better ergonomics and health
- Check the Troubleshooting section above
- Open DevTools (View β Toggle Developer Tools) to see console logs
- Ensure all dependencies are installed:
npm install - Make sure your webcam is working in other apps first
Found a bug or have a feature idea? Feel free to open an issue or submit a pull request!