nerfacc icon indicating copy to clipboard operation
nerfacc copied to clipboard

_C.traverse_grids returns empty intervals, empty samples

Open SumanyuAsthana opened this issue 1 year ago • 3 comments

I am using an OccGridEstimator instance as my estimator and following the documentation I .update_every_n_steps the estimator for every iteration, defined a sigma_fn and rgb_sigma_fn , and used estimator.sampling in order to get ray_indices, t_starts, t_ends. But my code doesn't work saying "RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn" and when I traced the issue I found that ray_indices, t_starts, t_ends are empty and further going back in nerfacc/grid.py _C.traverse_grid is being called which is what's returning the empty tensors. How do I proceed? Any help is appreciated. Thanks.

SumanyuAsthana avatar May 17 '23 10:05 SumanyuAsthana

Hi I’m this case you can check following things:

  • Are the ray and aabb correct? If any of them is not setup correctly then you may get no intersection between ray and aabb.
  • Does your network output non-zero density? If the network always outputs zero density then even if you update the occ grid it will still skip everything.
  • Does the occ grid have non-zero binary values after you update it at least once? You can print out the estimator.binaries.sum() to check this. You should update the occ grid before everything in the training loop, which should lead to non-zero binary when you sample from it.

liruilong940607 avatar May 17 '23 15:05 liruilong940607

Hi, I have met the same issue.

  • I firstly check the rays and aabb, it seems that the coordinates of the rays are always lies in the box
  • I checked the density function of my network, the output is non-zero
  • I checked the estimator.binaries.sum() after updating the occ grid, the result is non-zero

May I ask if there are other possible reason of the empty sampling result erro?

zhaoliangzhang avatar Sep 11 '23 20:09 zhaoliangzhang

Hi, I have met the same issue.

  • I firstly check the rays and aabb, it seems that the coordinates of the rays are always lies in the box
  • I checked the density function of my network, the output is non-zero
  • I checked the estimator.binaries.sum() after updating the occ grid, the result is non-zero

May I ask if there are other possible reason of the empty sampling result erro?

I encountered a similar situation, but upon inspection I found that this was because the sampled rays, which corresponded to the first few rows of pixels in the image, did not contain any objects at beginning. This is reasonable for object centric datasets like nerf_synthetic.

destroy314 avatar Nov 27 '23 07:11 destroy314