Skip to content

climb-sensei

A Python pose estimation tool for analyzing climbing footage. Extract vertical movement metrics, calculate biomechanics, visualize technique with animated dashboards, and analyze climbing performance using computer vision.

Features

  • ๐ŸŽฏ Pose Detection: Real-time human pose estimation using MediaPipe with temporal smoothing
  • ๐Ÿ“Š Performance Analysis: Comprehensive climbing metrics including speed, stability, smoothness, and body positioning
  • ๐ŸŽฏ Efficiency Metrics: Movement economy, lock-off detection, rest position identification, and fatigue scoring
  • ๐Ÿ“ Biomechanics: Calculate joint angles (8 joints), reach distances, and center of mass
  • ๐Ÿ“น Video Processing: Easy video I/O with pose overlay and animated metrics dashboards
  • ๐ŸŽจ Visualization: Draw pose landmarks, annotate metrics, and create real-time performance graphs
  • ๐Ÿ“ˆ Temporal Analysis: Track metrics over time with jerk calculation, sway detection, and progression tracking
  • โœ… Video Quality Validation: Pre-processing quality checks for resolution, FPS, duration, lighting, and stability
  • ๐Ÿงช Well-Tested: Comprehensive test suite with high code coverage

Quick Example

from climb_sensei import PoseEngine, VideoReader, ClimbingAnalysis

# Analyze climbing performance
analyzer = ClimbingAnalysis(window_size=30, fps=30)

with PoseEngine() as engine:
    with VideoReader('climbing_video.mp4') as video:
        while True:
            success, frame = video.read()
            if not success:
                break

            # Detect pose and analyze
            results = engine.process(frame)
            if results:
                landmarks = engine.extract_landmarks(results)
                metrics = analyzer.analyze_frame(landmarks)

                print(f"Velocity: {metrics['com_velocity']:.4f}")
                print(f"Stability: {metrics['com_sway']:.4f}")

# Get summary statistics
summary = analyzer.get_summary()
print(f"Average speed: {summary['avg_velocity']:.4f}")
print(f"Total vertical progress: {summary['total_vertical_progress']:.3f}")

Project Structure

climb-sensei/
โ”œโ”€โ”€ src/climb_sensei/
โ”‚   โ”œโ”€โ”€ __init__.py           # Package exports
โ”‚   โ”œโ”€โ”€ __main__.py           # Demo application
โ”‚   โ”œโ”€โ”€ config.py             # Configuration and constants
โ”‚   โ”œโ”€โ”€ video_io.py           # Video input/output handling
โ”‚   โ”œโ”€โ”€ pose_engine.py        # MediaPipe pose estimation
โ”‚   โ”œโ”€โ”€ biomechanics.py       # Pure mathematical calculations
โ”‚   โ”œโ”€โ”€ metrics.py            # ClimbingAnalysis with temporal tracking
โ”‚   โ”œโ”€โ”€ metrics_viz.py        # Metrics dashboard visualization
โ”‚   โ””โ”€โ”€ viz.py                # Pose visualization utilities
โ”œโ”€โ”€ scripts/
โ”‚   โ””โ”€โ”€ analyze_climb.py      # Unified CLI (analysis + video generation)
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ test_*.py             # Comprehensive unit tests
โ”‚   โ””โ”€โ”€ __init__.py
โ””โ”€โ”€ docs/                     # Documentation

Requirements

  • Python 3.12+
  • mediapipe >= 0.10.30
  • opencv-python >= 4.8.0
  • numpy >= 1.24.0
  • tqdm >= 4.66.0

License

See LICENSE file for details.

Contributing

Contributions are welcome! Please ensure:

  • All functions have type hints
  • Comprehensive docstrings
  • Unit tests for new functionality
  • Code follows existing style conventions