Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions mmdet3d/datasets/convert_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,15 @@ def get_kitti_style_2d_boxes(info: dict,
belong to. In KITTI, typically only CAM 2 will be used,
and in Waymo, multi cameras could be used.
Defaults to 2.
occluded (tuple[int]): Integer (0, 1, 2, 3) indicating occlusion state:
0 = fully visible, 1 = partly occluded, 2 = largely occluded,
3 = unknown, -1 = DontCare.
occluded (tuple[int], optional): Integer (0, 1, 2, 3) indicating
occlusion state: 0 = fully visible, 1 = partly occluded,
2 = largely occluded, 3 = unknown, -1 = DontCare.
Defaults to (0, 1, 2, 3).
annos (dict, optional): Original annotations.
mono3d (bool): Whether to get boxes with mono3d annotation.
annos (dict, optional): Original annotations. Defaults to None.
mono3d (bool, optional): Whether to get boxes with mono3d annotation.
Defaults to True.
dataset (str): Dataset name of getting 2d bboxes.
Defaults to `kitti`.
dataset (str, optional): Dataset name of getting 2d bboxes.
Defaults to 'kitti'.

Return:
list[dict]: List of 2d / mono3d annotation record that
Expand Down Expand Up @@ -344,10 +344,11 @@ def post_process_coords(
Args:
corner_coords (list[int]): Corner coordinates of reprojected
bounding box.
imsize (tuple[int]): Size of the image canvas.
imsize (tuple[int], optional): Size of the image canvas.
Defaults to (1600, 900).

Return:
tuple [float]: Intersection of the convex hull of the 2D box
tuple[float]: Intersection of the convex hull of the 2D box
corners and the image canvas.
"""
polygon_from_2d_box = MultiPoint(corner_coords).convex_hull
Expand Down Expand Up @@ -383,11 +384,11 @@ def generate_record(ann_rec: dict, x1: float, y1: float, x2: float, y2: float,

Returns:
dict: A sample 2d annotation record.
- bbox_label (int): 2d box label id
- bbox_label_3d (int): 3d box label id
- bbox (list[float]): left x, top y, right x, bottom y
of 2d box
- bbox_3d_isvalid (bool): whether the box is valid

- bbox_label (int): 2d box label id
- bbox_label_3d (int): 3d box label id
- bbox (list[float]): left x, top y, right x, bottom y of 2d box
- bbox_3d_isvalid (bool): whether the box is valid
"""

if dataset == 'nuscenes':
Expand All @@ -398,17 +399,17 @@ def generate_record(ann_rec: dict, x1: float, y1: float, x2: float, y2: float,
cat_name = NuScenesNameMapping[cat_name]
categories = nus_categories
else:
cat_name = ann_rec['name']
if cat_name not in categories:
return None

if dataset == 'kitti':
categories = kitti_categories
elif dataset == 'waymo':
categories = waymo_categories
else:
raise NotImplementedError('Unsupported dataset!')

cat_name = ann_rec['name']
if cat_name not in categories:
return None

rec = dict()
rec['bbox_label'] = categories.index(cat_name)
rec['bbox_label_3d'] = rec['bbox_label']
Expand Down