text stringlengths 0 1.47k |
|---|
T = T_ref if r1 <= r0 + 1e-6 else T0 |
# Dedicated scale line-search (Sim(3) only): the joint Umeyama scale is loosely pinned under |
# partial overlap, so AFTER the pose is chosen, refine just the scale DoF against the |
# SYMMETRIC overlap residual (which — unlike the one-directional gate above — actually |
# depends on scale). Rotation/translation are untouched, so this cannot flip the basin. |
if with_scale: |
T = _scale_line_search(src_full, tgt_full, T) |
info["confidence"] = float(max(0.0, 1.0 - min(r0, r1))) |
return T.to(device=dev, dtype=dtype), info |
# No Open3D — fall back to the pure-splatreg feature path with a scale-adaptive inlier tolerance. |
info["used_open3d"] = False |
T, finfo = feature_align(target, source, transform=transform, inlier_tol=max(voxel * 1.0, _FS_INLIER_TOL)) |
info["confidence"] = float(finfo.get("confidence", 0.0)) |
info["n_corr"] = int(finfo.get("n_inliers", 0)) |
return T, info |
# ── learned seed (GeoTransformer, optional) + splatreg refine ─────────────────── |
# Module-level cache of the loaded GeoTransformer model + config so we pay the (~0.3 s) load |
# exactly once per process; subsequent learned_feature_align calls reuse it. |
_GEOTRANSFORMER_CACHE: dict = {} |
def _geotransformer_paths() -> tuple[str, str] | None: |
"""Resolve ``(repo_root, experiment_dir)`` for the bundled GeoTransformer, or ``None``. |
The learned backend lives under ``splatreg/third_party_models/GeoTransformer`` (gitignored, |
cloned + built by the Tier-2 setup). We discover it relative to this file so the path is robust |
to the caller's CWD. Returns ``None`` (→ caller falls back to ``init="robust"``) when the repo / |
its built extension / its pretrained weights are not present. |
""" |
import os |
here = os.path.dirname(os.path.abspath(__file__)) |
repo = os.path.normpath(os.path.join(here, "..", "third_party_models", "GeoTransformer")) |
exp = os.path.join(repo, "experiments", "geotransformer.3dmatch.stage4.gse.k3.max.oacl.stage2.sinkhorn") |
weights = os.path.join(repo, "weights", "geotransformer-3dmatch.pth.tar") |
# The .so name embeds the cpython tag; accept any built ext.* in that dir. |
import glob |
ext_ok = bool(glob.glob(os.path.join(repo, "geotransformer", "ext.*.so"))) |
if not (os.path.isdir(exp) and os.path.isfile(weights) and ext_ok): |
return None |
return repo, exp |
def _load |
# ===== file: data_process/__init__.py ===== |
# ===== file: data_process/feature_extraction/__init__.py ===== |
# ===== file: data_process/feature_extraction/canonical_assets.py ===== |
"""Bake the export stage's rest-pose assets into the stage-4 canonical frame. |
For every object type in ``<features_dir>/cond.npy`` whose processed asset |
exists in ``<export_dir>/rigs/`` (``run_export.sh <ds> --save_glb`` / |
``--glb_only``), write ``<assets_dir>/<object_type>.glb``: the asset rebuilt |
to the cond's canonical T-pose (the joint order, facing, XZ centring, scale |
and grounding of the training clips), without animation |
(``mesh_animation.canonical_rig.bake_canonical_asset``). A stage-4 feature |
clip of that object type (``<features_dir>/motions/*.npz``: ``local_rotations`` |
+ ``global_positions``) then drives it with no ``cond.npy``; the sampler's |
``.npy`` features go through ``animate_motion`` and the cond instead:: |
python -m data_process.mesh_animation.animate_lbs \\ |
--char_path dataset/canonical_assets/<ds>/<type>.glb \\ |
--anim_path dataset/features/<ds>/motions/<type>-<motion>-000.npz |
The joint order rides in the GLB as ``canonical_joint_order`` and a digest of |
its inputs (the cond entry, its diameter, the source GLB's bytes and |
``BAKE_VERSION``) as ``canonical_cond_digest``: an asset whose cond or source |
changed is rebuilt on the next run, the others are skipped. The cond's frame |
alone (``asset_files.cond_frame_digest``) rides along as |
``canonical_frame_digest``: an asset whose source GLB is gone (an object type |
of the cond, or a Mixamo character with a canonical GLB but no ``rigs/`` GLB) |
keeps its canonical GLB only while that matches the cond, and one without the |
key cannot be checked and is kept. Mesh driving checks the same key. A skeleton whose |
roll about its joint line the fit cannot determine (collinear joints, or nearly |
collinear ones for the fit's residual) is refused. |
Mixamo has one object type, ``mixamo`` (the 22 core joints of the rig the clips |
were made on, or the full rig if stage 4 kept it), but many characters: every |
character in the export's ``rigs/`` gets ``<assets_dir>/<character>.glb``. |
Its joint positions are its OWN rest pose through the stage-4 T-pose |
canonicalization (the cond's joints, facing pair and diameter, grounding), and |
its bone frames are the shared cond's canonical rotations, so a Mixamo feature |
clip's local rotations drive every character directly as the change from rest, |
the character keeping its proportions (Y_Bot, the clips' rig, reproduces the |
clip exactly). The clips' rest root (the cond's T-pose root) rides along as |
``canonical_motion_rest_root``: the root then moves by the clip's change from |
that rest, from the character's own rest root (``animate_lbs`` reads it), so a character whose hips sit lower than Y_Bot's does not float. |
Bones the cond does not have are merged into kept ones. Unskinned meshes |
parented under the armature (rigid parts) are bound to their parent bone |
before the bake, and an asset without any mesh on the armature fails. A |
failure is recorded in ``<assets_dir>/glb_errors/<name>.txt`` (``<name>``: the |
object type, for Mixamo the character) and removes a GLB built from older |
inputs; an image the canonical GLB lost relative to its source goes to |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.