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

Pulsar unified interface update #1369

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

classner
Copy link
Contributor

This commit addresses several braking changes to PyTorch3d camera conventions that made the unified system unusable at the moment (see #1352 and #1276). This commit fixes all these problems and tests using the test case from #1352. The results are equivalent for FoVOrthographicCameras, OrthographicCameras, FoVPerspectiveCameras and PerspectiveCameras.

We used to have a test case for the unified interface for Pulsar that compared the rendering results with some 'ground truth' images. This test seems to have been removed, thus leading to these breaking changes remaining undiscovered for a long time. Would be great if we could revive that test case!

This commit addresses several braking changes to PyTorch3d camera conventions that made the unified system unusable at the moment (see facebookresearch#1352 and facebookresearch#1276). This commit fixes all these problems and tests using the test case from facebookresearch#1352. The results are equivalent for `FoVOrthographicCameras`, `OrthographicCameras`, `FoVPerspectiveCameras` and `PerspectiveCameras`.

We used to have a test case for the unified interface for Pulsar that compared the rendering results with some 'ground truth' images. This test seems to have been removed, thus leading to these breaking changes remaining undiscovered for a long time. Would be great if we could revive that test case!
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 26, 2022
@facebook-github-bot
Copy link
Contributor

Hi @classner!

Thank you for your pull request.

We require contributors to sign our Contributor License Agreement, and yours needs attention.

You currently have a record in our system, but the CLA is no longer valid, and will need to be resubmitted.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@bottler bottler self-assigned this Dec 22, 2022
@chenyuntc
Copy link
Contributor

Any updates on this PR?
I'm getting "Pulsar only supports a single focal length! " And I hope this PR can fix it

@@ -266,7 +270,10 @@ def _extract_intrinsics( # noqa: C901
afov = kwargs.get("fov", cameras.fov)[cloud_idx]
if kwargs.get("degrees", cameras.degrees):
afov *= math.pi / 180.0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@classner This operation shouldn't be in-place I think!
Replacing afov *= math.pi / 180.0 with afov = afov * math.pi / 180.0 fixed issues with my code.
Thanks for this PR by the way!

@classner
Copy link
Contributor Author

classner commented Sep 9, 2023

Hi @chenyuntc , @nlml - I have left Meta since opening this PR, maybe @bottler can have a look?

@bottler
Copy link
Contributor

bottler commented Sep 21, 2023

@classner Hi! Sorry I think it would be easiest if you do actually fill in the CLA again. I can work around it though if you don't want to.

@classner
Copy link
Contributor Author

Done!

@facebook-github-bot
Copy link
Contributor

@bottler has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@bottler
Copy link
Contributor

bottler commented Oct 3, 2023

Hi.

I made 2 easy updates to this locally for some test problems:

  • Instances of focal_length_conf *= ... I replaced with out-of-place focal_length_conf = focal_length_conf * ... because there are cases where focal_length_conf is an expanded tensor.
  • New versions of tests/data/test_pulsar_simple_pointcloud_sphere_azimuth{90,0}.0_fovperspective.png because the points are slightly different sizes.

I think I can push these back to your branch if you want.

However I have a problem with test_camera_pixels.py. It tries to check that all the renderers are pixel-perfect in their interpretation of PerspectiveCameras, the most common camera object. This change breaks that test for the camera in ndc. I think that this code is assuming that width is greater than height, and that the fix is to replace width and height with max(width,height) and min(width, height) respectively in all the new code in this change. Do you agree? More generally, I think I'd expect this code to be symmetrical in width and height.

@classner
Copy link
Contributor Author

classner commented Oct 4, 2023

Hmmm, in the renderer there is no assumption about the larger dimension in there - possibly in this preprocessing part? Worth a try looking at these scaling operations - they are mainly there to make Pulsar work well with the assumptions made in the PyTorch3D cameras, so you should have a better understanding than me about what those are at the various points. I might have snuck in a mistake there inadvertently.

@SubhadraG
Copy link

Error "Pulsar only supports a single focal length! " on consecutive renders. Suggestion to fix it:

Replacing

focal_length_conf = kwargs.get("focal_length", cameras.focal_length)[
cloud_idx
]

with

focal_length_conf = kwargs.get("focal_length", cameras.focal_length)[
cloud_idx
].clone()

And similar to other accesses to the camera parameters since they seem to get in-place updated in the _extract_intrinsics function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants