Skip to content
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

Tutorial example 'fit_textured_mesh' doesn't seem to work on Colab #790

Closed
ricklentz opened this issue Aug 5, 2021 · 8 comments
Closed

Comments

@ricklentz
Copy link
Contributor

ricklentz commented Aug 5, 2021

If you do not know the root cause of the problem / bug and wish someone to help you, please
post according to this template:

🐛 Bugs / Unexpected behaviors

The tutorial doesn't present a working example. The example's error increases exponentially vs. converging to zero. No resultant mesh is visible next to the benchmark when the code has finished running.

Instructions To Reproduce the Issue:

Load the fit_textured_mesh.ipynb example in Colab and run all blocks. Observe error in block:
" We initialize the source shape to be a sphere of radius 1.
src_mesh = ico_sphere(4, device)"
UserWarning: floor_divide is deprecated and will be removed in a future version of PyTorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values.

Observe the error going up to infinity

Observe no resultant solution mesh is displayed next to the benchmark mesh.

@bottler
Copy link
Contributor

bottler commented Aug 5, 2021

I think this problem (which you are observing in the new version 0.5.0) is the same as issue #561 (observed in 0.4.0). It should be fixed if you add perspective_correct=False to every RasterizationSettings in the notebook.

ricklentz added a commit to ricklentz/pytorch3d that referenced this issue Aug 5, 2021
…_correct=False needed for example convergence

Due to changes from 4.0 to 5.0 the additional parameter 
   perspective_correct=False is needed for the example to successfully converge on a mesh.  Without this parameter, the website examples will not work in Colaboratory or locally.
@ricklentz
Copy link
Contributor Author

ricklentz commented Aug 5, 2021

@Bitt

I think this problem (which you are observing in the new version 0.5.0) is the same as for issue #561 (observed in 0.4.0). It should be fixed if you add perspective_correct=False to every RasterizationSettings in the notebook.

Thank you. I've submitted a PR after successfully testing the tutorial example with the additional parameters: https://github.com/facebookresearch/pytorch3d/pull/792/commits

I could use guidance on helping the PR test results clear checks. Please let me know if there is anything I can do on my end. Thank you again!

@github-actions
Copy link

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.

@github-actions github-actions bot added the Stale label Sep 16, 2021
@ricklentz
Copy link
Contributor Author

I submitted a PR 42 days ago (August 5th) to fix this issue for others. Should the issue stay in open status to help others until the PR is merged?

@ricklentz ricklentz changed the title Tutorial example 'fit_textured_mesh' doesn't seem to work on Colab Tutorial example 'fit_textured_mesh' doesn't seem to work on Colab Sep 16, 2021
@github-actions github-actions bot removed the Stale label Sep 17, 2021
@github-actions
Copy link

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.

@github-actions github-actions bot added the Stale label Oct 18, 2021
@ricklentz
Copy link
Contributor Author

@bottler Anything I can do to move the associated PR forward?

@bottler
Copy link
Contributor

bottler commented Oct 18, 2021

We really want to understand where the nan comes from in the rasterizer (see more recent comment on #561). We are a bit resistant to patching over the problem instead of fixing it.

@ricklentz
Copy link
Contributor Author

ricklentz commented Oct 21, 2021

@bottler @nikhilaravi, @gkioxari I believe I found the bug in the rasterizer that is causing the NaN issue #561. The technical issue is a divide by zero. When perspective_correct=True, BarycentricPerspectiveCorrectionForward and BarycentricPerspectiveCorrectionBackward in ../csrc/utils/geometry_utils.cuh are called. The denominator values should not be allowed to go to zero. I completed local testing and have submitted #891 for review. :-)

facebook-github-bot pushed a commit that referenced this issue Oct 22, 2021
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants