109 Commits

Author SHA1 Message Date
Krzysztof Chalupka
7ea0756b05 fit_textured_mesh tutorial fixes
Summary: Updated to FoV cameras and added perspective_correct=False, otherwise it'll nan out.

Reviewed By: bottler

Differential Revision: D35970900

fbshipit-source-id: 569b8de0b124d415f4b841924ddc85585cee2dda
2022-04-27 12:18:03 -07:00
Krzysztof Chalupka
c3c4495c7a Fix image links in renderer documentation
Summary: Repo has jpgs but docs/website want pngs.

Reviewed By: nikhilaravi

Differential Revision: D35596475

fbshipit-source-id: 4cafd405c06c0eb339001a8db2422dbbd1f8f28a
2022-04-14 16:37:07 -07:00
Tim Hatch
34bbb3ad32 apply import merging for fbcode/vision/fair (2 of 2)
Summary:
Applies new import merging and sorting from µsort v1.0.

When merging imports, µsort will make a best-effort to move associated
comments to match merged elements, but there are known limitations due to
the diynamic nature of Python and developer tooling. These changes should
not produce any dangerous runtime changes, but may require touch-ups to
satisfy linters and other tooling.

Note that µsort uses case-insensitive, lexicographical sorting, which
results in a different ordering compared to isort. This provides a more
consistent sorting order, matching the case-insensitive order used when
sorting import statements by module name, and ensures that "frog", "FROG",
and "Frog" always sort next to each other.

For details on µsort's sorting and merging semantics, see the user guide:
https://usort.readthedocs.io/en/stable/guide.html#sorting

Reviewed By: bottler

Differential Revision: D35553814

