xiaohongshu
xiaohongshu
mediapipe-pose-detection
MediaPipe pose detection expertise. Use when debugging landmark tracking, adjusting confidence thresholds, fixing pose detection issues, working with pose.py and video_io.py, or validating pose detection with manual observation.
Full skill instructions
| Landmark | Left Index | Right Index | Use Case |
|---|---|---|---|
| Hip | 23 | 24 | Center of mass, jump height |
| Knee | 25 | 26 | Triple extension, landing |
| Ankle | 27 | 28 | Ground contact detection |
| Heel | 29 | 30 | Takeoff/landing timing |
| Toe | 31 | 32 | Forefoot contact |
| Landmark | Left Index | Right Index | Use Case |
|---|---|---|---|
| Shoulder | 11 | 12 | Arm swing tracking |
| Elbow | 13 | 14 | Arm action |
| Wrist | 15 | 16 | Arm swing timing |
| Landmark | Index | Use Case |
|---|---|---|
| Nose | 0 | Head position |
| Left Eye | 2 | Face orientation |
| Right Eye | 5 | Face orientation |
min_detection_confidence = 0.5 # Initial pose detection
min_tracking_confidence = 0.5 # Frame-to-frame tracking
| Preset | Detection | Tracking | Use Case |
|---|---|---|---|
fast | 0.3 | 0.3 | Quick processing, tolerates errors |
balanced | 0.5 | 0.5 | Default, good accuracy |
accurate | 0.7 | 0.7 | Best accuracy, slower |
Symptoms: Landmarks jump erratically between frames
Solutions:
# Butterworth filter (filtering.py)
from kinemotion.core.filtering import butterworth_filter
smoothed = butterworth_filter(landmarks, cutoff=8.0, fps=30)
# One-Euro filter (smoothing.py)
from kinemotion.core.smoothing import one_euro_filter
smoothed = one_euro_filter(landmarks, min_cutoff=1.0, beta=0.007)
Symptoms: MediaPipe swaps left and right landmarks mid-video
Cause: Occlusion at 90° lateral camera angle
Solutions:
Symptoms: Landmarks disappear for several frames
Causes:
Solutions:
# Simple linear interpolation for gaps
import numpy as np
def interpolate_gaps(landmarks, max_gap=5):
# Fill NaN gaps with linear interpolation
for i in range(landmarks.shape[1]):
mask = np.isnan(landmarks[:, i])
if mask.sum() > 0 and mask.sum() <= max_gap:
landmarks[:, i] = np.interp(
np.arange(len(landmarks)),
np.where(~mask)[0],
landmarks[~mask, i]
)
return landmarks
Symptoms: Visibility scores consistently below threshold
Causes:
Solutions:
Mobile videos often have rotation metadata that must be handled:
# video_io.py handles this automatically
# Reads EXIF rotation and applies correction
from kinemotion.core.video_io import read_video_frames
frames, fps, dimensions = read_video_frames("mobile_video.mp4")
# Frames are correctly oriented regardless of source
# FFmpeg rotation options
ffmpeg -i input.mp4 -vf "transpose=1" output.mp4 # 90° clockwise
ffmpeg -i input.mp4 -vf "transpose=2" output.mp4 # 90° counter-clockwise
ffmpeg -i input.mp4 -vf "hflip" output.mp4 # Horizontal flip
Always read actual frame dimensions from first frame, not metadata:
# Correct approach
cap = cv2.VideoCapture(video_path)
ret, frame = cap.read()
height, width = frame.shape[:2]
# Incorrect (may be wrong for rotated videos)
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
def normalized_to_pixel(landmark, width, height):
x = int(landmark.x * width)
y = int(landmark.y * height)
return x, y
Each landmark has a visibility score (0.0-1.0):
0.5: Likely visible and accurate
# Key connections for jump visualization
POSE_CONNECTIONS = [
(23, 25), (25, 27), (27, 29), (27, 31), # Left leg
(24, 26), (26, 28), (28, 30), (28, 32), # Right leg
(23, 24), # Hips
(11, 23), (12, 24), # Torso
]
| Element | Color (BGR) | Meaning |
|---|---|---|
| Skeleton | (0, 255, 0) | Green - normal tracking |
| Low confidence | (0, 165, 255) | Orange - visibility < 0.5 |
| Key angles | (255, 0, 0) | Blue - measured angles |
| Phase markers | (0, 0, 255) | Red - takeoff/landing |
model_complexity=0 for fastest inferenceimport mediapipe as mp
pose = mp.solutions.pose.Pose(
model_complexity=0, # 0=Lite, 1=Full, 2=Heavy
min_detection_confidence=0.5,
min_tracking_confidence=0.5,
static_image_mode=False # False for video (uses tracking)
)
pose.close()src/kinemotion/core/pose.pysrc/kinemotion/core/video_io.pysrc/kinemotion/core/filtering.pysrc/kinemotion/core/smoothing.pysrc/kinemotion/core/auto_tuning.pyVideo → read_video_frames() → pose.process() → filter/smooth → analyze
During development, use manual frame-by-frame observation to establish ground truth and validate pose detection accuracy.
Step 1: Generate Debug Video
uv run kinemotion cmj-analyze video.mp4 --output debug.mp4
Step 2: Manual Frame-by-Frame Analysis
Open debug video in a frame-stepping tool (QuickTime, VLC with frame advance, or video editor).
Step 3: Record Observations
For each key phase, record the frame number where the event occurs:
=== MANUAL OBSERVATION: PHASE DETECTION ===
Video: ________________________
FPS: _____ Total Frames: _____
PHASE DETECTION (frame numbers)
| Phase | Detected | Manual | Error | Notes |
|-------|----------|--------|-------|-------|
| Standing End | ___ | ___ | ___ | |
| Lowest Point | ___ | ___ | ___ | |
| Takeoff | ___ | ___ | ___ | |
| Peak Height | ___ | ___ | ___ | |
| Landing | ___ | ___ | ___ | |
LANDMARK QUALITY (per phase)
| Phase | Hip Visible | Knee Visible | Ankle Visible | Notes |
|-------|-------------|--------------|---------------|-------|
| Standing | Y/N | Y/N | Y/N | |
| Countermovement | Y/N | Y/N | Y/N | |
| Flight | Y/N | Y/N | Y/N | |
| Landing | Y/N | Y/N | Y/N | |
Standing End: Last frame before downward hip movement begins
Lowest Point: Frame where hip reaches minimum height
Takeoff: First frame where both feet leave ground
Peak Height: Frame where hip reaches maximum height
Landing: First frame where foot contacts ground
For each landmark, observe:
| Quality | Criteria |
|---|---|
| Good | Landmark stable, positioned correctly on body part |
| Jittery | Landmark oscillates ±5-10 pixels between frames |
| Offset | Landmark consistently displaced from actual position |
| Lost | Landmark missing or wildly incorrect |
| Swapped | Left/right landmarks switched |
When validating, provide structured data:
## Ground Truth: [video_name]
**Video Info:**
- Frames: 215
- FPS: 60
- Duration: 3.58s
- Camera: 45° oblique
**Phase Detection Comparison:**
| Phase | Detected | Manual | Error (frames) | Error (ms) |
|-------|----------|--------|----------------|------------|
| Standing End | 64 | 64 | 0 | 0 |
| Lowest Point | 91 | 88 | +3 (late) | +50 |
| Takeoff | 104 | 104 | 0 | 0 |
| Landing | 144 | 142 | +2 (late) | +33 |
**Error Analysis:**
- Mean absolute error: 1.25 frames (21ms)
- Bias detected: Landing consistently late
- Accuracy: 2/4 perfect, 4/4 within ±3 frames
**Landmark Issues Observed:**
- Frame 87-92: Hip jitter during lowest point
- Frame 140-145: Ankle tracking unstable at landing
At 60fps (16.67ms per frame):
| Error Level | Frames | Time | Interpretation |
|---|---|---|---|
| Perfect | 0 | 0ms | Exact match |
| Excellent | ±1 | ±17ms | Within human observation variance |
| Good | ±2 | ±33ms | Acceptable for most metrics |
| Acceptable | ±3 | ±50ms | May affect precise timing metrics |
| Investigate | >3 | >50ms | Algorithm may need adjustment |
Look for systematic patterns across multiple videos:
| Pattern | Meaning | Action |
|---|---|---|
| Consistent +N frames | Algorithm detects late | Adjust threshold earlier |
| Consistent -N frames | Algorithm detects early | Adjust threshold later |
| Variable ±N frames | Normal variance | No action needed |
| Increasing error | Tracking degrades | Check landmark quality |
Store ground truth observations:
# Save validation results
write_note(
title="CMJ Phase Detection Validation - [video_name]",
content="[structured observation data]",
folder="biomechanics"
)
# Search previous validations
search_notes("phase detection ground truth")
# Build context for analysis
build_context("memory://biomechanics/*")
See basic-memory for complete validation study:
biomechanics/cmj-phase-detection-validation-45deg-oblique-view-ground-truthbiomechanics/cmj-landing-detection-bias-root-cause-analysisbiomechanics/cmj-landing-detection-impact-vs-contact-method-comparisonKey findings from validation:
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience