dliu1014's picture Xuweiyi's picture meta-bot's picture
Initial data commit
9c890d3
|
Raw History Blame Contribute Delete
4.81 kB

Standalone SCALE4D example source

This source bundle contains the shared HTML/WebGL viewer, its sandbox-compatible embedded-data loader, 1–10-view inference, camera-conditioning ON/OFF inference, metric scoring, the 140k model implementation/config, and regression tests. It is exported from the corresponding files in infd4rt.

The earlier example data is pinned to facebook/SCALE4D revision c47225339a26f37db38e9f5a11c95a3891ca9a1e:

  • examples/view_count/: frozen 1–10-view PStudio/Show3D results.
  • examples/camera_conditioning/: three featured RGB examples from DexYCB and ADT, plus the earlier ten PStudio/Show3D pairs; calibrated inputs for all new examples are included.

The model API uses the frozen 140k weight release at revision 069f22ba021e3c23c7e4831ff4385927978eac63. The weights are downloaded from the model repository when running inference. Hugging Face authentication is required while the repository is private.

Install and view

Unpack infd4rt_scale4d_examples.tar.gz, then use a separate environment:

cd scale4d_examples
python -m venv .venv
.venv/bin/python -m pip install -e .
.venv/bin/python -m demo.scale4d_view_count download \
  --prefix examples/camera_conditioning --revision c47225339a26f37db38e9f5a11c95a3891ca9a1e \
  --output downloads --viewer-only
.venv/bin/python -m demo.scale4d_view_count serve \
  --directory downloads/examples/camera_conditioning/viewer --port 8000

Open http://127.0.0.1:8000/, or open the downloaded index.html directly. The HTML embeds all scene data and RGB videos and reads them without fetch(). The renderer was tested in an opaque-origin sandbox with network access blocked.

Download inputs and run inference

Install a PyTorch build appropriate for your GPU, then install the model extras:

.venv/bin/python -m pip install -e '.[model,dev]'
.venv/bin/python -m demo.scale4d_view_count download \
  --prefix examples/camera_conditioning --revision c47225339a26f37db38e9f5a11c95a3891ca9a1e \
  --output downloads
.venv/bin/python -m d4rt_scripts.demo.scale4d_camera_ablation \
  --input downloads/examples/camera_conditioning/inputs/dexycb_subject05.npz \
  --labels downloads/examples/camera_conditioning/labels/dexycb_subject05.npz \
  --views 3 --output /tmp/scale4d_camera_pair --device cuda:0

For the view-count experiment, download examples/view_count with the same command and run d4rt_scripts.demo.scale4d_view_count on its calibrated input. The extra views reuse decoder embedding rows; encoder weights remain shared.

Rebuild and test

.venv/bin/python -m demo.scale4d_view_count build \
  --assets downloads/examples/camera_conditioning/viewer \
  --output /tmp/scale4d_camera_viewer.html
.venv/bin/python -m pytest -q

Read docs/scale4d_camera_ablation.md and docs/scale4d_view_count.md for scoring, camera-order, coordinate, and context-point conventions. source_manifest.json records every source file's byte size and SHA-256. Copyright headers are retained.

Source package version 0.1.3 supports native 24-frame DexYCB clips, a selected color display camera, fixed query-density controls, and matched RGB-frame loading.

Camera-distillation EMA teachers

examples/camera_distillation/ contains HOT3D clip 002901 with matched 30k saved EMA teacher B2/B3 results. OFF errors are 17.62/6.25 cm; ON errors are 13.08/9.33 cm. All 14,558 scored trajectories, calibrated RGB inputs, labels, and provenance are included.

python -m demo.scale4d_view_count download \
  --prefix examples/camera_distillation --revision c47225339a26f37db38e9f5a11c95a3891ca9a1e \
  --output downloads --viewer-only
python -m demo.scale4d_view_count serve \
  --directory downloads/examples/camera_distillation/viewer --port 8000

Use demo.scale4d_view_count.distillation to export the teacher scenes from saved predictions, and d4rt_scripts.demo.scale4d_teacher_sample --context-grid 0 to rerun benchmark queries with a local verified teacher export.

Source-object four-state comparisons

The 0.1.3 package adds exact reconstruction of the approved 65k Ranch and BBQ object-focus camera-distillation viewers. Download the verified bundles from examples/camera_distillation/object_focus/ranch and bbq, then run:

python -m demo.scale4d_view_count.source_objects --bundle /path/to/ranch --output /tmp/ranch_viewer

The complete raw benchmark trajectories remain available; source labels define Object/Left hand/Right hand scopes. The exporter verifies raw GT and predictions, calibration, teacher identity, group membership and scoped scores, and reproduces the published HTML byte for byte. Viewer reconstruction needs no model weights.

See docs/scale4d_camera_distillation_objects.md and its revision-pinned sample catalog.