joeyan / gaussian_splatting

Unofficial implementation of 3D Gaussian Splatting in PyTorch + CUDA with MIT license
MIT License
79 stars 3 forks source link

Tests in test_rasterize_autograd run on "empty" images #21

Open MarekKowalski opened 3 weeks ago

MarekKowalski commented 3 weeks ago

All the gradient checks for rasterizer run in float64, which produces empty images for all values. This means that the gradient checks always pass regardless of changes to cuda code.

This is caused by the second term of the following if in render.cu (line 145): if (alpha < 0.00392156862 || !use_fast_exp) I believe it should instead be if (alpha < 0.00392156862 && use_fast_exp) so that the gaussians are not skipped for float64.

To prevent this in the future, I'd recommend adding a check in test_rasterize_autograd for whether the image is empty or not.

Also, could you share why the 0.25 is not added to the diagonal for float64 here?

if (use_fast_exp) {
  a = _conic[i * 3 + 0] + 0.25;
  c = _conic[i * 3 + 2] + 0.25;
} else {
  a = _conic[i * 3 + 0];
  c = _conic[i * 3 + 2];
}