StanfordVL / iGibson

A Simulation Environment to train Robots in Large Realistic Interactive Scenes
http://svl.stanford.edu/igibson
MIT License
653 stars 158 forks source link

Problem loading large texture images #89

Closed gmonaci closed 3 years ago

gmonaci commented 3 years ago

Hi! I have an issue loading texture images for large Gibson environments. The error comes from the function b3ImportMeshUtility.cpp, which raises an unknown image format warning. However after some tests I got to believe the error is caused by the large dimensions of the image.

Do you know if there is a solution to this problem? Something like increasing the maximum allowed size of images, like the MAX_IMAGE_PIXELS setting in PIL?

I appreciate you provided a subset of the dataset with better packed textures. It would be useful to do the same for the largest environments as well. Maybe you can provide a script to repack the scenes in the same way?

Thanks a lot, and keep up the great work!

fxia22 commented 3 years ago

@gmonaci If you use iGibson renderer instead of pybullet for visualization, you will not hit the problem in b3ImportMeshUtility.cpp, right?

And yes, I can provide some script for repacking the texture, I will search a bit and loop back.

gmonaci commented 3 years ago

Hi @fxia22 ,

I am under the impression I am using the iGibson renderer - or am I? How to switch between them? I have just used the default. The function load_texture_file in mesh_renderer_cpu.py is raising a RuntimeError:

  File "/home/gmonaci/.conda/envs/igibson-skills/lib/python3.6/site-packages/gibson2/simulator.py", line 156, in wrapped_load_func
    res = load_func(*args, **kwargs)
  File "/home/gmonaci/.conda/envs/igibson-skills/lib/python3.6/site-packages/gibson2/simulator.py", line 190, in import_scene
    use_pbr=False, use_pbr_mapping=False)
  File "/home/gmonaci/.conda/envs/igibson-skills/lib/python3.6/site-packages/gibson2/simulator.py", line 156, in wrapped_load_func
    res = load_func(*args, **kwargs)
  File "/home/gmonaci/.conda/envs/igibson-skills/lib/python3.6/site-packages/gibson2/simulator.py", line 321, in load_object_in_renderer
    load_texture=load_texture)
  File "/home/gmonaci/.conda/envs/igibson-skills/lib/python3.6/site-packages/gibson2/render/mesh_renderer/mesh_renderer_cpu.py", line 376, in load_object
    os.path.join(obj_dir, item.diffuse_texname))
  File "/home/gmonaci/.conda/envs/igibson-skills/lib/python3.6/site-packages/gibson2/render/mesh_renderer/mesh_renderer_cpu.py", line 278, in load_texture_file
    tex_filename, self.rendering_settings.texture_scale)
RuntimeError: Caught an unknown exception!

I could reproduce the error (on two different fresh installations on Ubuntu) by running mesh_renderer_example.py, with the scene set to Leilani and setting enable_pbr=False when creating MeshRendererSettings. Please note that I do not get errors for smaller environments.

By catching the underlying warning messages (not visible normally), I could see the warning message from b3ImportMeshUtility.cpp:

b3Printf: b3Warning[examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp,174]:

b3Printf: Unsupported texture image format [/home/gmonaci/.conda/envs/igibson-skills/lib/python3.6/site-packages/gibson2/data/g_dataset/Leilani/Leilani_mesh_texture.png]

Again, I do not see the warning message with smaller environments.

Thanks!

mjlbach commented 3 years ago

Textures are no longer imported by Bullet in the latest ig-develop branch

mjlbach commented 3 years ago

Closing because this should be fixed by ig-develop, if you are not using pbgui or gui mode (iggui, simple, and headless no longer load the textures in pybullet).

Dr-Xiaogaren commented 2 years ago

In fact, I am also faced with the same problem. When I tried to load a larger scene with iGibson of the latest version, I also encountered such an error. Instead of using pybullet for visualization (I set use_pb_gui=false), I used the visualization of igibson: render_ mode = "gui_non_interactive". But the mesh in the scene still has no texture. And I get warning:

b3Warning[examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp,174]:

Unsupported texture image format [/home/vsis/Documents/iGibson/igibson/data/g_dataset/2azQ1b91cZZ/texture_combined.jpg]

The dataset is from the Matterport3D shown in the toturial document page with format like this:

(base) vsis@vsis-System-Product-Name:~/Documents/iGibson/igibson/data/g_dataset/2azQ1b91cZZ$ ls
combined.mtl  floor_1.yaml      ins_map.png        texture_combined.jpg
floor_0.png   floors.txt        mesh_z_up.obj
floor_0.yaml  floor_trav_0.png  mesh_z_up.obj.mtl
floor_1.png   floor_trav_1.png  sem_map.png

And this is part of my config file:

# scene
scene: gibson
scene_id: 2azQ1b91cZZ
build_graph: true
load_texture: true
pybullet_load_texture: true
trav_map_type: no_obj
trav_map_resolution: 0.1
trav_map_erosion: 2
should_open_all_doors: true

# domain randomization
texture_randomization_freq: null
object_randomization_freq: null

I wonder if you have solved this problem. I would appreciate it if you could share the solution to the problem. @gmonaci @mjlbach

TakieddineSOUALHI commented 11 months ago

In fact, I am also faced with the same problem. When I tried to load a larger scene with iGibson of the latest version, I also encountered such an error. Instead of using pybullet for visualization (I set use_pb_gui=false), I used the visualization of igibson: render_ mode = "gui_non_interactive". But the mesh in the scene still has no texture. And I get warning:

b3Warning[examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp,174]:

Unsupported texture image format [/home/vsis/Documents/iGibson/igibson/data/g_dataset/2azQ1b91cZZ/texture_combined.jpg]

The dataset is from the Matterport3D shown in the toturial document page with format like this:

(base) vsis@vsis-System-Product-Name:~/Documents/iGibson/igibson/data/g_dataset/2azQ1b91cZZ$ ls
combined.mtl  floor_1.yaml      ins_map.png        texture_combined.jpg
floor_0.png   floors.txt        mesh_z_up.obj
floor_0.yaml  floor_trav_0.png  mesh_z_up.obj.mtl
floor_1.png   floor_trav_1.png  sem_map.png

And this is part of my config file:

# scene
scene: gibson
scene_id: 2azQ1b91cZZ
build_graph: true
load_texture: true
pybullet_load_texture: true
trav_map_type: no_obj
trav_map_resolution: 0.1
trav_map_erosion: 2
should_open_all_doors: true

# domain randomization
texture_randomization_freq: null
object_randomization_freq: null

I wonder if you have solved this problem. I would appreciate it if you could share the solution to the problem. @gmonaci @mjlbach

I'm also facing the same problem when loading large textures from the gibson or Matterport Datasets. I would be glad if you could share the solution to the problem. @gmonaci @mjlbach @Dr-Xiaogaren @cgokmen