15 Commits

Author SHA1 Message Date
Luya Gao
e053d7c456 Adding join_mesh in pytorch3d.structures.meshes
Summary: Adding a function in pytorch3d.structures.meshes to join multiple meshes into a Meshes object representing a single mesh. The function currently ignores all textures.

Reviewed By: nikhilaravi

Differential Revision: D21876908

fbshipit-source-id: 448602857e9d3d3f774d18bb4e93076f78329823
2020-06-09 08:33:23 -07:00
Nikhila Ravi
0eca74fa5f lint fixes
Summary:
Ran the linter.
TODO: need to update the linter as per D21353065.

Reviewed By: bottler

Differential Revision: D21362270

fbshipit-source-id: ad0e781de0a29f565ad25c43bc94a19b1828c020
2020-05-04 09:56:44 -07:00
Jeremy Reizenstein
0c595dcf5b Joining mismatched texture maps on CUDA #175
Summary:
Use nn.functional.interpolate instead of a TorchVision transform to resize texture maps to a common value. This works on all devices. This fixes issue #175.

Also fix the condition so it only happens when needed.

Reviewed By: nikhilaravi

Differential Revision: D21324510

fbshipit-source-id: c50eb06514984995bd81f2c44079be6e0b4098e4
2020-05-01 05:20:10 -07:00
Nikhila Ravi
c9267ab7af Update load obj and compare with SoftRas
Summary:
Updated the load obj function to support creating of a per face texture map using the information in an .mtl file. Uses the approach from in SoftRasterizer.

Currently I have ported in the SoftRasterizer code but this is only to help with comparison and will  be deleted before landing. The ShapeNet Test data will also be deleted.

Here is the [Design doc](https://docs.google.com/document/d/1AUcLP4QwVSqlfLAUfbjM9ic5vYn9P54Ha8QbcVXW2eI/edit?usp=sharing).

## Added
- texture atlas creation functions in PyTorch based on the SoftRas cuda implementation
- tests to compare SoftRas vs PyTorch3D implementation to verify it matches (using real shapenet data with meshes consisting of multiple textures)
- benchmarks tests

## Remaining todo:
- add more tests for obj io to test the new functions and the two texturing options
- replace the shapenet data with the output from SoftRas saved as a file.

# MAIN FILES TO REVIEW

- `obj_io.py`
- `test_obj_io.py` [still some tests to be added but have comparisons with SoftRas for now]

The reference SoftRas implementations are in `softras_load_obj.py` and `load_textures.cu`.

Reviewed By: gkioxari

Differential Revision: D20754859

fbshipit-source-id: 42ace9dfb73f26e29d800c763f56d5b66c60c5e2
2020-04-23 19:38:35 -07:00
Jeremy Reizenstein
b64fe51360 join_meshes_as_batch
Summary: rename join_meshes to join_meshes_as_batch.

Reviewed By: nikhilaravi

Differential Revision: D20671293

fbshipit-source-id: e84d6a67d6c1ec28fb5e52d4607db8e92561a4cd
2020-03-30 11:27:41 -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
Patrick Labatut
3061c5b663 Fix saving / loading empty OBJ files
Summary:
OBJ files without vertices or faces should be allowed:
- an OBJ with only vertices can represent a point cloud
- an OBJ without any vertex or face is just empty
- an OBJ with faces referencing inexistent vertices has invalid data

Reviewed By: gkioxari

Differential Revision: D20392526

fbshipit-source-id: e72c846ff1e5787fb11d527af3fefa261f9eb0ee
2020-03-28 08:14:00 -07:00
Jeremy Reizenstein
595aca27ea use assertClose
Summary: use assertClose in some tests, which enforces shape equality. Fixes some small problems, including graph_conv on an empty graph.

Reviewed By: nikhilaravi

Differential Revision: D20556912

fbshipit-source-id: 60a61eafe3c03ce0f6c9c1a842685708fb10ac5b
2020-03-23 11:36:38 -07:00
Patrick Labatut
d91c1d365b Add more complex mesh I/O benchmarks
Summary: Add more complex mesh I/O benchmarks: simple yet non-trivial procedural donut mesh

Reviewed By: nikhilaravi

Differential Revision: D20390726

fbshipit-source-id: b28b7e3a7f1720823c6bd24faabf688bb0127b7d
2020-03-13 04:31:25 -07:00
Patrick Labatut
94fc862ff7 Simplify mesh I/O benchmarking methods
Summary: Rename mesh I/O benchmarking methods: always (re-)create file-like object and directly return a lambda

Reviewed By: nikhilaravi

Differential Revision: D20390723

fbshipit-source-id: b45236360869cccdf3d5458a0aafb3ebe269babe
2020-03-12 10:39:45 -07:00
Patrick Labatut
797e468e45 Rename mesh I/O benchmarks and associated methods
Summary:
Rename mesh I/O benchmarks and associated methods:
- add `simple` qualifier (benchmark on more realistic mesh data to be added later)
- align naming between OBJ and PLY
- prefix with `bm_` to make the benchmarking purpose clear(er)

Reviewed By: nikhilaravi

Differential Revision: D20390764

fbshipit-source-id: 7714520abfcfe1125067f3c52f7ce19bca359574
2020-03-12 10:39:45 -07:00
Patrick Labatut
3c71ab64cc Remove shebang line when not strictly required
Summary: The shebang line `#!<path to interpreter>` is only required for Python scripts, so remove it on source files for class or function definitions. Additionally explicitly mark as executable the actual Python scripts in the codebase.

Reviewed By: nikhilaravi

Differential Revision: D20095778

fbshipit-source-id: d312599fba485e978a243292f88a180d71e1b55a
2020-03-12 10:39:44 -07:00
Jeremy Reizenstein
8fe65d5f56 Single function to load meshes from OBJs. join_meshes.
Summary:
Create the textures and the Meshes object from OBJ files in a single call.

There is functionality in OBJ files (like normals) which is ignored by this function.

Reviewed By: gkioxari

Differential Revision: D19691699

fbshipit-source-id: e26442ed80ff231b65b17d6c54c9d41e22b4e4a3
2020-02-13 03:38:07 -08:00
Georgia Gkioxari
659ad34389 load texture flag
Summary: Add flag for loading textures

Reviewed By: nikhilaravi

Differential Revision: D19664437

fbshipit-source-id: 3cc4e6179df9b7e24efff9e7da3b164253f1d775
2020-01-31 13:37:35 -08:00
facebook-github-bot
dbf06b504b Initial commit
fbshipit-source-id: ad58e416e3ceeca85fae0583308968d04e78fe0d
2020-01-23 11:53:46 -08:00