Pose2Par turns an ordinary video of a golf swing into full 3D biomechanical data — pelvis rotation, torso rotation, X-factor, and swing event timing — all without a motion capture lab.
It combines deep-learning pose estimation (MMPose), AI marker enhancement (LSTM / Transformer), and physics-based biomechanical modelling (OpenSim) into a single, Docker-powered pipeline with an easy-to-use desktop UI.
Capture, analyse, and visualise golf swing biomechanics — all from one interface.
Pose2Par has been independently validated against laboratory-grade 3D motion capture equipment. Key findings:
| Metric | Reliability |
|---|---|
| Swing event timing | ✅ High |
| Pelvis rotation (Top of Backswing) | ✅ High |
| X-Factor (Top of Backswing) | ✅ High |
| Impact detection (low handicap) | ✅ Good |
| Impact detection (high handicap) | |
| Swing finish phase | ❌ Limited (self-occlusion) |
| Angular velocity | ❌ Unreliable |
| Sagittal-plane tilt | ❌ Unreliable (single camera depth) |
→ Read the full, transparent breakdown: VALIDATION.md
- Live Swing Capture — high-FPS camera support (up to 120 FPS) with automatic swing detection
- 2D Pose Estimation — powered by MMPose with state-of-the-art keypoint detection
- AI Marker Enhancement — LSTM and Transformer models correct and fill tracking gaps
- 3D Biomechanical Modelling — OpenSim calculates true joint angles from markerless video
- Golf-Specific Metrics:
- Pelvis rotation angle
- Torso rotation angle
- X-Factor (torso–pelvis separation)
- Swing phase labels (address → backswing → downswing → follow-through)
- Key event timestamps (top of backswing, ball impact)
- Interactive Desktop UI — capture, replay, graph, and export in one window
- CSV Export — frame-by-frame metric export for external analysis
- Fully Containerised — Docker pipeline for reproducible, portable deployment
Pose2Par uses a three-stage pipeline:
Video Input → MMPose (Pose Estimation) → Marker Enhancer (ML Enhancement) → OpenSim (Biomechanics) → Analysis & Visualization
- MMPose: 2D pose estimation using state-of-the-art deep learning models
- Marker Enhancer: LSTM/Transformer models to improve marker tracking and fill gaps
- OpenSim: Biomechanical modeling and joint angle calculations
- Analysis: Event detection, metric calculation, and visualization
- OS: Windows 10/11 (tested), Linux (should work with minor modifications)
- GPU: NVIDIA GPU with CUDA support (recommended for real-time performance)
- RAM: 8GB minimum, 16GB recommended
- Storage: 10GB free space (for Docker images and dependencies)
- Python: 3.8 or higher
- Docker Desktop: Latest version with Docker Compose
- NVIDIA GPU Drivers: If using GPU acceleration
- NVIDIA Container Toolkit: For GPU support in Docker (Linux only)
- Camera: External USB webcam or capture card
- Recommended: High-FPS camera (60-120 FPS) for optimal swing capture
- Minimum: 30 FPS webcam
- Camera Position: Face-on view of golfer during swing
git clone https://github.com/cavanaulton/pose2par.git
cd pose2parWindows:
setup.batLinux/Mac:
chmod +x setup.sh
./setup.shThis will:
- Verify Python and Docker installation
- Install Python dependencies
- Build Docker images (MMPose, Marker Enhancer, OpenSim)
- Create necessary directories
Windows:
scripts\run_pose2par.batPython (any OS):
python src/UI.pyDownload and install Python 3.8+ from python.org
- Download from docker.com
- Install and ensure Docker is running
- (Windows) Enable WSL 2 backend if prompted
- Download latest drivers from nvidia.com
- Install NVIDIA Container Toolkit (Linux):
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit sudo systemctl restart docker
pip install -r requirements_ui.txt# Windows
build_docker_images.bat
# Linux/Mac
docker-compose -f docker-compose.build.yml buildThis builds three Docker images:
mmpose:latest- Pose estimationmarker_enhancer:latest- ML-based marker enhancementopensim:latest- Biomechanical modeling
Note: First build may take 20-30 minutes depending on your internet speed and system.
Edit config.py to customize camera settings:
# Camera settings
CAMERA_WIDTH = 1920
CAMERA_HEIGHT = 1080
CAMERA_FPS = 60
# Force specific camera index (None for auto-detection)
FORCE_CAMERA_INDEX = None # or set to specific index like 2
# Golfer handedness
GOLFER_HANDEDNESS = 'right' # or 'left'- Launch the UI: Run
python UI.pyorrun_pose2par.bat - Select Camera: Choose your external camera from the dropdown
- Position Golfer: Ensure face-on view with full body visible
- Start Recording: Click "Start Recording" button
- Capture Swing: Record 3-5 seconds including full swing
- Stop Recording: Click "Stop Recording"
- Run Analysis: Click "Analyze Swing" button
- Wait for Processing: Pipeline runs automatically (2-5 minutes typical)
- View Results:
- Playback with overlay visualization
- Real-time angle graphs
- Frame-by-frame metrics
- Export Data: Click "Export" to save CSV with all metrics
- Place video file in
pipeline_data/input_video/asinput_video.mp4 - Click "Analyze Swing" in UI, or
- Run pipeline manually:
python run_full_pipeline.py
After analysis, you'll find:
pipeline_data/mmpose_output/- Raw pose estimation datapipeline_data/marker_enhancer_output/- Enhanced marker trajectories (.trc files)pipeline_data/opensim_output/- Biomechanical analysis results (.mot files, joint angles)pipeline_data/exports/- CSV exports for external analysis
# Camera settings
CAMERA_WIDTH = 1920
CAMERA_HEIGHT = 1080
CAMERA_FPS = 60
FORCE_CAMERA_INDEX = None # Auto-detect or specify index
# Skip built-in webcams
SKIP_BUILTIN_WEBCAM = True
# Golf analysis settings
GOLFER_HANDEDNESS = 'right' # 'right' or 'left'
CAMERA_VIEW = 'face_on' # 'face_on' or 'down_the_line'Edit Docker service parameters in docker-compose.yml:
# MMPose settings
--bbox-thr 0.4 # Bounding box confidence threshold
--kpt-thr 0.3 # Keypoint confidence threshold
# Marker Enhancer settings
--fps 60 # Video framerate
--subject_height 1.70 # Subject height in meters
--subject_weight 74.0 # Subject weight in kgpose2par/
├── UI.py # Main application UI
├── config.py # Configuration settings
├── docker_handler.py # Docker pipeline orchestration
├── event_detection.py # Golf swing event detection
├── camera_detector.py # Camera detection utilities
├── run_full_pipeline.py # Standalone pipeline runner
├── setup.bat # Windows setup script
├── build_docker_images.bat # Docker image builder
├── run_pose2par.bat # Windows launcher
├── docker-compose.yml # Docker services configuration
├── requirements_ui.txt # Python dependencies
├── mmpose/ # MMPose pose estimation
├── marker-enhancer/ # ML-based marker enhancement
├── opensim/ # OpenSim biomechanical models
├── docker_image_files/ # Dockerfiles for each service
├── pipeline_data/ # Pipeline input/output/working directory
│ ├── input_video/ # Input videos
│ ├── mmpose_output/ # Pose estimation output
│ ├── marker_enhancer_output/ # Enhanced markers
│ ├── opensim_output/ # Biomechanical analysis
│ └── exports/ # CSV exports
├── scripts/ # Utility scripts
└── models/ # Pre-trained model weights
Test individual stages using Docker Compose profiles:
# MMPose only
docker-compose run mmpose-only
# Marker Enhancer only
docker-compose run marker-enhancer-only
# OpenSim only
docker-compose run opensim-only- Modify OpenSim scripts in
opensim/scripts/ - Update
docker_handler.pyto parse new metrics - Update
UI.pyto visualize new metrics
Problem: "Cannot connect to Docker daemon"
# Ensure Docker Desktop is running
# Windows: Check system tray for Docker icon
# Linux: sudo systemctl start dockerProblem: "CUDA not available" in Docker container
# Windows: Ensure WSL 2 is enabled and NVIDIA drivers are installed in Windows
# Linux: Install nvidia-container-toolkitProblem: Camera not detected
# Check camera connection
# Try different USB port
# Set FORCE_CAMERA_INDEX in config.pyProblem: Low FPS during capture
# Reduce CAMERA_FPS in config.py
# Check camera specifications
# Close other applications using cameraProblem: "No pose detected" error
# Ensure golfer is fully visible in frame
# Check lighting conditions
# Lower --bbox-thr threshold in docker-compose.ymlProblem: Docker build fails
# Ensure stable internet connection
# Clear Docker cache: docker system prune -a
# Rebuild: docker-compose -f docker-compose.build.yml build --no-cacheIf you use Pose2Par in your research, please cite:
@software{pose2par,
title={Pose2Par: Markerless Golf Swing Biomechanical Analysis via Monocular Video},
author={Aulton, Cavan},
year={2026},
url={https://github.com/cavanaulton/pose2par}
}Pose2Par builds on the following open-source projects — thank you to their maintainers:
| Project | Licence | Use in Pose2Par |
|---|---|---|
| MMPose | Apache 2.0 | 2D pose estimation backbone |
| OpenSim | Apache 2.0 | Biomechanical modelling engine |
| PyTorch | BSD | ML model training and inference |
This project is licensed under the MIT License - see the LICENSE file for details.
Individual components may have their own licenses:
- MMPose: Apache License 2.0
- OpenSim: Apache License 2.0
- Marker Enhancer: Check
marker-enhancer/LICENSE
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Make your changes and test them
- Open a Pull Request with a clear description
- Bug reports / feature requests: GitHub Issues
- Discussion: GitHub Discussions
- Down-the-line camera view support
- Multi-camera fusion for improved depth estimation
- Cloud-based processing option
- Expanded biomechanical metrics (hip speed, shoulder plane)
- Mobile companion app
See CHANGELOG.md for version history.
Pose2Par is a research and coaching tool for biomechanical analysis. Results should be interpreted by qualified professionals. This software is not intended for medical diagnosis or treatment. See VALIDATION.md for a full account of accuracy and known limitations.
Made with ⛳ for golf biomechanics research

