Skip to content

Commit

Permalink
Fix ShapeNetDataset (#593)
Browse files Browse the repository at this point in the history
Summary:
- Add MANIFEST.in and `include_package_data=True` to include dataset .json files in the installation
Fix #435
- Fix `load_textures=False` for ShapeNetDataset with a test
Fix #450, partly fix #444. I've set the textures to `None`, if they should be all white instead, let me know.

Pull Request resolved: #593

Reviewed By: patricklabatut

Differential Revision: D29116264

Pulled By: nikhilaravi

fbshipit-source-id: 1fb0198e616b7f834dfeaf7168bb5e6e530810d1
  • Loading branch information
Talmaj authored and facebook-github-bot committed Jun 18, 2021
1 parent 1b39ceb commit 029a9da
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include pytorch3d/datasets/shapenet/shapenet_synset_dict_v1.json
include pytorch3d/datasets/shapenet/shapenet_synset_dict_v2.json
include pytorch3d/datasets/r2n2/r2n2_synset_dict.json
2 changes: 2 additions & 0 deletions pytorch3d/datasets/shapenet_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def _load_mesh(self, model_path) -> Tuple:
self.texture_resolution,
3,
)
else:
textures = None

return verts, faces.verts_idx, textures

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,5 @@ def __init__(self, *args, **kwargs):
},
ext_modules=get_extensions(),
cmdclass={"build_ext": BuildExtension},
include_package_data=True,
)
7 changes: 7 additions & 0 deletions tests/test_shapenet_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,10 @@ def test_render_shapenet_core(self):
"test_shapenet_core_render_without_sample_nums_%s.png" % idx, DATA_DIR
)
self.assertClose(mixed_rgb_2, image_ref, atol=0.05)

def test_load_textures_false(self):
shapenet_dataset = ShapeNetCore(
SHAPENET_PATH, load_textures=False, version=VERSION
)
model = shapenet_dataset[0]
self.assertIsNone(model["textures"])

0 comments on commit 029a9da

Please sign in to comment.