PoseCheck Pro: AI-Powered Exercise Trainer

What Inspired Us

The rise of home workouts during the pandemic highlighted a critical issue: exercising alone often leads to poor form, risking injuries like joint pain or back strain. As a fitness enthusiast and tech lover, I was inspired to create PoseCheck Pro, an AI-powered exercise trainer that ensures safe, effective workouts without a coach. My goal was to leverage computer vision and audio feedback to make fitness accessible and injury-free, aligning with the hackathon’s focus on innovative health solutions. I envisioned a tool that feels like a personal trainer, guiding users through exercises with real-time corrections.

What We Learned

Building PoseCheck Pro was a deep dive into computer vision and web app development:

  • Mediapipe Pose Estimation: Learned to process 33 skeletal landmarks for precise posture tracking, tuning parameters like min_detection_confidence for reliability.
  • Streamlit Development: Mastered creating interactive UIs with sidebar controls and real-time webcam feeds.
  • Audio Integration: Explored gTTS and pydub for text-to-speech, caching MP3s to optimize performance, and JavaScript for seamless audio playback.
  • OpenCV: Gained expertise in webcam handling and image processing for live video analysis.
  • Debugging Challenges: Developed skills in handling webcam delays, Mediapipe warnings, and browser autoplay restrictions, enhancing my problem-solving toolkit.

How We Built It

PoseCheck Pro is a Streamlit web app powered by Python, integrating multiple technologies:

  • Tech Stack:
    • Mediapipe: Tracks pose landmarks for arm raises (150-210° angles) and squats (50-90° knee angle).
    • OpenCV: Captures and processes webcam video (640x480 resolution).
    • Streamlit: Provides a sleek UI with a two-column layout (webcam/debug on left, feedback on right) and sidebar for exercise selection, reps, and user stats.
    • gTTS & pydub: Generates audio instructions, cached as MP3s in a local audio_cache directory for efficiency.
    • JavaScript (via Streamlit components): Plays audio without a visible play bar, ensuring a clean UX.
  • Features:
    • Real-time posture correction with feedback (e.g., “Level your shoulders”).
    • Audio-guided instructions for each exercise step (e.g., “Hold arms up for 3 seconds”).
    • Personalized stats: tracks reps, time (starts when camera activates), and calories burned (MET-based formula).
    • Supports arm raise and squat exercises with strict form validation (5-frame threshold).
  • Development Process:
    • Designed exercise flows (6 steps for arm raise, 3 for squat) with validators and feedback functions.
    • Implemented a debouncing system (0.3s delay) for stable pose validation.
    • Optimized audio playback with a queue system (audio_end_time) to prevent overlaps.
    • Tested on a local webcam, ensuring calibration tips (e.g., “Stand 3-6 feet”) for accuracy.

Challenges We Faced

The hackathon’s tight timeline brought several hurdles:

  • Webcam Latency: Initial 3-minute camera startup delays skewed workout timing. I fixed this by starting the timer only when the camera was active (cap.read() success).
  • Mediapipe Warnings: Encountered NORM_RECT errors due to missing image dimensions. Resolved by setting explicit frame sizes (640x480) and tuning model complexity.
  • Audio Playback: Browser autoplay policies blocked audio. I implemented JavaScript-based playback (play_audio_backend) with unique keys to bypass restrictions.
  • Form Validation: Ensuring accurate pose detection required fine-tuning angle thresholds (e.g., 150-210° for arms) and visibility checks (>0.1) to avoid false positives.
  • Resource Constraints: As a solo developer, balancing UI design, AI integration, and testing was intense. I prioritized core features and iterative debugging to meet the deadline.

PoseCheck Pro is more than a hackathon project—it’s a step toward safer, smarter fitness. I’m excited to explore its potential in physiotherapy, rehab, or group workouts. Check out the demo video and share your feedback!

Built With

Share this project:

Updates