Unverified Commit 4243ff67 authored by Jingwei Zhang's avatar Jingwei Zhang Committed by GitHub
Browse files

[CI]: Upgrade pre-commit-hook in the dev-1.x branch (#1893)

* update pre-commit-hook config

* fix typos in new pre-commit-hook
parent d6ad6a7b
repos: repos:
- repo: https://github.com/PyCQA/flake8 - repo: https://github.com/PyCQA/flake8
rev: 3.8.3 rev: 5.0.4
hooks: hooks:
- id: flake8 - id: flake8
- repo: https://github.com/PyCQA/isort - repo: https://github.com/PyCQA/isort
...@@ -8,11 +8,11 @@ repos: ...@@ -8,11 +8,11 @@ repos:
hooks: hooks:
- id: isort - id: isort
- repo: https://github.com/pre-commit/mirrors-yapf - repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.30.0 rev: v0.32.0
hooks: hooks:
- id: yapf - id: yapf
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0 rev: v4.3.0
hooks: hooks:
- id: trailing-whitespace - id: trailing-whitespace
- id: check-yaml - id: check-yaml
...@@ -25,7 +25,7 @@ repos: ...@@ -25,7 +25,7 @@ repos:
- id: mixed-line-ending - id: mixed-line-ending
args: ["--fix=lf"] args: ["--fix=lf"]
- repo: https://github.com/codespell-project/codespell - repo: https://github.com/codespell-project/codespell
rev: v2.1.0 rev: v2.2.1
hooks: hooks:
- id: codespell - id: codespell
- repo: https://github.com/executablebooks/mdformat - repo: https://github.com/executablebooks/mdformat
......
...@@ -234,7 +234,7 @@ Actually, both [`IterBasedTrainLoop`](https://github.com/open-mmlab/mmengine/blo ...@@ -234,7 +234,7 @@ Actually, both [`IterBasedTrainLoop`](https://github.com/open-mmlab/mmengine/blo
```python ```python
# Before 365001th iteration, we do evaluation every 5000 iterations. # Before 365001th iteration, we do evaluation every 5000 iterations.
# After 365000th iteration, we do evaluation every 368750 iteraions, # After 365000th iteration, we do evaluation every 368750 iterations,
# which means that we do evaluation at the end of training. # which means that we do evaluation at the end of training.
interval = 5000 interval = 5000
......
...@@ -411,7 +411,7 @@ param_scheduler = [ ...@@ -411,7 +411,7 @@ param_scheduler = [
### Hook config ### Hook config
Users can attach hooks to training, validation, and testing loops to insert some oprations during running. There are two different hook fields, one is `default_hooks` and the other is `custom_hooks`. Users can attach hooks to training, validation, and testing loops to insert some operations during running. There are two different hook fields, one is `default_hooks` and the other is `custom_hooks`.
`default_hooks` is a dict of hook configs. `default_hooks` are the hooks must required at runtime. They have default priority which should not be modified. If not set, runner will use the default values. To disable a default hook, users can set its config to `None`. `default_hooks` is a dict of hook configs. `default_hooks` are the hooks must required at runtime. They have default priority which should not be modified. If not set, runner will use the default values. To disable a default hook, users can set its config to `None`.
......
...@@ -98,7 +98,8 @@ class DataBaseSampler(object): ...@@ -98,7 +98,8 @@ class DataBaseSampler(object):
for more details. Defaults to dict(backend='disk'). for more details. Defaults to dict(backend='disk').
""" """
def __init__(self, def __init__(
self,
info_path: str, info_path: str,
data_root: str, data_root: str,
rate: float, rate: float,
...@@ -110,7 +111,8 @@ class DataBaseSampler(object): ...@@ -110,7 +111,8 @@ class DataBaseSampler(object):
coord_type='LIDAR', coord_type='LIDAR',
load_dim=4, load_dim=4,
use_dim=[0, 1, 2, 3]), use_dim=[0, 1, 2, 3]),
file_client_args: dict = dict(backend='disk')) -> None: file_client_args: dict = dict(backend='disk')
) -> None:
super().__init__() super().__init__()
self.data_root = data_root self.data_root = data_root
self.info_path = info_path self.info_path = info_path
...@@ -304,9 +306,7 @@ class DataBaseSampler(object): ...@@ -304,9 +306,7 @@ class DataBaseSampler(object):
return ret return ret
def sample_class_v2(self, def sample_class_v2(self, name: str, num: int,
name: str,
num: int,
gt_bboxes: np.ndarray) -> List[dict]: gt_bboxes: np.ndarray) -> List[dict]:
"""Sampling specific categories of bounding boxes. """Sampling specific categories of bounding boxes.
......
...@@ -72,7 +72,8 @@ class Pack3DDetInputs(BaseTransform): ...@@ -72,7 +72,8 @@ class Pack3DDetInputs(BaseTransform):
'sample_idx', 'pcd_scale_factor', 'pcd_rotation', 'sample_idx', 'pcd_scale_factor', 'pcd_rotation',
'pcd_rotation_angle', 'lidar_path', 'pcd_rotation_angle', 'lidar_path',
'transformation_3d_flow', 'trans_mat', 'transformation_3d_flow', 'trans_mat',
'affine_aug')) -> None: 'affine_aug')
) -> None:
self.keys = keys self.keys = keys
self.meta_keys = meta_keys self.meta_keys = meta_keys
......
...@@ -25,11 +25,9 @@ class LoadMultiViewImageFromFiles(BaseTransform): ...@@ -25,11 +25,9 @@ class LoadMultiViewImageFromFiles(BaseTransform):
Defaults to 'unchanged'. Defaults to 'unchanged'.
""" """
def __init__( def __init__(self,
self,
to_float32: bool = False, to_float32: bool = False,
color_type: str = 'unchanged' color_type: str = 'unchanged') -> None:
) -> None:
self.to_float32 = to_float32 self.to_float32 = to_float32
self.color_type = color_type self.color_type = color_type
...@@ -154,16 +152,14 @@ class LoadPointsFromMultiSweeps(BaseTransform): ...@@ -154,16 +152,14 @@ class LoadPointsFromMultiSweeps(BaseTransform):
Defaults to False. Defaults to False.
""" """
def __init__( def __init__(self,
self,
sweeps_num: int = 10, sweeps_num: int = 10,
load_dim: int = 5, load_dim: int = 5,
use_dim: List[int] = [0, 1, 2, 4], use_dim: List[int] = [0, 1, 2, 4],
file_client_args: dict = dict(backend='disk'), file_client_args: dict = dict(backend='disk'),
pad_empty_sweeps: bool = False, pad_empty_sweeps: bool = False,
remove_close: bool = False, remove_close: bool = False,
test_mode: bool = False test_mode: bool = False) -> None:
) -> None:
self.load_dim = load_dim self.load_dim = load_dim
self.sweeps_num = sweeps_num self.sweeps_num = sweeps_num
self.use_dim = use_dim self.use_dim = use_dim
...@@ -195,11 +191,9 @@ class LoadPointsFromMultiSweeps(BaseTransform): ...@@ -195,11 +191,9 @@ class LoadPointsFromMultiSweeps(BaseTransform):
points = np.fromfile(pts_filename, dtype=np.float32) points = np.fromfile(pts_filename, dtype=np.float32)
return points return points
def _remove_close( def _remove_close(self,
self,
points: Union[np.ndarray, BasePoints], points: Union[np.ndarray, BasePoints],
radius: float = 1.0 radius: float = 1.0) -> Union[np.ndarray, BasePoints]:
) -> Union[np.ndarray, BasePoints]:
"""Removes point too close within a certain radius from origin. """Removes point too close within a certain radius from origin.
Args: Args:
......
...@@ -46,7 +46,7 @@ class MultiScaleFlipAug3D(BaseTransform): ...@@ -46,7 +46,7 @@ class MultiScaleFlipAug3D(BaseTransform):
self.img_scale = img_scale if isinstance(img_scale, self.img_scale = img_scale if isinstance(img_scale,
list) else [img_scale] list) else [img_scale]
self.pts_scale_ratio = pts_scale_ratio \ self.pts_scale_ratio = pts_scale_ratio \
if isinstance(pts_scale_ratio, list) else[float(pts_scale_ratio)] if isinstance(pts_scale_ratio, list) else [float(pts_scale_ratio)]
assert mmengine.is_list_of(self.img_scale, tuple) assert mmengine.is_list_of(self.img_scale, tuple)
assert mmengine.is_list_of(self.pts_scale_ratio, float) assert mmengine.is_list_of(self.pts_scale_ratio, float)
......
...@@ -1221,10 +1221,8 @@ class IndoorPatchPointSample(BaseTransform): ...@@ -1221,10 +1221,8 @@ class IndoorPatchPointSample(BaseTransform):
return points return points
def _patch_points_sampling( def _patch_points_sampling(
self, self, points: BasePoints,
points: BasePoints, sem_mask: np.ndarray) -> Tuple[BasePoints, np.ndarray]:
sem_mask: np.ndarray
) -> Tuple[BasePoints, np.ndarray]:
"""Patch points sampling. """Patch points sampling.
First sample a valid patch. First sample a valid patch.
...@@ -1470,9 +1468,7 @@ class VoxelBasedPointSampler(BaseTransform): ...@@ -1470,9 +1468,7 @@ class VoxelBasedPointSampler(BaseTransform):
self.prev_voxel_generator = None self.prev_voxel_generator = None
self.prev_voxel_num = 0 self.prev_voxel_num = 0
def _sample_points(self, def _sample_points(self, points: np.ndarray, sampler: VoxelGenerator,
points: np.ndarray,
sampler: VoxelGenerator,
point_dim: int) -> np.ndarray: point_dim: int) -> np.ndarray:
"""Sample points for each points subset. """Sample points for each points subset.
......
...@@ -92,7 +92,7 @@ def build_segmentor(cfg, train_cfg=None, test_cfg=None): ...@@ -92,7 +92,7 @@ def build_segmentor(cfg, train_cfg=None, test_cfg=None):
def build_model(cfg, train_cfg=None, test_cfg=None): def build_model(cfg, train_cfg=None, test_cfg=None):
"""A function warpper for building 3D detector or segmentor according to """A function wrapper for building 3D detector or segmentor according to
cfg. cfg.
Should be deprecated in the future. Should be deprecated in the future.
......
...@@ -10,7 +10,8 @@ from .voxelnet import VoxelNet ...@@ -10,7 +10,8 @@ from .voxelnet import VoxelNet
@MODELS.register_module() @MODELS.register_module()
class DynamicVoxelNet(VoxelNet): class DynamicVoxelNet(VoxelNet):
r"""VoxelNet using `dynamic voxelization <https://arxiv.org/abs/1910.06528>`_. r"""VoxelNet using `dynamic voxelization
<https://arxiv.org/abs/1910.06528>`_.
""" """
def __init__(self, def __init__(self,
......
...@@ -6,7 +6,7 @@ from torch import nn as nn ...@@ -6,7 +6,7 @@ from torch import nn as nn
@MODELS.register_module() @MODELS.register_module()
class GroupFree3DMHA(MultiheadAttention): class GroupFree3DMHA(MultiheadAttention):
"""A warpper for torch.nn.MultiheadAttention for GroupFree3D. """A wrapper for torch.nn.MultiheadAttention for GroupFree3D.
This module implements MultiheadAttention with identity connection, This module implements MultiheadAttention with identity connection,
and positional encoding used in DETR is also passed as input. and positional encoding used in DETR is also passed as input.
......
...@@ -278,7 +278,7 @@ class SparseEncoderSASSD(SparseEncoder): ...@@ -278,7 +278,7 @@ class SparseEncoderSASSD(SparseEncoder):
Returns: Returns:
dict: Backbone features. dict: Backbone features.
tuple[torch.Tensor]: Mean feature value of the points, tuple[torch.Tensor]: Mean feature value of the points,
Classificaion result of the points, Classification result of the points,
Regression offsets of the points. Regression offsets of the points.
""" """
coors = coors.int() coors = coors.int()
...@@ -409,7 +409,7 @@ class SparseEncoderSASSD(SparseEncoder): ...@@ -409,7 +409,7 @@ class SparseEncoderSASSD(SparseEncoder):
Args: Args:
points (torch.Tensor): Mean feature value of the points. points (torch.Tensor): Mean feature value of the points.
point_cls (torch.Tensor): Classificaion result of the points. point_cls (torch.Tensor): Classification result of the points.
point_reg (torch.Tensor): Regression offsets of the points. point_reg (torch.Tensor): Regression offsets of the points.
gt_bboxes (list[:obj:`BaseInstance3DBoxes`]): Ground truth gt_bboxes (list[:obj:`BaseInstance3DBoxes`]): Ground truth
boxes for each sample. boxes for each sample.
......
...@@ -13,4 +13,4 @@ no_lines_before = STDLIB,LOCALFOLDER ...@@ -13,4 +13,4 @@ no_lines_before = STDLIB,LOCALFOLDER
default_section = THIRDPARTY default_section = THIRDPARTY
[codespell] [codespell]
ignore-words-list = ans,refridgerator,crate,hist,formating,dout,wan,nd,fo,avod,AVOD ignore-words-list = ans,refridgerator,crate,hist,formating,dout,wan,nd,fo,avod,AVOD,warmup
...@@ -566,7 +566,7 @@ def test_lidar_boxes3d(): ...@@ -566,7 +566,7 @@ def test_lidar_boxes3d():
def test_boxes_conversion(): def test_boxes_conversion():
"""Test the conversion of boxes between different modes. """Test the conversion of boxes between different modes.
ComandLine: CommandLine:
xdoctest tests/test_box3d.py::test_boxes_conversion zero xdoctest tests/test_box3d.py::test_boxes_conversion zero
""" """
lidar_boxes = LiDARInstance3DBoxes( lidar_boxes = LiDARInstance3DBoxes(
...@@ -1121,7 +1121,7 @@ def test_camera_boxes3d(): ...@@ -1121,7 +1121,7 @@ def test_camera_boxes3d():
def test_boxes3d_overlaps(): def test_boxes3d_overlaps():
"""Test the iou calculation of boxes in different modes. """Test the iou calculation of boxes in different modes.
ComandLine: CommandLine:
xdoctest tests/test_box3d.py::test_boxes3d_overlaps zero xdoctest tests/test_box3d.py::test_boxes3d_overlaps zero
""" """
if not torch.cuda.is_available(): if not torch.cuda.is_available():
......
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