Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

room_type_map error #24

Open
mariiak2021 opened this issue Feb 22, 2023 · 4 comments · May be fixed by #25
Open

room_type_map error #24

mariiak2021 opened this issue Feb 22, 2023 · 4 comments · May be fixed by #25

Comments

@mariiak2021
Copy link

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
Copy link
Author

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

@jordis-ai2 jordis-ai2 linked a pull request Feb 28, 2023 that will close this issue
@jordis-ai2
Copy link

jordis-ai2 commented Feb 28, 2023

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
Copy link
Author

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
Copy link

jordis-ai2 commented Mar 1, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants