barbararoessle / dense_depth_priors_nerf

Dense Depth Priors for Neural Radiance Fields from Sparse Input Views
MIT License
378 stars 49 forks source link

Error in compute_depth_loss #28

Open LZL-CS opened 1 year ago

LZL-CS commented 1 year ago

Hi, thanks for your nice work. However, when I run the code I got the error in compute_depth_loss:

image

Traceback (most recent call last): File "/public/home/luanzl/.pycharm_helpers/pydev/pydevd.py", line 2195, in <module> main() File "/public/home/luanzl/.pycharm_helpers/pydev/pydevd.py", line 2177, in main globals = debugger.run(setup['file'], None, None, is_module) File "/public/home/luanzl/.pycharm_helpers/pydev/pydevd.py", line 1489, in run return self._exec(is_module, entry_point_fn, module_name, file, globals, locals) File "/public/home/luanzl/.pycharm_helpers/pydev/pydevd.py", line 1496, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "/public/home/luanzl/.pycharm_helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/public/home/luanzl/WorkSpace/dense_depth_priors_nerf/run_nerf.py", line 1137, in <module> run_nerf() File "/public/home/luanzl/WorkSpace/dense_depth_priors_nerf/run_nerf.py", line 1100, in run_nerf train_nerf(images, depths, valid_depths, poses, intrinsics, i_split, args, scene_sample_params, lpips_alex, gt_depths, gt_valid_depths) File "/public/home/luanzl/WorkSpace/dense_depth_priors_nerf/run_nerf.py", line 859, in train_nerf depth_loss = compute_depth_loss(extras['depth_map'], extras['z_vals'], extras['weights'], target_d, target_vd) File "/public/home/luanzl/WorkSpace/dense_depth_priors_nerf/model/run_nerf_helpers.py", line 44, in compute_depth_loss return float(pred_mean.shape[0]) / float(target_valid_depth.shape[0]) * f(pred_mean, target_mean, pred_var) File "/public/home/luanzl/anaconda3/envs/dense_depth_priors_nerf/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(*input, **kwargs) File "/public/home/luanzl/anaconda3/envs/dense_depth_priors_nerf/lib/python3.8/site-packages/torch/nn/modules/loss.py", line 372, in forward return F.gaussian_nll_loss(input, target, var, full=self.full, eps=self.eps, reduction=self.reduction) File "/public/home/luanzl/anaconda3/envs/dense_depth_priors_nerf/lib/python3.8/site-packages/torch/nn/functional.py", line 2804, in gaussian_nll_loss raise ValueError("var has negative entry/entries") ValueError: var has negative entry/entries

It seems that I got a negative value during the loss calculation. May I know how to tackle this issue? Hope for your reply, thanks!