Commit b27919fc authored by wangtai's avatar wangtai Committed by zhangwenwei
Browse files

Update mmdet3d/core/bbox/structures/base_box3d.py,...

Update mmdet3d/core/bbox/structures/base_box3d.py, mmdet3d/core/bbox/structures/lidar_box3d.py, mmdet3d/core/post_processing/box3d_nms.py files
parent a05dff6f
...@@ -14,12 +14,12 @@ def chamfer_distance(src, ...@@ -14,12 +14,12 @@ def chamfer_distance(src,
"""Calculate Chamfer Distance of two sets. """Calculate Chamfer Distance of two sets.
Args: Args:
src (Tensor): Source set with shape [B, N, C] to src (torch.Tensor): Source set with shape [B, N, C] to
calculate Chamfer Distance. calculate Chamfer Distance.
dst (Tensor): Destination set with shape [B, M, C] to dst (torch.Tensor): Destination set with shape [B, M, C] to
calculate Chamfer Distance. calculate Chamfer Distance.
src_weight (Tensor or float): Weight of source loss. src_weight (torch.Tensor or float): Weight of source loss.
dst_weight (Tensor or float): Weight of destination loss. dst_weight (torch.Tensor or float): Weight of destination loss.
criterion_mode (str): Criterion mode to calculate distance. criterion_mode (str): Criterion mode to calculate distance.
The valid modes are smooth_l1, l1 or l2. The valid modes are smooth_l1, l1 or l2.
reduction (str): Method to reduce losses. reduction (str): Method to reduce losses.
...@@ -27,12 +27,14 @@ def chamfer_distance(src, ...@@ -27,12 +27,14 @@ def chamfer_distance(src,
Returns: Returns:
tuple: Source and Destination loss with indices. tuple: Source and Destination loss with indices.
- loss_src (Tensor): The min distance from source to destination. - loss_src (torch.Tensor): The min distance
- loss_dst (Tensor): The min distance from destination to source. from source to destination.
- indices1 (Tensor): Index the min distance point for each point - loss_dst (torch.Tensor): The min distance
in source to destination. from destination to source.
- indices2 (Tensor): Index the min distance point for each point - indices1 (torch.Tensor): Index the min distance point
in destination to source. for each point in source to destination.
- indices2 (torch.Tensor): Index the min distance point
for each point in destination to source.
""" """
if criterion_mode == 'smooth_l1': if criterion_mode == 'smooth_l1':
...@@ -106,14 +108,14 @@ class ChamferDistance(nn.Module): ...@@ -106,14 +108,14 @@ class ChamferDistance(nn.Module):
"""Forward function of loss calculation. """Forward function of loss calculation.
Args: Args:
source (Tensor): Source set with shape [B, N, C] to source (torch.Tensor): Source set with shape [B, N, C] to
calculate Chamfer Distance. calculate Chamfer Distance.
target (Tensor): Destination set with shape [B, M, C] to target (torch.Tensor): Destination set with shape [B, M, C] to
calculate Chamfer Distance. calculate Chamfer Distance.
src_weight (Tensor | float, optional): Weight of source loss. src_weight (torch.Tensor | float, optional):
Defaults to 1.0. Weight of source loss. Defaults to 1.0.
dst_weight (Tensor | float, optional): Weight of destination loss. dst_weight (torch.Tensor | float, optional):
Defaults to 1.0. Weight of destination loss. Defaults to 1.0.
reduction_override (str, optional): Method to reduce losses. reduction_override (str, optional): Method to reduce losses.
The valid reduction method are 'none', 'sum' or 'mean'. The valid reduction method are 'none', 'sum' or 'mean'.
Defaults to None. Defaults to None.
......
...@@ -147,14 +147,14 @@ class SparseUNet(nn.Module): ...@@ -147,14 +147,14 @@ class SparseUNet(nn.Module):
"""Forward of upsample and residual block. """Forward of upsample and residual block.
Args: Args:
x_lateral (SparseConvTensor): lateral tensor x_lateral (:obj:`SparseConvTensor`): lateral tensor
x_bottom (SparseConvTensor): feature from bottom layer x_bottom (:obj:`SparseConvTensor`): feature from bottom layer
lateral_layer (SparseBasicBlock): convolution for lateral tensor lateral_layer (SparseBasicBlock): convolution for lateral tensor
merge_layer (SparseSequential): convolution for merging features merge_layer (SparseSequential): convolution for merging features
upsample_layer (SparseSequential): convolution for upsampling upsample_layer (SparseSequential): convolution for upsampling
Returns: Returns:
SparseConvTensor: upsampled feature :obj:`SparseConvTensor`: upsampled feature
""" """
x = lateral_layer(x_lateral) x = lateral_layer(x_lateral)
x.features = torch.cat((x_bottom.features, x.features), dim=1) x.features = torch.cat((x_bottom.features, x.features), dim=1)
...@@ -169,11 +169,11 @@ class SparseUNet(nn.Module): ...@@ -169,11 +169,11 @@ class SparseUNet(nn.Module):
"""reduce channel for element-wise addition. """reduce channel for element-wise addition.
Args: Args:
x (SparseConvTensor): x.features (N, C1) x (:obj:`SparseConvTensor`): x.features (N, C1)
out_channels (int): the number of channel after reduction out_channels (int): the number of channel after reduction
Returns: Returns:
SparseConvTensor: channel reduced feature :obj:`SparseConvTensor`: channel reduced feature
""" """
features = x.features features = x.features
n, in_channels = features.shape n, in_channels = features.shape
......
...@@ -66,11 +66,13 @@ class VoteModule(nn.Module): ...@@ -66,11 +66,13 @@ class VoteModule(nn.Module):
"""forward. """forward.
Args: Args:
seed_points (Tensor): (B, N, 3) coordinate of the seed points. seed_points (torch.Tensor): (B, N, 3) coordinate of the seed
seed_feats (Tensor): (B, C, N) features of the seed points. points.
seed_feats (torch.Tensor): (B, C, N) features of the seed points.
Returns: Returns:
tuple[Tensor]: tuple[torch.Tensor]:
- vote_points: Voted xyz based on the seed points - vote_points: Voted xyz based on the seed points
with shape (B, M, 3) M=num_seed*vote_per_seed. with shape (B, M, 3) M=num_seed*vote_per_seed.
- vote_features: Voted features based on the seed points with - vote_features: Voted features based on the seed points with
...@@ -106,14 +108,14 @@ class VoteModule(nn.Module): ...@@ -106,14 +108,14 @@ class VoteModule(nn.Module):
"""Calculate loss of voting module. """Calculate loss of voting module.
Args: Args:
seed_points (Tensor): coordinate of the seed points. seed_points (torch.Tensor): coordinate of the seed points.
vote_points (Tensor): coordinate of the vote points. vote_points (torch.Tensor): coordinate of the vote points.
seed_indices (Tensor): indices of seed points in raw points. seed_indices (torch.Tensor): indices of seed points in raw points.
vote_targets_mask (Tensor): mask of valid vote targets. vote_targets_mask (torch.Tensor): mask of valid vote targets.
vote_targets (Tensor): targets of votes. vote_targets (torch.Tensor): targets of votes.
Returns: Returns:
Tensor: weighted vote loss. torch.Tensor: weighted vote loss.
""" """
batch_size, num_seed = seed_points.shape[:2] batch_size, num_seed = seed_points.shape[:2]
......
...@@ -37,7 +37,7 @@ class PartA2BboxHead(nn.Module): ...@@ -37,7 +37,7 @@ class PartA2BboxHead(nn.Module):
regression layers. regression layers.
roi_feat_size (int): The size of pooled roi features. roi_feat_size (int): The size of pooled roi features.
with_corner_loss (bool): Whether to use corner loss or not. with_corner_loss (bool): Whether to use corner loss or not.
bbox_coder (BaseBBoxCoder): Bbox coder for box head. bbox_coder (:obj:`BaseBBoxCoder`): Bbox coder for box head.
conv_cfg (dict): Config dict of convolutional layers conv_cfg (dict): Config dict of convolutional layers
norm_cfg (dict): Config dict of normalization layers norm_cfg (dict): Config dict of normalization layers
loss_bbox (dict): Config dict of box regression loss. loss_bbox (dict): Config dict of box regression loss.
...@@ -285,15 +285,15 @@ class PartA2BboxHead(nn.Module): ...@@ -285,15 +285,15 @@ class PartA2BboxHead(nn.Module):
"""Coumputing losses. """Coumputing losses.
Args: Args:
cls_score (Torch.tensor): Scores of each roi. cls_score (torch.Tensor): Scores of each roi.
bbox_pred (Torch.tensor): Predictions of bboxes. bbox_pred (torch.Tensor): Predictions of bboxes.
rois (Torch.tensor): Roi bboxes. rois (torch.Tensor): Roi bboxes.
labels (Torch.tensor): Labels of class. labels (torch.Tensor): Labels of class.
bbox_targets (Torch.tensor): Target of positive bboxes. bbox_targets (torch.Tensor): Target of positive bboxes.
pos_gt_bboxes (Torch.tensor): Gt of positive bboxes. pos_gt_bboxes (torch.Tensor): Gt of positive bboxes.
reg_mask (Torch.tensor): Mask for positive bboxes. reg_mask (torch.Tensor): Mask for positive bboxes.
label_weights (Torch.tensor): Weights of class loss. label_weights (torch.Tensor): Weights of class loss.
bbox_weights (Torch.tensor): Weights of bbox loss. bbox_weights (torch.Tensor): Weights of bbox loss.
Returns: Returns:
dict: Computed losses. dict: Computed losses.
...@@ -357,9 +357,9 @@ class PartA2BboxHead(nn.Module): ...@@ -357,9 +357,9 @@ class PartA2BboxHead(nn.Module):
"""Generate targets. """Generate targets.
Args: Args:
sampling_results (list[:obj:SamplingResult]): sampling_results (list[:obj:`SamplingResult`]):
Sampled results from rois. Sampled results from rois.
rcnn_train_cfg (ConfigDict): Training config of rcnn. rcnn_train_cfg (:obj:`ConfigDict`): Training config of rcnn.
concat (bool): Whether to concatenate targets between batches. concat (bool): Whether to concatenate targets between batches.
Returns: Returns:
...@@ -511,7 +511,7 @@ class PartA2BboxHead(nn.Module): ...@@ -511,7 +511,7 @@ class PartA2BboxHead(nn.Module):
class_labels (torch.Tensor): Label of classes class_labels (torch.Tensor): Label of classes
class_pred (torch.Tensor): Score for nms. class_pred (torch.Tensor): Score for nms.
img_metas (list[dict]): Contain pcd and img's meta info. img_metas (list[dict]): Contain pcd and img's meta info.
cfg (ConfigDict): Testing config. cfg (:obj:`ConfigDict`): Testing config.
Returns: Returns:
list[tuple]: Decoded bbox, scores and labels after nms. list[tuple]: Decoded bbox, scores and labels after nms.
......
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