Closed pauljcb closed 2 years ago
I ran into that problem too. Checkout my pull request at simple-3dviz: https://github.com/angeloskath/simple-3dviz/pull/7
Thank you for your answer ! Without having to modify through simple-3dviz, for the moment I have come with this trick.
In get_textured_objects_in_scene
of file scripts\utils.py
, add from simple_3dviz.io import read_mesh_file
and replace:
# Load the furniture and scale it as it is given in the dataset
raw_mesh = TexturedMesh.from_file(model_path)
by:
# Load the furniture and scale it as it is given in the dataset
try:
raw_mesh = TexturedMesh.from_file(model_path)
except:
try:
texture_path = furniture.texture_image_path
mesh_info = read_mesh_file(model_path)
vertices = mesh_info.vertices
normals = mesh_info.normals
uv = mesh_info.uv
material = Material.with_texture_image(texture_path)
raw_mesh = TexturedMesh(vertices,normals,uv,material)
except:
print("Failed loading texture info.")
raw_mesh = Mesh.from_file(model_path)
Feel free if you have better solutions.
@pauljcb I used your code to fix the IndexError
but I face this one
python preprocess_data.py /datawaha/cggroup/parawr/datasets/scenegraphs/3D-bedrooms /datawaha/cggroup/parawr/datasets/scenegraphs/3D-FRONT /datawaha/cggroup/parawr/datasets/scenegraphs/3D-FUTURE-model /datawaha/cggroup/parawr/datasets/scenegraphs/3D-FUTURE-model/model_info.json /datawaha/cggroup/parawr/datasets/scenegraphs/3D-FRONT-texture-folder --dataset_filtering threed_front_bedroom Applying threed_front_bedroom filtering Loading scenes from /tmp/threed_front.pkl Loading dataset with 682 rooms Saving training statistics for dataset with bounds: {'translations': (array([-2.76956 , 0.0844895 , -2.65222538]), array([2.55987 , 3.396067, 2.66785 ])), 'sizes': (array([0.05946365, 0.0505 , 0.05698576]), array([2.10990515, 1.55473 , 1.32646537])), 'angles': (array([-3.14159265]), array([3.14159265]))} to /datawaha/cggroup/parawr/datasets/scenegraphs/3D-bedrooms/dataset_stats.txt Applying threed_front_bedroom filtering Loading scenes from /tmp/threed_front.pkl {'translations': (array([-2.76956 , 0.0844895 , -2.65222538]), array([2.55987 , 3.396067, 2.66785 ])), 'sizes': (array([0.05946365, 0.0505 , 0.05698576]), array([2.10990515, 1.55473 , 1.32987 ])), 'angles': (array([-3.14159265]), array([3.14159265]))} Loading dataset with 711 rooms 274it [13:39, 2.99s/it] Traceback (most recent call last): File "preprocess_data.py", line 271, in <module> main(sys.argv[1:]) File "preprocess_data.py", line 261, in main render( File "/home/parawr/Projects/scenegraphs/external/ATISS/scripts/utils.py", line 194, in render scene.add(r) File "/home/parawr/anaconda3/envs/atiss/lib/python3.8/site-packages/simple_3dviz/scenes.py", line 60, in add renderable.init(self._ctx) File "/home/parawr/anaconda3/envs/atiss/lib/python3.8/site-packages/simple_3dviz/renderables/textured_mesh.py", line 197, in init self.material = self._material File "/home/parawr/anaconda3/envs/atiss/lib/python3.8/site-packages/simple_3dviz/renderables/textured_mesh.py", line 239, in material self._material.texture.shape[2], IndexError: tuple index out of range
Any idea what causes this?
Well, I do know what causes this. There are a few textures in the 3D-FRONT dataset that are greyscale and do not have that axis indexed by 2. My solution was to simply remove those textures.
Hi,
I am sorry for not replying sooner. As @wamiq-reyaz said the simplest solution is simply to remove those textures. Unfortunately, this is an issue with 3D-FRONT data, so we don't have a better way of solving it. I am closing this issue for now but feel free to reopen it.
Cheers, Despoina
Hi,
The material files provided with the meshes in the 3D-FUTURE dataset do no contain information about the specular exponents "Ns", leading to a failure of simple_3dviz when reading the textured meshes in
preprocess_data.py
:Do you know an easy way to overcome this issue without having to locally make changes in the
simple_3dviz
library ? Thanks ! Paul