Skip to content

Commit

Permalink
clean op (#3232)
Browse files Browse the repository at this point in the history
* clean op

* clean

* update build.yml

* fix setup

* change ci mmcv version

* change ci mmcv version

* add install pre-build mmcv instructions

* update mmcv url, move some unnit tests to mmcv

* update ci mmcv

* test

* test

* test

* fix unit test

* fix unit test

* fix onnx script

* update mmcv url

* fix typo

* fix some doc

* Bump version

* resolve comments

* Fix version bug

Co-authored-by: ZwwWayne <wayne.zw@outlook.com>
  • Loading branch information
yhcao6 and ZwwWayne authored Jul 9, 2020
1 parent 200f257 commit 5f2cded
Show file tree
Hide file tree
Showing 162 changed files with 232 additions and 9,894 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}}
- name: Install mmdet dependencies
run: |
pip install mmcv
pip install mmcv-full==latest+torch${{matrix.torch}}+cu101 -f https://openmmlab.oss-accelerate.aliyuncs.com/mmcv/dist/index.html
pip install -r requirements.txt
pip install "git+https://github.com/open-mmlab/cocoapi.git#subdirectory=pycocotools"
- name: Lint with flake8
Expand All @@ -60,7 +60,7 @@ jobs:
- name: Format with yapf
run: yapf -r -d mmdet/ tools/ configs/ tests/
- name: Check docstring
run: interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --exclude mmdet/ops --ignore-regex "__repr__" --fail-under 80 mmdet
run: interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-regex "__repr__" --fail-under 80 mmdet
- name: Build and install
env:
CUDA_ARCH: ${{matrix.cuda_arch}}
Expand Down
2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ line_length = 79
multi_line_output = 0
known_standard_library = setuptools
known_first_party = mmdet
known_third_party = PIL,asynctest,cityscapesscripts,cv2,matplotlib,mmcv,numpy,onnx,pycocotools,pytest,robustness_eval,roi_align,roi_pool,seaborn,six,terminaltables,torch,torchvision
known_third_party = PIL,asynctest,cityscapesscripts,cv2,matplotlib,mmcv,numpy,onnx,pycocotools,pytest,robustness_eval,seaborn,six,terminaltables,torch,torchvision
no_lines_before = STDLIB,LOCALFOLDER
default_section = THIRDPARTY
6 changes: 3 additions & 3 deletions configs/_base_/models/cascade_mask_rcnn_r50_fpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
stage_loss_weights=[1, 0.5, 0.25],
bbox_roi_extractor=dict(
type='SingleRoIExtractor',
roi_layer=dict(type='RoIAlign', out_size=7, sample_num=0),
roi_layer=dict(type='RoIAlign', output_size=7, sampling_ratio=0),
out_channels=256,
featmap_strides=[4, 8, 16, 32]),
bbox_head=[
Expand Down Expand Up @@ -95,7 +95,7 @@
],
mask_roi_extractor=dict(
type='SingleRoIExtractor',
roi_layer=dict(type='RoIAlign', out_size=14, sample_num=0),
roi_layer=dict(type='RoIAlign', output_size=14, sampling_ratio=0),
out_channels=256,
featmap_strides=[4, 8, 16, 32]),
mask_head=dict(
Expand Down Expand Up @@ -195,6 +195,6 @@
min_bbox_size=0),
rcnn=dict(
score_thr=0.05,
nms=dict(type='nms', iou_thr=0.5),
nms=dict(type='nms', iou_threshold=0.5),
max_per_img=100,
mask_thr_binary=0.5))
6 changes: 4 additions & 2 deletions configs/_base_/models/cascade_rcnn_r50_fpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
stage_loss_weights=[1, 0.5, 0.25],
bbox_roi_extractor=dict(
type='SingleRoIExtractor',
roi_layer=dict(type='RoIAlign', out_size=7, sample_num=0),
roi_layer=dict(type='RoIAlign', output_size=7, sampling_ratio=0),
out_channels=256,
featmap_strides=[4, 8, 16, 32]),
bbox_head=[
Expand Down Expand Up @@ -178,4 +178,6 @@
nms_thr=0.7,
min_bbox_size=0),
rcnn=dict(
score_thr=0.05, nms=dict(type='nms', iou_thr=0.5), max_per_img=100))
score_thr=0.05,
nms=dict(type='nms', iou_threshold=0.5),
max_per_img=100))
6 changes: 4 additions & 2 deletions configs/_base_/models/fast_rcnn_r50_fpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
type='StandardRoIHead',
bbox_roi_extractor=dict(
type='SingleRoIExtractor',
roi_layer=dict(type='RoIAlign', out_size=7, sample_num=0),
roi_layer=dict(type='RoIAlign', output_size=7, sampling_ratio=0),
out_channels=256,
featmap_strides=[4, 8, 16, 32]),
bbox_head=dict(
Expand Down Expand Up @@ -57,4 +57,6 @@
debug=False))
test_cfg = dict(
rcnn=dict(
score_thr=0.05, nms=dict(type='nms', iou_thr=0.5), max_per_img=100))
score_thr=0.05,
nms=dict(type='nms', iou_threshold=0.5),
max_per_img=100))
6 changes: 4 additions & 2 deletions configs/_base_/models/faster_rcnn_r50_caffe_c4.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
norm_eval=True),
bbox_roi_extractor=dict(
type='SingleRoIExtractor',
roi_layer=dict(type='RoIAlign', out_size=14, sample_num=0),
roi_layer=dict(type='RoIAlign', output_size=14, sampling_ratio=0),
out_channels=1024,
featmap_strides=[16]),
bbox_head=dict(
Expand Down Expand Up @@ -111,4 +111,6 @@
nms_thr=0.7,
min_bbox_size=0),
rcnn=dict(
score_thr=0.05, nms=dict(type='nms', iou_thr=0.5), max_per_img=100))
score_thr=0.05,
nms=dict(type='nms', iou_threshold=0.5),
max_per_img=100))
8 changes: 5 additions & 3 deletions configs/_base_/models/faster_rcnn_r50_fpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
type='StandardRoIHead',
bbox_roi_extractor=dict(
type='SingleRoIExtractor',
roi_layer=dict(type='RoIAlign', out_size=7, sample_num=0),
roi_layer=dict(type='RoIAlign', output_size=7, sampling_ratio=0),
out_channels=256,
featmap_strides=[4, 8, 16, 32]),
bbox_head=dict(
Expand Down Expand Up @@ -103,7 +103,9 @@
nms_thr=0.7,
min_bbox_size=0),
rcnn=dict(
score_thr=0.05, nms=dict(type='nms', iou_thr=0.5), max_per_img=100)
score_thr=0.05,
nms=dict(type='nms', iou_threshold=0.5),
max_per_img=100)
# soft-nms is also supported for rcnn testing
# e.g., nms=dict(type='soft_nms', iou_thr=0.5, min_score=0.05)
# e.g., nms=dict(type='soft_nms', iou_threshold=0.5, min_score=0.05)
)
4 changes: 2 additions & 2 deletions configs/_base_/models/mask_rcnn_r50_caffe_c4.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
norm_eval=True),
bbox_roi_extractor=dict(
type='SingleRoIExtractor',
roi_layer=dict(type='RoIAlign', out_size=14, sample_num=0),
roi_layer=dict(type='RoIAlign', output_size=14, sampling_ratio=0),
out_channels=1024,
featmap_strides=[16]),
bbox_head=dict(
Expand Down Expand Up @@ -122,6 +122,6 @@
min_bbox_size=0),
rcnn=dict(
score_thr=0.05,
nms=dict(type='nms', iou_thr=0.5),
nms=dict(type='nms', iou_threshold=0.5),
max_per_img=100,
mask_thr_binary=0.5))
6 changes: 3 additions & 3 deletions configs/_base_/models/mask_rcnn_r50_fpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
type='StandardRoIHead',
bbox_roi_extractor=dict(
type='SingleRoIExtractor',
roi_layer=dict(type='RoIAlign', out_size=7, sample_num=0),
roi_layer=dict(type='RoIAlign', output_size=7, sampling_ratio=0),
out_channels=256,
featmap_strides=[4, 8, 16, 32]),
bbox_head=dict(
Expand All @@ -55,7 +55,7 @@
loss_bbox=dict(type='L1Loss', loss_weight=1.0)),
mask_roi_extractor=dict(
type='SingleRoIExtractor',
roi_layer=dict(type='RoIAlign', out_size=14, sample_num=0),
roi_layer=dict(type='RoIAlign', output_size=14, sampling_ratio=0),
out_channels=256,
featmap_strides=[4, 8, 16, 32]),
mask_head=dict(
Expand Down Expand Up @@ -119,6 +119,6 @@
min_bbox_size=0),
rcnn=dict(
score_thr=0.05,
nms=dict(type='nms', iou_thr=0.5),
nms=dict(type='nms', iou_threshold=0.5),
max_per_img=100,
mask_thr_binary=0.5))
2 changes: 1 addition & 1 deletion configs/_base_/models/retinanet_r50_fpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@
nms_pre=1000,
min_bbox_size=0,
score_thr=0.05,
nms=dict(type='nms', iou_thr=0.5),
nms=dict(type='nms', iou_threshold=0.5),
max_per_img=100)
2 changes: 1 addition & 1 deletion configs/_base_/models/ssd300.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
neg_pos_ratio=3,
debug=False)
test_cfg = dict(
nms=dict(type='nms', iou_thr=0.45),
nms=dict(type='nms', iou_threshold=0.45),
min_bbox_size=0,
score_thr=0.02,
max_per_img=200)
2 changes: 1 addition & 1 deletion configs/atss/atss_r50_fpn_1x_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
nms_pre=1000,
min_bbox_size=0,
score_thr=0.05,
nms=dict(type='nms', iou_thr=0.6),
nms=dict(type='nms', iou_threshold=0.6),
max_per_img=100)
# optimizer
optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_base_ = '../cascade_rcnn/cascade_mask_rcnn_r101_fpn_1x_coco.py'
model = dict(
backbone=dict(
dcn=dict(type='DCN', deformable_groups=1, fallback_on_stride=False),
dcn=dict(type='DCN', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)))
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_base_ = '../cascade_rcnn/cascade_mask_rcnn_r50_fpn_1x_coco.py'
model = dict(
backbone=dict(
dcn=dict(type='DCN', deformable_groups=1, fallback_on_stride=False),
dcn=dict(type='DCN', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)))
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_base_ = '../cascade_rcnn/cascade_mask_rcnn_x101_32x4d_fpn_1x_coco.py'
model = dict(
backbone=dict(
dcn=dict(type='DCN', deformable_groups=1, fallback_on_stride=False),
dcn=dict(type='DCN', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)))
2 changes: 1 addition & 1 deletion configs/dcn/cascade_rcnn_r101_fpn_dconv_c3-c5_1x_coco.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_base_ = '../cascade_rcnn/cascade_rcnn_r101_fpn_1x_coco.py'
model = dict(
backbone=dict(
dcn=dict(type='DCN', deformable_groups=1, fallback_on_stride=False),
dcn=dict(type='DCN', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)))
2 changes: 1 addition & 1 deletion configs/dcn/cascade_rcnn_r50_fpn_dconv_c3-c5_1x_coco.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_base_ = '../cascade_rcnn/cascade_rcnn_r50_fpn_1x_coco.py'
model = dict(
backbone=dict(
dcn=dict(type='DCN', deformable_groups=1, fallback_on_stride=False),
dcn=dict(type='DCN', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)))
2 changes: 1 addition & 1 deletion configs/dcn/faster_rcnn_r101_fpn_dconv_c3-c5_1x_coco.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_base_ = '../faster_rcnn/faster_rcnn_r101_fpn_1x_coco.py'
model = dict(
backbone=dict(
dcn=dict(type='DCN', deformable_groups=1, fallback_on_stride=False),
dcn=dict(type='DCN', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)))
2 changes: 1 addition & 1 deletion configs/dcn/faster_rcnn_r50_fpn_dconv_c3-c5_1x_coco.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_base_ = '../faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
model = dict(
backbone=dict(
dcn=dict(type='DCN', deformable_groups=1, fallback_on_stride=False),
dcn=dict(type='DCN', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)))
9 changes: 3 additions & 6 deletions configs/dcn/faster_rcnn_r50_fpn_dpool_1x_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
type='SingleRoIExtractor',
roi_layer=dict(
_delete_=True,
type='DeformRoIPoolingPack',
out_size=7,
out_channels=256,
no_trans=False,
group_size=1,
trans_std=0.1),
type='DeformRoIPoolPack',
output_size=7,
output_channels=256),
out_channels=256,
featmap_strides=[4, 8, 16, 32])))
2 changes: 1 addition & 1 deletion configs/dcn/faster_rcnn_r50_fpn_mdconv_c3-c5_1x_coco.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_base_ = '../faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
model = dict(
backbone=dict(
dcn=dict(type='DCNv2', deformable_groups=1, fallback_on_stride=False),
dcn=dict(type='DCNv2', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)))
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_base_ = '../faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
model = dict(
backbone=dict(
dcn=dict(type='DCNv2', deformable_groups=4, fallback_on_stride=False),
dcn=dict(type='DCNv2', deform_groups=4, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)))
9 changes: 3 additions & 6 deletions configs/dcn/faster_rcnn_r50_fpn_mdpool_1x_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
type='SingleRoIExtractor',
roi_layer=dict(
_delete_=True,
type='ModulatedDeformRoIPoolingPack',
out_size=7,
out_channels=256,
no_trans=False,
group_size=1,
trans_std=0.1),
type='ModulatedDeformRoIPoolPack',
output_size=7,
output_channels=256),
out_channels=256,
featmap_strides=[4, 8, 16, 32])))
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
style='pytorch',
dcn=dict(type='DCN', deformable_groups=1, fallback_on_stride=False),
dcn=dict(type='DCN', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)))
2 changes: 1 addition & 1 deletion configs/dcn/mask_rcnn_r101_fpn_dconv_c3-c5_1x_coco.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_base_ = '../mask_rcnn/mask_rcnn_r101_fpn_1x_coco.py'
model = dict(
backbone=dict(
dcn=dict(type='DCN', deformable_groups=1, fallback_on_stride=False),
dcn=dict(type='DCN', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)))
2 changes: 1 addition & 1 deletion configs/dcn/mask_rcnn_r50_fpn_dconv_c3-c5_1x_coco.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_base_ = '../mask_rcnn/mask_rcnn_r50_fpn_1x_coco.py'
model = dict(
backbone=dict(
dcn=dict(type='DCN', deformable_groups=1, fallback_on_stride=False),
dcn=dict(type='DCN', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)))
2 changes: 1 addition & 1 deletion configs/dcn/mask_rcnn_r50_fpn_mdconv_c3-c5_1x_coco.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_base_ = '../mask_rcnn/mask_rcnn_r50_fpn_1x_coco.py'
model = dict(
backbone=dict(
dcn=dict(type='DCNv2', deformable_groups=1, fallback_on_stride=False),
dcn=dict(type='DCNv2', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)))
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
stages=(False, False, True, True),
position='after_conv2')
],
dcn=dict(type='DCN', deformable_groups=1, fallback_on_stride=False),
dcn=dict(type='DCN', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)))
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
stages=(False, False, True, True),
position='after_conv2')
],
dcn=dict(type='DCN', deformable_groups=1, fallback_on_stride=False),
dcn=dict(type='DCN', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)))
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
test_cfg = dict(
rcnn=dict(
score_thr=0.05,
nms=dict(type='soft_nms', iou_thr=0.5),
nms=dict(type='soft_nms', iou_threshold=0.5),
max_per_img=100))
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
conv_bias=True,
loss_bbox=dict(type='GIoULoss', loss_weight=1.0)))
# training and testing settings
test_cfg = dict(nms=dict(type='nms', iou_thr=0.6))
test_cfg = dict(nms=dict(type='nms', iou_threshold=0.6))

