Skip to content

Add COCO Wholebody 133 keypoint schema and generic.py support#226

Merged
AmitMY merged 2 commits into
sign-language-processing:masterfrom
bricksdont:add-coco-wholebody-133-header
Jun 20, 2026
Merged

Add COCO Wholebody 133 keypoint schema and generic.py support#226
AmitMY merged 2 commits into
sign-language-processing:masterfrom
bricksdont:add-coco-wholebody-133-header

Conversation

@bricksdont

@bricksdont bricksdont commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Context

AlphaPose 133, MMPose wholebody, OpenPifPaf wholebody, and SDPose all output the same COCO Wholebody 133-keypoint format (23 body + 68 face + 21 left hand + 21 right hand = 133, in the same canonical ordering). Rather than each estimator duplicating or subtly diverging from this schema, this PR establishes a single canonical definition and makes the existing alphapose_133 derive from it. Subsequent PRs will add the individual estimator loaders (MMPose, OpenPifPaf, SDPose) on top.

Changes

New canonical schema: pose_format/utils/cocowholebody133_header.py

Single source of truth for the COCO Wholebody 133-keypoint format:

  • BODY_POINTS — 23 keypoints (17 standard COCO body + 6 feet)
  • FACE_POINTS — 68 keypoints, named face-0face-67 (dash separator, matching the COCO Wholebody / MMPose convention)
  • HAND_POINTS — 21 keypoints per hand, named hand_0hand_20 (shared between LEFT_HAND and RIGHT_HAND components; the side is captured by the component name, not the point name — this is required for normalize_hands_3d to work correctly)
  • FACE_LIMBS_NAMES — full face connectivity (jaw contour, brows, nose bridge, eyes, lips): 67 edges
  • Pre-computed BODY_LIMBS, FACE_LIMBS, HAND_LIMBS exported as module-level constants for downstream importers
  • cocowholebody_components() — assembles the four PoseHeaderComponent objects

pose_format/utils/alphapose_133.py now derives from the canonical header

Previously duplicated body point names, body limbs, and hand point names with minor inconsistencies (no face limbs; generic hand_N naming that happened to match the canonical standard; face used face_N underscore separator). Now imports BODY_POINTS, FACE_POINTS, HAND_POINTS, BODY_LIMBS, FACE_LIMBS, HAND_LIMBS directly from cocowholebody133_header. Retains _133-suffixed component names (BODY_133, FACE_133, etc.) for backward compatibility with serialized files.

pose_format/utils/generic.py

Registers "coco_wholebody_133" as a KnownPoseFormat with full support across all per-format utility functions. Hand point lookups use the shared hand_N names consistent with the canonical header.

pose_format/utils/generic_test.py

Parametric tests extended to cover coco_wholebody_133. Three standalone header unit tests verify total keypoint count (133), component names, and that all limb indices are in bounds.

Test plan

  • All 96 tests pass: pytest src/python/pose_format/utils/generic_test.py src/python/pose_format/utils/alphapose_test.py -v
  • detect_known_pose_format correctly identifies both alphapose_133 and coco_wholebody_133 fake poses
  • pose_hide_legs, correct_wrists, normalize_pose_size work for coco_wholebody_133
  • alphapose_133 loader round-trips correctly (component names unchanged)

🤖 Generated with Claude Code

Introduces cocowholebody133_header.py as a shared schema definition for the
133-keypoint COCO Wholebody format (23 body + 68 face + 21 left hand + 21 right
hand), and registers it as a known pose format in generic.py with full support
across detection, leg hiding, shoulder/hand utilities, and normalization helpers.

Also fixes several bugs present in the upstream fork: incorrect component name
("pose_keypoints_2d" instead of "BODY") and string-index point names in
pose_hide_legs, wrong hand component name suffix in get_hand_wrist_index, and the
missing coco_wholebody_133 case in get_standard_components_for_known_format.

Co-Authored-By: catherine-o-brien <catherine-o-brien@users.noreply.github.com>
Co-Authored-By: GerrySant <GerrySant@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bricksdont bricksdont requested a review from AmitMY June 19, 2026 09:16
@bricksdont

Copy link
Copy Markdown
Collaborator Author

(CI fails, but seems unrelated to this PR)

@bricksdont bricksdont marked this pull request as draft June 19, 2026 12:22
…apose_133 derives from it

Research confirmed that AlphaPose 133, MMPose wholebody, OpenPifPaf wholebody, and
SDPose all output the same COCO Wholebody 133 keypoints in the same order. The
previous alphapose_133.py duplicated the schema definition with minor naming
inconsistencies (face_N underscore, side-prefixed hand point names, no face limbs).

cocowholebody133_header.py is now the single source of truth for the 133-keypoint
COCO Wholebody format:
- HAND_POINTS uses shared "hand_N" naming (same for both left/right components),
  matching the AlphaPose convention and enabling normalize_hands_3d to work correctly
- FACE_LIMBS_NAMES adds full face connectivity (jaw, brows, eyes, nose, lips)
- All limb index pairs are pre-computed as module-level constants (BODY_LIMBS,
  FACE_LIMBS, HAND_LIMBS) and exported for downstream importers

alphapose_133.py now imports BODY_POINTS, FACE_POINTS, HAND_POINTS and pre-computed
limb pairs from cocowholebody133_header.py, keeping only its _133-suffixed component
names for backward compatibility.

generic.py hand point lookups for coco_wholebody_133 updated to use "hand_N" names.

Co-Authored-By: catherine-o-brien <catherine-o-brien@users.noreply.github.com>
Co-Authored-By: GerrySant <GerrySant@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bricksdont bricksdont marked this pull request as ready for review June 19, 2026 12:31
@AmitMY AmitMY merged commit 604f5aa into sign-language-processing:master Jun 20, 2026
5 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants