64 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
Jeremy Reizenstein
fdcf368708 import vis parts separately
Summary: We envision `pytorch3d.vis` to contain submodules with different dependencies. Allow (and require) them to be imported independently.

Reviewed By: theschnitz

Differential Revision: D24622519

fbshipit-source-id: 44840f70f5fd2bd410405bf09546024e48238744
2020-10-29 10:16:43 -07:00
Jeremy Reizenstein
aa4cc0adbc images for debugging TexturesUV
Summary: New methods to directly plot a TexturesUV map with its used points, using PIL and matplotlib.

Reviewed By: gkioxari

Differential Revision: D23782968

fbshipit-source-id: 692970857b5be13a35a3175dc82ac03963a73555
2020-10-27 10:10:05 -07:00
Amitav Baruah
2084160b16 Remove duplicate imports in DensePose tutorial
Summary: We were importing torch, torchvision, PyTorch3D, and sys twice. This is just removing the duplicate (unneeded) imports

Reviewed By: theschnitz

Differential Revision: D24479270

fbshipit-source-id: 1048732f65242eb776c3eef537cb1ae58815c1eb
2020-10-22 12:10:40 -07:00
Amitav Baruah
005a334f99 Render PyTorch3d cameras in plotly
Summary: Take in a renderer with camera(s) and render the cameras as wireframes in the corresponding plotly plots

Reviewed By: nikhilaravi

Differential Revision: D24151706

fbshipit-source-id: f8e86d61f3d991500bafc0533738c79b96bda630
2020-10-20 17:16:17 -07:00
Amitav Baruah
3d1863ce6f Update tutorials to reflect plotly refactor
Summary: Change the two affected tutorials to use plot_scene and plot_batch_individually.

Reviewed By: nikhilaravi

Differential Revision: D24235480

fbshipit-source-id: ca9d73bfb7ccf733efaf16299c15927406d7f2aa
2020-10-20 17:16:17 -07:00
Amitav Baruah
5d65a0cf8c Rename visualization to vis
Summary: Importing from pytorch3d.visualization is wordy, so shortened the path to the vis module and updated the relevant imports.

Reviewed By: nikhilaravi

Differential Revision: D24116527

fbshipit-source-id: e0e4da7d48c5afedec07482d7be43362b6822445
2020-10-06 15:55:05 -07:00
Amitav Baruah
a03fd7320f Add plotly visualization examples
Summary: Add examples of using the Plotly visualization functions to the corresponding tutorial notebooks.

Reviewed By: nikhilaravi

Differential Revision: D23879109

fbshipit-source-id: ea8c45aa6c828eb2f6ea2ae1c8846adc486f92e0
2020-10-01 16:49:19 -07:00
Amitav Baruah
f34f4073f0 Add tutorial notebook for rendering densepose
Summary:
Add a notebook demonstrating how to use Pytorch3D to render a textured mesh with the DensePose textures and the SMPL model

{F336408690}

Reviewed By: nikhilaravi

Differential Revision: D23784314

fbshipit-source-id: c92f32fb9b9468eb7ec26bf58dcabb1f26d92e7b
2020-09-21 11:42:26 -07:00
Amitav Baruah
61121b9f2c Add example of rendering pointclouds with a background color.
Summary:
Add cells to the rendering_colored_points tutorial showing how to initialize a renderer and compositor that will render pointclouds with a background color.

{F333731292}
{F334136799}

Reviewed By: nikhilaravi

Differential Revision: D23632503

fbshipit-source-id: e9ce0178b41e74baf912bd82ca1db41b680fc68f
2020-09-14 10:39:08 -07:00
Amitav Baruah
f2eb34dc7a Correctly create reference image silhouette
Summary: Previously the tutorial code assumed that the reference image had a black background, resulting in an empty silhouette mask. Since the background is white, this change allows the model to find the correct silhouette mask.

Reviewed By: nikhilaravi, sbranson

Differential Revision: D23502202

