How rohitkrish46/posture-insights-vision works
Project Overview and Purpose
• The project is a web-based posture correction tool built using Flask. Its purpose is to guide users in rectifying exercise postures by leveraging YOLOv8’s pose estimation and a set of heuristics for analyzing key joint positions.
• It captures real-time video from a webcam, processes each frame using the YOLOv8 pose estimation model to yield 17 key joints, and applies exercise-specific heuristics (for plank, pushup, and bicep curl) to determine if the posture is correct.
Key Components
• Web Frontend (Flask Templates & Static Assets):
• HTML pages (index.html, feed.html, streaming_page.html, etc.) that serve as the user interface.
• Static directory with videos and other assets that enhance the UI.
• Flask Backend (app.py):
• Handles routing, serving the web pages, and communicating with the pose analysis module.
• Pose Estimation Module:
• The YOLOv8 model files in the models directory (yolov8l-pose.pt, yolov8m-pose.pt, yolov8s-pose.pt), used for performing pose detection.
• The pose_estimator.py script, which likely encapsulates code to run inference using the YOLO model.
• Exercise Heuristics and Analysis:
• Scripts in the scripts directory (calculate_angle.py, curls.py, planks.py, rules_curls.py, rules_plank.py, rules_pushup.py) that implement the logic for evaluating the user's posture based on joint angles.
• Results Processing:
• The results folder shows output videos which may represent processed/annotated videos indicating correct or incorrect postures.
• Media Content:
• The videos folder provides demonstration or sample exercise videos.
• Dependencies & Environment Setup:
• Files such as requirements.txt that handle package installations and setup instructions in the README.
Determining Relationships and Interactions
• Data Flow and Control Flow:
• The user accesses a web page to select an exercise, which triggers webcam capture.
• Real-time video frames are sent to the Flask backend, where they are passed to the YOLOv8 pose estimation module.
• The pose estimator returns keypoint data to heuristic scripts.
• Heuristic modules calculate joint angles from the detected keypoints and determine if the posture is correct.
• Feedback (visual cues or messages) is then sent back through the Flask app and displayed to the user.
• External Dependencies:
• YOLO model downloads and possibly libraries for video processing, computer vision, and Flask routing.
Architectural Patterns and Design Principles
• Separation of Concerns:
• The project separates the web server (Flask app), pose estimation logic, and exercise-specific heuristics. This suggests a modular, layered architecture.
• Reusability and Extensibility:
• By isolating heuristics for different exercises in separate scripts, the design permits the addition of new exercises or modifications without significant changes to the core system.
• Real-Time Processing:
• The integration of camera input with frame-by-frame analysis suggests an emphasis on low latency and efficient processing.
Final Recommendations
• The user’s webcam input → Flask app → Pose estimation → Heuristic analysis → UI feedback.