3838from typing import Any , Dict , List
3939
4040import numpy as np
41- import seaborn as sns
4241import shapely .geometry
4342import shapely .ops
4443
@@ -236,10 +235,9 @@ def get_id(self):
236235 """Get a NodeSymbol using the original region index from the mp3d file."""
237236 return NodeSymbol ("R" , self ._index )
238237
239- def get_attrs (self , color ):
238+ def get_attrs (self ):
240239 """Get suitable room node attributes for inclusion in a scene graph."""
241240 attrs = RoomNodeAttributes ()
242- attrs .color = color
243241 attrs .name = str (NodeSymbol ("R" , self ._index ))
244242 attrs .position = self ._pos
245243 attrs .last_update_time_ns = 0
@@ -397,12 +395,11 @@ def expand_rooms(G_old, verbose=False):
397395def repartition_rooms (
398396 G_prev ,
399397 mp3d_info ,
400- angle_deg = - 90.0 ,
401- min_iou_threshold = 0.0 ,
402- colors = None ,
403- verbose = False ,
404- eps = 0.0 ,
405- z_eps = 0.0 ,
398+ angle_deg : float = - 90.0 ,
399+ min_iou_threshold : float = 0.0 ,
400+ verbose : bool = False ,
401+ eps : float = 0.0 ,
402+ z_eps : float = 0.0 ,
406403):
407404 """
408405 Create a copy of the DSG with ground-truth room nodes.
@@ -412,7 +409,6 @@ def repartition_rooms(
412409 mp3d_info (Dict[str, List[Dict[Str, Any]]]): Parsed house file information
413410 angle_deg (float): Degrees to rotate the parsed rooms
414411 min_iou_threshold (float): Minimum intersection over union for valid rooms
415- colors (Optional[List[Iterable[float]]]): Optional colormap to assign to rooms
416412 verbose (bool): Print information about repartition process
417413
418414 Returns:
@@ -426,17 +422,12 @@ def repartition_rooms(
426422 G .remove_node (i )
427423
428424 new_rooms = get_rooms_from_mp3d_info (mp3d_info , angle_deg )
429-
430- if colors is None :
431- colors = sns .color_palette ("husl" , len (new_rooms ))
432-
433425 buildings = [node .id .value for node in G .get_layer (DsgLayers .BUILDINGS ).nodes ]
434426
435427 # add new room nodes and connect them to building node
436428 room_id_to_gt_index = dict () # map room node id in dsg to index in new_rooms
437429 for index , room in enumerate (new_rooms ):
438- color = np .array ([int (255 * c ) for c in colors [index % len (colors )]][:3 ])
439- attrs = room .get_attrs (color )
430+ attrs = room .get_attrs ()
440431
441432 room_id = room .get_id ()
442433 G .add_node (DsgLayers .ROOMS , room_id .value , attrs )
@@ -558,6 +549,7 @@ def add_gt_room_label(
558549 # check whether hydra room position is inside the ground-truth room
559550 if not mp3d_room .pos_on_same_floor (room .attributes .position ):
560551 continue
552+
561553 intersection_area = xy_polygon .intersection (hydra_polygon ).area
562554 union_area = xy_polygon .union (hydra_polygon ).area
563555 intersection_over_union .append ((idx , intersection_area / union_area ))
0 commit comments