-
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
nan in Rasterizer gradients #110
Comments
Update: actually, even using a simpler vertex location can reproduce the error e.g. vs = torch.Tensor([[0., 0., 1.0],[0.2, 0.2, 2.0],[0., 0., 3.0]]).to(device) |
@shubhtuls thanks for the detailed explanation of the issue. I will try to reproduce the error as described and get back to you! |
I think this is related to some precision issues when computing the face areas. Adding a statement to print the 'face_area' in the cuda rasterizer implementation here shows that it is of the order of 1e-9, which is greater than the kEpsilon=1e-30 used to check for zero area. I unblocked on my end by additionally defining a 'kEpsilonFace=1e-7' in these lines and using that for the zero area check, but I'm not sure if this is the ideal solution. |
Small face areas are such a headache! I guess in both the example faces above you have almost 0 face areas. Did nans disappear with 1e-7? |
@gkioxari - so far, yes! |
Thanks for your solution, can I realize your solution aims to avoid gradient vanish problem through a more rigid settings according to each |
@tomguluson92 In a follow up diff we are setting the |
This has been fixed by 487d4d6. |
Description
I encountered a case where two vertices of a triangle had same screen-space XY coordinates, and this led to a 'nan' value in the gradient.
Some interesting things I noted:
Instructions To Reproduce the Issue:
The text was updated successfully, but these errors were encountered: