nerfstudio-project / nerfacc

A General NeRF Acceleration Toolbox in PyTorch.
https://www.nerfacc.com/
Other
1.37k stars 113 forks source link

Deciding values for "render_step_size" and "occ_thre" #213

Closed rohana96 closed 1 year ago

rohana96 commented 1 year ago

Hi,

Thanks for the awesome work with Nerfacc!

I was wondering of a good way to initialize render_step_size and occ_thre values in the multires occgrid based sampling. Are these values suppose to scale linearly with the aabb size? If yes, should I be deciding based on the smallest aabb or the largest?

Are there other hyperparameters that need to scaled based on the aabb size?

liruilong940607 commented 1 year ago

Hi the render_step_size is definitely relative to the scene scale so you want to linearly scale it with the aabb. See here for an example. As whether based on small or large aabb is up to how dense you want to sample within the scene. Generally roughly 1000 samples in the small aabb would be a nice trade off between speed and quality.

As for the occ_thre, it is also related to how dense the sampling is. For example, marching with 1000 steps v.s. 10 steps within the same near far region, the 1000 steps would lead to in average smaller opacity for each sample (but this is NOT linear scaling!). In practice we found for 1000-2000 samples, 0.01 is a good choice for the occ threshold. For less dense sampling you should increase it accordingly. (Note all that matters for this hyperparam is the estimated number of samples along the ray, not the aabb size. If you already linearly scaled the render step size to keep the #samples roughly the same with us, you don’t need to change this threshold.

I think that’s basically all the hyperparams you need to pay attention when applying it on another dataset.

rohana96 commented 1 year ago

Thanks for the detailed explanation! If I understand correctly, occ_thredoesn't need to change as long as render_step_size remains constant?

This also got me wondering about alpha_thre since it is a function of the mean occupancy value. Does alpha_thre need to be increased if we increased render_step_size and vice versa?

liruilong940607 commented 1 year ago

occ_thre does not need to change as long as the number of samples along the rays remains roughly the same. And the render_step_size = scene_aabb / number of samples along the rays. So if you linearly scale your render step size based on your aabb comparing to the provided example, you then have the same number of samples along the rays with us and thus do not need to change occ_thre.

The same rule of occ_thre can be applied to the alpha_thre as they are basically the same thing

rohana96 commented 1 year ago

Thanks! Super helpful to know this!