3D IoU Calculator. Args: coordinate (str): The coordinate system, valid options are 'camera', 'lidar', and 'depth'.
| 56 | |
| 57 | @TASK_UTILS.register_module() |
| 58 | class BboxOverlaps3D(object): |
| 59 | """3D IoU Calculator. |
| 60 | |
| 61 | Args: |
| 62 | coordinate (str): The coordinate system, valid options are |
| 63 | 'camera', 'lidar', and 'depth'. |
| 64 | """ |
| 65 | |
| 66 | def __init__(self, coordinate): |
| 67 | assert coordinate in ['camera', 'lidar', 'depth'] |
| 68 | self.coordinate = coordinate |
| 69 | |
| 70 | def __call__(self, bboxes1, bboxes2, mode='iou'): |
| 71 | """Calculate 3D IoU using cuda implementation. |
| 72 | |
| 73 | Note: |
| 74 | This function calculate the IoU of 3D boxes based on their volumes. |
| 75 | IoU calculator ``:class:BboxOverlaps3D`` uses this function to |
| 76 | calculate the actual 3D IoUs of boxes. |
| 77 | |
| 78 | Args: |
| 79 | bboxes1 (torch.Tensor): with shape (N, 7+C), |
| 80 | (x, y, z, x_size, y_size, z_size, ry, v*). |
| 81 | bboxes2 (torch.Tensor): with shape (M, 7+C), |
| 82 | (x, y, z, x_size, y_size, z_size, ry, v*). |
| 83 | mode (str): "iou" (intersection over union) or |
| 84 | iof (intersection over foreground). |
| 85 | |
| 86 | Return: |
| 87 | torch.Tensor: Bbox overlaps results of bboxes1 and bboxes2 |
| 88 | with shape (M, N) (aligned mode is not supported currently). |
| 89 | """ |
| 90 | return bbox_overlaps_3d(bboxes1, bboxes2, mode, self.coordinate) |
| 91 | |
| 92 | def __repr__(self): |
| 93 | """str: return a string that describes the module""" |
| 94 | repr_str = self.__class__.__name__ |
| 95 | repr_str += f'(coordinate={self.coordinate}' |
| 96 | return repr_str |
| 97 | |
| 98 | |
| 99 | def bbox_overlaps_nearest_3d(bboxes1, |
nothing calls this directly
no outgoing calls
no test coverage detected