NVlabs / instant-ngp

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

2D image fitting with Python binding / RuntimeError: Can't set params because buffer has the wrong size. #1498

Open HyungGeun-Cho opened 5 months ago

HyungGeun-Cho commented 5 months ago

Hi! I am trying to fit 2D images using instant-ngp and Python bindings, but I am currently stuck on the error as below.

It seems like it successfully learns the 2D image and save its snapshot.

instant-ngp$ ./scripts/run.py data/image/albert.exr  --n_steps 100 --save_snapshot data/snapshot/albert.ingp
02:47:59 SUCCESS  Initialized CUDA 11.4. Active GPU is #0: NVIDIA GeForce RTX 2080 Ti [75]
02:48:00 SUCCESS  Detected auxiliary GPUs:
02:48:00 SUCCESS    #1: NVIDIA GeForce RTX 2080 Ti [75]
02:48:00 SUCCESS    #2: NVIDIA GeForce RTX 2080 Ti [75]
02:48:00 SUCCESS    #3: NVIDIA GeForce RTX 2080 Ti [75]
02:48:00 SUCCESS    #4: NVIDIA GeForce RTX 2080 Ti [75]
02:48:00 SUCCESS    #5: NVIDIA GeForce RTX 2080 Ti [75]
02:48:00 SUCCESS    #6: NVIDIA GeForce RTX 2080 Ti [75]
02:48:00 INFO     Loading EXR image from data/image/albert.exr
02:48:00 SUCCESS  Loaded a full-precision image with 1024x1024 pixels.
Training:   0%|                                                                                 | 0/100 [00:00<?, ?steps/s]02:48:00 INFO     Loading network config from: /code/instant-ngp/configs/image/base.json
02:48:00 INFO     GridEncoding:  Nmin=16 b=1.25992 F=2 T=2^24 L=16
02:48:00 INFO     Model:         2--[HashGrid]-->32--[FullyFusedMLP(neurons=64,layers=4)]-->3
02:48:00 INFO       total_encoding_params=1423440 total_network_params=7168
Training:  85%|███████████████████████████████████████████████▌        | 85/100 [00:00<00:00, 241.39steps/s, loss=0.000237]
02:48:01 SUCCESS  Saved snapshot 'data/snapshot/albert.ingp'

However, when I try to reconstruct this image by using the .ingp file and load the corresponding snapshot, it occurs the error that RuntimeError: Can't set params because buffer has the wrong size.

I would really appreciate it if anyone could tell me how to resolve this issue! Thank you in advance.

instant-ngp$ ./scripts/run.py --load_snapshot data/snapshot/albert.ingp
02:48:46 SUCCESS  Initialized CUDA 11.4. Active GPU is #0: NVIDIA GeForce RTX 2080 Ti [75]
02:48:48 SUCCESS  Detected auxiliary GPUs:
02:48:48 SUCCESS    #1: NVIDIA GeForce RTX 2080 Ti [75]
02:48:48 SUCCESS    #2: NVIDIA GeForce RTX 2080 Ti [75]
02:48:48 SUCCESS    #3: NVIDIA GeForce RTX 2080 Ti [75]
02:48:48 SUCCESS    #4: NVIDIA GeForce RTX 2080 Ti [75]
02:48:48 SUCCESS    #5: NVIDIA GeForce RTX 2080 Ti [75]
02:48:48 SUCCESS    #6: NVIDIA GeForce RTX 2080 Ti [75]
02:48:48 INFO     Loading network snapshot from: data/snapshot/albert.ingp
02:48:48 INFO     GridEncoding:  Nmin=16 b=0 F=2 T=2^24 L=16
02:48:48 INFO     Model:         2--[HashGrid]-->32--[FullyFusedMLP(neurons=64,layers=4)]-->3
02:48:48 INFO       total_encoding_params=16 total_network_params=7168
Traceback (most recent call last):
  File "./scripts/run.py", line 124, in <module>
    testbed.load_snapshot(args.load_snapshot)
RuntimeError: Can't set params because buffer has the wrong size.
flybiubiu commented 3 months ago

+1