Sub topic 10
Bottom-Up Estimation and Keypoint Grouping
Assume you know basic Python, NumPy, convolutional neural networks, object detection, and training loss. In bottom-up pose estimation, the model finds body parts first and decides which parts belong to the same person afterward.
How bottom-up estimation works
A bottom-up system usually follows this process:
- Run one network over the whole image.
- Detect candidates for each keypoint type, such as every visible wrist and ankle.
- Predict information that connects related keypoints.
- Group the candidates into separate human poses.
For an image containing three people, the network might find six wrists, six elbows, and six shoulders. Grouping must determine which wrist belongs with which elbow and shoulder.
This differs from a top-down system, which first detects each person with a bounding box and then estimates a pose inside each box.
Evidence for grouping
A model needs more than the location and confidence of an isolated keypoint. It also needs evidence that two keypoints are connected.
Common approaches include:
- Part affinity fields (PAFs): A PAF predicts a 2D direction vector along each limb. A candidate shoulder and candidate elbow are likely connected when the vectors along the line between them agree with the predicted field.
- Associative embedding: Each detected keypoint receives a learned tag, or a small numeric embedding. Keypoints from the same person should have similar tags.
- Geometric matching: The system scores pairs using distance, limb length, visibility, and confidence. This is often combined with learned connection evidence.
The grouping stage usually builds a graph. A node represents a keypoint candidate. An edge represents a possible connection between two candidates. The algorithm selects high-scoring edges while respecting the skeleton structure.
| Method | Main grouping signal | Strength | Typical weakness |
|---|---|---|---|
| PAFs | Limb direction and alignment | Handles people at different positions | Requires graph matching |
| Associative embeddings | Similar learned tags | Flexible and simple to decode | Tags can collide in crowds |
| Geometry only | Distance and pose rules | Easy to implement | Fails when people overlap |
A simple grouping model
The following example groups detected keypoints by a one-dimensional tag. Real models learn these tags from training data. The example uses a threshold and keeps each keypoint type separate.
import numpy as np
def group_by_tag(detections, threshold=0.25):
"""Group (x, y, score, tag) detections into person-like groups."""
groups = []
for x, y, score, tag in sorted(detections, key=lambda item: item[2], reverse=True):
best_group = None
best_distance = float("inf")
for group in groups:
distance = abs(tag - group["mean_tag"])
if distance < best_distance:
best_group = group
best_distance = distance
if best_group is not None and best_distance < threshold:
best_group["points"].append((x, y, score))
tags = [point[3] for point in best_group["tagged_points"]]
best_group["tagged_points"].append((x, y, score, tag))
best_group["mean_tag"] = float(np.mean(tags + [tag]))
else:
groups.append({
"points": [(x, y, score)],
"tagged_points": [(x, y, score, tag)],
"mean_tag": float(tag),
})
return groupsThis greedy algorithm is only a teaching example. Production decoders must handle missing joints, duplicate detections, multiple skeleton edges, and conflicting assignments.
Trade-offs and failure cases
Bottom-up methods process the image once, so their cost is less dependent on the number of people. They can be efficient in crowds and do not require a separate person detector.
However, grouping becomes difficult when people overlap, limbs cross, or a person is partly outside the image. Similar-looking keypoints can receive similar tags. Occlusion can remove the connection evidence needed to build a complete skeleton. The decoder may then merge two people or split one person into fragments.
Top-down methods often produce stronger results for isolated people because each crop receives focused attention. Bottom-up methods are attractive when many people appear and detector cost would otherwise grow with the crowd size.
Exercise
Why can a bottom-up model detect all keypoints correctly but still return an incorrect pose?
Show answer
Detection and grouping are separate problems. The model may locate the right body parts but connect a keypoint from one person to another.