Commit ec84da2b authored by zhangwenwei's avatar zhangwenwei
Browse files

Merge branch 'refine_docstrings' into 'master'

Refine mmdet3d docstrings

See merge request open-mmlab/mmdet.3d!135
parents a05dff6f b27919fc
...@@ -14,14 +14,14 @@ class BaseInstance3DBoxes(object): ...@@ -14,14 +14,14 @@ class BaseInstance3DBoxes(object):
the box is (0.5, 0.5, 0). the box is (0.5, 0.5, 0).
Args: Args:
tensor (torch.Tensor | np.ndarray | list): a Nxbox_dim matrix. tensor (torch.Tensor | np.ndarray | list): a N x box_dim matrix.
box_dim (int): number of the dimension of a box box_dim (int): number of the dimension of a box
Each row is (x, y, z, x_size, y_size, z_size, yaw). Each row is (x, y, z, x_size, y_size, z_size, yaw).
Default to 7. Default to 7.
with_yaw (bool): Whether the box is with yaw rotation. with_yaw (bool): Whether the box is with yaw rotation.
If False, the value of yaw will be set to 0 as minmax boxes. If False, the value of yaw will be set to 0 as minmax boxes.
Default to True. Default to True.
origin (tuple): The relative position of origin in the box. origin (tuple[float]): The relative position of origin in the box.
Default to (0.5, 0.5, 0). This will guide the box be converted to Default to (0.5, 0.5, 0). This will guide the box be converted to
(0.5, 0.5, 0) mode. (0.5, 0.5, 0) mode.
""" """
...@@ -228,7 +228,7 @@ class BaseInstance3DBoxes(object): ...@@ -228,7 +228,7 @@ class BaseInstance3DBoxes(object):
"""Convert self to `dst` mode. """Convert self to `dst` mode.
Args: Args:
dst (BoxMode): the target Box mode dst (:obj:`BoxMode`): the target Box mode
rt_mat (np.ndarray | torch.Tensor): The rotation and translation rt_mat (np.ndarray | torch.Tensor): The rotation and translation
matrix between different coordinates. Defaults to None. matrix between different coordinates. Defaults to None.
The conversion from `src` coordinates to `dst` coordinates The conversion from `src` coordinates to `dst` coordinates
...@@ -236,7 +236,7 @@ class BaseInstance3DBoxes(object): ...@@ -236,7 +236,7 @@ class BaseInstance3DBoxes(object):
to LiDAR. This requires a transformation matrix. to LiDAR. This requires a transformation matrix.
Returns: Returns:
BaseInstance3DBoxes: A new object of :class:`xxx` after indexing:
The converted box of the same type in the `dst` mode. The converted box of the same type in the `dst` mode.
""" """
pass pass
...@@ -295,8 +295,7 @@ class BaseInstance3DBoxes(object): ...@@ -295,8 +295,7 @@ class BaseInstance3DBoxes(object):
subject to Pytorch's indexing semantics. subject to Pytorch's indexing semantics.
Returns: Returns:
BaseInstance3DBoxes: Create a new :class:`BaseInstance3DBoxes` A new object of :class:`BaseInstances3DBoxes` after indexing.
by indexing.
""" """
original_type = type(self) original_type = type(self)
if isinstance(item, int): if isinstance(item, int):
...@@ -322,10 +321,10 @@ class BaseInstance3DBoxes(object): ...@@ -322,10 +321,10 @@ class BaseInstance3DBoxes(object):
"""Concatenates a list of Boxes into a single Boxes. """Concatenates a list of Boxes into a single Boxes.
Args: Args:
boxes_list (list[Boxes]): List of boxes. boxes_list (list[:obj:`BaseInstances3DBoxes`]): List of boxes.
Returns: Returns:
Boxes: The concatenated Boxes. :obj:`BaseInstances3DBoxes`: The concatenated Boxes.
""" """
assert isinstance(boxes_list, (list, tuple)) assert isinstance(boxes_list, (list, tuple))
if len(boxes_list) == 0: if len(boxes_list) == 0:
...@@ -360,7 +359,8 @@ class BaseInstance3DBoxes(object): ...@@ -360,7 +359,8 @@ class BaseInstance3DBoxes(object):
"""Clone the Boxes. """Clone the Boxes.
Returns: Returns:
BaseInstance3DBoxes: Box object with the same properties as self. :obj:`BaseInstance3DBoxes`: Box object with the same properties
as self.
""" """
original_type = type(self) original_type = type(self)
return original_type( return original_type(
...@@ -388,8 +388,8 @@ class BaseInstance3DBoxes(object): ...@@ -388,8 +388,8 @@ class BaseInstance3DBoxes(object):
boxes2, boxes1 and boxes2 should be in the same type. boxes2, boxes1 and boxes2 should be in the same type.
Args: Args:
boxes1 (:obj:BaseInstanceBoxes): Boxes 1 contain N boxes. boxes1 (:obj:`BaseInstanceBoxes`): Boxes 1 contain N boxes.
boxes2 (:obj:BaseInstanceBoxes): Boxes 2 contain M boxes. boxes2 (:obj:`BaseInstanceBoxes`): Boxes 2 contain M boxes.
mode (str, optional): Mode of iou calculation. Defaults to 'iou'. mode (str, optional): Mode of iou calculation. Defaults to 'iou'.
Returns: Returns:
...@@ -420,8 +420,8 @@ class BaseInstance3DBoxes(object): ...@@ -420,8 +420,8 @@ class BaseInstance3DBoxes(object):
boxes1 and boxes2 are not necessarily to be in the same type. boxes1 and boxes2 are not necessarily to be in the same type.
Args: Args:
boxes1 (:obj:BaseInstanceBoxes): Boxes 1 contain N boxes. boxes1 (:obj:`BaseInstanceBoxes`): Boxes 1 contain N boxes.
boxes2 (:obj:BaseInstanceBoxes): Boxes 2 contain M boxes. boxes2 (:obj:`BaseInstanceBoxes`): Boxes 2 contain M boxes.
mode (str, optional): Mode of iou calculation. Defaults to 'iou'. mode (str, optional): Mode of iou calculation. Defaults to 'iou'.
Returns: Returns:
...@@ -479,7 +479,7 @@ class BaseInstance3DBoxes(object): ...@@ -479,7 +479,7 @@ class BaseInstance3DBoxes(object):
returned Tensor copies. returned Tensor copies.
Returns: Returns:
BaseInstance3DBoxes: A new bbox with data and other :obj:`BaseInstance3DBoxes`: A new bbox with data and other
properties are similar to self. properties are similar to self.
""" """
new_tensor = self.tensor.new_tensor(data) \ new_tensor = self.tensor.new_tensor(data) \
......
...@@ -13,6 +13,7 @@ class Box3DMode(IntEnum): ...@@ -13,6 +13,7 @@ class Box3DMode(IntEnum):
r"""Enum of different ways to represent a box. r"""Enum of different ways to represent a box.
Coordinates in LiDAR: Coordinates in LiDAR:
.. code-block:: none .. code-block:: none
up z up z
...@@ -25,6 +26,7 @@ class Box3DMode(IntEnum): ...@@ -25,6 +26,7 @@ class Box3DMode(IntEnum):
and the yaw is around the z axis, thus the rotation axis=2. and the yaw is around the z axis, thus the rotation axis=2.
Coordinates in camera: Coordinates in camera:
.. code-block:: none .. code-block:: none
z front z front
...@@ -40,6 +42,7 @@ class Box3DMode(IntEnum): ...@@ -40,6 +42,7 @@ class Box3DMode(IntEnum):
and the yaw is around the y axis, thus the rotation axis=1. and the yaw is around the y axis, thus the rotation axis=1.
Coordinates in Depth mode: Coordinates in Depth mode:
.. code-block:: none .. code-block:: none
up z up z
......
...@@ -9,6 +9,7 @@ class CameraInstance3DBoxes(BaseInstance3DBoxes): ...@@ -9,6 +9,7 @@ class CameraInstance3DBoxes(BaseInstance3DBoxes):
"""3D boxes of instances in CAM coordinates. """3D boxes of instances in CAM coordinates.
Coordinates in camera: Coordinates in camera:
.. code-block:: none .. code-block:: none
z front (yaw=0.5*pi) z front (yaw=0.5*pi)
...@@ -124,7 +125,7 @@ class CameraInstance3DBoxes(BaseInstance3DBoxes): ...@@ -124,7 +125,7 @@ class CameraInstance3DBoxes(BaseInstance3DBoxes):
"""Calculate the 2D bounding boxes in BEV with rotation. """Calculate the 2D bounding boxes in BEV with rotation.
Returns: Returns:
torch.Tensor: A nx5 tensor of 2D BEV box of each box. torch.Tensor: A n x 5 tensor of 2D BEV box of each box.
The box is in XYWHR format. The box is in XYWHR format.
""" """
return self.tensor[:, [0, 2, 3, 5, 6]] return self.tensor[:, [0, 2, 3, 5, 6]]
...@@ -249,8 +250,8 @@ class CameraInstance3DBoxes(BaseInstance3DBoxes): ...@@ -249,8 +250,8 @@ class CameraInstance3DBoxes(BaseInstance3DBoxes):
boxes2, boxes1 and boxes2 should be in the same type. boxes2, boxes1 and boxes2 should be in the same type.
Args: Args:
boxes1 (:obj:BaseInstanceBoxes): Boxes 1 contain N boxes. boxes1 (:obj:`BaseInstanceBoxes`): Boxes 1 contain N boxes.
boxes2 (:obj:BaseInstanceBoxes): Boxes 2 contain M boxes. boxes2 (:obj:`BaseInstanceBoxes`): Boxes 2 contain M boxes.
mode (str, optional): Mode of iou calculation. Defaults to 'iou'. mode (str, optional): Mode of iou calculation. Defaults to 'iou'.
Returns: Returns:
...@@ -278,7 +279,7 @@ class CameraInstance3DBoxes(BaseInstance3DBoxes): ...@@ -278,7 +279,7 @@ class CameraInstance3DBoxes(BaseInstance3DBoxes):
"""Convert self to `dst` mode. """Convert self to `dst` mode.
Args: Args:
dst (BoxMode): The target Box mode. dst (:obj:`BoxMode`): The target Box mode.
rt_mat (np.dnarray | torch.Tensor): The rotation and translation rt_mat (np.dnarray | torch.Tensor): The rotation and translation
matrix between different coordinates. Defaults to None. matrix between different coordinates. Defaults to None.
The conversion from `src` coordinates to `dst` coordinates The conversion from `src` coordinates to `dst` coordinates
......
...@@ -10,6 +10,7 @@ class DepthInstance3DBoxes(BaseInstance3DBoxes): ...@@ -10,6 +10,7 @@ class DepthInstance3DBoxes(BaseInstance3DBoxes):
"""3D boxes of instances in Depth coordinates. """3D boxes of instances in Depth coordinates.
Coordinates in Depth: Coordinates in Depth:
.. code-block:: none .. code-block:: none
up z y front (yaw=0.5*pi) up z y front (yaw=0.5*pi)
...@@ -24,7 +25,7 @@ class DepthInstance3DBoxes(BaseInstance3DBoxes): ...@@ -24,7 +25,7 @@ class DepthInstance3DBoxes(BaseInstance3DBoxes):
the positive direction of x to the positive direction of y. the positive direction of x to the positive direction of y.
Args: Args:
tensor (Tensor): Float matrix of N x box_dim. tensor (torch.Tensor): Float matrix of N x box_dim.
box_dim (int): Integer indicates the dimension of a box box_dim (int): Integer indicates the dimension of a box
Each row is (x, y, z, x_size, y_size, z_size, yaw, ...). Each row is (x, y, z, x_size, y_size, z_size, yaw, ...).
with_yaw (bool): If True, the value of yaw will be set to 0 as minmax with_yaw (bool): If True, the value of yaw will be set to 0 as minmax
...@@ -92,7 +93,7 @@ class DepthInstance3DBoxes(BaseInstance3DBoxes): ...@@ -92,7 +93,7 @@ class DepthInstance3DBoxes(BaseInstance3DBoxes):
"""Calculate the 2D bounding boxes in BEV with rotation. """Calculate the 2D bounding boxes in BEV with rotation.
Returns: Returns:
torch.Tensor: A nx5 tensor of 2D BEV box of each box. torch.Tensor: A n x 5 tensor of 2D BEV box of each box.
The box is in XYWHR format. The box is in XYWHR format.
""" """
return self.tensor[:, [0, 1, 3, 4, 6]] return self.tensor[:, [0, 1, 3, 4, 6]]
...@@ -222,7 +223,7 @@ class DepthInstance3DBoxes(BaseInstance3DBoxes): ...@@ -222,7 +223,7 @@ class DepthInstance3DBoxes(BaseInstance3DBoxes):
"""Convert self to `dst` mode. """Convert self to `dst` mode.
Args: Args:
dst (BoxMode): The target Box mode. dst (:obj:`BoxMode`): The target Box mode.
rt_mat (np.ndarray | torch.Tensor): The rotation and translation rt_mat (np.ndarray | torch.Tensor): The rotation and translation
matrix between different coordinates. Defaults to None. matrix between different coordinates. Defaults to None.
The conversion from `src` coordinates to `dst` coordinates The conversion from `src` coordinates to `dst` coordinates
...@@ -230,7 +231,7 @@ class DepthInstance3DBoxes(BaseInstance3DBoxes): ...@@ -230,7 +231,7 @@ class DepthInstance3DBoxes(BaseInstance3DBoxes):
to LiDAR. This requires a transformation matrix. to LiDAR. This requires a transformation matrix.
Returns: Returns:
BaseInstance3DBoxes: :obj:`BaseInstance3DBoxes`:
The converted box of the same type in the `dst` mode. The converted box of the same type in the `dst` mode.
""" """
from .box_3d_mode import Box3DMode from .box_3d_mode import Box3DMode
......
...@@ -10,6 +10,7 @@ class LiDARInstance3DBoxes(BaseInstance3DBoxes): ...@@ -10,6 +10,7 @@ class LiDARInstance3DBoxes(BaseInstance3DBoxes):
"""3D boxes of instances in LIDAR coordinates. """3D boxes of instances in LIDAR coordinates.
Coordinates in LiDAR: Coordinates in LiDAR:
.. code-block:: none .. code-block:: none
up z x front (yaw=0.5*pi) up z x front (yaw=0.5*pi)
...@@ -216,7 +217,7 @@ class LiDARInstance3DBoxes(BaseInstance3DBoxes): ...@@ -216,7 +217,7 @@ class LiDARInstance3DBoxes(BaseInstance3DBoxes):
"""Convert self to `dst` mode. """Convert self to `dst` mode.
Args: Args:
dst (BoxMode): the target Box mode dst (:obj:`BoxMode`): the target Box mode
rt_mat (np.ndarray | torch.Tensor): The rotation and translation rt_mat (np.ndarray | torch.Tensor): The rotation and translation
matrix between different coordinates. Defaults to None. matrix between different coordinates. Defaults to None.
The conversion from `src` coordinates to `dst` coordinates The conversion from `src` coordinates to `dst` coordinates
...@@ -224,7 +225,7 @@ class LiDARInstance3DBoxes(BaseInstance3DBoxes): ...@@ -224,7 +225,7 @@ class LiDARInstance3DBoxes(BaseInstance3DBoxes):
to LiDAR. This requires a transformation matrix. to LiDAR. This requires a transformation matrix.
Returns: Returns:
BaseInstance3DBoxes: :obj:`BaseInstance3DBoxes`:
The converted box of the same type in the `dst` mode. The converted box of the same type in the `dst` mode.
""" """
from .box_3d_mode import Box3DMode from .box_3d_mode import Box3DMode
...@@ -238,7 +239,7 @@ class LiDARInstance3DBoxes(BaseInstance3DBoxes): ...@@ -238,7 +239,7 @@ class LiDARInstance3DBoxes(BaseInstance3DBoxes):
extra_width (float | torch.Tensor): extra width to enlarge the box extra_width (float | torch.Tensor): extra width to enlarge the box
Returns: Returns:
:obj:LiDARInstance3DBoxes: enlarged boxes :obj:`LiDARInstance3DBoxes`: enlarged boxes
""" """
enlarged_boxes = self.tensor.clone() enlarged_boxes = self.tensor.clone()
enlarged_boxes[:, 3:6] += extra_width * 2 enlarged_boxes[:, 3:6] += extra_width * 2
...@@ -250,7 +251,7 @@ class LiDARInstance3DBoxes(BaseInstance3DBoxes): ...@@ -250,7 +251,7 @@ class LiDARInstance3DBoxes(BaseInstance3DBoxes):
"""Find the box which the points are in. """Find the box which the points are in.
Args: Args:
points (:obj:torch.Tensor): Points in shape Nx3 points (torch.Tensor): Points in shape Nx3
Returns: Returns:
torch.Tensor: The index of box where each point are in. torch.Tensor: The index of box where each point are in.
......
...@@ -2,7 +2,17 @@ import torch ...@@ -2,7 +2,17 @@ import torch
def bbox3d_mapping_back(bboxes, scale_factor, flip_horizontal, flip_vertical): def bbox3d_mapping_back(bboxes, scale_factor, flip_horizontal, flip_vertical):
"""Map bboxes from testing scale to original image scale.""" """Map bboxes from testing scale to original image scale.
Args:
bboxes (:obj:`BaseInstance3DBoxes`): Boxes to be mapped back.
scale_factor (float): Scale factor.
flip_horizontal (bool): Whether to flip horizontally.
flip_vertical (bool): Whether to flip vertically.
Returns:
:obj:`BaseInstance3DBoxes`: Boxes mapped back.
"""
new_bboxes = bboxes.clone() new_bboxes = bboxes.clone()
if flip_horizontal: if flip_horizontal:
new_bboxes.flip('horizontal') new_bboxes.flip('horizontal')
...@@ -44,7 +54,11 @@ def bbox3d2result(bboxes, scores, labels): ...@@ -44,7 +54,11 @@ def bbox3d2result(bboxes, scores, labels):
scores (torch.Tensor): shape (n, ) scores (torch.Tensor): shape (n, )
Returns: Returns:
dict(torch.Tensor): Bbox results in cpu mode. dict[str, torch.Tensor]: Bbox results in cpu mode.
- boxes_3d (torch.Tensor): 3D boxes
- scores (torch.Tensor): prediction scores
- labels_3d (torch.Tensor): box labels
""" """
return dict( return dict(
boxes_3d=bboxes.to('cpu'), boxes_3d=bboxes.to('cpu'),
......
...@@ -14,7 +14,7 @@ def load_lyft_gts(lyft, data_root, eval_split, logger=None): ...@@ -14,7 +14,7 @@ def load_lyft_gts(lyft, data_root, eval_split, logger=None):
"""Loads ground truth boxes from database. """Loads ground truth boxes from database.
Args: Args:
lyft (:obj:``LyftDataset``): Lyft class in the sdk. lyft (:obj:`LyftDataset`): Lyft class in the sdk.
data_root (str): Root of data for reading splits. data_root (str): Root of data for reading splits.
eval_split (str): Name of the split for evaluation. eval_split (str): Name of the split for evaluation.
logger (logging.Logger | str | None): Logger used for printing logger (logging.Logger | str | None): Logger used for printing
......
...@@ -27,7 +27,8 @@ def box3d_multiclass_nms(mlvl_bboxes, ...@@ -27,7 +27,8 @@ def box3d_multiclass_nms(mlvl_bboxes,
of direction classifier. Defaults to None. of direction classifier. Defaults to None.
Returns: Returns:
tuple: Return (bboxes, scores, labels, dir_scores). tuple[torch.Tensor]: Return results after nms, including 3D
bounding boxes, scores, labels and direction scores.
""" """
# do multi class nms # do multi class nms
# the fg class id range: [0, num_classes-1] # the fg class id range: [0, num_classes-1]
......
...@@ -112,7 +112,7 @@ class Custom3DDataset(Dataset): ...@@ -112,7 +112,7 @@ class Custom3DDataset(Dataset):
"""Initialization before data preparation. """Initialization before data preparation.
Args: Args:
dict: Dict before data preprocessing. results (dict): Dict before data preprocessing.
- img_fields (list): image fields - img_fields (list): image fields
- bbox3d_fields (list): 3D bounding boxes fields - bbox3d_fields (list): 3D bounding boxes fields
......
...@@ -19,10 +19,10 @@ class KittiDataset(Custom3DDataset): ...@@ -19,10 +19,10 @@ class KittiDataset(Custom3DDataset):
This class serves as the API for experiments on the KITTI Dataset. This class serves as the API for experiments on the KITTI Dataset.
Please refer to `<http://www.cvlibs.net/datasets/kitti/eval_object.php? Please refer to
obj_benchmark=3d>`_for data downloading. It is recommended to symlink `<http://www.cvlibs.net/datasets/kitti/eval_object.php?obj_benchmark=3d>`_
the dataset root to $MMDETECTION3D/data and organize them as the doc for data downloading. It is recommended to symlink the dataset root to
shows. $MMDETECTION3D/data and organize them as the doc shows.
Args: Args:
data_root (str): Path of dataset root. data_root (str): Path of dataset root.
...@@ -461,14 +461,14 @@ class KittiDataset(Custom3DDataset): ...@@ -461,14 +461,14 @@ class KittiDataset(Custom3DDataset):
"""Convert results to kitti format for evaluation and test submission. """Convert results to kitti format for evaluation and test submission.
Args: Args:
net_outputs (List[np.ndarray]): list of array storing the net_outputs (list[np.ndarray]): list of array storing the
bbox and score bbox and score
class_nanes (List[String]): A list of class names class_nanes (list[String]): A list of class names
pklfile_prefix (str | None): The prefix of pkl file. pklfile_prefix (str | None): The prefix of pkl file.
submission_prefix (str | None): The prefix of submission file. submission_prefix (str | None): The prefix of submission file.
Returns: Returns:
List[dict]: A list of dict have the kitti format list[dict]: A list of dict have the kitti format
""" """
assert len(net_outputs) == len(self.data_infos) assert len(net_outputs) == len(self.data_infos)
...@@ -633,7 +633,7 @@ class KittiDataset(Custom3DDataset): ...@@ -633,7 +633,7 @@ class KittiDataset(Custom3DDataset):
"""Results visualization. """Results visualization.
Args: Args:
results (list[dict]): List of bounding boxes results. results (list[dict]): list of bounding boxes results.
out_dir (str): Output directory of visualization result. out_dir (str): Output directory of visualization result.
""" """
assert out_dir is not None, 'Expect out_dir, got none.' assert out_dir is not None, 'Expect out_dir, got none.'
......
...@@ -21,8 +21,8 @@ class LyftDataset(Custom3DDataset): ...@@ -21,8 +21,8 @@ class LyftDataset(Custom3DDataset):
This class serves as the API for experiments on the Lyft Dataset. This class serves as the API for experiments on the Lyft Dataset.
Please refer to Please refer to
`<https://www.kaggle.com/c/3d-object-detection-for-autonomous-vehicles `<https://www.kaggle.com/c/3d-object-detection-for-autonomous-vehicles/data>`_ # noqa
/data>`_for data downloading. It is recommended to symlink the dataset for data downloading. It is recommended to symlink the dataset
root to $MMDETECTION3D/data and organize them as the doc shows. root to $MMDETECTION3D/data and organize them as the doc shows.
Args: Args:
......
...@@ -443,7 +443,7 @@ class NuScenesDataset(Custom3DDataset): ...@@ -443,7 +443,7 @@ class NuScenesDataset(Custom3DDataset):
Default: None. Default: None.
Returns: Returns:
dict[str: float] dict[str, float]: results of each evaluation metric
""" """
result_files, tmp_dir = self.format_results(results, jsonfile_prefix) result_files, tmp_dir = self.format_results(results, jsonfile_prefix)
......
...@@ -191,7 +191,7 @@ class DataBaseSampler(object): ...@@ -191,7 +191,7 @@ class DataBaseSampler(object):
- gt_labels_3d (np.ndarray): labels of ground truths: - gt_labels_3d (np.ndarray): labels of ground truths:
labels of sampled ground truths labels of sampled ground truths
- gt_bboxes_3d (:obj:``BaseInstance3DBoxes``): - gt_bboxes_3d (:obj:`BaseInstance3DBoxes`):
sampled 3D bounding boxes sampled 3D bounding boxes
- points (np.ndarray): sampled points - points (np.ndarray): sampled points
- group_ids (np.ndarray): ids of sampled ground truths - group_ids (np.ndarray): ids of sampled ground truths
......
...@@ -423,15 +423,16 @@ class IndoorPointSample(object): ...@@ -423,15 +423,16 @@ class IndoorPointSample(object):
Sample points to a certain number. Sample points to a certain number.
Args: Args:
points (ndarray): 3D Points. points (np.ndarray): 3D Points.
num_samples (int): Number of samples to be sampled. num_samples (int): Number of samples to be sampled.
replace (bool): Whether the sample is with or without replacement. replace (bool): Whether the sample is with or without replacement.
return_choices (bool): Whether return choice. return_choices (bool): Whether return choice.
Returns: Returns:
tuple (np.ndarray, np.ndarray) | np.ndarray: tuple[np.ndarray] | np.ndarray:
points (np.ndarray): 3D Points.
choices (np.ndarray, optional): The generated random samples. - points (np.ndarray): 3D Points.
- choices (np.ndarray, optional): The generated random samples.
""" """
if replace is None: if replace is None:
replace = (points.shape[0] < num_samples) replace = (points.shape[0] < num_samples)
......
...@@ -13,8 +13,8 @@ class ScanNetDataset(Custom3DDataset): ...@@ -13,8 +13,8 @@ class ScanNetDataset(Custom3DDataset):
This class serves as the API for experiments on the ScanNet Dataset. This class serves as the API for experiments on the ScanNet Dataset.
Please refer to `<https://github.com/ScanNet/ScanNet>`_for data Please refer to `<https://github.com/ScanNet/ScanNet>`_
downloading. It is recommended to symlink the dataset root to for data downloading. It is recommended to symlink the dataset root to
$MMDETECTION3D/data and organize them as the doc shows. $MMDETECTION3D/data and organize them as the doc shows.
Args: Args:
...@@ -73,7 +73,7 @@ class ScanNetDataset(Custom3DDataset): ...@@ -73,7 +73,7 @@ class ScanNetDataset(Custom3DDataset):
dict: Standard annotation dictionary dict: Standard annotation dictionary
consists of the data information. consists of the data information.
- gt_bboxes_3d (:obj:``DepthInstance3DBoxes``): - gt_bboxes_3d (:obj:`DepthInstance3DBoxes`):
3D ground truth bboxes 3D ground truth bboxes
- gt_labels_3d (np.ndarray): labels of ground truths - gt_labels_3d (np.ndarray): labels of ground truths
- pts_instance_mask_path (str): path of instance masks - pts_instance_mask_path (str): path of instance masks
......
...@@ -115,17 +115,17 @@ class PointNet2SASSG(nn.Module): ...@@ -115,17 +115,17 @@ class PointNet2SASSG(nn.Module):
"""Forward pass. """Forward pass.
Args: Args:
points (Tensor): point coordinates with features, points (torch.Tensor): point coordinates with features,
with shape (B, N, 3 + input_feature_dim). with shape (B, N, 3 + input_feature_dim).
Returns: Returns:
dict[str, list[Tensor]]: outputs after SA and FP modules. dict[str, list[torch.Tensor]]: outputs after SA and FP modules.
- fp_xyz (list[Tensor]): contains the coordinates of - fp_xyz (list[torch.Tensor]): contains the coordinates of
each fp features. each fp features.
- fp_features (list[Tensor]): contains the features - fp_features (list[torch.Tensor]): contains the features
from each Feature Propagate Layers. from each Feature Propagate Layers.
- fp_indices (list[Tensor]): contains indices of the - fp_indices (list[torch.Tensor]): contains indices of the
input points. input points.
""" """
xyz, features = self._split_point_feats(points) xyz, features = self._split_point_feats(points)
......
...@@ -356,7 +356,7 @@ class Anchor3DHead(nn.Module, AnchorTrainMixin): ...@@ -356,7 +356,7 @@ class Anchor3DHead(nn.Module, AnchorTrainMixin):
dir_cls_preds (list[torch.Tensor]): Multi-level direction dir_cls_preds (list[torch.Tensor]): Multi-level direction
class predictions. class predictions.
input_metas (list[dict]): Contain pcd and img's meta info. input_metas (list[dict]): Contain pcd and img's meta info.
cfg (None | ConfigDict): Training or testing config. cfg (None | :obj:`ConfigDict`): Training or testing config.
rescale (list[torch.Tensor]): whether th rescale bbox. rescale (list[torch.Tensor]): whether th rescale bbox.
Returns: Returns:
...@@ -410,7 +410,7 @@ class Anchor3DHead(nn.Module, AnchorTrainMixin): ...@@ -410,7 +410,7 @@ class Anchor3DHead(nn.Module, AnchorTrainMixin):
mlvl_anchors (List[torch.Tensor]): Multi-level anchors mlvl_anchors (List[torch.Tensor]): Multi-level anchors
in single batch. in single batch.
input_meta (list[dict]): Contain pcd and img's meta info. input_meta (list[dict]): Contain pcd and img's meta info.
cfg (None | ConfigDict): Training or testing config. cfg (None | :obj:`ConfigDict`): Training or testing config.
rescale (list[torch.Tensor]): whether th rescale bbox. rescale (list[torch.Tensor]): whether th rescale bbox.
Returns: Returns:
......
...@@ -139,7 +139,7 @@ class PartA2RPNHead(Anchor3DHead): ...@@ -139,7 +139,7 @@ class PartA2RPNHead(Anchor3DHead):
mlvl_anchors (List[torch.Tensor]): Multi-level anchors mlvl_anchors (List[torch.Tensor]): Multi-level anchors
in single batch. in single batch.
input_meta (list[dict]): Contain pcd and img's meta info. input_meta (list[dict]): Contain pcd and img's meta info.
cfg (None | ConfigDict): Training or testing config. cfg (None | :obj:`ConfigDict`): Training or testing config.
rescale (list[torch.Tensor]): whether th rescale bbox. rescale (list[torch.Tensor]): whether th rescale bbox.
Returns: Returns:
...@@ -236,7 +236,7 @@ class PartA2RPNHead(Anchor3DHead): ...@@ -236,7 +236,7 @@ class PartA2RPNHead(Anchor3DHead):
Multi-level bbox. Multi-level bbox.
score_thr (int): Score threshold. score_thr (int): Score threshold.
max_num (int): Max number of bboxes after nms. max_num (int): Max number of bboxes after nms.
cfg (None | ConfigDict): Training or testing config. cfg (None | :obj:`ConfigDict`): Training or testing config.
input_meta (dict): Contain pcd and img's meta info. input_meta (dict): Contain pcd and img's meta info.
Returns: Returns:
......
...@@ -21,7 +21,7 @@ class VoteHead(nn.Module): ...@@ -21,7 +21,7 @@ class VoteHead(nn.Module):
Args: Args:
num_classes (int): The number of class. num_classes (int): The number of class.
bbox_coder (BaseBBoxCoder): Bbox coder for encoding and bbox_coder (:obj:`BaseBBoxCoder`): Bbox coder for encoding and
decoding boxes. decoding boxes.
train_cfg (dict): Config for training. train_cfg (dict): Config for training.
test_cfg (dict): Config for testing. test_cfg (dict): Config for testing.
......
...@@ -229,9 +229,9 @@ class PointFusion(nn.Module): ...@@ -229,9 +229,9 @@ class PointFusion(nn.Module):
"""Forward function. """Forward function.
Args: Args:
img_feats (list[Tensor]): img features img_feats (list[torch.Tensor]): img features
pts: [list[Tensor]]: a batch of points with shape Nx3 pts: [list[torch.Tensor]]: a batch of points with shape Nx3
pts_feats (Tensor): a tensor consist of point features of the pts_feats (torch.Tensor): a tensor consist of point features of the
total batch total batch
img_metas (list[dict]): meta information of images img_metas (list[dict]): meta information of images
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment