def _process_items(self, index, rgb_im, depth_im, instance, label, bbox, pose):
# print 'Processing pose', pose, bbox
# def _process_bbox(bbox):
# return dict(category=bbox['category'], target=UWRGBDDataset.target_hash[str(bbox['category'])],
# left=bbox.coords['left'], right=bbox['right'], top=bbox['top'], bottom=bbox['bottom'])
# # Compute bbox from pose and map (v2 support)
# if self.version == 'v1':
# if bbox is not None:
# bbox = [_process_bbox(bb) for bb in bbox]
# bbox = filter(lambda bb: bb['target'] in UWRGBDDataset.train_ids_set, bbox)
# if self.version == 'v2':
# if bbox is None and hasattr(self, 'map_info'):
# bbox = self.get_bboxes(pose)
# print 'Processing pose', pose, bbox
rgb_im = np.swapaxes(rgb_im, 0, 2)
rgb_im = cv2.cvtColor(rgb_im, cv2.COLOR_RGB2BGR)
depth_im = np.swapaxes(depth_im, 0, 1) * 1000
instance = np.swapaxes(instance, 0, 1)
label = np.swapaxes(label, 0, 1)
return AttrDict(index=index, img=rgb_im, depth=depth_im, instance=instance,
label=label, bbox=bbox if bbox is not None else [], pose=pose)
评论列表
文章目录