Download examples/visualizer_code/source/docs/scale4d_view_count.md from facebook/SCALE4D: direct link, hf CLI and curl.
- Browser
- Download file 5.41 kB
-
https://huggingface.co/facebook/SCALE4D/resolve/main/examples/visualizer_code/source/docs/scale4d_view_count.md
- Command line
-
hf download hf://facebook/SCALE4D/examples/visualizer_code/source/docs/scale4d_view_count.md
-
curl -L -o scale4d_view_count.md https://huggingface.co/facebook/SCALE4D/resolve/main/examples/visualizer_code/source/docs/scale4d_view_count.md
SCALE4D view-count visualizer
The portable viewer compares frozen SCALE4D predictions with 1–10 calibrated input
views. It includes the PStudio softball_25 clip and the Show3D tomato-sauce-can
spin clip, synchronized RGB playback, a primary count and comparison selector,
ground truth, predicted context points, and an RGB display-camera selector.
The data lives in facebook/SCALE4D under examples/view_count/. The local bundle
is outputs/scale4d_view_count/.
View the results
From an infd4rt checkout with NumPy installed:
python -m demo.scale4d_view_count serve \
--directory outputs/scale4d_view_count/viewer --port 8000
Open http://127.0.0.1:8000/. The generated index.html also embeds all its
assets and can be opened directly in a recent Chrome, Firefox, or Edge browser.
GPU access, fbsource, Buck, and internal dataset storage are unnecessary for viewing.
To fetch a pinned upload, substitute its commit SHA from the upload receipt:
python -m demo.scale4d_view_count download \
--revision COMMIT_SHA --output downloads --viewer-only
Omit --viewer-only to download the full calibrated inputs and result bundle and
verify its checksums. Hugging Face authentication is required while the model
repository is private.
Rebuild and verify
python -m demo.scale4d_view_count build \
--assets outputs/scale4d_view_count/viewer --output /tmp/view_count.html
python -m demo.scale4d_view_count verify \
--bundle outputs/scale4d_view_count
The builder accepts a scenes.json collection, gzip-compressed scene JSON, and
WebM RGB atlases. template.html and viewer.js contain the standalone UI and
WebGL renderer. Building refuses to overwrite an existing output.
To regenerate scene payloads and RGB atlas videos directly from the portable
input, result, label, and context NPZ files (requires ffmpeg):
python -m demo.scale4d_view_count export \
--bundle outputs/scale4d_view_count --output /tmp/rebuilt_view_count
Run inference with additional views
python -m d4rt_scripts.demo.scale4d_view_count \
--input outputs/scale4d_view_count/inputs/pstudio.npz \
--output /tmp/pstudio_view_count --device cuda:0
This runs the released 140k checkpoint with camera conditioning enabled. Each count takes a prefix of the same ordered, distinct camera videos; camera 0 remains the query and target camera. PStudio uses target camera 25 and its nine nearest calibrated camera centers. Show3D uses cameras 1 through 10.
The encoder uses shared per-view video attention, followed by same-time attention
across views after every block. UCPE supplies camera geometry. Learned encoder
view-index embeddings are disabled, so no encoder parameters are resized or copied.
The decoder's three learned view/source embedding rows are reused with zero-based
indices [0, 1, 2, 1, 2, 1, 2, 1, 2, 1]. All model weights remain frozen.
This experiment evaluated up to ten views; larger counts are not validated.
The dedicated runner uses uint8 OpenCV RGB resizing followed by float32 conversion, BF16 autocast for encoder and decoder attention, and FP32 output heads to match the native experiment. The existing general inference API keeps its defaults; the view-count options are explicit:
from evaluation.scale4d import SCALE4D
model = SCALE4D(
max_input_views=10,
)
prediction = model.predict_npz("clip.npz", views=10, camera="on")
Hardware and query batching can introduce small floating-point differences during replay. The uploaded results preserve the original finalized predictions.
Bundle conventions
inputs/*.npz: uint8 RGB(V,T,3,H,W), camera-to-world transforms(V,T,4,4), original pixel intrinsics(V,T,3,3), query UV, times, source views, and world up. Scoring labels are separate.results/*.npz:views=1..10, stackedxyz,uv_depth,uv, visibility, confidence, query identities, and provenance. Tracks use(views,T,N,channels).labels/*.npz: ground truth and visibility in the target camera frame, in metres.context/*.npz: 1024 extra SCALE4D queries from frame zero, with predictions for all ten counts. These points are used for display and are not scored.screening/*.npzandscores/screening.json: all ten screened candidates, including candidates not selected for the viewer.scores/selected.csv: full-clip AJ and APD for the two displayed clips.manifest.json: byte sizes and SHA-256 checksums for every released file.
Scored positions use UV-depth backprojection through the original target-camera intrinsics, rather than the independent XYZ head. No scale fitting or ground-truth alignment is applied. Viewer coordinates are rounded to five decimals; result NPZs retain the exact original float32 values. The RGB display camera does not change which observations the model received. Increasing views improves Show3D AJ at every count; PStudio improves substantially overall, with small reversals at five and nine views.
Upload a prepared bundle
python -m d4rt_scripts.upload_scale4d_view_count \
--bundle outputs/scale4d_view_count --receipt /tmp/view_count_upload.json
This uploads only manifest-listed files under examples/view_count/, guards the
commit against concurrent repository updates, and verifies uploaded sizes and
object hashes. The receipt stays outside the uploaded bundle.