diff --git a/habitat/core/utils.py b/habitat/core/utils.py index e5b7f15bfcb3b28d895b3ac2b83a03d23c35003f..ff07b92197899903eec2c82063ed8910415cca96 100644 --- a/habitat/core/utils.py +++ b/habitat/core/utils.py @@ -12,6 +12,8 @@ import quaternion from habitat.utils.geometry_utils import quaternion_to_list +# Internals from inner json library needed for patching functionality in +# DatasetFloatJSONEncoder. try: from _json import encode_basestring_ascii except ImportError: @@ -108,12 +110,10 @@ def center_crop(obs, new_shape): class DatasetFloatJSONEncoder(json.JSONEncoder): + r"""JSON Encoder that sets a float precision for a space saving purpose and + encodes ndarray and quaternion. The encoder is compatible with JSON + version 2.0.9. """ - JSON Encoder that set float precision for space saving purpose. - """ - - # Version of JSON library that encoder is compatible with. - __version__ = "2.0.9" def default(self, object): # JSON doesn't support numpy ndarray and quaternion diff --git a/habitat/datasets/object_nav/object_nav_dataset.py b/habitat/datasets/object_nav/object_nav_dataset.py index 79836cb4f454daf6c033b61c0913ae043ba0279c..a595b26bdadf254969868feda27eefc4bd7fc8bb 100644 --- a/habitat/datasets/object_nav/object_nav_dataset.py +++ b/habitat/datasets/object_nav/object_nav_dataset.py @@ -25,7 +25,7 @@ class ObjectNavDatasetV1(PointNavDatasetV1): r"""Class inherited from PointNavDataset that loads Object Navigation dataset. """ category_to_task_category_id: Dict[str, int] - category_to_mp3d_category_id: Dict[str, int] + category_to_scene_annotation_category_id: Dict[str, int] episodes: List[NavigationEpisode] content_scenes_path: str = "{data_path}/content/{scene}.json.gz" @@ -45,17 +45,22 @@ class ObjectNavDatasetV1(PointNavDatasetV1): "category_to_task_category_id" ] + if "category_to_scene_annotation_category_id" in deserialized: + self.category_to_scene_annotation_category_id = deserialized[ + "category_to_scene_annotation_category_id" + ] + if "category_to_mp3d_category_id" in deserialized: - self.category_to_mp3d_category_id = deserialized[ + self.category_to_scene_annotation_category_id = deserialized[ "category_to_mp3d_category_id" ] assert len(self.category_to_task_category_id) == len( - self.category_to_mp3d_category_id + self.category_to_scene_annotation_category_id ) assert set(self.category_to_task_category_id.keys()) == set( - self.category_to_mp3d_category_id.keys() + self.category_to_scene_annotation_category_id.keys() ), "category_to_task and category_to_mp3d must have the same keys" for episode in deserialized["episodes"]: diff --git a/habitat/utils/visualizations/maps.py b/habitat/utils/visualizations/maps.py index b990333196c045448c4b02255548905fea80a2e2..d9ab319c6abdc73669449699297661a2c611fb49 100644 --- a/habitat/utils/visualizations/maps.py +++ b/habitat/utils/visualizations/maps.py @@ -43,14 +43,14 @@ TOP_DOWN_MAP_COLORS = np.full((256, 3), 150, dtype=np.uint8) TOP_DOWN_MAP_COLORS[10:] = cv2.applyColorMap( np.arange(246, dtype=np.uint8), cv2.COLORMAP_JET ).squeeze(1)[:, ::-1] -TOP_DOWN_MAP_COLORS[MAP_INVALID_POINT] = [255, 255, 255] -TOP_DOWN_MAP_COLORS[MAP_VALID_POINT] = [150, 150, 150] -TOP_DOWN_MAP_COLORS[MAP_BORDER_INDICATOR] = [50, 50, 50] -TOP_DOWN_MAP_COLORS[MAP_SOURCE_POINT_INDICATOR] = [0, 0, 200] -TOP_DOWN_MAP_COLORS[MAP_TARGET_POINT_INDICATOR] = [200, 0, 0] -TOP_DOWN_MAP_COLORS[MAP_SHORTEST_PATH_COLOR] = [0, 200, 0] -TOP_DOWN_MAP_COLORS[MAP_VIEW_POINT_INDICATOR] = [245, 150, 150] -TOP_DOWN_MAP_COLORS[MAP_TARGET_BOUNDING_BOX] = [0, 175, 0] +TOP_DOWN_MAP_COLORS[MAP_INVALID_POINT] = [255, 255, 255] # White +TOP_DOWN_MAP_COLORS[MAP_VALID_POINT] = [150, 150, 150] # Light Grey +TOP_DOWN_MAP_COLORS[MAP_BORDER_INDICATOR] = [50, 50, 50] # Grey +TOP_DOWN_MAP_COLORS[MAP_SOURCE_POINT_INDICATOR] = [0, 0, 200] # Blue +TOP_DOWN_MAP_COLORS[MAP_TARGET_POINT_INDICATOR] = [200, 0, 0] # Red +TOP_DOWN_MAP_COLORS[MAP_SHORTEST_PATH_COLOR] = [0, 200, 0] # Green +TOP_DOWN_MAP_COLORS[MAP_VIEW_POINT_INDICATOR] = [245, 150, 150] # Light Red +TOP_DOWN_MAP_COLORS[MAP_TARGET_BOUNDING_BOX] = [0, 175, 0] # Green def draw_agent(