Project Info
This project did not submit a demo video on Devpost.
Real-Time Weightlifting Form Analysis
Inspiration
We've all been there, lifting weights at the gym, unsure if our form is correct, risking injury with every rep. Personal trainers are expensive, and watching yourself in a mirror only shows one angle while you're mid-lift. We wanted to democratize access to professional-quality form analysis, making it as simple as pointing your phone's camera at yourself while you train.
What it does
FormCheck is an iOS app that analyzes weightlifting form in real-time using computer vision. Simply select your exercise (bench press, squats, deadlifts, etc), start recording, and lift. The app detects your body pose and barbell position using Apple's Vision framework and a custom-trained YOLOv8 object detection model. It automatically counts your reps, tracks bar path, and flags form issues like knee cave, elbow flare, back rounding, or wrist misalignment, providing instant feedback with severity levels (warning/danger) and educational content explaining why proper form matters. After your set, review the recording with pose skeleton overlays, see a per-rep breakdown of form issues, and track your progress over time with session history.
How we built it
We built FormCheck as a modular iOS app using Swift and SwiftUI, organized into seven local packages for clean architecture: FCPoseEstimation: Apple Vision framework (VNDetectHumanBodyPoseRequest) extracts 19 body keypoints from each frame FCPoseEstimation: Apple Vision framework (VNDetectHumanBodyPoseRequest) extracts 19 body keypoints from each frame FCBarbellDetection: Custom YOLOv8 model trained in Python (using Ultralytics) and exported to Core ML for barbell tracking FCBarbellDetection: Custom YOLOv8 model trained in Python (using Ultralytics) and exported to Core ML for barbell tracking FCFormAnalysis: Rule engine with 22+ exercise-specific form rules using angle calculations and biomechanical thresholds FCFormAnalysis: Rule engine with 22+ exercise-specific form rules using angle calculations and biomechanical thresholds FCCapture: AVFoundation-based camera capture with frame-by-frame analysis FCCapture: AVFoundation-based camera capture with frame-by-frame analysis FCPersistence: Core Data for local storage of sessions and metrics FCPersistence: Core Data for local storage of sessions and metrics FCUI: Design system with modern UI components FCUI: Design system with modern UI components MLTraining/: The ML training pipeline uses Python with PyTorch, Ultralytics YOLOv8, and CoreML Tools to prepare datasets, train the barbell detector, and export to a format optimized for on-device inference MLTraining/: The ML training pipeline uses Python with PyTorch, Ultralytics YOLOv8, and CoreML Tools to prepare datasets, train the barbell detector, and export to a format optimized for on-device inference
Challenges we ran into
Real-time performance: Processing pose estimation and object detection at 30fps on-device required significant optimization — we implemented frame skipping, model quantization, and efficient rendering Real-time performance: Processing pose estimation and object detection at 30fps on-device required significant optimization — we implemented frame skipping, model quantization, and efficient rendering Barbell occlusion: The barbell often gets occluded by the lifter's body, making consistent tracking difficult. We implemented a wrist-based fallback estimator Barbell occlusion: The barbell often gets occluded by the lifter's body, making consistent tracking difficult. We implemented a wrist-based fallback estimator Camera angle detection: Form rules vary based on viewing angle (front vs. side). We built an automatic camera angle classifier using shoulder-hip alignment Camera angle detection: Form rules vary based on viewing angle (front vs. side). We built an automatic camera angle classifier using shoulder-hip alignment Rep counting accuracy: Distinguishing between exercise phases (descending, bottom, ascending, lockout) required hysteresis filtering to avoid false triggers from shaky movements Rep counting accuracy: Distinguishing between exercise phases (descending, bottom, ascending, lockout) required hysteresis filtering to avoid false triggers from shaky movements
Accomplishments we're proud of
Runs entirely on-device with no cloud processing — privacy-first and works offline Runs entirely on-device with no cloud processing — privacy-first and works offline 22+ biomechanically-sound form rules across 6 exercises, each with educational content 22+ biomechanically-sound form rules across 6 exercises, each with educational content Sub-100ms latency from camera frame to form feedback Sub-100ms latency from camera frame to form feedback Smooth 60fps UI even during intensive ML inference Smooth 60fps UI even during intensive ML inference Beautiful, intuitive design that feels like a polished commercial app Beautiful, intuitive design that feels like a polished commercial app Comprehensive architecture with proper separation of concerns and testable components Comprehensive architecture with proper separation of concerns and testable components
What we learned
How to optimize ML models for real-time on-device inference on mobile hardware How to optimize ML models for real-time on-device inference on mobile hardware The complexity of human biomechanics and the nuances of proper lifting technique The complexity of human biomechanics and the nuances of proper lifting technique Apple's Vision framework capabilities and limitations for pose estimation Apple's Vision framework capabilities and limitations for pose estimation Core Data performance optimization for high-frequency writes during recording Core Data performance optimization for high-frequency writes during recording The importance of user feedback timing — too many alerts become noise, too few and issues get missed The importance of user feedback timing — too many alerts become noise, too few and issues get missed Building maintainable iOS codebases using Swift Package Manager for modularization Building maintainable iOS codebases using Swift Package Manager for modularization
What's next
for FormCheck More exercises: Overhead press, rows, pull-ups, dips, and olympic lifts More exercises: Overhead press, rows, pull-ups, dips, and olympic lifts Advanced analytics: Velocity tracking, bar speed zones, fatigue detection across sets Advanced analytics: Velocity tracking, bar speed zones, fatigue detection across sets Social features: Share PRs, compare form with friends, coach-athlete collaboration Social features: Share PRs, compare form with friends, coach-athlete collaboration Apple Watch integration: Heart rate correlation with form breakdown Apple Watch integration: Heart rate correlation with form breakdown 3D visualization: Render full 3D skeleton from multiple camera angles 3D visualization: Render full 3D skeleton from multiple camera angles Form recommendations: AI-powered suggestions for correcting specific issues Form recommendations: AI-powered suggestions for correcting specific issues Gamification: Achievements, streaks, and perfect-form challenges Gamification: Achievements, streaks, and perfect-form challenges Cross-platform: Expand to Android using TensorFlow Lite Cross-platform: Expand to Android using TensorFlow Lite
FormCheck
An iOS app that analyzes weightlifting form in real-time using computer vision. Point your camera at a lift, and FormCheck detects your body pose and barbell position to provide rep-by-rep feedback on technique.
Supported Exercises
- Bench Press — bar path, elbow flare, wrist alignment, bar touch point, shoulder rounding
- Squat — depth, knee cave, forward lean, bar path, heel rise
Each issue includes severity levels (warning/danger) and educational content explaining why correct form matters.
Architecture
The project is organized as a main app target with seven local Swift packages:
| Package | Purpose |
|---|---|
| FCCore | Shared models (Session, Rep, FormIssue), protocols, angle calculation utilities |
| FCPoseEstimation | Body pose detection via Apple Vision (VNDetectHumanBodyPoseRequest), keypoint interpolation, skeleton building |
| FCBarbellDetection | Barbell detection using a Core ML YOLOv8 model with wrist-based fallback when no model is available |
| FCFormAnalysis | Form rule engine (10 rules across 2 exercises), rep counting, camera angle detection, hysteresis filtering |
| FCCapture | Camera capture service and preview view |
| FCPersistence | Core Data persistence, session and settings repositories |
| FCUI | Design system and reusable UI components |
Screens
- Home — dashboard and entry point
- Exercise Selection — choose bench press or squat
- Recording — live camera feed with real-time form analysis
- Playback — review recorded sessions with overlay
- Session Detail — per-rep breakdown and metrics
- History — browse past sessions
- Settings — user preferences
- Educational Content — drill-down explanations for each form issue
How It Works
- Pose Estimation — Apple Vision framework extracts body joint positions from each camera frame
- Barbell Detection — A Core ML object detection model (or wrist-based fallback) locates the barbell
- Rep Counting — Bar position peaks/valleys and joint angle thresholds detect rep phases (descending, bottom, ascending, lockout)
- Form Analysis — Exercise-specific rules evaluate each frame and flag issues with severity levels
- Persistence — Sessions, reps, and form issues are saved locally via Core Data
ML Training
The MLTraining/ directory contains a Python pipeline for training the barbell detection model:
prepare_dataset.py— dataset preparationtrain_yolov8.py— YOLOv8 trainingexport_coreml.py— export to Core ML format
Dependencies: ultralytics, albumentations, opencv-python, coremltools (see MLTraining/requirements.txt).
Requirements
- iOS 17.0+
- Xcode 15.0+
- Swift 5.9
Getting Started
- Clone the repository
- Open
FormCheck.xcodeprojin Xcode (project generated via XcodeGen fromproject.yml) - Build and run on a physical device (camera required)
To train a custom barbell detection model:
cd MLTraining
pip install -r requirements.txt
python barbell_training/prepare_dataset.py
python barbell_training/train_yolov8.py
python barbell_training/export_coreml.py
Place the exported BarbellDetector.mlmodelc in the app bundle. Without it, the app falls back to wrist-based barbell estimation.
Analysis
View
Metric
- 5
- 4
- 3
- 2
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- CIn code
- PythonIn code
- PyTorchIn code
- SwiftIn code
- TensorFlowIn code
- C++Claimed
5 of 6 appear in the indexed code. 1 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
No AI coding agent signals were found in this repository.
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
595 KB
Source files
119
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
leojia22/Treehacks26
4,000 files · 306.2 MB · @ ad49342
Structure
Interface
16 files · 0%Screens, components and styles rendered to the user.
Application logic
22 files · 1%Domain rules, services and shared utilities.
+4 more
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- Swift88%
- Python11%
- YAML1%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
MLTraining/form_classification/requirements.txt
pypi · 12- coremltools
- keras
- matplotlib
- mediapipe
- numpy
- opencv-python
- pandas
- pyyaml
- scikit-learn
- seaborn
- tensorflow
- tqdm
MLTraining/requirements.txt
pypi · 9- albumentations
- coremltools
- opencv-python
- pyyaml
- scipy
- torch
- torchvision
- tqdm
- ultralytics
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This repository has more files than are indexed here, so the diagram and browser show a partial tree. Open it on GitHub for the complete structure.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.