-
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 when using MeshRasterizer #561
Comments
Thanks @pengsongyou for reporting this issue! We'll look into it asap. |
@pengsongyou I was able to reproduce the error. To resolve the issue in the tutorial add |
Great, now it indeed seems working, thanks a lot! I have been always using the perspective camera model, but I did not need to turn Thanks so much in advance! Best, |
@pengsongyou the |
Hi, I have encountered similar NaN error in rasterizer :/. I just wanna provide another example that might help the team to debug. But as far as right now, NaN seems to happen when the rendered faces is parallel to the ray. (maybe relevant to the previous issue #110.)
The triangle looks like this in 3D:
Thanks and good luck. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
This issue was closed because it has been stalled for 5 days with no activity. |
I will look into this issue! Thanks for the explanation @JudyYe. |
EDIT: I didn't notice they were multiple RasterizationSettings instances. Works now!
|
I can confirm both that this bug still exists in 0.5.0, and that setting
And the error message:
|
Hi same here on Additionally, I was also wondering if having |
I can confirm that this bug is present in v0.5.0 using the out of the box tutorial "camera_position_optimization_with_differentiable_rendering". |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
Summary: #561 #790 Divide by zero fix (NaN fix). When perspective_correct=True, BarycentricPerspectiveCorrectionForward and BarycentricPerspectiveCorrectionBackward in ../csrc/utils/geometry_utils.cuh are called. The denominator (denom) values should not be allowed to go to zero. I'm able to resolve this issue locally with this PR and submit it for the team's review. Pull Request resolved: #891 Reviewed By: patricklabatut Differential Revision: D31829695 Pulled By: bottler fbshipit-source-id: a3517b8362f6e60d48c35731258d8ce261b1d912
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
Hello, the NaN problem still exists. In my cases, I use raster_settings = RasterizationSettings(
image_size=(self.img_h, self.img_w),
blur_radius=0,
faces_per_pixel=1,
perspective_correct=False,
) My environment:
|
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
This issue was closed because it has been stalled for 5 days with no activity. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
I'm also running into periodic NaNs w/ the mesh rasterizer. Seems to occur with the HardDepthShader in #1208 which is about as simple as you can get shading wise |
I turned on anomaly detection and traced those NaNs back to transform_points denom correction in Might be a good idea to change eps so it's not None. Seems to be set in a lot of places so None seems like a bad default given the potential bad behavior. I set it to
|
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
I encountered a similar problem and I think d4l3k is right. Calling renderer(meshes, eps=1e-8) or similarly for point clouds solved the issue for me. |
This solved my problem too! Thanks so much, as setting perspective_correct=False didn't do it. |
Description
I installed the latest pytorch3d 0.4 and tried to run the fit_textured_mesh tutorial under the Mesh prediction via silhouette rendering section. The loss becomes NaN after around 200 iterations (4 out of 5 times I can reproduce this issue).
I also tried pytorch3d 0.3 (built from source in December), and this issue never happened. Therefore, there might be some issues in the latest update for Mesh Rasterizer.
Reproduce
Install pytorch 1.7.1
Install pytorch3d using wheels for linux instruction
And then simply run the fit_textured_mesh tutorial, you should be able to reproduce results. I can obtain the nan 4 out 5 times I run.
Best,
Songyou
The text was updated successfully, but these errors were encountered: