Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Points that matter, in the right place
Some tasks need more than a box: where exactly are this person’s wrists and knees, or the four corners of a docking target? A keypoint detector marks a fixed list of named points on each object. Joined up they give a stick figure, and on a rigid object such as a satellite they let you compute its exact orientation and distance. How precise must a point be? That depends on the point and the object’s size: an eye must be placed far more precisely than a hip. The demo shows the scoring rule COCO uses.
Keypoints on a target spacecraft (corners, antenna tips) plus the known 3D model give its relative pose for rendezvous and docking; human keypoints drive ergonomics, sports analytics and robot imitation from video.
- 1. A keypoint detector outputs…
- 2. From 2D keypoints on a rigid object with a known 3D model you can compute…
- 3. COCO's keypoint score is stricter for…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Output. For each instance, K keypoints (x, y) with a visibility flag (COCO: 0 unlabelled, 1 labelled but occluded, 2 visible) and a score.
- Top-down (detect, crop, then estimate each instance): SimpleBaseline (Xiao et al. 2018), HRNet (Sun et al. 2019), ViTPose (Xu et al. 2022), RTMPose (Jiang et al. 2023). Accurate; cost grows with the number of people; fails when boxes overlap.
- Bottom-up (all keypoints, then group): OpenPose (Cao et al. 2017) with part affinity fields, associative embedding (Newell et al. 2017), HigherHRNet (2020). One-stage regressors: YOLO-Pose (2022), RTMO (2024).
- Representations. Direct regression (DeepPose, Toshev and Szegedy 2014; RLE, 2021); Gaussian heatmaps at stride 4, decoded by argmax plus a sub-pixel step; coordinate classification over sub-pixel bins (SimCC, 2022, used by RTMPose).
- Datasets. COCO keypoints (17 per person, about 250000 person instances); MPII (2014, 16 joints); CrowdPose (2019); COCO-WholeBody (2020, 133 keypoints); SPEED and SPEED+ (Kisantal et al. 2020, Park et al. 2022) for satellite pose.
- Metrics. OKS = mean over labelled keypoints of exp(−d²/(2s²κ²)), with s² the object area and κ = 2σ a per-keypoint constant from annotator spread (eyes 0.050, hips 0.214); AP averaged over OKS thresholds 0.5 to 0.95, like box AP. PCK and PCKh@0.5 (MPII). For 3D: MPJPE in millimetres.
- 1. Top-down pose estimation first…
- 2. OKS's κ is larger for…
- 3. SimCC represents each coordinate as…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.A pose pipeline from crop to pose
Exercise 1.
- COCO OKS with visibility and per-keypoint constants.
- PCK.
- Gaussian heatmap targets on a strided grid, and flipping with left/right swaps.
Practice.
- Crop. Expand each detected box to the model’s aspect ratio (3:4 for 256 × 192) with about 25% padding, and warp with an affine transform; keep the inverse to map keypoints back.
- Targets and decoding. Gaussian heatmaps with σ = 2 at stride 4; decode with a sub-pixel method (quarter offset, DARK or UDP); never plain argmax.
- Flip test. Average the heatmaps of the image and its mirror, after swapping left and right channels.
- Choose the family. RTMPose or ViTPose for accuracy and speed (MMPose); YOLO11-pose for one-stage real-time use; bottom-up for crowds.
- Rigid objects. Define 8–12 keypoints on the 3D model (corners, antenna tips); regress them; solve PnP with RANSAC (OpenCV solvePnPRansac); refine.
- Check failures by keypoint: left–right swaps, occluded joints, truncation at crop edges.
from ultralytics import YOLO
import cv2, numpy as np
pose = YOLO("yolo11s-pose.pt")
kps = pose("frame.jpg")[0].keypoints # xy (N, 17, 2) and conf (N, 17)
# rigid target: 2D keypoints (from a keypoint model) + 3D model points -> pose
ok, rvec, tvec, inliers = cv2.solvePnPRansac(model_pts_3d, kps_2d, K, None, reprojectionError=3.0)- 1. Before averaging flip-test heatmaps you must…
- 2. Pose of a rigid object from 2D keypoints and a 3D model:
- 3. The 256 × 192 crop has aspect ratio…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
OKS behaves like IoU for points. For one keypoint, OKS = exp(−d²/(2s²κ²)) is a Gaussian in the error, scaled by object size s and keypoint tolerance κ. An error of sκ gives e^(−1/2) ≈ 0.61, and OKS falls to 0.5 at d = sκ√(2 ln 2) ≈ 1.18 sκ. For an eye (κ = 0.05) on a person of scale 32 pixels that is 1.9 pixels, below a stride-4 heatmap cell.
Quantisation error. A heatmap at stride r represents positions on a grid r pixels apart. Argmax snaps to the nearest cell; with the true point uniform within a cell, the error per axis is uniform on ±r/2, mean absolute r/4 per axis, adding about 0.38 r to the radial error. The quarter-offset rule moves the estimate 0.25 cells towards the larger neighbour, halving the worst case.
DARK. If the heatmap is a Gaussian around μ, its log is quadratic: log h(x) = c − (x − μ)ᵀΣ⁻¹(x − μ)/2. A second-order Taylor expansion at the maximum m gives μ = m − (∇² log h)⁻¹ ∇ log h exactly; smoothing the predicted heatmap first (‘distribution modulation’) makes the log better behaved. Its residual error is then the network’s own localisation error.
Soft-argmax (integral regression) is differentiable and sub-pixel, but takes an expectation that background mass and multiple peaks bias.
- 1. OKS of one keypoint at error sκ is…
- 2. Argmax quantisation error grows with…
- 3. DARK is exact when the heatmap is…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.How much error does heatmap decoding add to a keypoint network, and which decoder removes it?
History.
- A. Toshev and C. Szegedy, “DeepPose” (2014): direct regression.
- B. Xiao, H. Wu and Y. Wei, “Simple baselines for human pose estimation and tracking” (2018): heatmaps with the quarter offset.
- F. Zhang et al., “Distribution-aware coordinate representation for human pose estimation” (2020): DARK.
- X. Sun et al., “Integral human pose regression” (2018): soft-argmax.
Exercise 2. 600 keypoints placed uniformly in a 256 × 192 input.
- Simulated network: it ‘believes’ each point is displaced by Gaussian noise with σ = 1 input pixel (its own error, mean radius 1.25 pixels); its heatmap is a σ = 2 cell Gaussian at that belief plus pixel noise (σ = 0.05).
- Heatmaps: stride 4 (64 × 48) and stride 8 (32 × 24).
- Decoders: argmax; argmax with the quarter offset; DARK (smoothing, then Taylor expansion of the log-heatmap); soft-argmax with β = 20.
- Measures: mean error in input pixels; mean OKS of an eye (κ = 0.05) if the object’s scale were 32 pixels.
| decoder | stride 4 error | stride 4 eye OKS | stride 8 error | stride 8 eye OKS |
|---|---|---|---|---|
| argmax | 2.32 | 0.419 | 4.24 | 0.163 |
| quarter offset | 1.77 | 0.562 | 2.96 | 0.315 |
| DARK | 1.28 | 0.710 | 1.34 | 0.693 |
| soft-argmax | 1.51 | 0.639 | 2.17 | 0.462 |
| network’s own error | 1.25 | 1.25 |
- Argmax nearly doubled the error at stride 4 and more than tripled it at stride 8; for small objects and precise keypoints this is the dominant error.
- The quarter offset recovered about half the gap; DARK came within 0.03 pixels (stride 4) and 0.09 pixels (stride 8) of the network’s own error, making stride 8 almost as good as stride 4.
- Soft-argmax helped but less, because the softmax expectation still spreads over neighbouring cells.
- Seeds 1 and 2: stride 8 argmax 4.27 and 4.18 pixels, DARK 1.38 and 1.42; stride 4 DARK 1.29 and 1.28.
- Caveat: the simulated heatmaps are exactly Gaussian, which is DARK’s own assumption; real heatmaps are less regular, and the reported gains of DARK on COCO are 1–2 AP points rather than this ideal.
Keypoints and pose in AI, robotics and aerospace
- Spacecraft pose estimation: ESA and Stanford’s Satellite Pose Estimation Challenges (2019, 2021) on SPEED and SPEED+; winning entries detected the satellite, regressed 11 keypoints with HRNet and solved PnP, with the synthetic-to-real gap as the hard part.
- Robotics: keypoints on objects for category-level manipulation (kPAM, 2019); human pose for safe human–robot collaboration and imitation from video.
- Aviation and space operations: astronaut and ground-crew motion analysis, and marker-free tracking of docking targets.
References
- A. Toshev and C. Szegedy (2014). “DeepPose: human pose estimation via deep neural networks.” CVPR.
- Z. Cao, T. Simon, S.-E. Wei and Y. Sheikh (2017). “Realtime multi-person 2D pose estimation using part affinity fields.” CVPR.
- B. Xiao, H. Wu and Y. Wei (2018). “Simple baselines for human pose estimation and tracking.” ECCV.
- K. Sun, B. Xiao, D. Liu and J. Wang (2019). “Deep high-resolution representation learning for human pose estimation.” CVPR.
- F. Zhang, X. Zhu, H. Dai, M. Ye and C. Zhu (2020). “Distribution-aware coordinate representation for human pose estimation.” CVPR.
- Y. Xu, J. Zhang, Q. Zhang and D. Tao (2022). “ViTPose: simple vision transformer baselines for human pose estimation.” NeurIPS.
- T. Jiang et al. (2023). “RTMPose: real-time multi-person pose estimation based on MMPose.” arXiv.
- M. Kisantal et al. (2020). “Satellite pose estimation challenge: dataset, competition design and results.” IEEE Transactions on Aerospace and Electronic Systems.
- T. H. Park, M. Märtens, G. Lecuyer, D. Izzo and S. D’Amico (2022). “SPEED+: next-generation dataset for spacecraft pose estimation across domain gap.” IEEE Aerospace Conference.