fbshipit-source-id: be49bdb6a4c25264ff8d4db3a601f18736d17be1
2022-04-13 06:51:33 -07:00
h5jam
0a7c354dc1 fix typo on NeRF tutorial (#1163)
Summary:
Hello, I'm Seungoh from South Korea.

I'm finding typo while I'm learning tutorials.
Wrong numbers are changed to right numbers.

Thank you.

Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/1163

Reviewed By: patricklabatut

Differential Revision: D35546843

Pulled By: bottler

fbshipit-source-id: b6e70cdf821fd4a108dfd416e8f4bcb3ecbeb449
2022-04-13 04:35:05 -07:00
Jeremy Reizenstein
67778caee8 avoid deprecated raysamplers
Summary: Migrate away from NDCGridRaysampler and GridRaysampler to their more flexible replacements.

Reviewed By: patricklabatut

Differential Revision: D33281584

fbshipit-source-id: 65f8702e700a32d38f7cd6bda3924bb1707a0633
2022-01-24 10:52:23 -08:00
Jeremy Reizenstein
174738c33e safer pip install in doc
Summary: Add --no-cache and --no-index to all commands which try to download wheels from S3, to avoid hitting pypi.

Reviewed By: nikhilaravi

Differential Revision: D33507975

fbshipit-source-id: ee796e43cc1864e475cd73c248e9900487012f25
2022-01-21 06:28:32 -08:00
Jeremy Reizenstein
741777b5b5 More company name & License
Summary: Manual adjustments for license changes.

Reviewed By: patricklabatut

Differential Revision: D33405657

fbshipit-source-id: 8a21735726f3aece9f9164da9e3b272b27db8032
2022-01-04 11:43:38 -08:00
Jeremy Reizenstein
9eeb456e82 Update license for company name
Summary: Update all FB license strings to the new format.

Reviewed By: patricklabatut

Differential Revision: D33403538

fbshipit-source-id: 97a4596c5c888f3c54f44456dc07e718a387a02c
2022-01-04 11:43:38 -08:00
Jeremy Reizenstein
eb2bbf8433 screen space docstrings fix
Summary: Fix some comments to match the recent change to transform_points_screen.

Reviewed By: patricklabatut

Differential Revision: D33243697

fbshipit-source-id: dc8d182667a9413bca2c2e3657f97b2f7a47c795
2021-12-21 04:31:33 -08:00
Jeremy Reizenstein
1152a93b72 PyTorch>1.9 version str
Summary: Make code for downloading linux wheels robust to double-digit PyTorch minor version.

Reviewed By: nikhilaravi

Differential Revision: D33170562

fbshipit-source-id: 559a97cc98ff8411e235a9f9e29f84b7a400c716
2021-12-18 15:49:17 -08:00
Jeremy Reizenstein
093999e71f update tutorials for release
Summary: Pre 0.6.1 release, make the tutorials expect wheels with PyTorch 1.10.0

Reviewed By: patricklabatut

Differential Revision: D33016834

fbshipit-source-id: b8c5c1c6158f806c3e55ec668117fa762fa4b75f
2021-12-13 04:38:16 -08:00
Jeremy Reizenstein
bf3bc6f8e3 screen cameras lose -1
Summary:
All the renderers in PyTorch3D (pointclouds including pulsar, meshes, raysampling) use align_corners=False style. NDC space goes between the edges of the outer pixels. For a non square image with W>H, the vertical NDC space goes from -1 to 1 and the horizontal from -W/H to W/H.

However it was recently pointed out that functionality which deals with screen space inside the camera classes is inconsistent with this. It unintentionally uses align_corners=True. This fixes that.

This would change behaviour of the following:
- If you create a camera in screen coordinates, i.e. setting in_ndc=False, then anything you do with the camera which touches NDC space may be affected, including trying to use renderers. The transform_points_screen function will not be affected...
- If you call the function “transform_points_screen” on a camera defined in NDC space results will be different. I have illustrated in the diff how to get the old results from the new results but this probably isn’t the right long-term solution..

Reviewed By: gkioxari

Differential Revision: D32536305

fbshipit-source-id: 377325a9137282971dcb7ca11a6cba3fc700c9ce
2021-12-07 15:04:20 -08:00
Patrick Labatut
e4456dba2f Facebook -> Meta Platforms on website footer + docs
Summary: Update company copyright on website footer + documentation pages, see [guidelines](https://www.internalfb.com/intern/wiki/Open_Source/Launch_an_OSS_Project/Launch_Preparation/Automated_Checkup/Terms_Of_Use_&_Privacy_Policy/).

Reviewed By: bottler

Differential Revision: D32649563

fbshipit-source-id: f285be79c185496832c5d41b839ee974234a8fa5
2021-11-24 10:07:15 -08:00
Ignacio Rocco
16ebf54e69 NDC doc fix (#28)
Summary:
- Added clarifications about NDC coordinate system for square and non-square images.

Pull Request resolved: https://github.com/fairinternal/pytorch3d/pull/28

Reviewed By: nikhilaravi

Differential Revision: D31681444

Pulled By: bottler

fbshipit-source-id: f71eabe9b3dd54b9372cef617e08f837f316555b
2021-10-17 07:41:57 -07:00
Jeremy Reizenstein
14dd2611ee Remove version number from docs title
Summary: Small docs fixes: spelling. Avoid things which get out of date quickly: year, version.

Reviewed By: patricklabatut

Differential Revision: D31659927

fbshipit-source-id: b0111140bdaf3c6cadc09f70621bf5656909ca02
2021-10-16 15:06:23 -07:00
Georgia Gkioxari
1360d69ffb minor note fix
Summary: A small fix for the iou3d note

Reviewed By: bottler

Differential Revision: D31370686

fbshipit-source-id: 6c97302b5c78de52915f31be70f234179c4b246d
2021-10-03 17:17:47 -07:00
Georgia Gkioxari
1b1ba5612f Note for iou3d
Summary:
A note for our new algorithm for IoU of oriented 3D boxes. It includes
* A description of the algorithm
* A comparison with Objectron

Reviewed By: nikhilaravi

Differential Revision: D31288066

fbshipit-source-id: 0ea8da887bc5810bf4a3e0848223dd3590df1538
2021-09-29 19:15:19 -07:00
Alex Naumann
d2bbd0cdb7 Fix link to render textured meshes example (#818)
Summary:
Great work! :)
Just found a link in the examples that is not working. This will fix it.

Best,
Alex

Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/818

Reviewed By: nikhilaravi

Differential Revision: D30637532

Pulled By: patricklabatut

fbshipit-source-id: ed6c52375d1e760cb0fb2c0a66648dfeb0c6ed46
2021-08-30 13:11:53 -07:00
Jeremy Reizenstein
b0dd0c8821 rename master branch to main
Summary: Change doc references to master branch to its new name main.

Reviewed By: nikhilaravi

Differential Revision: D30303018

fbshipit-source-id: cfdbb207dfe3366de7e0ca759ed56f4b8dd894d1
2021-08-16 04:06:53 -07:00
Jeremy Reizenstein
addbe49de1 update tutorials for new prebuilt version
Summary: At the next release, the prebuilt PyTorch3D wheels will depend on PyTorch 1.9.0. Update the tutorials to expect this.

Reviewed By: nikhilaravi

Differential Revision: D29614450

fbshipit-source-id: 39978a6a55b62fb7c7e62aaa8f138e47cadd631e
2021-08-03 08:10:52 -07:00
Georgia Gkioxari
0c32f094af NDC/screen cameras API fix, compatibility with renderer
Summary:
API fix for NDC/screen cameras and compatibility with PyTorch3D renderers.

With this new fix:
* Users can define cameras and `transform_points` under any coordinate system conventions. The transformation applies the camera K and RT to the input points, not regarding for PyTorch3D conventions. So this makes cameras completely independent from PyTorch3D renderer.

* Cameras can be defined either in NDC space or screen space. For existing ones, FoV cameras are in NDC space. Perspective/Orthographic can be defined in NDC or screen space.

* The interface with PyTorch3D renderers happens through `transform_points_ndc` which transforms points to the NDC space and assumes that input points are provided according to PyTorch3D conventions.

* Similarly, `transform_points_screen` transforms points to screen space and again assumes that input points are under PyTorch3D conventions.

* For Orthographic/Perspective cameras, if they are defined in screen space, the `get_ndc_camera_transform` allows points to be converted to NDC for use for the renderers.

Reviewed By: nikhilaravi

Differential Revision: D26932657

fbshipit-source-id: 1a964e3e7caa54d10c792cf39c4d527ba2fb2e79
2021-08-02 01:01:10 -07:00
Jeremy Reizenstein
10eb3892da Downloads from utils in a couple of tutorials
Summary: Fixes #514, so we don't assume user of the tutorial has access to utils.

Reviewed By: nikhilaravi

Differential Revision: D29557294

fbshipit-source-id: 10ac994be65df0822d3ee4e9d690189ff13074a2
2021-07-06 15:32:24 -07:00
Patrick Labatut
5615f072d7 Add missing common module to auto-generated documentation
Summary: Add missing common module to auto-generated documentation

Reviewed By: nikhilaravi

Differential Revision: D29429687

fbshipit-source-id: fcbd02bda959b0f5674c344d17ce3f36ac4b85ae
2021-06-29 15:37:33 -07:00
Patrick Labatut
5284de6e97 Deprecate so3_exponential_map
Summary: Deprecate the `so3_exponential_map()` function in favor of its alias `so3_exp_map()`: this aligns with the naming of `so3_log_map()` and the recently introduced `se3_exp_map()` / `se3_log_map()` pair.

Reviewed By: bottler

Differential Revision: D29329966

fbshipit-source-id: b6f60b9e86b2995f70b1fbeb16f9feea05c55de9
2021-06-28 04:28:06 -07:00
Patrick Labatut
af93f34834 License lint codebase
Summary: License lint codebase

Reviewed By: theschnitz

Differential Revision: D29001799

fbshipit-source-id: 5c59869911785b0181b1663bbf430bc8b7fb2909
2021-06-22 03:45:27 -07:00
Patrick Labatut
7e43f29d52 Lint codebase
Summary: Lint codebase

Reviewed By: bottler

Differential Revision: D29263057

fbshipit-source-id: ac97f01d2a79fead3b09c2cbb21b50ce688a577d
2021-06-22 03:45:27 -07:00
Nikhila Ravi
a343cf534c Small fix to tutorial
Summary: Small fix to `fit_textured_mesh.ipynb` tutorial due to a recent change in numpy

Reviewed By: bottler

Differential Revision: D29219990

fbshipit-source-id: f5feeef9eb952720ea7154d066795fbbe64ce7a1
2021-06-18 07:40:51 -07:00
Ignacio Rocco
4efadaecfc Minor fix in HarmonicEmbedding docstring (#13)
Summary:
The multiplicative factors in function embeddings go from `2**0` to `2**(self.n_harmonic_functions-1)`, and not from `2**0` to `2**self.n_harmonic_functions`.

Pull Request resolved: https://github.com/fairinternal/pytorch3d/pull/13

Reviewed By: nikhilaravi

Differential Revision: D28637894

Pulled By: ignacio-rocco

fbshipit-source-id: da20f39eba9aaa09af5b24be1554a3bfd7556281
2021-05-27 03:14:06 -07:00
Jeremy Reizenstein
ed6983ea84 Experimental glTF reading
Summary: Experimental data loader for taking the default scene from a GLB file and converting it to a single mesh in PyTorch3D.

Reviewed By: nikhilaravi

Differential Revision: D25900167

fbshipit-source-id: bff22ac00298b83a0bd071ae5c8923561e1d81d7
2021-05-26 04:54:19 -07:00
Jeremy Reizenstein
d17b121d9d remove skimage import from most tutorials
Summary:
Several tutorials were importing skimage and not using it (and it is not an official dependency of PyTorch3D).

Also several had a bad call to plt.grid.

Reviewed By: nikhilaravi

Differential Revision: D28185822

fbshipit-source-id: adabfd0d4d339e1081c26b7b28f5e3953b492f2e
2021-05-05 04:06:43 -07:00
Jeremy Reizenstein
1c45ec9770 Avoid gradients when rendering for visualization
Summary: The renderer gets used for visualization only in places. Here we avoid creating an autograd graph during that, which is not needed and can fail because some of the graph which existed earlier might be needed and has not been retained after the optimizer step. See https://github.com/facebookresearch/pytorch3d/issues/624

Reviewed By: gkioxari

Differential Revision: D27593018

fbshipit-source-id: 62ae7a5a790111273aa4c566f172abd36c844bfb
2021-04-14 12:52:09 -07:00
Jeremy Reizenstein
124bb5e391 spelling
Summary: Collection of spelling things, mostly in docs / tutorials.

Reviewed By: gkioxari

Differential Revision: D26101323

fbshipit-source-id: 652f62bc9d71a4ff872efa21141225e43191353a
2021-04-09 09:58:54 -07:00
Jeremy Reizenstein
6c4151a820 Remove _read_image from densepose example
Summary:
As noted in #601, the example notebook was using an internal function _read_image from PyTorch3D, which has changed signature recently. It is not meant to be used externally. Switch to using PIL directly.

Other changes: (1) removed unused skimage import. (2) some small tidyups. We now don't have places where cells modify values set by other cells. (3) removed bad calls to `plt.grid` which have no effect.

Reviewed By: theschnitz, nikhilaravi

Differential Revision: D27080372

fbshipit-source-id: 2fce651b3e5d7a4619f0a2b298c5db18c8fa1e2c
2021-03-17 16:13:36 -07:00
Jeremy Reizenstein
8e1bcd5568 Tidy comments around imports
Summary: Make black and isort stop disagreeing by removing some unneeded comments around import statements. pyre ignores are moved.

Reviewed By: theschnitz

Differential Revision: D27118137

fbshipit-source-id: 9926d0f21142adcf9b5cfe1d394754317f6386df
2021-03-17 09:26:33 -07:00
Nikhila Ravi
4bb3fff52b pulsar image size bug fix
Summary: Small change to swap how height/width are inferred from the image_size setting.

Reviewed By: gkioxari

Differential Revision: D26648340

fbshipit-source-id: 2c657a115c96cadf3ac63be87b0e1bfba10c9315
2021-02-26 09:09:08 -08:00
Jeremy Reizenstein
db6fbfad90 update notebooks for s3 wheels
Summary: Prepare the tutorial notebooks to use wheels from S3 when run on colab.

Reviewed By: nikhilaravi

Differential Revision: D26226932

fbshipit-source-id: 1f9366c3fb4ba195333a5d5dfa3f6876ea934508
2021-02-05 05:52:36 -08:00
imlixinyang
2ee11c7845 Update generate_cow_renders.py (#529)
Summary:
Typo fixed.

Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/529

Reviewed By: bottler

Differential Revision: D26008651

Pulled By: nikhilaravi

fbshipit-source-id: 76d5baadba7bcd3577397adb842e964ee4490b7d
2021-01-22 11:01:02 -08:00
Jeremy Reizenstein
ddebdfbcd7 Allow single offset in offset_verts
Summary:
It is common when trying things out to want to move a whole mesh or point cloud by the same amount. Here we allow the offset functions to broadcast.

Also add a sanity check to join_meshes_as_scene which it is easy to call wrongly.

Reviewed By: nikhilaravi

Differential Revision: D25980593

fbshipit-source-id: cdf1568e1317e3b81ad94ed4e608ba7eef81290b
2021-01-22 07:33:31 -08:00
Jeremy Reizenstein
b183dcb6e8 skeleton of pluggable IO
Summary: Unified interface for loading and saving meshes and pointclouds.

Reviewed By: nikhilaravi

Differential Revision: D25372968

fbshipit-source-id: 6fe57cc3704a89d81d13e959bee707b0c7b57d3b
2021-01-07 15:40:11 -08:00
David Novotny
9fc661f8b3 Tutorial - Fit neural radiance field
Summary: Implements a simple nerf tutorial.

Reviewed By: nikhilaravi

Differential Revision: D24650983

fbshipit-source-id: b3db51c0ed74779ec9b510350d1675b0ae89422c
2021-01-06 08:27:20 -08:00
David Novotny
01f86ddeb1 Tutorial - Fit textured volume.
Summary: Implements a notebook that fits a volume to multiple views of the cow mesh.

Reviewed By: nikhilaravi

Differential Revision: D24553385

fbshipit-source-id: 367ca39e176b40df2c5946c9c05d3be824dc8d1c
2021-01-06 08:27:20 -08:00
Jeremy Reizenstein
513a6476bc iopath dependency
Summary: Add ioPath as a dependency of PyTorch3D in preparation for using the new PathManager.

Reviewed By: nikhilaravi

Differential Revision: D25372971

fbshipit-source-id: d8aa661d2de975e747dd494edc42bf843990cf68
2020-12-24 10:16:03 -08:00
Jeremy Reizenstein
0a309ec6c7 requirements for readthedocs
Summary: Use a more recent PyTorch to build the documentation.

Reviewed By: nikhilaravi

Differential Revision: D25679756

fbshipit-source-id: 83d647f709337110d39886eaa6aad2565d740c6d
2020-12-22 08:53:36 -08:00
Nikhila Ravi
01759d8ffb Texture Atlas sampling bug fix
Summary: Fixes the index out of bound errors for texture sampling from a texture atlas: when barycentric coordinates are 1.0, the integer index into the (R, R) per face texture map is R (max can only be R-1).

Reviewed By: gkioxari

Differential Revision: D25543803

fbshipit-source-id: 82d0935b981352b49c1d95d5a17f9cc88bad0a82
2020-12-17 04:10:56 -08:00
Nikhila Ravi
d07307a451 Non square image rasterization for meshes
Summary:
There are a couple of options for supporting non square images:
1) NDC stays at [-1, 1] in both directions with the distance calculations all modified by (W/H). There are a lot of distance based calculations (e.g. triangle areas for barycentric coordinates etc) so this requires changes in many places.
2) NDC is scaled by (W/H) so the smallest side has [-1, 1]. In this case none of the distance calculations need to be updated and only the pixel to NDC calculation needs to be modified.

I decided to go with option 2 after trying option 1!

API Changes:
- Image size can now be specified optionally as a tuple

TODO:
- add a benchmark test for the non square case.

Reviewed By: jcjohnson

Differential Revision: D24404975

fbshipit-source-id: 545efb67c822d748ec35999b35762bce58db2cf4
2020-12-09 09:18:11 -08:00
Jeremy Reizenstein
4296fd96c5 curl needs -L
Summary: As mentioned in a comment on https://github.com/facebookresearch/pytorch3d/issues/438, curl must be told to follow redirects.

Reviewed By: nikhilaravi

Differential Revision: D24870138

fbshipit-source-id: 0c8aeb5146f8699bcea03d4108276fc24e9eab6b
2020-11-10 16:35:42 -08:00
Jeremy Reizenstein
de7af4a704 CUB when installing inside tutorials
Summary:
We now require CUB for building, here we make the tutorials include it.

Also make the installation cell do nothing if it has already succeeded.

I use curl not wget, and `os.environ` to set the variables not shell methods, because they are more likely to work on Windows.

Reviewed By: nikhilaravi

Differential Revision: D24860574

fbshipit-source-id: 5be86af15e53f8db016ee0e96fb43153bd69adbc
2020-11-10 13:06:08 -08:00
Jeremy Reizenstein
d220ee2f66 pulsar build and CI changes
Summary:
Changes to CI and some minor fixes now that pulsar is part of pytorch3d. Most significantly, add CUB to CI builds.

Make CUB_HOME override the CUB already in cudatoolkit (important for cuda11.0 which uses cub 1.9.9 which pulsar doesn't work well with.
Make imageio available for testing.
Lint fixes.
Fix some test verbosity.
Avoid use of atomicAdd_block on older GPUs.

Reviewed By: nikhilaravi, classner

Differential Revision: D24773716

fbshipit-source-id: 2428356bb2e62735f2bc0c15cbe4cff35b1b24b8
2020-11-10 09:38:05 -08:00
Christoph Lassner
b6be3b95fb Example and test updates.
Summary: This commit performs pulsar example and test refinements. The examples are fully adjusted to adhere to PEP style guide and additional comments are added.

Reviewed By: nikhilaravi

Differential Revision: D24723391

fbshipit-source-id: 6d289006f080140159731e7f3a8c98b582164f1a
2020-11-04 09:54:17 -08:00
Christoph Lassner
039e02601d examples and docs.
Summary: This diff updates the documentation and tutorials with information about the new pulsar backend. For more information about the pulsar backend, see the release notes and the paper (https://arxiv.org/abs/2004.07484). For information on how to use the backend, see the point cloud rendering notebook and the examples in the folder docs/examples.

Reviewed By: nikhilaravi

Differential Revision: D24498129

fbshipit-source-id: e312b0169a72b13590df6e4db36bfe6190d742f9
2020-11-03 13:06:35 -08:00