A real-time ergonomic posture analyzer built with Python, MediaPipe Pose & OpenCV. Computes joint angles, classifies “good” vs. “slouching” posture, overlays visual feedback on webcam feed, and logs session statistics for offline analysis.
-
Pose Estimation
Uses MediaPipe Pose to extract 33 3D landmarks per frame (shoulders, spine, neck, hips, etc.). -
Kinematic Computations
Calculates key joint angles (e.g. back tilt, neck flexion) via NumPy and compares against calibrated thresholds. -
Real‑Time Visualization
Overlays landmarks, angle values, and posture status (✅ Good /⚠️ Slouching) on live webcam feed with OpenCV. -
Session Logging & Analytics
Streams timestamped posture labels into Pandas DataFrames, exports CSV for time‑series analysis or dashboarding. -
Demo Notebook
Jupyter Notebook walkthrough showing setup, landmark plotting, threshold tuning, and interactive session reporting.
-
Clone the repo
git clone https://github.com/zainibaloch/Posture-Detection-Project.git cd Posture-Detection-Project -
Create & activate virtual environment
python3 -m venv venv #conda create -n newenv python==3.10 --y source venv/bin/activate # Linux/Mac venv\Scripts\activate # Windows
-
Install dependencies
pip install streamlit opencv-python mediapipe tensorflow numpy pillow
-
Run real‑time detection
streamlit run app.py
-
Explore the demo Notebook Open
demo/Posture_Detection_Demo.ipynbin Jupyter to see angle calculations, threshold tuning, and data logging examples.
- Driver Safety: CSVs, preprocessing.pkl, analysis notebook
- Exercise:
- Yoga pose folders (train/test)
- Model training script, evaluation report & confusion matrix
- Handley: YOLOv5 model config, training output
- Sitting: Image dataset (train/test/val), result folders, model script
- Main Files:
main.py, README, and a screenshot
⚠️ Images and model weights are excluded. DM for full access.
- Python 3.10+
opencv-pythonmediapipenumpypandas
Install via:
pip install opencv-python mediapipe numpy pandas- Fork the repo
- Create a feature branch (
git checkout -b feature/awesome) - Commit your changes (
git commit -m "Add awesome feature") - Push to branch (
git push origin feature/awesome) - Open a Pull Request