Skip to content

Commit 029a9da

Browse files
Talmajfacebook-github-bot
authored andcommitted
Fix ShapeNetDataset (#593)
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
1 parent 1b39ceb commit 029a9da

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

MANIFEST.in

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include pytorch3d/datasets/shapenet/shapenet_synset_dict_v1.json
2+
include pytorch3d/datasets/shapenet/shapenet_synset_dict_v2.json
3+
include pytorch3d/datasets/r2n2/r2n2_synset_dict.json

pytorch3d/datasets/shapenet_base.py

+2
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ def _load_mesh(self, model_path) -> Tuple:
9696
self.texture_resolution,
9797
3,
9898
)
99+
else:
100+
textures = None
99101

100102
return verts, faces.verts_idx, textures
101103

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,5 @@ def __init__(self, *args, **kwargs):
142142
},
143143
ext_modules=get_extensions(),
144144
cmdclass={"build_ext": BuildExtension},
145+
include_package_data=True,
145146
)

tests/test_shapenet_core.py

+7
Original file line numberDiff line numberDiff line change
@@ -282,3 +282,10 @@ def test_render_shapenet_core(self):
282282
"test_shapenet_core_render_without_sample_nums_%s.png" % idx, DATA_DIR
283283
)
284284
self.assertClose(mixed_rgb_2, image_ref, atol=0.05)
285+
286+
def test_load_textures_false(self):
287+
shapenet_dataset = ShapeNetCore(
288+
SHAPENET_PATH, load_textures=False, version=VERSION
289+
)
290+
model = shapenet_dataset[0]
291+
self.assertIsNone(model["textures"])

0 commit comments

Comments
 (0)