Unverified Commit cbc2491f authored by Tai-Wang's avatar Tai-Wang Committed by GitHub
Browse files

Add code-spell pre-commit hook and fix typos (#995)

parent 6b1602f1
......@@ -151,7 +151,7 @@ class RandomFlip3D(RandomFlip):
'pcd_horizontal_flip' and 'pcd_vertical_flip' keys are added
into result dict.
"""
# filp 2D image and its annotations
# flip 2D image and its annotations
super(RandomFlip3D, self).__call__(input_dict)
if self.sync_2d:
......@@ -921,11 +921,11 @@ class PointSample(object):
"""
points = results['points']
# Points in Camera coord can provide the depth information.
# TODO: Need to suport distance-based sampling for other coord system.
# TODO: Need to support distance-based sampling for other coord system.
if self.sample_range is not None:
from mmdet3d.core.points import CameraPoints
assert isinstance(points, CameraPoints), \
'Sampling based on distance is only appliable for CAMERA coord'
assert isinstance(points, CameraPoints), 'Sampling based on' \
'distance is only applicable for CAMERA coord'
points, choices = self._points_random_sampling(
points,
self.num_points,
......@@ -1293,7 +1293,7 @@ class VoxelBasedPointSampler(object):
Args:
cur_sweep_cfg (dict): Config for sampling current points.
prev_sweep_cfg (dict): Config for sampling previous points.
time_dim (int): Index that indicate the time dimention
time_dim (int): Index that indicate the time dimension
for input points.
"""
......@@ -1317,7 +1317,7 @@ class VoxelBasedPointSampler(object):
points (np.ndarray): Points subset to be sampled.
sampler (VoxelGenerator): Voxel based sampler for
each points subset.
point_dim (int): The dimention of each points
point_dim (int): The dimension of each points
Returns:
np.ndarray: Sampled points.
......@@ -1398,7 +1398,7 @@ class VoxelBasedPointSampler(object):
points_numpy = points_numpy.squeeze(1)
results['points'] = points.new_point(points_numpy[..., :original_dim])
# Restore the correspoinding seg and mask fields
# Restore the corresponding seg and mask fields
for key, dim_index in map_fields2dim:
results[key] = points_numpy[..., dim_index]
......@@ -1551,7 +1551,7 @@ class AffineResize(object):
results[key] = bboxes
def _affine_transform(self, points, matrix):
"""Affine transform bbox points to input iamge.
"""Affine transform bbox points to input image.
Args:
points (np.ndarray): Points to be transformed.
......@@ -1605,10 +1605,10 @@ class AffineResize(object):
return matrix.astype(np.float32)
def _get_ref_point(self, ref_point1, ref_point2):
"""Get reference point to calculate affine transfrom matrix.
"""Get reference point to calculate affine transform matrix.
While using opencv to calculate the affine matrix, we need at least
three corresponding points seperately on original image and target
three corresponding points separately on original image and target
image. Here we use two points to get the the third reference point.
"""
d = ref_point1 - ref_point2
......@@ -1628,7 +1628,7 @@ class RandomShiftScale(object):
Different from the normal shift and scale function, it doesn't
directly shift or scale image. It can record the shift and scale
infos into loading pipelines. It's desgined to be used with
infos into loading pipelines. It's designed to be used with
AffineResize together.
Args:
......
......@@ -234,7 +234,7 @@ class WaymoDataset(KittiDataset):
pklfile_prefix (str, optional): The prefix of pkl files including
the file path and the prefix of filename, e.g., "a/b/prefix".
If not specified, a temp file will be created. Default: None.
submission_prefix (str, optional): The prefix of submission datas.
submission_prefix (str, optional): The prefix of submission data.
If not specified, the submission data will not be generated.
show (bool, optional): Whether to visualize.
Default: False.
......
......@@ -16,7 +16,7 @@ class NoStemRegNet(RegNet):
- wm (float): Quantization parameter to quantize the width.
- depth (int): Depth of the backbone.
- group_w (int): Width of group.
- bot_mul (float): Bottleneck ratio, i.e. expansion of bottlneck.
- bot_mul (float): Bottleneck ratio, i.e. expansion of bottleneck.
strides (Sequence[int]): Strides of the first block of each stage.
base_channels (int): Base channels after stem layer.
in_channels (int): Number of input image channels. Normally 3.
......
......@@ -321,7 +321,7 @@ class AnchorFreeMono3DHead(BaseMono3DDenseHead):
return multi_apply(self.forward_single, feats)[:5]
def forward_single(self, x):
"""Forward features of a single scale levle.
"""Forward features of a single scale level.
Args:
x (Tensor): FPN feature maps of the specified stride.
......
......@@ -23,8 +23,8 @@ class SeparateHead(BaseModule):
heads (dict): Conv information.
head_conv (int, optional): Output channels.
Default: 64.
final_kernal (int, optional): Kernal size for the last conv layer.
Deafult: 1.
final_kernal (int, optional): Kernel size for the last conv layer.
Default: 1.
init_bias (float, optional): Initial bias. Default: -2.19.
conv_cfg (dict, optional): Config of conv layer.
Default: dict(type='Conv2d')
......@@ -136,8 +136,8 @@ class DCNSeparateHead(BaseModule):
dcn_config (dict): Config of dcn layer.
head_conv (int, optional): Output channels.
Default: 64.
final_kernal (int, optional): Kernal size for the last conv
layer. Deafult: 1.
final_kernal (int, optional): Kernel size for the last conv
layer. Default: 1.
init_bias (float, optional): Initial bias. Default: -2.19.
conv_cfg (dict, optional): Config of conv layer.
Default: dict(type='Conv2d')
......
......@@ -151,7 +151,7 @@ class FCOSMono3DHead(AnchorFreeMono3DHead):
self.strides)[:5]
def forward_single(self, x, scale, stride):
"""Forward features of a single scale levle.
"""Forward features of a single scale level.
Args:
x (Tensor): FPN feature maps of the specified stride.
......@@ -691,7 +691,7 @@ class FCOSMono3DHead(AnchorFreeMono3DHead):
Args:
points (torch.Tensor): points in 2D images, [N, 3],
3 corresponds with x, y in the image and depth.
view (np.ndarray): camera instrinsic, [3, 3]
view (np.ndarray): camera intrinsic, [3, 3]
Returns:
torch.Tensor: points in 3D space. [N, 3],
......@@ -713,7 +713,7 @@ class FCOSMono3DHead(AnchorFreeMono3DHead):
viewpad[:view.shape[0], :view.shape[1]] = points2D.new_tensor(view)
inv_viewpad = torch.inverse(viewpad).transpose(0, 1)
# Do operation in homogenous coordinates.
# Do operation in homogeneous coordinates.
nbr_points = unnorm_points2D.shape[0]
homo_points2D = torch.cat(
[unnorm_points2D,
......
......@@ -299,7 +299,7 @@ class GroupFree3DHead(BaseModule):
"""Forward pass.
Note:
The forward of GroupFree3DHead is devided into 2 steps:
The forward of GroupFree3DHead is divided into 2 steps:
1. Initial object candidates sampling.
2. Iterative object box prediction by transformer decoder.
......@@ -880,7 +880,7 @@ class GroupFree3DHead(BaseModule):
Returns:
list[tuple[torch.Tensor]]: Bounding boxes, scores and labels.
"""
# support multi-stage predicitons
# support multi-stage predictions
assert self.test_cfg['prediction_stages'] in \
['last', 'all', 'last_three']
......
......@@ -207,7 +207,7 @@ class PartA2RPNHead(Anchor3DHead):
mlvl_dir_scores = torch.cat(mlvl_dir_scores)
# shape [k, num_class] before sigmoid
# PartA2 need to keep raw classification score
# becase the bbox head in the second stage does not have
# because the bbox head in the second stage does not have
# classification branch,
# roi head need this score as classification score
mlvl_cls_score = torch.cat(mlvl_cls_score)
......
......@@ -25,9 +25,9 @@ class SMOKEMono3DHead(AnchorFreeMono3DHead):
num_classes (int): Number of categories excluding the background
category.
in_channels (int): Number of channels in the input feature map.
dim_channel (list[int]): indexs of dimension offset preds in
dim_channel (list[int]): indices of dimension offset preds in
regression heatmap channels.
ori_channel (list[int]): indexs of orientation offset pred in
ori_channel (list[int]): indices of orientation offset pred in
regression heatmap channels.
bbox_coder (:obj:`CameraInstance3DBoxes`): Bbox coder
for encoding and decoding boxes.
......@@ -221,12 +221,12 @@ class SMOKEMono3DHead(AnchorFreeMono3DHead):
return batch_bboxes, batch_scores, batch_topk_labels
def get_predictions(self, labels3d, centers2d, gt_locations, gt_dimensions,
gt_orientations, indexs, img_metas, pred_reg):
gt_orientations, indices, img_metas, pred_reg):
"""Prepare predictions for computing loss.
Args:
labels3d (Tensor): Labels of each 3D box.
shpae (B, max_objs, )
shape (B, max_objs, )
centers2d (Tensor): Coords of each projected 3D box
center on image. shape (B * max_objs, 2)
gt_locations (Tensor): Coords of each 3D box's location.
......@@ -235,7 +235,7 @@ class SMOKEMono3DHead(AnchorFreeMono3DHead):
shape (N, 3)
gt_orientations (Tensor): Orientation(yaw) of each 3D box.
shape (N, 1)
indexs (Tensor): Indexs of the existence of the 3D box.
indices (Tensor): Indices of the existence of the 3D box.
shape (B * max_objs, )
img_metas (list[dict]): Meta information of each image,
e.g., image size, scaling factor, etc.
......@@ -247,7 +247,7 @@ class SMOKEMono3DHead(AnchorFreeMono3DHead):
- bbox3d_yaws (:obj:`CameraInstance3DBoxes`):
bbox calculated using pred orientations.
- bbox3d_dims (:obj:`CameraInstance3DBoxes`):
bbox calculated using pred dimentions.
bbox calculated using pred dimensions.
- bbox3d_locs (:obj:`CameraInstance3DBoxes`):
bbox calculated using pred locations.
"""
......@@ -269,12 +269,12 @@ class SMOKEMono3DHead(AnchorFreeMono3DHead):
pred_regression_pois, centers2d, labels3d, cam2imgs, trans_mats,
gt_locations)
locations, dimensions, orientations = locations[indexs], dimensions[
indexs], orientations[indexs]
locations, dimensions, orientations = locations[indices], dimensions[
indices], orientations[indices]
locations[:, 1] += dimensions[:, 1] / 2
gt_locations = gt_locations[indexs]
gt_locations = gt_locations[indices]
assert len(locations) == len(gt_locations)
assert len(dimensions) == len(gt_dimensions)
......@@ -293,7 +293,7 @@ class SMOKEMono3DHead(AnchorFreeMono3DHead):
def get_targets(self, gt_bboxes, gt_labels, gt_bboxes_3d, gt_labels_3d,
centers2d, feat_shape, img_shape, img_metas):
"""Get training targets for batch images.
``
Args:
gt_bboxes (list[Tensor]): Ground truth bboxes of each image,
shape (num_gt, 4).
......@@ -318,10 +318,10 @@ class SMOKEMono3DHead(AnchorFreeMono3DHead):
- gt_centers2d (Tensor): Coords of each projected 3D box
center on image. shape (B * max_objs, 2)
- gt_labels3d (Tensor): Labels of each 3D box.
shpae (B, max_objs, )
- indexs (Tensor): Indexs of the existence of the 3D box.
shape (B, max_objs, )
- indices (Tensor): Indices of the existence of the 3D box.
shape (B * max_objs, )
- affine_indexs (Tensor): Indexs of the affine of the 3D box.
- affine_indices (Tensor): Indices of the affine of the 3D box.
shape (N, )
- gt_locs (Tensor): Coords of each 3D box's location.
shape (N, 3)
......@@ -417,8 +417,8 @@ class SMOKEMono3DHead(AnchorFreeMono3DHead):
target_labels = dict(
gt_centers2d=batch_centers2d.long(),
gt_labels3d=batch_labels_3d,
indexs=inds,
reg_indexs=reg_inds,
indices=inds,
reg_indices=reg_inds,
gt_locs=batch_gt_locations,
gt_dims=gt_dimensions,
gt_yaws=gt_orientations,
......@@ -487,14 +487,14 @@ class SMOKEMono3DHead(AnchorFreeMono3DHead):
gt_locations=target_labels['gt_locs'],
gt_dimensions=target_labels['gt_dims'],
gt_orientations=target_labels['gt_yaws'],
indexs=target_labels['indexs'],
indices=target_labels['indices'],
img_metas=img_metas,
pred_reg=pred_reg)
loss_cls = self.loss_cls(
center2d_heatmap, center2d_heatmap_target, avg_factor=avg_factor)
reg_inds = target_labels['reg_indexs']
reg_inds = target_labels['reg_indices']
loss_bbox_oris = self.loss_bbox(
pred_bboxes['ori'].corners[reg_inds, ...],
......
......@@ -35,7 +35,7 @@ class AnchorTrainMixin(object):
tuple (list, list, list, list, list, list, int, int):
Anchor targets, including labels, label weights,
bbox targets, bbox weights, direction targets,
direction weights, number of postive anchors and
direction weights, number of positive anchors and
number of negative anchors.
"""
num_imgs = len(input_metas)
......
......@@ -136,7 +136,7 @@ class VoteHead(BaseModule):
"""Forward pass.
Note:
The forward of VoteHead is devided into 4 steps:
The forward of VoteHead is divided into 4 steps:
1. Generate vote_points from seed_points.
2. Aggregate vote_points.
......
......@@ -103,6 +103,6 @@ class Base3DDetector(BaseDetector):
Box3DMode.DEPTH)
elif box_mode_3d != Box3DMode.DEPTH:
ValueError(
f'Unsupported box_mode_3d {box_mode_3d} for convertion!')
f'Unsupported box_mode_3d {box_mode_3d} for conversion!')
pred_bboxes = pred_bboxes.tensor.cpu().numpy()
show_result(points, None, pred_bboxes, out_dir, file_name)
......@@ -497,7 +497,7 @@ class MVXTwoStageDetector(Base3DDetector):
Box3DMode.DEPTH)
elif box_mode_3d != Box3DMode.DEPTH:
ValueError(
f'Unsupported box_mode_3d {box_mode_3d} for convertion!')
f'Unsupported box_mode_3d {box_mode_3d} for conversion!')
pred_bboxes = pred_bboxes.tensor.cpu().numpy()
show_result(points, None, pred_bboxes, out_dir, file_name)
......@@ -132,7 +132,7 @@ class ConvBNPositionalEncoding(nn.Module):
xyz (Tensor): (B, N, 3) the coordinates to embed.
Returns:
Tensor: (B, num_pos_feats, N) the embeded position features.
Tensor: (B, num_pos_feats, N) the embedded position features.
"""
xyz = xyz.permute(0, 2, 1)
position_embedding = self.position_embedding_head(xyz)
......
......@@ -172,7 +172,7 @@ class DLANeck(BaseModule):
Args:
in_channels (list[int], optional): List of input channels
of multi-scale feature map.
start_level (int, optioanl): The scale level where upsampling
start_level (int, optional): The scale level where upsampling
starts. Default: 2.
end_level (int, optional): The scale level where upsampling
ends. Default: 5.
......
......@@ -20,7 +20,7 @@ class H3DBboxHead(BaseModule):
Args:
num_classes (int): The number of classes.
suface_matching_cfg (dict): Config for suface primitive matching.
surface_matching_cfg (dict): Config for surface primitive matching.
line_matching_cfg (dict): Config for line primitive matching.
bbox_coder (:obj:`BaseBBoxCoder`): Bbox coder for encoding and
decoding boxes.
......@@ -36,7 +36,7 @@ class H3DBboxHead(BaseModule):
primitive_refine_channels (tuple[int]): Convolution channels of
prediction layer.
upper_thresh (float): Threshold for line matching.
surface_thresh (float): Threshold for suface matching.
surface_thresh (float): Threshold for surface matching.
line_thresh (float): Threshold for line matching.
conv_cfg (dict): Config of convolution in prediction layer.
norm_cfg (dict): Config of BN in prediction layer.
......
......@@ -574,7 +574,7 @@ class PartA2BboxHead(BaseModule):
box_preds (torch.Tensor): Predicted boxes in shape (N, 7+C).
score_thr (float): Threshold of scores.
nms_thr (float): Threshold for NMS.
input_meta (dict): Meta informations of the current sample.
input_meta (dict): Meta information of the current sample.
use_rotate_nms (bool, optional): Whether to use rotated nms.
Defaults to True.
......
......@@ -20,7 +20,7 @@ class PrimitiveHead(BaseModule):
num_dims (int): The dimension of primitive semantic information.
num_classes (int): The number of class.
primitive_mode (str): The mode of primitive module,
avaliable mode ['z', 'xy', 'line'].
available mode ['z', 'xy', 'line'].
bbox_coder (:obj:`BaseBBoxCoder`): Bbox coder for encoding and
decoding boxes.
train_cfg (dict): Config for training.
......@@ -30,7 +30,7 @@ class PrimitiveHead(BaseModule):
feat_channels (tuple[int]): Convolution channels of
prediction layer.
upper_thresh (float): Threshold for line matching.
surface_thresh (float): Threshold for suface matching.
surface_thresh (float): Threshold for surface matching.
conv_cfg (dict): Config of convolution in prediction layer.
norm_cfg (dict): Config of BN in prediction layer.
objectness_loss (dict): Config of objectness loss.
......
......@@ -233,7 +233,7 @@ class DynamicPillarFeatureNet(PillarFeatureNet):
Returns:
torch.Tensor: Corresponding voxel centers of each points, shape
(M, C), where M is the numver of points.
(M, C), where M is the number of points.
"""
# Step 1: scatter voxel into canvas
# Calculate necessary things for canvas creation
......
......@@ -232,7 +232,7 @@ class DynamicVFE(nn.Module):
coors (torch.Tensor): Coordinates of voxels, shape is Nx(1+NDim).
points (list[torch.Tensor], optional): Raw points used to guide the
multi-modality fusion. Defaults to None.
img_feats (list[torch.Tensor], optional): Image fetures used for
img_feats (list[torch.Tensor], optional): Image features used for
multi-modality fusion. Defaults to None.
img_metas (dict, optional): [description]. Defaults to None.
......@@ -397,7 +397,7 @@ class HardVFE(nn.Module):
features (torch.Tensor): Features of voxels, shape is MxNxC.
num_points (torch.Tensor): Number of points in each voxel.
coors (torch.Tensor): Coordinates of voxels, shape is Mx(1+NDim).
img_feats (list[torch.Tensor], optional): Image fetures used for
img_feats (list[torch.Tensor], optional): Image features used for
multi-modality fusion. Defaults to None.
img_metas (dict, optional): [description]. Defaults to None.
......
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