allenai / procthor

🏘️ Scaling Embodied AI by Procedurally Generating Interactive 3D Houses
https://procthor.allenai.org/
Apache License 2.0
293 stars 25 forks source link

room_type_map error #24

Open mariiak2021 opened 1 year ago

mariiak2021 commented 1 year ago

Hi!

I'm trying to generate the dataset which will contain only 1-room houses. For that I have edited room_specs.py file by saving only 4 room specs available:

        RoomSpec(
            room_spec_id="kitchen",
            sampling_weight=1,
            spec=[LeafRoom(room_id=2, ratio=1, room_type="Kitchen")],
        ),
        RoomSpec(
            room_spec_id="living-room",
            sampling_weight=1,
            spec=[LeafRoom(room_id=2, ratio=1, room_type="LivingRoom")],
        ),
        RoomSpec(
            room_spec_id="bedroom",
            sampling_weight=1,
            spec=[LeafRoom(room_id=2, ratio=1, room_type="Bedroom")],
        ),
        RoomSpec(
            # scale=1.25?
            room_spec_id="bathroom",
            sampling_weight=1,
            spec=[LeafRoom(room_id=2, ratio=1, room_type="Bathroom")],
        ),

During the generation process after the random number of generated houses I'm encountering an error like:

multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/mkhan/.conda/envs/pr/lib/python3.9/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/home/mkhan/.conda/envs/pr/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/home/mkhan/pr/scripts/generate_procthor_10k_dataset.py", line 63, in generate_house
    house, _ = house_generator.sample()
  File "/home/mkhan/pr/procthor/generation/__init__.py", line 201, in sample
    door_polygons = gfs.add_doors(
  File "/home/mkhan/pr/procthor/generation/doors.py", line 103, in default_add_doors
    outdoor_openings = select_outdoor_openings(
  File "/home/mkhan/pr/procthor/generation/doors.py", line 139, in select_outdoor_openings
    room_type = room_type_map[room_id]
KeyError: 0
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/mkhan/pr/scripts/generate_procthor_10k_dataset.py", line 81, in <module>
    r = p.map(generate_house, range(100_000))
  File "/home/mkhan/.conda/envs/pr/lib/python3.9/multiprocessing/pool.py", line 364, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/home/mkhan/.conda/envs/pr/lib/python3.9/multiprocessing/pool.py", line 771, in get
    raise self._value
KeyError: 0
"""

@mattdeitke Can you please help to understand what can cause it or what's wrong with my set up?

mariiak2021 commented 1 year ago

Hi @jordis-ai2 @Lucaweihs @mattdeitke can someone help please? :)

jordis-ai2 commented 1 year ago

Hi @mariiak2021 ,

It looks like the floor plan generation function does leave some empty cells in edge cases. A quick workaround is to ensure that the room_id used in select_outdoor_openings is never the EMPTY_ROOM_ID.

I linked a PR with the workaround, but we should ensure floor plans don't include empty cells. I'll check with @mattdeitke .

mariiak2021 commented 1 year ago

Hi @jordis-ai2 The workaround is not fully working. The new error appear with walls this time:

multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/mkhan/.conda/envs/pr/lib/python3.9/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/home/mkhan/.conda/envs/pr/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/home/mkhan/pr/scripts/generate_procthor_10k_dataset.py", line 63, in generate_house
    house, _ = house_generator.sample()
  File "/home/mkhan/pr/procthor/generation/__init__.py", line 236, in sample
    gfs.add_exterior_walls(
  File "/home/mkhan/pr/procthor/generation/exterior_walls.py", line 42, in default_add_exterior_walls
    house_wall = house_walls[wall_id]
KeyError: 'wall|0|1.90|3.81|3.81|3.81'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/mkhan/pr/scripts/generate_procthor_10k_dataset.py", line 81, in <module>
    r = p.map(generate_house, range(100_000))
  File "/home/mkhan/.conda/envs/pr/lib/python3.9/multiprocessing/pool.py", line 364, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/home/mkhan/.conda/envs/pr/lib/python3.9/multiprocessing/pool.py", line 771, in get
    raise self._value
KeyError: 'wall|0|1.90|3.81|3.81|3.81'
jordis-ai2 commented 1 year ago

I see. In order to get you going, you can try to enclose the code in generate_house in a try-except block.