Sub topic 9
Top-down estimation: detect, crop, estimate
Top-down pose estimation finds people first and estimates a pose separately for each detected person. This chapter assumes you know basic Python and NumPy, convolutional neural networks, bounding boxes, and training and evaluation metrics.
The three-stage pipeline
A top-down system performs these steps:
- An object detector finds person bounding boxes.
- Each box is cropped and resized to the pose model's input size.
- The pose model predicts keypoints inside each crop.
- The crop coordinates are mapped back to the original image.
The detector usually returns a box (x1, y1, x2, y2) and a confidence score. The pose model then predicts the selected keypoints, such as the 17 COCO keypoints. Because each person is processed independently, the pose model does not need to decide which joints belong to which person.
This separation makes the design easy to understand and often produces accurate poses. It also creates a dependency: a missed person cannot receive a pose, and a badly placed box can cut off important joints.
Mapping crop coordinates back
Suppose the original box has width bw and height bh. If the crop is resized to (input_width, input_height), a predicted crop point (u, v) maps approximately to:
x = x_1 + u\frac{bw}{input\_width}, \qquad
y = y_1 + v\frac{bh}{input\_height}The reverse mapping is needed when the crop was padded to preserve its aspect ratio. In that case, remove the padding before applying the scale.
import numpy as np
def crop_to_image(points, box, crop_size):
"""Map (N, 2) crop points to original-image x,y coordinates."""
x1, y1, x2, y2 = map(float, box)
crop_width, crop_height = map(float, crop_size)
scale_x = (x2 - x1) / crop_width
scale_y = (y2 - y1) / crop_height
points = np.asarray(points, dtype=np.float32)
result = points.copy()
result[:, 0] = x1 + points[:, 0] * scale_x
result[:, 1] = y1 + points[:, 1] * scale_y
return result
box = (100, 50, 500, 850)
crop_points = np.array([[200, 300], [100, 600]])
print(crop_to_image(crop_points, box, (256, 512)))Trade-offs and common errors
| Choice | Benefit | Cost |
|---|---|---|
| Detect then estimate | Accurate, modular models | Detector errors propagate |
| One crop per person | Handles different poses and scales | More people require more inference |
| Tight boxes | More pixels focus on the person | Joints can be clipped |
| Expanded boxes | Includes nearby joints and context | Adds background and reduces resolution |
A detector may produce overlapping boxes for the same person. Non-maximum suppression, or NMS, keeps the highest-scoring box when overlap is too large. Detector and pose confidences should be kept separate. A high pose confidence does not prove that the person box is correct.
Top-down estimation works well when the number of people is moderate and detection quality is high. Its runtime grows roughly with the number of detected people. For dense crowds, a bottom-up method can be faster because it estimates all joints in one pass and groups them afterward.
Exercise
A pose model predicts a wrist at (64, 128) in a 256 × 256 crop. The crop came from box (50, 100, 450, 700). What is the wrist position in the original image?
Show answer
The crop scales by 400/256 horizontally and 600/256 vertically. The mapped position is approximately (150, 400).