How airscholar/ai-workout-manager works
Project Type & Purpose
• This is a single-script application (main.py) aimed at analyzing video input (or live camera feed) to detect human poses, count exercise repetitions, and display real-time performance metrics.
• Its core functionality includes pose detection, calculating angles between body landmarks, counting repetitions, and displaying UI elements.
File Structure
• The root directory contains the main application logic (main.py) along with a requirements file that lists the dependencies, such as OpenCV, MediaPipe, and Numpy.
• The assets directory holds external resources like video files (e.g., pushup.mp4) which might be used for demonstrations or testing.
• This organized, compact structure suggests that the main application coordinates all major functionalities from a central script.
Core Architectural Components
a. Input Component:
• Video Feed/Input: This could be either from a camera feed or a video file (as seen with pushup.mp4 in the assets).
b. Processing Component:
• Pose Detection Module: Utilizes MediaPipe for detecting human pose landmarks.
• Video Processing Module: Uses OpenCV for frame acquisition, pre-processing, and post-processing of video frames.
• Repetition Counting Module: Implements algorithms that use detected poses and calculated angles to determine exercise counts.
• Angle Calculation: Uses provided algorithms (likely with numpy and math libraries) for determining body joint angles.
c. Output/UI Component:
• Metrics and Timing: Elapsed time tracking and rep count feedback presented visually.
Relationships & Data Flow
• The Video Input feeds into the Processing Component where the frame is analyzed.
• The processing chain then splits into separate functionalities: one branch for pose detection (using MediaPipe with input from OpenCV) and another for repetition counting (using the detected landmarks).
• The results from processing are then passed to the UI/Visualization Module to update the on-screen feedback.
Technical Stack & Libraries
• Python 3 acts as the runtime environment.
• OpenCV is used for image capture and frame manipulation.
• MediaPipe is utilized for pose detection.
• Numpy provides numerical support for computations.
• Standard libraries such as math and time handle calculation and tracking.