Native Windows video motion capture with ExMR, FlowHMR and GVHMR, contact correction, humanoid retargeting, and FBX/VMD export.
Python
Use meta checkpoint loading for fast VGGT cameras
toyxyzc0d5f30b8948
diff --git a/SOURCE_MANIFEST.json b/SOURCE_MANIFEST.jsonindex bf5a8b2..d98a61c 100644--- a/SOURCE_MANIFEST.json+++ b/SOURCE_MANIFEST.json@@ -91,8 +91,8 @@},{"path": "docs/AGENT_GUIDE.md",- "bytes": 21841,- "sha256": "475ca8a1ce0706c0937bd89080a509c6eb61934cf4b4e22b86ed2996b3ce0973"+ "bytes": 22518,+ "sha256": "d5155575064bc3d71d73fb1e118799156c37362843f53d7838a88cbaa41a9fe6"},{"path": "docs/BUILD.md",@@ -101,8 +101,8 @@},{"path": "docs/MAMMA.md",- "bytes": 22348,- "sha256": "87e50f7cbcc0b1bf1a683039c7f3cb1388fb928dc5667e79ba2964d75065b9e5"+ "bytes": 22810,+ "sha256": "45d5b2284e97d7b296884c67155ffd2099a286e93f389fe003818bb4d93f230c"},{"path": "docs/MAMMA_AGENT_SETUP.md",@@ -111,8 +111,8 @@},{"path": "docs/PERFORMANCE.md",- "bytes": 11860,- "sha256": "d945c44e31393092d5b116f34323562495d2f79ec8203e7a9d90b537d669a226"+ "bytes": 13717,+ "sha256": "607e9be394e7b8b3f9c2e818106de238a469eb71db9b519da2ba9ddc13a0cd6c"},{"path": "docs/USER_GUIDE.md",@@ -121,8 +121,8 @@},{"path": "docs/VALIDATION.md",- "bytes": 42142,- "sha256": "abc00662fc334b6a5c49a712a37d9fa8610e3926c5cf6b9072268be0dc8381ce"+ "bytes": 43972,+ "sha256": "280e254eeea78bbcf08f52a2d09d182767c1e52883a34047b1d99729dab7ef23"},{"path": "docs/images/rgbmocap-workspace.png",@@ -136,8 +136,8 @@},{"path": "docs/models/FLOWHMR.md",- "bytes": 7457,- "sha256": "4934536f41a3821c9039e300a5aec96b2ac256b8a97e7f952c851f693392cdac"+ "bytes": 8023,+ "sha256": "425d7ce85725569dd6ff5e179be1d9fa56c3f5ec34682e447784efe3b6b4bc01"},{"path": "docs/models/GVHMR.md",@@ -1216,8 +1216,8 @@},{"path": "mocap/gpu_offload.py",- "bytes": 3099,- "sha256": "278b8b4c935d8ee01527e481a58566c618d7b7997cf479be2100982af2eedeef"+ "bytes": 3784,+ "sha256": "10ffb66c23b82aa9cc01dbb285222ce99b8bb10995258c877639ac2dd67e33ac"},{"path": "mocap/gui.py",diff --git a/docs/AGENT_GUIDE.md b/docs/AGENT_GUIDE.mdindex ee0c422..4d95e44 100644--- a/docs/AGENT_GUIDE.md+++ b/docs/AGENT_GUIDE.md@@ -120,6 +120,15 @@ GPU allocator limits share ComfyUI's external-use margin: 600 MiB on Windows, 70### Measured savings and acceleration+`gpu_offload.load_vggt` uses meta initialization plus `assign=True` only for the+camera-only fast path. Preserve copy loading for Low Memory (including Automatic+fallback/retry) and generic depth loading. The Low Memory assign experiment+increased Windows private allocation despite slightly lower working set. Require+all checkpoint tensors to be materialized before device transfer; do not fill+missing meta tensors with guessed values. Camera outputs must remain unchanged.+This is a loader optimization for FlowHMR/MAMMA VGGT, not a new precision mode or+a global loading policy for the other models. See [its measurements](PERFORMANCE.md#vggt-camera-checkpoint-loading).+Use [PERFORMANCE.md](PERFORMANCE.md) for recorded conditions and current appliedmethods, and [older processing records](USER_GUIDE.md#recorded-processing-time-and-vram)for historical long-clip observations. Do not present old timings as a currentdiff --git a/docs/MAMMA.md b/docs/MAMMA.mdindex b26bcb3..fbe28fe 100644--- a/docs/MAMMA.md+++ b/docs/MAMMA.md@@ -181,6 +181,13 @@ or a lower-precision model. It keeps VGGT camera transformer blocks on CPU andtransfers them for inference. Automatic uses the fast camera path when GPU memoryis sufficient, selects offloading when needed, and can recover once from a cameraCUDA OOM. Decisions and Low Memory advice appear in Console and the CMD window.++The Automatic VGGT camera fast path shares FlowHMR's meta-initialized,+direct-assignment checkpoint loader. It reduces temporary model loading work;+landmarks, masks, fitting and camera calculations are unchanged. Low Memory and+Automatic fallback retain copy loading because the experimental assign/offload+combination increased Windows private allocation. See the+[camera-loading measurements and scope](PERFORMANCE.md#vggt-camera-checkpoint-loading).Offloading may be slower and use more RAM; masks, landmarks and fitting retaintheir existing bounded settings. The shared allocator budget and system-memory guardstill apply; shorten the common clip or reduce input views yourself if needed.diff --git a/docs/PERFORMANCE.md b/docs/PERFORMANCE.mdindex a9c9211..5ffcae4 100644--- a/docs/PERFORMANCE.md+++ b/docs/PERFORMANCE.md@@ -85,6 +85,38 @@ estimate a complete job. No extra packages, quantization, TensorRT engine oruser compilation is needed for these optimizations. MAMMA's optional runtimestill has its separately documented installation/build requirements.+### VGGT camera checkpoint loading++The Automatic camera-only fast path uses `meta` initialization and+`load_state_dict(assign=True)` to avoid disposable initial weights and copying+over them. FlowHMR and MAMMA share this loader. Low Memory, including an Automatic+fallback/retry, retains the previous copy-based loader and block offload. Generic+depth loading is unchanged. There is no new setting or runtime dependency.++Paired component tests used nine images from three cameras, balanced 512+preprocessing (9x3x432x592 tensor), on the test PC above. Each Flow runtime+configuration ran in two separate processes; times below are means and memory+is the largest recorded value. Image decoding is outside the reported timers.++| Automatic VGGT camera component | Previous loading | Meta + assign |+| --- | ---: | ---: |+| Instrumented model loading | 7.24 s | 2.34 s |+| Peak process RAM working set | 8.88 GiB | 5.40 GiB |+| Peak Windows process private allocation | 14.19 GiB | 14.19 GiB |+| Peak PyTorch allocated VRAM, including inference | 6.47 GiB | 6.47 GiB |++Loading timers include measurement-time cleanup/synchronization; filesystem+caches were not cleared. The MAMMA Python runtime separately completed a+one-pair check, 7.10 to 2.41 s loading. All 14 experimental runs retained exact+camera pose encodings, extrinsics and intrinsics, with unchanged FP32 parameter+storage and native inference autocast. These are camera-component observations,+not whole-motion speedups or a guarantee of improved system allocation headroom.++Meta/assign was deliberately not adopted for Low Memory: experimental Windows+private allocation increased from 11.04 to 13.86 GiB, while peak working set+changed only from 8.88 to 8.46 GiB. Some reading also moved to first inference.+`assign=True` without meta initialization did not provide the combined benefit.+### Model reuse and connected workersOne resident model serves actors sequentially, then is released before the nextdiff --git a/docs/VALIDATION.md b/docs/VALIDATION.mdindex 11b7f42..17d282a 100644--- a/docs/VALIDATION.md+++ b/docs/VALIDATION.md@@ -622,3 +622,31 @@ and measured zero remaining allocation. This is not a model leak or a guaranteeof zero CUDA context memory. No new runtime packages or clean-PC tests were added.Source syntax, manifest hashes, local documentation links and publishable filecomposition were checked; private tests, assets and logs remain outside the repo.++## Automatic VGGT meta/assign loading (2026-10-30)++Only the camera-only fast loader now uses meta initialization and direct+checkpoint assignment. Low Memory and its Automatic retry retain copy loading+and the existing block offloader; generic depth loading keeps its previous path.+No packages, model precision, sampled frames or camera equations changed.++The preceding independent component study ran 14 configurations across the Flow+and MAMMA Python runtimes. Camera pose encodings, intrinsics and extrinsics were+exact; six real load/infer/close cycles and one controlled failure cleared model+references and hooks. See [the measured scope](PERFORMANCE.md#vggt-camera-checkpoint-loading).++App integration used copied private data, not user projects. FlowHMR's actual+camera worker processed a 60-frame moving-camera clip with old/new fast loading,+Low Memory and one deliberately injected CUDA transfer OOM. All numerical camera+arrays were exact. The OOM test observed meta/assign on the first attempt, disposal+of that model, then non-meta copy loading on the Low Memory retry. MAMMA's separate+runtime processed its camera/capture worker from cached masks/landmarks for a+30-frame, two-view clip. Old fast, new fast and Low Memory produced exact world+cameras, estimated scale and calibration YAML. No new mask/landmark/body fitting,+full-motion quality, Blender or clean-PC test is claimed for this loader change.++Those seven camera-worker runs passed. Two additional checks confirmed a FlowHMR+camera cache hit loads no VGGT model and Static Camera still skips VGGT with zero+recorded GPU allocation. Five focused loader checks covered fast/Low Memory+selection, unchanged generic depth routing, missing checkpoint rejection and+unmaterialized-meta rejection. Test files, raw logs and assets stay outside the repo.diff --git a/docs/models/FLOWHMR.md b/docs/models/FLOWHMR.mdindex 6c95114..aeec926 100644--- a/docs/models/FLOWHMR.md+++ b/docs/models/FLOWHMR.md@@ -76,6 +76,14 @@ overlap. This does not change the Fast SAM switches, resolution or precision.### Measured effects+Automatic's VGGT camera-only loader skips temporary initial weights using meta+initialization and direct checkpoint assignment. A paired camera-component test+reduced loading from **7.24 to 2.34 s**, with identical camera outputs and peak+allocated VRAM; peak RAM working set fell **8.88 to 5.40 GiB**. Low Memory and+Automatic fallback retain the previous loader, avoiding the experimental increase+in Windows private allocation. This does not change SAM or motion inference.+See [loading measurements and scope](../PERFORMANCE.md#vggt-camera-checkpoint-loading).+Measured on Windows with RTX 5090 32 GB, Ryzen 9 9950X and 96 GB RAM.The rows use different stages/baselines; do not combine their speedups.diff --git a/mocap/gpu_offload.py b/mocap/gpu_offload.pyindex a40a0e3..0374cef 100644--- a/mocap/gpu_offload.py+++ b/mocap/gpu_offload.py@@ -67,10 +67,21 @@ def load_vggt(checkpoint, device, camera_only=True, low_memory=False):import gcimport torchfrom vggt_omega.models import VGGTOmega- model = VGGTOmega(enable_depth=not camera_only).eval()+ # Only the validated camera-only fast path skips disposable initial weights.+ # Low Memory retains copy loading: assign-backed offload increased Windows+ # private allocation in the paired tests. Keep generic depth loading intact.+ meta_assign = camera_only and not low_memory+ if meta_assign:+ with torch.device('meta'):+ model = VGGTOmega(enable_depth=False).eval()+ else:+ model = VGGTOmega(enable_depth=not camera_only).eval()state = torch.load(checkpoint, map_location='cpu', mmap=True, weights_only=False)if camera_only:state = {k:v for k,v in state.items() if not k.startswith('dense_head.')}- model.load_state_dict(state)+ if meta_assign:model.load_state_dict(state, assign=True)+ else:model.load_state_dict(state)+ if meta_assign and any(t.is_meta for t in (*model.parameters(), *model.buffers())):+ raise RuntimeError('VGGT camera checkpoint left uninitialized tensors. Repair its checkpoint or runtime.')del stategc.collect()if low_memory:model._mocap_offload = BlockOffload(model, device)