Skip to content

Fix direct SMPL NPZ loading - #84

Open
jeongseok-meta wants to merge 1 commit into
mainfrom
fix/smpl-model-loading
Open

Fix direct SMPL NPZ loading#84
jeongseok-meta wants to merge 1 commit into
mainfrom
fix/smpl-model-loading

Conversation

@jeongseok-meta

Copy link
Copy Markdown
Contributor

Why:

The SMPL conversion example serialized .npz arrays to a temporary pickle without normalizing their layout. A standard component-first posedirs array shaped (207, 20670) was therefore interpreted incorrectly by smplx, producing mat1 and mat2 shapes cannot be multiplied (1x207 and 20670x207). The alternative legacy SMPL pickle requires Chumpy, which is not compatible with the supported Python environments.

What:

Load standard SMPL .npz files directly in memory, accept Chumpy-free .pkl files, and document the supported model files and Python setup. No generated pickle is needed.

How:

  • SMPL loader -- add mhr.smpl.load_smpl_model, normalize 3D and flattened shapedirs/posedirs layouts, and validate the standard 6890-vertex SMPL schema before constructing smplx.SMPL.
  • Conversion example -- replace the broad fallback-and-pickle path with the loader and default to the official .npz model.
  • Documentation -- identify the official SMPL for Julia .npz download, tested smplx==0.1.28 setup, supported Python 3.12/3.13 environments, Windows limitations, and current package boundaries.
  • Regression coverage -- verify component-first bases, the reported (207, 20670) layout, and rejection of nonstandard topology.

API changes:

Adds mhr.smpl.load_smpl_model(path, **kwargs) as an optional-dependency API. Importing mhr.smpl does not require smplx; loading a model does.

Packaging scope:

No conda-forge recipe change is included. The feedstock installs the upstream wheel, while the full converter is not yet an installable package and smplx is unavailable on conda-forge with an upstream license that restricts redistribution. Packaging the complete converter should be a separate upstream-first follow-up; this PR ensures the reusable loader is included in future MHR wheels and therefore future conda-forge builds.

Evidence:

  • Reproduced the exact old 1x207 / 20670x207 failure with smplx==0.1.28 on Python 3.12 and 3.13.
  • The same standard 6890-vertex fixture loads through the new API and produces finite vertices shaped (1, 6890, 3) on both versions, without generating a .pkl.
  • A legacy Chumpy pickle now reports the official NPZ path instead of exposing an import failure.
  • The built wheel contains mhr/smpl.py and imports it without smplx installed.

Related to #54. The issue should remain open until the reporter confirms the documented path works in their environment.

Test plan

pixi run -e py312 test

Run URL: local only (no run URL emitted) — 10 passed

pixi run -e py313 test

Run URL: local only (no run URL emitted) — 10 passed

pixi run -e py312 demo
pixi run -e py313 demo

Run URL: local only (no run URL emitted) — both passed

pixi run -e py312 python -m build

Run URL: local only (no run URL emitted) — sdist and wheel built successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant