NVlabs / instant-ngp

Instant neural graphics primitives: lightning fast NeRF and more
https://nvlabs.github.io/instant-ngp
Other
16k stars 1.93k forks source link

How to export images or videos within or without GUI? #620

Closed YuhsiHu closed 2 years ago

YuhsiHu commented 2 years ago

Hey, thank you for your great work! I have tried on instant-ngp and it is beyond my expectation! So I want to export some images base on the model I trained on fox. I knew that in GUI we can set camera path and generate some frames in GUI, but how can we export that (or image is enough)? I save the camera path file base_camera.json, model base.msgpack, and I ran:

python scripts/run.py --scene data/nerf/fox/ --mode nerf --load_snapshot data/nerf/fox/base.msgpack --screenshot_transforms data/nerf/fox/base_cam.json --screenshot_frames 1 --screenshot_dir data/nerf/fox/screenshot --n_steps 0

It cannot export images to screenshot folder :

10:19:41 INFO Loading NeRF dataset from 10:19:41 INFO data/nerf/fox/transforms.json 10:19:41 WARNING data/nerf/fox/base_cam.json does not contain any frames. Skipping. 10:19:41 SUCCESS Loaded 50 images of size 1080x1920 after 0s 10:19:41 INFO cam_aabb=[min=[1.0229,-1.33309,-0.378748], max=[2.46175,1.00721,1.41295]] Loading snapshot data/nerf/fox/base.msgpack 10:19:41 INFO Loading network config from: data/nerf/fox/base.msgpack 10:19:41 INFO GridEncoding: Nmin=16 b=1.51572 F=2 T=2^19 L=16 10:19:41 INFO Density model: 3--[HashGrid]-->32--[FullyFusedMLP(neurons=64,layers=3)]-->1 10:19:41 INFO Color model: 3--[Composite]-->16+16--[FullyFusedMLP(neurons=64,layers=4)]-->3 10:19:41 INFO total_encoding_params=13074912 total_network_params=10240 Screenshot transforms from data/nerf/fox/base_cam.json

There is nothing in it. How can I export images using run.py or GUI? Thank you for your time!

YuhsiHu commented 2 years ago

Update: Now I can export images! python scripts/run.py --scene data/nerf/fox/ --mode nerf --load_snapshot data/nerf/fox/base.msgpack --screenshot_transforms data/nerf/fox/transforms.json --screenshot_dir data/nerf/fox/screenshot --width 2048 --height 2048 --n_steps 0 But this transforms.json is my trainning data. I want to render some view that I choose in GUI(because they are great) using camera path window( and save to base_cam.json), but run.py cannot load this file.

Tom94 commented 2 years ago

https://github.com/NVlabs/instant-ngp/discussions/490 contains a conversion script.

If you have follow-up questions or comments, please post them in the above thread. Cheers!