Gets object info from simulator directly
(
self,
controller,
depth,
override_metadata=False,
include_picked_up=False,
)
| 1060 | return masks |
| 1061 | |
| 1062 | def get_objects_gt( |
| 1063 | self, |
| 1064 | controller, |
| 1065 | depth, |
| 1066 | override_metadata=False, |
| 1067 | include_picked_up=False, |
| 1068 | ): |
| 1069 | ''' |
| 1070 | Gets object info from simulator directly |
| 1071 | ''' |
| 1072 | |
| 1073 | origin_T_camX = utils.aithor.get_origin_T_camX(controller.last_event, False).cuda() |
| 1074 | |
| 1075 | semantic = controller.last_event.instance_segmentation_frame |
| 1076 | object_id_to_color = controller.last_event.object_id_to_color |
| 1077 | color_to_object_id = controller.last_event.color_to_object_id |
| 1078 | |
| 1079 | obj_ids = np.unique(semantic.reshape(-1, semantic.shape[2]), axis=0) |
| 1080 | |
| 1081 | obj_metadata_IDs = [] |
| 1082 | for obj_m in controller.last_event.metadata['objects']: #objects: |
| 1083 | obj_metadata_IDs.append(obj_m['objectId']) |
| 1084 | |
| 1085 | instance_masks = controller.last_event.instance_masks |
| 1086 | instance_detections2d = controller.last_event.instance_detections2D |
| 1087 | obj_meta_all = controller.last_event.metadata['objects'] |
| 1088 | |
| 1089 | bboxes = [] |
| 1090 | labels = [] |
| 1091 | scores = [] |
| 1092 | centroids = [] |
| 1093 | attributes = [] |
| 1094 | |
| 1095 | if args.use_gt_metadata and not override_metadata: |
| 1096 | idxs = obj_metadata_IDs |
| 1097 | else: |
| 1098 | idxs = [] |
| 1099 | for object_id in instance_masks.keys(): #range(obj_ids.shape[0]): |
| 1100 | |
| 1101 | if object_id not in obj_metadata_IDs: |
| 1102 | continue |
| 1103 | |
| 1104 | idxs.append(object_id) |
| 1105 | |
| 1106 | for object_id in idxs: |
| 1107 | |
| 1108 | obj_meta_index = obj_metadata_IDs.index(object_id) |
| 1109 | obj_meta = obj_meta_all[obj_meta_index] |
| 1110 | |
| 1111 | obj_category_name = obj_meta['objectType'] |
| 1112 | |
| 1113 | if obj_category_name not in self.name_to_id: |
| 1114 | continue |
| 1115 | |
| 1116 | if obj_category_name=="Sink": |
| 1117 | continue |
| 1118 | |
| 1119 | if not include_picked_up and ((obj_meta['pickupable'] and obj_meta['isPickedUp']) or (obj_meta['pickupable'] and obj_meta['parentReceptacles'] is None)): |
no test coverage detected