File size: 2,002 Bytes
bdc469b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""Rebuild the NeRF-Synthetic and captured objects of the task set from their public sources.

  uv run python scripts/prepare_datasets.py                       # all nine
  uv run python scripts/prepare_datasets.py --names nerf_lego     # one object

Sources: NeRF-Synthetic (lego, chair, hotdog, ficus, mic, drums) from a Hugging Face mirror, Tanks and Temples
(Ignatius, Caterpillar) from the NSVF release, BlendedMVS (jade) from a Hugging Face mirror. Downloads go to
data/raw/. Each object is normalized to +Z up inside [-0.9, 0.9]^3 with 8 reference and 8 held-out views at 256 px.
"""
import argparse
import sys
import traceback

from splatbench.datasets import load_bmvs, load_nerf_synthetic, load_nsvf_tt
from splatbench.prep import prepare_scene

LOADERS = {
    "nerf_lego": lambda: load_nerf_synthetic("lego"),
    "nerf_chair": lambda: load_nerf_synthetic("chair"),
    "nerf_hotdog": lambda: load_nerf_synthetic("hotdog"),
    "nerf_ficus": lambda: load_nerf_synthetic("ficus"),
    "nerf_mic": lambda: load_nerf_synthetic("mic"),
    "nerf_drums": lambda: load_nerf_synthetic("drums"),
    "tt_ignatius": lambda: load_nsvf_tt("Ignatius"),
    "tt_caterpillar": lambda: load_nsvf_tt("Caterpillar", select="mask"),
    "bmvs_jade": lambda: load_bmvs("jade"),
}

ap = argparse.ArgumentParser()
ap.add_argument("--out", default="data/bench")
ap.add_argument("--names", nargs="*", default=list(LOADERS))
ap.add_argument("--iters", type=int, default=2000)
ap.add_argument("--device", default="cuda")
a = ap.parse_args()

failed = []
for name in a.names:
    try:
        sc = LOADERS[name]()
        assert sc.name == name, (sc.name, name)
        prepare_scene(sc, a.out, iters=a.iters, device=a.device, log=lambda s: print(s, flush=True))
    except Exception as e:  # one failing object must not block the others
        failed.append(name)
        print(f"[{name}] FAILED: {type(e).__name__}: {e}", flush=True)
        traceback.print_exc()
print("done; failed:", failed, file=sys.stderr)