Skip to content

Add animal pipeline support to FMPose3DInference (and add test suite)#16

Merged
deruyter92 merged 10 commits intomainfrom
feat/update_api_with_animals
Feb 12, 2026
Merged

Add animal pipeline support to FMPose3DInference (and add test suite)#16
deruyter92 merged 10 commits intomainfrom
feat/update_api_with_animals

Conversation

@deruyter92
Copy link
Collaborator

Summary

  • Extend FMPose3DInference with full animal (26-joint Animal3D) pipeline support,
    including SuperAnimalEstimator (DeepLabCut 2D), AnimalPostProcessor (limb
    regularisation), and the for_animals() convenience constructor.
  • Add a basic test suite (tests/test_fmpose3d.py) covering all public and
    internal components of the inference API with 78 tests (64 unit + 14 functional).

Changes

fmpose3d/fmpose3d.py

  • Add SuperAnimalEstimator: wraps DeepLabCut SuperAnimal, maps quadruped80K keypoints
    to the 26-joint Animal3D layout via _map_keypoints, handles missing detections
    (zero-fill fallback).
  • Add AnimalPostProcessor: applies limb regularisation (Rodrigues rotation aligning
    average limb direction to vertical) instead of root-zeroing / camera_to_world.
  • Add compute_limb_regularization_matrix and apply_limb_regularization helpers.
  • Add _default_components resolver that selects the correct estimator + postprocessor
    based on model_type.
  • Add FMPose3DInference.for_animals() class method for one-line animal pipeline setup.

tests/test_fmpose3d.py (new)

  • Unit tests (64): _map_keypoints (direct mapping, interpolation, out-of-range,
    multi-individual), limb regularisation (identity, rotation, 180-degree, degenerate,
    valid-rotation properties), both postprocessors (shape, mutation, camera_rotation
    handling, all-zero pose), _default_components, FMPose3DInference construction
    (for_animals, custom injection, _resolve_pad), _ingest_input (arrays, paths,
    directories, 8 error cases), _load_weights error paths, pose_3d input validation
    (wrong ndim, zero frames, 4D→first person, TTA path, progress callback, seed
    reproducibility), dataclasses, mocked SuperAnimalEstimator.predict (no-detection
    and valid-detection branches).
  • Functional tests (14): full human pipeline (HRNet 2D → FMPose3D 3D, shape checks,
    root-zeroed, world z-floor, finite, seed reproducibility) and full animal pipeline
    (DLC 2D → FMPose3D-animals 3D, shape checks, finite, magnitude sanity,
    reproducibility). Marked @pytest.mark.functional and auto-skipped when pretrained
    weights are not present.

pyproject.toml

  • Register functional pytest marker.

@deruyter92 deruyter92 changed the base branch from main to ti_video_demo February 11, 2026 12:31
Base automatically changed from ti_video_demo to main February 11, 2026 13:18
Copy link

@C-Achard C-Achard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good ! Should be easy to use downstream, definitely great there is some testing.

Some minor comments for future usage but nothing major.

@deruyter92 deruyter92 merged commit 1edd4d7 into main Feb 12, 2026
5 checks passed
@deruyter92 deruyter92 deleted the feat/update_api_with_animals branch February 12, 2026 14:12
@deruyter92 deruyter92 restored the feat/update_api_with_animals branch February 12, 2026 14:52
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.

3 participants