fbshipit-source-id: c3a570f93efd480323f27cb081db0a9fb54be219
2020-09-10 12:55:32 -07:00
Jeremy Reizenstein
9aeb88b48e tutorial fixes. validate #cameras
Summary:
Update the installation cells to import torch.
Replace use of deprecated Textures in deform tutorial.
Correct the deform tutorial's idea of its own name.
Fix typo in batched part of render_textured_meshes which meant only one mesh was being rendered with a batch of cameras.
Add an error check in the rasterizer to make the error friendly from such a mistake elsewhere.

Reviewed By: gkioxari

Differential Revision: D23345462

fbshipit-source-id: 1d5bd25db052f7ef687b7168d7aee5cc4dce8952
2020-08-26 08:27:53 -07:00
Jeremy Reizenstein
32484500be tutorial fixes from #336. Wheels with cuda10.1.
Summary:
Add a document to explain how to run the tutorials.
Fix API of TexturesVertex in fit_textured_mesh.
Prepare cuda 10.1 wheels (not 10.2) for linux to be available on pypi - this matches what colab has.
Change the tutorials to use these new wheels.

Reviewed By: gkioxari

Differential Revision: D23324479

fbshipit-source-id: 60e92a3f46a2d878f811b7703638f8d1dae143d9
2020-08-25 13:11:10 -07:00
Nikhila Ravi
90f6a005b0 Tutorials textures updates and fix bug in extending meshes with uv textures
Summary:
Found a bug in extending textures with vertex uv coordinates. This was due to the padded -> list conversion of vertex uv coordinates i.e.                 The number of vertices in the mesh and in verts_uvs can differ
e.g. if a vertex is shared between 3 faces, it can
have up to 3 different uv coordinates. Therefore we cannot convert directly from padded to list using _num_verts_per_mesh

Reviewed By: bottler

Differential Revision: D23233595

fbshipit-source-id: 0c66d15baae697ead0bdc384f74c27d4c6539fc9
2020-08-21 19:20:09 -07:00
Georgia Gkioxari
57a22e7306 camera refactoring
Summary:
Refactor cameras
* CamerasBase was enhanced with `transform_points_screen` that transforms projected points from NDC to screen space
* OpenGLPerspective, OpenGLOrthographic -> FoVPerspective, FoVOrthographic
* SfMPerspective, SfMOrthographic -> Perspective, Orthographic
* PerspectiveCamera can optionally be constructred with screen space parameters
* Note on Cameras and coordinate systems was added

Reviewed By: nikhilaravi

Differential Revision: D23168525

fbshipit-source-id: dd138e2b2cc7e0e0d9f34c45b8251c01266a2063
2020-08-20 22:22:06 -07:00
mlygao@devgpu002.atn3.facebook.com
9242e7e65d ShapeNetCore & R2N2 tutorial
Summary: Tutorial for ShapeNetCore & R2N2.

Reviewed By: gkioxari

Differential Revision: D22916882

fbshipit-source-id: 752742be87f44919164ec7eafcc9c09c17a0f8a3
2020-08-20 17:57:06 -07:00
Nikhila Ravi
a3932960b3 Texturing API updates
Summary:
A fairly big refactor of the texturing API with some breaking changes to how textures are defined.

Main changes:
- There are now 3 types of texture classes: `TexturesUV`, `TexturesAtlas` and `TexturesVertex`. Each class:
   - has a `sample_textures` function which accepts the `fragments` from rasterization and returns `texels`. This means that the shaders will not need to know the type of the mesh texture which will resolve several issues people were reporting on GitHub.
  -  has a `join_batch` method for joining multiple textures of the same type into a batch

Reviewed By: gkioxari

Differential Revision: D21067427

fbshipit-source-id: 4b346500a60181e72fdd1b0dd89b5505c7a33926
2020-07-29 16:11:23 -07:00
Georgia Gkioxari
42b5b96595 remove composite params from tutorials
Summary: Remove composite params from tutorial

Reviewed By: nikhilaravi

Differential Revision: D22809242

