Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
mmdetection3d
Commits
ec84da2b
Commit
ec84da2b
authored
Jul 08, 2020
by
zhangwenwei
Browse files
Merge branch 'refine_docstrings' into 'master'
Refine mmdet3d docstrings See merge request open-mmlab/mmdet.3d!135
parents
a05dff6f
b27919fc
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
43 deletions
+47
-43
mmdet3d/models/losses/chamfer_distance.py
mmdet3d/models/losses/chamfer_distance.py
+18
-16
mmdet3d/models/middle_encoders/sparse_unet.py
mmdet3d/models/middle_encoders/sparse_unet.py
+5
-5
mmdet3d/models/model_utils/vote_module.py
mmdet3d/models/model_utils/vote_module.py
+11
-9
mmdet3d/models/roi_heads/bbox_heads/parta2_bbox_head.py
mmdet3d/models/roi_heads/bbox_heads/parta2_bbox_head.py
+13
-13
No files found.
mmdet3d/models/losses/chamfer_distance.py
View file @
ec84da2b
...
...
@@ -14,12 +14,12 @@ def chamfer_distance(src,
"""Calculate Chamfer Distance of two sets.
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.
dst (Tensor): Destination set with shape [B, M, C] to
dst (
torch.
Tensor): Destination set with shape [B, M, C] to
calculate Chamfer Distance.
src_weight (Tensor or float): Weight of source loss.
dst_weight (Tensor or float): Weight of destination loss.
src_weight (
torch.
Tensor or float): Weight of source loss.
dst_weight (
torch.
Tensor or float): Weight of destination loss.
criterion_mode (str): Criterion mode to calculate distance.
The valid modes are smooth_l1, l1 or l2.
reduction (str): Method to reduce losses.
...
...
@@ -27,12 +27,14 @@ def chamfer_distance(src,
Returns:
tuple: Source and Destination loss with indices.
- loss_src (Tensor): The min distance from source to destination.
- loss_dst (Tensor): The min distance from destination to source.
- indices1 (Tensor): Index the min distance point for each point
in source to destination.
- indices2 (Tensor): Index the min distance point for each point
in destination to source.
- loss_src (torch.Tensor): The min distance
from source to destination.
- loss_dst (torch.Tensor): The min distance
from destination to source.
- indices1 (torch.Tensor): Index the min distance point
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'
:
...
...
@@ -106,14 +108,14 @@ class ChamferDistance(nn.Module):
"""Forward function of loss calculation.
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.
target (Tensor): Destination set with shape [B, M, C] to
target (
torch.
Tensor): Destination set with shape [B, M, C] to
calculate Chamfer Distance.
src_weight (Tensor | float, optional):
Weight of source loss.
Defaults to 1.0.
dst_weight (Tensor | float, optional):
Weight of destination loss.
Defaults to 1.0.
src_weight (
torch.
Tensor | float, optional):
Weight of source loss.
Defaults to 1.0.
dst_weight (
torch.
Tensor | float, optional):
Weight of destination loss.
Defaults to 1.0.
reduction_override (str, optional): Method to reduce losses.
The valid reduction method are 'none', 'sum' or 'mean'.
Defaults to None.
...
...
mmdet3d/models/middle_encoders/sparse_unet.py
View file @
ec84da2b
...
...
@@ -147,14 +147,14 @@ class SparseUNet(nn.Module):
"""Forward of upsample and residual block.
Args:
x_lateral (SparseConvTensor): lateral tensor
x_bottom (SparseConvTensor): feature from bottom layer
x_lateral (
:obj:`
SparseConvTensor
`
): lateral tensor
x_bottom (
:obj:`
SparseConvTensor
`
): feature from bottom layer
lateral_layer (SparseBasicBlock): convolution for lateral tensor
merge_layer (SparseSequential): convolution for merging features
upsample_layer (SparseSequential): convolution for upsampling
Returns:
SparseConvTensor: upsampled feature
:obj:`
SparseConvTensor
`
: upsampled feature
"""
x
=
lateral_layer
(
x_lateral
)
x
.
features
=
torch
.
cat
((
x_bottom
.
features
,
x
.
features
),
dim
=
1
)
...
...
@@ -169,11 +169,11 @@ class SparseUNet(nn.Module):
"""reduce channel for element-wise addition.
Args:
x (SparseConvTensor): x.features (N, C1)
x (
:obj:`
SparseConvTensor
`
): x.features (N, C1)
out_channels (int): the number of channel after reduction
Returns:
SparseConvTensor: channel reduced feature
:obj:`
SparseConvTensor
`
: channel reduced feature
"""
features
=
x
.
features
n
,
in_channels
=
features
.
shape
...
...
mmdet3d/models/model_utils/vote_module.py
View file @
ec84da2b
...
...
@@ -66,11 +66,13 @@ class VoteModule(nn.Module):
"""forward.
Args:
seed_points (Tensor): (B, N, 3) coordinate of the seed points.
seed_feats (Tensor): (B, C, N) features of the seed points.
seed_points (torch.Tensor): (B, N, 3) coordinate of the seed
points.
seed_feats (torch.Tensor): (B, C, N) features of the seed points.
Returns:
tuple[Tensor]:
tuple[torch.Tensor]:
- vote_points: Voted xyz based on the seed points
with shape (B, M, 3) M=num_seed*vote_per_seed.
- vote_features: Voted features based on the seed points with
...
...
@@ -106,14 +108,14 @@ class VoteModule(nn.Module):
"""Calculate loss of voting module.
Args:
seed_points (Tensor): coordinate of the seed points.
vote_points (Tensor): coordinate of the vote points.
seed_indices (Tensor): indices of seed points in raw points.
vote_targets_mask (Tensor): mask of valid vote targets.
vote_targets (Tensor): targets of votes.
seed_points (
torch.
Tensor): coordinate of the seed points.
vote_points (
torch.
Tensor): coordinate of the vote points.
seed_indices (
torch.
Tensor): indices of seed points in raw points.
vote_targets_mask (
torch.
Tensor): mask of valid vote targets.
vote_targets (
torch.
Tensor): targets of votes.
Returns:
Tensor: weighted vote loss.
torch.
Tensor: weighted vote loss.
"""
batch_size
,
num_seed
=
seed_points
.
shape
[:
2
]
...
...
mmdet3d/models/roi_heads/bbox_heads/parta2_bbox_head.py
View file @
ec84da2b
...
...
@@ -37,7 +37,7 @@ class PartA2BboxHead(nn.Module):
regression layers.
roi_feat_size (int): The size of pooled roi features.
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
norm_cfg (dict): Config dict of normalization layers
loss_bbox (dict): Config dict of box regression loss.
...
...
@@ -285,15 +285,15 @@ class PartA2BboxHead(nn.Module):
"""Coumputing losses.
Args:
cls_score (
T
orch.
t
ensor): Scores of each roi.
bbox_pred (
T
orch.
t
ensor): Predictions of bboxes.
rois (
T
orch.
t
ensor): Roi bboxes.
labels (
T
orch.
t
ensor): Labels of class.
bbox_targets (
T
orch.
t
ensor): Target of positive bboxes.
pos_gt_bboxes (
T
orch.
t
ensor): Gt of positive bboxes.
reg_mask (
T
orch.
t
ensor): Mask for positive bboxes.
label_weights (
T
orch.
t
ensor): Weights of class loss.
bbox_weights (
T
orch.
t
ensor): Weights of bbox loss.
cls_score (
t
orch.
T
ensor): Scores of each roi.
bbox_pred (
t
orch.
T
ensor): Predictions of bboxes.
rois (
t
orch.
T
ensor): Roi bboxes.
labels (
t
orch.
T
ensor): Labels of class.
bbox_targets (
t
orch.
T
ensor): Target of positive bboxes.
pos_gt_bboxes (
t
orch.
T
ensor): Gt of positive bboxes.
reg_mask (
t
orch.
T
ensor): Mask for positive bboxes.
label_weights (
t
orch.
T
ensor): Weights of class loss.
bbox_weights (
t
orch.
T
ensor): Weights of bbox loss.
Returns:
dict: Computed losses.
...
...
@@ -357,9 +357,9 @@ class PartA2BboxHead(nn.Module):
"""Generate targets.
Args:
sampling_results (list[:obj:SamplingResult]):
sampling_results (list[:obj:
`
SamplingResult
`
]):
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.
Returns:
...
...
@@ -511,7 +511,7 @@ class PartA2BboxHead(nn.Module):
class_labels (torch.Tensor): Label of classes
class_pred (torch.Tensor): Score for nms.
img_metas (list[dict]): Contain pcd and img's meta info.
cfg (ConfigDict): Testing config.
cfg (
:obj:`
ConfigDict
`
): Testing config.
Returns:
list[tuple]: Decoded bbox, scores and labels after nms.
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment