ashawkey / torch-ngp

A pytorch CUDA extension implementation of instant-ngp (sdf and nerf), with a GUI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Depth Output 0 or Nan

KaiMJ opened this issue · comments

I am trying to implement a depth loss, in nerf/utils.py/Trainer.train_step.

    outputs = self.model.render(rays_o, rays_d, staged=False, bg_color=bg_color, perturb=True, force_all_rays=False if self.opt.patch_size == 1 else True, **vars(self.opt))    

the outputs['depth'] always return 0 or nan during training.

depth = outputs['depth']
print(depth[~depth.isnan()].sum()) --> always 0.

With self.model.eval(), I get an appropriate depth result with some non zero values, but unable to backprop.

Any idea what is going on?