fbshipit-source-id: e5ed4e93fc892baf74e3a464119f0d11973423c3
2020-07-28 22:21:20 -07:00
Steve Branson
9a5341bde3 Add tutorial for fitting textured mesh to multi-view images
Summary: Tutorial showing how to create a synthetic dataset by rendering a cow from multiple views, fit a mesh using a differential silhouette renderer, then fit a mesh using an RGB renderer.

Reviewed By: nikhilaravi

Differential Revision: D22513859

fbshipit-source-id: 24bdaac4ebec6dd01f98e2f5c702065f9335ff33
2020-07-23 12:14:45 -07:00
Jeremy Reizenstein
275ddade66 CPU device for tutorials
Reviewed By: nikhilaravi

Differential Revision: D22357376

fbshipit-source-id: c103f9b0c798d4425d642781b5bfbb1a27310270
2020-07-03 08:52:41 -07:00
Jeremy Reizenstein
52979226bc strip output from tutorials
Summary: It's easier to understand code changes if we don't store the output in the notebooks. This is just a run of nbstripout on all the notebooks.

Reviewed By: nikhilaravi

Differential Revision: D22357375

fbshipit-source-id: bffdb426af2f676d448630d717658d609c224811
2020-07-03 08:52:41 -07:00
Nikhila Ravi
17ca6ecd81 allow cameras to be None in rasterizer initialization
Summary: Fix to enable a mesh/point rasterizer to be initialized without having to specify the camera.

Reviewed By: jcjohnson, gkioxari

Differential Revision: D21362359

fbshipit-source-id: 4f84ea18ad9f179c7b7c2289ebf9422a2f5e26de
2020-05-05 22:32:57 -07:00
Nikhila Ravi
9ef1ee8455 coarse rasterization bug fix
Summary:
Fix a bug which resulted in a rendering artifacts if the image size was not a multiple of 16.
Fix: Revert coarse rasterization to original implementation and only update fine rasterization to reverse the ordering of Y and X axis. This is much simpler than the previous approach!

Additional changes:
- updated mesh rendering end-end tests to check outputs from both naive and coarse to fine rasterization.
- added pointcloud rendering end-end tests

Reviewed By: gkioxari

Differential Revision: D21102725

fbshipit-source-id: 2e7e1b013dd6dd12b3a00b79eb8167deddb2e89a
2020-04-20 14:54:16 -07:00
Nikhila Ravi
474c8b456a remove bin_size from the settings in the tutorials
Summary: Remove `bin_size` and `max_faces_per_pixel` from being specified. This means the coarse-to-fine rasterization will be used by default and will help avoid confusion with the naive version.

Reviewed By: jcjohnson

Differential Revision: D20908905

fbshipit-source-id: c181c88e844d888aa81a36870918307961dc1175
2020-04-08 10:07:36 -07:00
Patrick Labatut
d57daa6f85 Address black + isort fbsource linter warnings
Summary: Address black + isort fbsource linter warnings from D20558374 (previous diff)

Reviewed By: nikhilaravi

Differential Revision: D20558373

fbshipit-source-id: d3607de4a01fb24c0d5269634563a7914bddf1c8
2020-03-29 14:51:02 -07:00
Nikhila Ravi
6d34e1c60d Tutorial updates
Summary:
Add a note about the difference between naive and coarse-to-fine rasterization to all the rendering tutorials.

Update the render pointclouds tutorial to wget the data file.

Reviewed By: gkioxari

Differential Revision: D20575257

fbshipit-source-id: a2806b9452438f97cb754f87e011c6e32e2545e4
2020-03-20 18:26:49 -07:00
Olivia
53599770dd Accumulate points (#4)
Summary:
Code for accumulating points in the z-buffer in three ways:
1. weighted sum
2. normalised weighted sum
3. alpha compositing

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

Reviewed By: nikhilaravi

Differential Revision: D20522422

Pulled By: gkioxari

fbshipit-source-id: 5023baa05f15e338f3821ef08f5552c2dcbfc06c
2020-03-19 11:23:12 -07:00