# dataset settings
img_norm_cfg = dict(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
model = dict(
pretrained='open-mmlab://detectron2/resnet50_caffe',
backbone=dict(
dcn=dict(type='DCNv2', deformable_groups=1, fallback_on_stride=False),
dcn=dict(type='DCNv2', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)),
bbox_head=dict(
norm_on_bbox=True,
Expand All @@ -13,7 +13,7 @@
conv_bias=True,
loss_bbox=dict(type='GIoULoss', loss_weight=1.0)))
# training and testing settings
test_cfg = dict(nms=dict(type='nms', iou_thr=0.6))
test_cfg = dict(nms=dict(type='nms', iou_threshold=0.6))

# dataset settings
img_norm_cfg = dict(
Expand Down
2 changes: 1 addition & 1 deletion configs/fcos/fcos_r50_caffe_fpn_4x4_1x_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
nms_pre=1000,
min_bbox_size=0,
score_thr=0.05,
nms=dict(type='nms', iou_thr=0.5),
nms=dict(type='nms', iou_threshold=0.5),
max_per_img=100)
img_norm_cfg = dict(
mean=[102.9801, 115.9465, 122.7717], std=[1.0, 1.0, 1.0], to_rgb=False)
Expand Down
2 changes: 1 addition & 1 deletion configs/fcos/fcos_r50_caffe_fpn_gn-head_4x4_1x_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
nms_pre=1000,
min_bbox_size=0,
score_thr=0.05,
nms=dict(type='nms', iou_thr=0.5),
nms=dict(type='nms', iou_threshold=0.5),
max_per_img=100)
img_norm_cfg = dict(
mean=[102.9801, 115.9465, 122.7717], std=[1.0, 1.0, 1.0], to_rgb=False)
Expand Down
2 changes: 1 addition & 1 deletion configs/foveabox/fovea_r50_fpn_4x4_1x_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
test_cfg = dict(
nms_pre=1000,
score_thr=0.05,
nms=dict(type='nms', iou_thr=0.5),
nms=dict(type='nms', iou_threshold=0.5),
max_per_img=100)
data = dict(samples_per_gpu=4, workers_per_gpu=4)
# optimizer
Expand Down
2 changes: 1 addition & 1 deletion configs/gfl/gfl_r101_fpn_dconv_c3-c5_mstrain_2x_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
dcn=dict(type='DCN', deformable_groups=1, fallback_on_stride=False),
dcn=dict(type='DCN', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True),
norm_eval=True,
style='pytorch'))
Loading

0 comments on commit 5f2cded

Please sign in to comment.