-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement gradient scaling #1901
Conversation
Here are the full runs, please take a look: |
Black was updated, use |
Scale gradients by the ray distance to the pixel | ||
as suggested in `Radiance Field Gradient Scaling for Unbiased Near-Camera Training` paper | ||
|
||
Note, the scaling is applied on the interval of [0, 1] along the ray! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add example of how to call in docstring. More info here
""" | ||
|
||
@staticmethod | ||
def forward(ctx, field_outputs, ray_samples): # pylint: disable=arguments-differ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we type and add dosctrings? Or does it break since we are overwriting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typing and doctrings are not visible anywhere. I have added a wrapper function to provide the docstrings and typing support.
In the paper they set |
The near plane can be set with |
Can't wait to be implemented in the next version of Nerfstudio 💯 |
As stated in the paper, the PSNR will slightly change (not too much), but it more better qualitatively because less of floaters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. We should try experiment with it over the next few days. If we see better results on average, let's enable it by default.
Thanks for testing it on your scene! I guess we can optimize it to fit into the memory. |
Does anyone know if gradients in autograd.function can me modified in-place? |
Both of tests will OOM CUDA, so I think the problem of OOM is not caused by grad scaling. The problem of OOM CUDA come from my own potato GPU which it has low VRAM |
Ok, I guess I will keep the current implementation then. |
Another testing come here... Without Gradient Scaling without.GradScal.mp4With Gradient Scaling with.GradScal.mp4 |
This PR implements gradient scaling from Radiance Field Gradient Scaling for Unbiased Near-Camera Training
GradientScaling is added to the nerfacto model and enabled using flag
--pipeline.model.use_gradient_scaling True