Skip to content

Native Windows video motion capture with ExMR, FlowHMR and GVHMR, contact correction, humanoid retargeting, and FBX/VMD export.

Python

Fix PromptHMR untracked finger placeholders

toyxyzbfd879e87b00
diff --git a/SOURCE_MANIFEST.json b/SOURCE_MANIFEST.json
index 4ecad87..ab85b8d 100644
--- a/SOURCE_MANIFEST.json
+++ b/SOURCE_MANIFEST.json
@@ -96,8 +96,8 @@
},
{
"path": "docs/AGENT_GUIDE.md",
- "bytes": 28473,
- "sha256": "db6dfe045441fe432739e13563b9952e25267903808237725063a34273e7c8a6"
+ "bytes": 28748,
+ "sha256": "efdb3f9793fee6a6f94d5ae0a22a8f877f12f8c47e5966e6cd26168dc6810018"
},
{
"path": "docs/BUILD.md",
@@ -126,8 +126,8 @@
},
{
"path": "docs/VALIDATION.md",
- "bytes": 45987,
- "sha256": "805354466c96b54799b2714b645c7c254c7eaa42b10c5036e2aca09e2f6cc63c"
+ "bytes": 47178,
+ "sha256": "2375b9be585f97c16e07ec3314f1b5cf7ae7aec6a811d07340872bcdd8a9887d"
},
{
"path": "docs/images/rgbmocap-workspace.png",
@@ -151,8 +151,8 @@
},
{
"path": "docs/models/PROMPTHMR.md",
- "bytes": 11760,
- "sha256": "0b2e28c29f2345213a79053bce2b376ca989518210b87c729db389dc9a7dfba1"
+ "bytes": 12912,
+ "sha256": "a5ab49e4d11a9209c9e16bda68af81256c8772dbf686a37baa5b0e3158493a26"
},
{
"path": "docs/models/README.md",
@@ -1496,8 +1496,8 @@
},
{
"path": "mocap/prompthmr_publish.py",
- "bytes": 10029,
- "sha256": "fef2e37215b24469dd9905065859f4419b4ea1a6381ecd7e62e118f96c80c825"
+ "bytes": 11220,
+ "sha256": "f6db793dee88db0187b2fc38962d9ef149b5282cda0db46ccf825053e49ba08c"
},
{
"path": "mocap/prompthmr_runtime.py",
@@ -1511,8 +1511,8 @@
},
{
"path": "mocap/prompthmr_ui.py",
- "bytes": 6173,
- "sha256": "8a7cc807431a14884e5ed83f62056d9a1d127592e55618a4eb9996cd86af694d"
+ "bytes": 6608,
+ "sha256": "6f0b3eb8375208991cde4af8055bafc6b44c1f63a549e12c6d18d2ea95e10148"
},
{
"path": "mocap/queue_groups.py",
diff --git a/docs/AGENT_GUIDE.md b/docs/AGENT_GUIDE.md
index 2c32724..3ac11a6 100644
--- a/docs/AGENT_GUIDE.md
+++ b/docs/AGENT_GUIDE.md
@@ -116,8 +116,11 @@ runtime isolation.
Native inference, published actors, corrections and exports have separate
generations/receipts. Never load untrusted cached pickles or independently
-reposition actors. Only the flat hand-mean representation is converted for the
-shared SMPL-X evaluator; native joint positions are preserved. Optional contact
+reposition actors. Valid native hands use the flat-hand-mean representation conversion. Zero-matrix
+hand placeholders from the untracked video path use fixed registered-neutral
+hands instead of the invalid 120-degree conversion. Preserve body/root/wrist
+motion and the native raw result. Older published finger poses need Reconstruct
+3D with a verified inference cache; Prepare Preview alone does not republish them. Optional contact
correction is a subsequent intentional pose change. Preserve other runtimes.
### MAMMA setup and verification
diff --git a/docs/VALIDATION.md b/docs/VALIDATION.md
index 317ed20..d454642 100644
--- a/docs/VALIDATION.md
+++ b/docs/VALIDATION.md
@@ -680,3 +680,23 @@ unmaterialized-meta rejection. Test files, raw logs and assets stay outside the
- Test programs, source videos, model weights and outputs were kept outside the
public source file list. Restricted upstream PromptHMR source is downloaded
locally by setup, rather than bundled into the source distribution.
+
+
+## PromptHMR untracked hand placeholders (2026-10-31)
+
+The pinned native video path writes zero 3×3 matrices for all 30 untracked finger
+joints. They are not rotation matrices; subsequent axis-angle conversion produced
+a fixed 120-degree rotation at every joint. Earlier native-mesh equivalence checks
+preserved that invalid posture and did not establish a valid hand default.
+
+Publication now uses the registered relaxed hand mean for this all-zero missing
+hand case, while keeping raw native inference files intact. Valid native hand
+rotations keep their prior conversion; inconsistent invalid matrices are rejected.
+Receipts record the hand policy. Older published results show a refresh notice.
+
+Private copies of two two-person clips (32 and 85 frames) were republished from
+cached inference. Original and corrected body/root/shape tensors were exact;
+the first 22 body/wrist joint positions were unchanged. Four original/corrected
+FBXs imported into Blender with 52 bones and 30 finger bones. Local finger
+rotation variation across the 32 frames was zero. Source projects/raw caches were
+not changed. The runtime and AI inference calculations were not modified.
diff --git a/docs/models/PROMPTHMR.md b/docs/models/PROMPTHMR.md
index 33381c5..5c61237 100644
--- a/docs/models/PROMPTHMR.md
+++ b/docs/models/PROMPTHMR.md
@@ -106,8 +106,9 @@ from an arbitrary machine or edit registration files to mark them Ready.
post-optimization are retained. The app does not independently space or
rescale actors. Progress/activity and cancellation use the normal worker UI.
- SMPL-X body motion is generated. The official video settings used here
- **do not generate animated fingers**. Hand contact correction is not finger
- inference.
+ **do not generate animated fingers**. Missing zero-matrix hand placeholders
+ are replaced with the registered body's fixed relaxed hand pose. Hand contact
+ correction is not finger inference.
- Check People rows to show/hide actors and select a row to edit contacts.
**Enable Correction** switches original/corrected motion. **Apply Correction**
does not rerun PromptHMR and refreshes linked characters. Correction may
@@ -152,6 +153,24 @@ opens kept handle/thread counts stable. This short check does not establish
universal playback performance or leak freedom. Fresh two-second inference/export
smoke tests also passed for ExMR, FlowHMR and GVHMR. See [validation](../VALIDATION.md).
+### Refreshing older finger poses
+
+Earlier results could contain a fixed, severely curled hand: the upstream video
+path filled missing finger rotations with zero matrices, which became 120-degree
+rotations during axis-angle conversion. The app now treats these as missing
+hands and uses a fixed registered-neutral pose. Native inference files remain
+unchanged; this is not newly inferred finger animation.
+
+For an existing result showing the legacy notice, keep the original video,
+models and settings, then **Reconstruct 3D**. A verified native inference cache
+is reused and the app republishes motion, correction and export previews; a
+missing or changed cache can require inference. **Prepare Preview** alone does
+not replace already published hand parameters. No runtime reinstall is needed.
+
+Two short two-person clips (32 and 85 frames) were checked. Body/root/shape and
+corrected-body tensors remained exact, body/wrist joint positions were unchanged,
+and four Blender FBX imports retained fixed local finger rotations.
+
## Files and agent/developer guide
| Item | Location |
diff --git a/mocap/prompthmr_publish.py b/mocap/prompthmr_publish.py
index c4e48e6..03bb7c3 100644
--- a/mocap/prompthmr_publish.py
+++ b/mocap/prompthmr_publish.py
@@ -6,8 +6,21 @@ from .storage import atomic_json,sha256
from .result_artifacts import file_stat
-def convert(params,body,indices):
- """Convert flat-mean upstream hands to the app's native SMPL-X convention."""
+def hand_policy(person):
+ """Zero matrices in the video path are missing hands, not rotations."""
+ rotations=np.asarray(person['smplx_cam']['rotmat'])
+ if rotations.shape!=(len(person['frames']),55,3,3):raise ValueError('Invalid PromptHMR rotation dimensions.')
+ hands=rotations[:,25:]
+ absent=np.all(hands==0,axis=(-1,-2))
+ if absent.all():return 'registered-neutral-untracked-v1'
+ if absent.any() or not np.isfinite(hands).all():raise ValueError('Inconsistent PromptHMR hand rotations.')
+ if not np.allclose(np.linalg.det(hands),1.,atol=1e-3) or not np.allclose([email protected](-1,-2),np.eye(3),atol=1e-3):
+ raise ValueError('Invalid PromptHMR hand rotations.')
+ return 'native'
+
+
+def convert(params,body,indices,*,neutral_hands=False):
+ """Rebase valid native hands; use registered neutral for missing video hands."""
import torch
pose=np.asarray(params['pose'],dtype=np.float32)[indices]
betas=np.asarray(params['shape'],dtype=np.float32)
@@ -18,6 +31,11 @@ def convert(params,body,indices):
left_hand_pose=torch.from_numpy(pose[:,75:120].copy())-body.left_hand_mean.detach().cpu(),
right_hand_pose=torch.from_numpy(pose[:,120:165].copy())-body.right_hand_mean.detach().cpu(),
betas=torch.from_numpy(betas[indices].copy()),transl=torch.from_numpy(trans.copy()))
+ if neutral_hands:
+ # The shared evaluator adds the registered relaxed hand mean. Supplying
+ # zero coefficients here gives a fixed neutral hand without inventing
+ # tracked motion or converting the upstream zero matrices into angles.
+ result['left_hand_pose'].zero_();result['right_hand_pose'].zero_()
if not all(torch.isfinite(v).all() for v in result.values()):raise ValueError('Non-finite PromptHMR pose.')
return result
@@ -63,6 +81,7 @@ def publish(job,emit):
K=np.array([[focal*sx,0,center[0]*sx],[0,focal*sy,center[1]*sy],[0,0,1.]])
people=[];projects=[]
for number,(track_id,person) in enumerate(tracks,1):
+ hands=hand_policy(person)
frames=np.asarray(person['frames'],dtype=np.int64);observed=np.asarray(person.get('detected',np.ones(len(frames))),dtype=bool)
if frames.shape!=(len(person['smplx_world']['pose']),) or observed.shape!=frames.shape or np.any(np.diff(frames)<=0) or (frames<0).any() or (frames>=n).any():
raise ValueError('Invalid PromptHMR actor frame mapping.')
@@ -78,14 +97,14 @@ def publish(job,emit):
state=dict(common,frames=end-first,start=job['start']+first/30,end=job['start']+end/30,
timeline=dict(start=job['start']+first/30,step=1/30,frames=end-first),people_root=os.path.relpath(group,project),
person_id=number,person_frames=[first,end],workspace_root=os.path.relpath(root,project))
- native=dict(raw=file_stat(work/'results.pkl'),range=[first,end],track_id=str(track_id),body=file_stat(BY_KEY['smplx'].path),adapter=sha256(Path(__file__)))
+ native=dict(raw=file_stat(work/'results.pkl'),range=[first,end],track_id=str(track_id),body=file_stat(BY_KEY['smplx'].path),adapter=sha256(Path(__file__)),hand_pose_policy=hands)
receipt=project/'prompthmr_source.json';reuse=False
try:
old=json.loads(receipt.read_text(encoding='utf8'));reuse=old['native']==native and old['output']==file_stat(project/'hmr4d_results.pt')
except (OSError,ValueError,KeyError):pass
atomic_json(project/'project.json',state)
if not reuse:
- params=convert(person['smplx_world'],body,positions);incam={k:v.clone() for k,v in params.items()}
+ params=convert(person['smplx_world'],body,positions,neutral_hands=hands!='native');incam={k:v.clone() for k,v in params.items()}
pelvis=body.J_regressor.numpy()[0]@body.v_template.numpy()+np.einsum('v,vci,bi->bc',body.J_regressor.numpy()[0],body.shapedirs.numpy(),params['betas'].numpy())
r=transform[:3,:3];t=transform[:3,3]
incam['global_orient']=torch.from_numpy(Rotation.from_matrix([email protected]_rotvec(params['global_orient'].numpy()).as_matrix()).as_rotvec().astype('float32'))
@@ -93,7 +112,7 @@ def publish(job,emit):
logits=np.asarray(person['smplx_cam']['static_conf_logits'],dtype=np.float32)
if logits.shape!=(len(frames),6) or not np.isfinite(logits).all():raise ValueError('Missing or invalid native PromptHMR contact confidence.')
save_tensor(dict(smpl_params_global=params,smpl_params_incam=incam,
- net_outputs=dict(static_conf_logits=torch.from_numpy(logits[positions].copy())[None]),source_model='prompthmr'),project/'hmr4d_results.pt')
+ net_outputs=dict(static_conf_logits=torch.from_numpy(logits[positions].copy())[None]),source_model='prompthmr',hand_pose_policy=hands),project/'hmr4d_results.pt')
atomic_json(receipt,dict(version=1,native=native,output=file_stat(project/'hmr4d_results.pt')))
if not (project/'input.mp4').exists():
if first==0 and end==n:media_link(group/'input.mp4',project/'input.mp4')
diff --git a/mocap/prompthmr_ui.py b/mocap/prompthmr_ui.py
index f085b11..f98f716 100644
--- a/mocap/prompthmr_ui.py
+++ b/mocap/prompthmr_ui.py
@@ -49,8 +49,12 @@ class PromptHMRWorkspace:
from .prompthmr_runtime import configuration
configuration()
if self.project is not None:
- saved=json.loads((self.project/'project.json').read_text(encoding='utf8')).get('prompthmr_options',{})
+ state=json.loads((self.project/'project.json').read_text(encoding='utf8'));saved=state.get('prompthmr_options',{})
if saved!=self.prompthmr_options():message='People/interaction settings changed. Reconstruct 3D to apply; previous motion is still displayed.'
+ elif state.get('pipeline',{}).get('model')=='prompthmr':
+ receipt=self.project/'prompthmr_source.json'
+ if receipt.is_file() and not json.loads(receipt.read_text(encoding='utf8')).get('native',{}).get('hand_pose_policy'):
+ message='Legacy PromptHMR finger placeholders. Reconstruct 3D to refresh hands; verified inference caches will be reused.'
except (OSError,ValueError,RuntimeError) as error:
message=str(error);self.run_button.setEnabled(False)
self.prompthmr_notice.setText(message);self.prompthmr_notice.setVisible(bool(message))