chenhsuanlin / bundle-adjusting-NeRF

BARF: Bundle-Adjusting Neural Radiance Fields 🤮 (ICCV 2021 oral)
MIT License
793 stars 114 forks source link

When I try BARF on my own sequence, some error(s) occurred in Test while loading state_dict for NeRF #17

Closed lancerste closed 2 years ago

lancerste commented 2 years ago

Hi Chenhsuan!

Thank you for sharing the code! When I try BARF on my own sequence,

tran script:python train.py --group='barf' --model=barf --yaml=barf_iphone --name='iphone' --data.scene='cats' --arch.posenc! test script:python evaluate.py --group='barf' --model=barf --yaml=barf_iphone --name='iphone' --data.scene='cats' --resume

some error(s) occurred in test while loading state_dict for NeRF. Have you encountered this problem before? Thank you

Errors: restoring nerf... Traceback (most recent call last): File "evaluate.py", line 34, in main() File "evaluate.py", line 28, in main m.restore_checkpoint(opt) File "/data1/lvxinbi/barf/model/base.py", line 53, in restore_checkpoint epoch_start,iter_start = util.restore_checkpoint(opt,self,resume=opt.resume) File "/data1/lvxinbi/barf/util.py", line 131, in restore_checkpoint child.load_state_dict(child_state_dict) File "/home/hotel_ai/anaconda3/envs/torch1.7/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1407, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for NeRF: size mismatch for mlp_feat.0.weight: copying a param with shape torch.Size([256, 3]) from checkpoint, the shape in current model is torch.Size([256, 63]). size mismatch for mlp_feat.4.weight: copying a param with shape torch.Size([256, 259]) from checkpoint, the shape in current model is torch.Size([256, 319]). size mismatch for mlp_rgb.0.weight: copying a param with shape torch.Size([128, 259]) from checkpoint, the shape in current model is torch.Size([128, 283]).

chenhsuanlin commented 2 years ago

Hi @lancerste, you would also need to pass --arch.posenc! into your evaluation command, or there will be a shape mismatch in the model weights you're loading from your checkpoint.