The torchvision detector drop-in, headless pyrender/OpenGL shims, and the detector+smoke tests existed only on ultra's disk inside gitignored .engine/. Captured byte-identical copies into engine_patches/ (mirrors the HSMR subtree) and moved setup_hsmr.sh to the repo root (tracked, path-relative) with a --patch step that overlays them onto the clone. Acceptance PASSED: fresh shallow clone of HSMR in a temp dir + './setup_hsmr.sh --patch' + validated venv -> test_detector.py green (7/7 demo imgs, 15 patches), no hand edits. A re-clone can no longer silently drop the ARM fixes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4.3 KiB
Lane B engine — HSMR install & smoke-test state (session 3, 2026-07-17)
Engine per Decision 1 = Path B: HSMR → SKEL, run local on ultra, MPS. Installed under
.engine/HSMR (gitignored). This doc = how it's wired + how to run once SKEL lands.
State
- ✅
uv venvpy3.10 at.engine/HSMR/.venv; torch 2.13.0,mps.is_available() == True. - ✅ Ungated weights in
.engine/HSMR/data_inputs/: HSMR-ViTH ckpt (released_models/HSMR-ViTH-r1d1/checkpoints/hsmr.ckpt), ViTPose backbone, 3 regressors. - ✅ Real person detector (torchvision Faster R-CNN, no detectron2) — checked by
.engine/HSMR/test_detector.py, green today with no SKEL: 7/7 demo images → 15 patches @256×256 through HSMR's own cropper. - ✅ Smoke-test runner
.engine/HSMR/smoke_test.py— PASSED 2026-07-17 (session 5): SKEL v1.1.1 in place, device=mps, 263 frames → 1315 patches, recovery 31.2 fps, nan=False,data_outputs/smoke/params.npzwritten (poses (N,46), betas (N,10), cam_t (N,3)). - ✅ Install script (re-runnable):
./setup_hsmr.shat the repo root (tracked in git)../setup_hsmr.sh --patchre-applies the ARM/headless fixes onto an existing/re-cloned HSMR. - ✅ The ARM fixes are now durable in git (session 5, was: "on ultra's disk only"). Canonical
copies live in
engine_patches/(_headless.py,test_detector.py,smoke_test.py,lib/modeling/pipelines/vitdet/__init__.py);setup_hsmr.shoverlays them onto the gitignored.engine/HSMRclone. Verified: fresh clone +--patch→test_detector.pygreen, no hand edits.
Apple-Silicon blockers — all three resolved (session 4, "Lane B detector")
- detectron2 won't build on ARM Mac → RESOLVED. Replaced its whole ViTDet detector with
a torchvision Faster R-CNN drop-in in
lib/modeling/pipelines/vitdet/__init__.py— samebuild_detector(...) -> (dets, downsample_ratios)contract, torchvision's person class (1) remapped to HSMR's human id (0), boxes as lurb, ratio 1.0. This also killed a load-time landmine: the oldimport detectron2there exploded anything importinglib.kits.hsmr_demo(why session 3 had to stub it). Detector pinned to CPU — cheap next to the ViT-H pass and it dodges MPS RoIAlign/NMS gaps; an in-file# ponytailnote marks the mobilenet swap if per-frame detection ever dominates on long videos. - pyrender is dead headless on macOS (
py_rendererforcesPYOPENGL_PLATFORM=egl, no EGL on Mac;pyrenderis even referenced in a type annotation, so a plain import-guard won't do). Centralized the permissivepyrender/OpenGLfake into.engine/HSMR/_headless.py— every entrypoint doesimport _headlessbefore anylib.*import. QC still happens in Blender (fleet renderer + Lane C's tool); the runner dumpsparams.npz(SKEL poses/betas/cam_t — the Path-B payload) andmesh_qc.npz(verts/faces for Blender). - chumpy failed to build → NOT a blocker (verified). The runtime
SKELWrapperloads its pkls with plainpickle.load(encoding='latin1')— no chumpy import. chumpy only appears in SKEL's offline model-build script (merge_smplh_mano.py), which we never run. Ignore the WARN.
John's one step — drop the SKEL files (login + licence, so it's yours to do)
Register skel.is.tue.mpg.de → Download → "SKEL and BSM models" → skel_models_v1.1.zip
(must be v1.1.1 — check changelog_v1.1.1.txt inside; older = silent incompatibility).
Unzip, then:
mv /path/to/skel_models_v1.1 ~/Documents/MOCAPGOD/.engine/HSMR/data_inputs/body_models/skel
so that …/data_inputs/body_models/skel/skel_male.pkl exists.
Run the smoke test (once SKEL is in place)
cd ~/Documents/MOCAPGOD/.engine/HSMR && source .venv/bin/activate
PYTHONPATH=. python smoke_test.py -i data_inputs/demo/example_videos/gymnasts.mp4 # or .../example_imgs
Outputs → data_outputs/smoke/: params.npz (rotations), mesh_qc.npz (Blender QC), and
console device/fps/NaN. Answers the Lane B smoke questions: MPS forward OK? timing (<2×
realtime)? pose sane?
⚠️ HSMR is a per-frame recoverer → root is camera-space cam_t, not world-grounded.
Fine for in-place DJ moves; locomotion (walk) needs Lane C's foot-contact root derivation or a
grounding pass. This is the treaty's global-trajectory caveat, carried into Path B.