Python 3 (ipykernel)
Posture Detector
A webcam app that notices when you slouch and plays a sound to nudge you upright. It runs in real time on a normal laptop and calibrates to your normal posture.
- Python
- PyTorch
- OpenCV
- Ultralytics (YOLO11n-pose)
In [1]:
posture.specs()Out[1]:
- model
- YOLO11n-pose (17 body keypoints)
- speed
- 30+ FPS on standard hardware
- signal
- vertical distance from eyes to shoulders
- calibration
- 7 seconds of your normal posture
- alert
- sound when the distance drops below your baseline
How it works
When you slouch, your head drops toward your shoulders. Each frame, a pose model finds your eyes and shoulders, and the app measures the distance between them. If it shrinks past a tolerance below your normal, you hear a sound.
Calibration
Camera height, how far you sit from the screen, lighting and body shape all change what "normal" looks like, so a fixed threshold doesn't work. The app spends 7 seconds to calibrate and learn your posture:
- It throws out impossible readings, like a hand over your face or a bad frame.
- It ignores the extremes, dropping the highest and lowest 10% before averaging.
The result is fewer false alarms across different rooms and lighting.
Demo
Takeaways
- Everyone's body and camera setup is different, so a hard-coded threshold doesn't work. Each user needs their own baseline.
- Simple statistics went a long way. Trimming outliers alone removed a whole class of false alerts.
- Next, I'd build a browser version that runs without installing anything.