Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

add dcn from mmdetection #693

Merged
merged 33 commits into from
Apr 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f93b369
make pixel indexes 0-based for bounding box in pascal voc dataset
zimenglan-sysu-512 Nov 25, 2018
45e4ba8
Merge remote-tracking branch 'upstream/master'
zimenglan-sysu-512 Nov 29, 2018
86caae2
Merge remote-tracking branch 'upstream/master'
zimenglan-sysu-512 Dec 5, 2018
a46bfb9
replacing all instances of torch.distributed.deprecated with torch.di…
zimenglan-sysu-512 Dec 5, 2018
7bbf46f
replacing all instances of torch.distributed.deprecated with torch.di…
zimenglan-sysu-512 Dec 5, 2018
7c8cf41
Merge remote-tracking branch 'upstream/master'
zimenglan-sysu-512 Dec 6, 2018
07a0f9c
Merge remote-tracking branch 'upstream/master'
zimenglan-sysu-512 Dec 26, 2018
6f09a6f
Merge remote-tracking branch 'upstream/master'
zimenglan-sysu-512 Jan 11, 2019
c4e3245
Merge remote-tracking branch 'upstream/master'
zimenglan-sysu-512 Jan 15, 2019
baba31f
add GroupNorm
zimenglan-sysu-512 Jan 15, 2019
4877e36
add GroupNorm -- sort out yaml files
zimenglan-sysu-512 Jan 16, 2019
d4ae039
use torch.nn.GroupNorm instead, replace 'use_gn' with 'conv_block' an…
zimenglan-sysu-512 Jan 18, 2019
333864d
modification on 'group_norm' and 'conv_with_kaiming_uniform' function
zimenglan-sysu-512 Jan 18, 2019
58da4d5
modification on yaml files in configs/gn_baselines/ and reduce the am…
zimenglan-sysu-512 Jan 21, 2019
1798e63
Merge remote-tracking branch 'upstream/master'
zimenglan-sysu-512 Jan 21, 2019
ecc68c4
Merge remote-tracking branch 'upstream/master'
zimenglan-sysu-512 Jan 22, 2019
02a86f3
Merge remote-tracking branch 'upstream/master'
zimenglan-sysu-512 Jan 23, 2019
9808a21
use 'kaiming_uniform' to initialize resnet, disable gn after fc layer…
zimenglan-sysu-512 Jan 23, 2019
d1ce06e
Merge remote-tracking branch 'upstream/master'
zimenglan-sysu-512 Jan 28, 2019
4de3488
agnostic-regression for bbox
zimenglan-sysu-512 Jan 28, 2019
52be8d7
Merge remote-tracking branch 'upstream/master'
zimenglan-sysu-512 Feb 1, 2019
288e16f
Merge remote-tracking branch 'upstream/master'
zimenglan-sysu-512 Feb 5, 2019
d91ff2d
Merge remote-tracking branch 'upstream/master'
zimenglan-sysu-512 Feb 10, 2019
d177092
Merge remote-tracking branch 'upstream/master'
zimenglan-sysu-512 Feb 15, 2019
a52e159
Merge remote-tracking branch 'upstream/master'
zimenglan-sysu-512 Feb 15, 2019
f7ad55e
Merge remote-tracking branch 'upstream/master'
zimenglan-sysu-512 Feb 19, 2019
483fca8
please set 'STRIDE_IN_1X1' to be 'False' when backbone use GN
zimenglan-sysu-512 Feb 19, 2019
f5786e9
merge from upstream/master
zimenglan-sysu-512 Feb 25, 2019
d2d55f9
add README.md for GN
zimenglan-sysu-512 Feb 26, 2019
fc08cdd
Merge remote-tracking branch 'upstream/master'
zimenglan-sysu-512 Mar 6, 2019
db01edb
Merge remote-tracking branch 'upstream/master'
zimenglan-sysu-512 Apr 1, 2019
ca7276d
Merge remote-tracking branch 'upstream/master'
zimenglan-sysu-512 Apr 18, 2019
eee83fc
add dcn from mmdetection
zimenglan-sysu-512 Apr 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ dist/
# project dirs
/datasets
/models
/output
31 changes: 31 additions & 0 deletions configs/dcn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
### Reference
1 [Deformable ConvNets v2: More Deformable, Better Results](https://arxiv.org/pdf/1811.11168.pdf)
2 third-party: [mmdetection](https://github.com/open-mmlab/mmdetection/tree/master/configs/dcn)

### Performance
| case | bbox AP | mask AP |
|----------------------------:|--------:|:-------:|
| R-50-FPN-dcn (implement) | 39.8 | - |
| R-50-FPN-dcn (mmdetection) | 40.0 | - |
| R-50-FPN-mdcn (implement) | 40.0 | - |
| R-50-FPN-mdcn (mmdetection) | 40.3 | - |
| R-50-FPN-dcn (implement) | 40.8 | 36.8 |
| R-50-FPN-dcn (mmdetection) | 41.1 | 37.2 |
| R-50-FPN-dcn (implement) | 40.7 | 36.7 |
| R-50-FPN-dcn (mmdetection) | 41.4 | 37.4 |


### Note
see [dcn-v2](https://github.com/open-mmlab/mmdetection/blob/master/MODEL_ZOO.md#deformable-convolution-v2) in `mmdetection` for more details.


### Usage
add these three lines
```
MODEL:
RESNETS:
# corresponding to C2,C3,C4,C5
STAGE_WITH_DCN: (False, True, True, True)
WITH_MODULATED_DCN: True
DEFORMABLE_GROUPS: 1
```
44 changes: 44 additions & 0 deletions configs/dcn/e2e_faster_rcnn_dconv_R_50_FPN_1x.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
INPUT:
MIN_SIZE_TRAIN: (800,)
MAX_SIZE_TRAIN: 1333
MIN_SIZE_TEST: 800
MAX_SIZE_TEST: 1333
MODEL:
META_ARCHITECTURE: "GeneralizedRCNN"
WEIGHT: "catalog://ImageNetPretrained/MSRA/R-50"
BACKBONE:
CONV_BODY: "R-50-FPN"
RESNETS:
BACKBONE_OUT_CHANNELS: 256
STAGE_WITH_DCN: (False, True, True, True)
WITH_MODULATED_DCN: False
DEFORMABLE_GROUPS: 1
RPN:
USE_FPN: True
ANCHOR_STRIDE: (4, 8, 16, 32, 64)
PRE_NMS_TOP_N_TRAIN: 2000
PRE_NMS_TOP_N_TEST: 1000
POST_NMS_TOP_N_TEST: 1000
FPN_POST_NMS_TOP_N_TEST: 1000
ROI_HEADS:
USE_FPN: True
ROI_BOX_HEAD:
POOLER_RESOLUTION: 7
POOLER_SCALES: (0.25, 0.125, 0.0625, 0.03125)
POOLER_SAMPLING_RATIO: 2
FEATURE_EXTRACTOR: "FPN2MLPFeatureExtractor"
PREDICTOR: "FPNPredictor"
DATASETS:
TRAIN: ("coco_2014_train", "coco_2014_valminusminival")
TEST: ("coco_2014_minival",)
DATALOADER:
SIZE_DIVISIBILITY: 32
SOLVER:
# Assume 8 gpus
BASE_LR: 0.02
WEIGHT_DECAY: 0.0001
STEPS: (60000, 80000)
MAX_ITER: 90000
IMS_PER_BATCH: 16
TEST:
IMS_PER_BATCH: 8
44 changes: 44 additions & 0 deletions configs/dcn/e2e_faster_rcnn_mdconv_R_50_FPN_1x.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
INPUT:
MIN_SIZE_TRAIN: (800,)
MAX_SIZE_TRAIN: 1333
MIN_SIZE_TEST: 800
MAX_SIZE_TEST: 1333
MODEL:
META_ARCHITECTURE: "GeneralizedRCNN"
WEIGHT: "catalog://ImageNetPretrained/MSRA/R-50"
BACKBONE:
CONV_BODY: "R-50-FPN"
RESNETS:
BACKBONE_OUT_CHANNELS: 256
STAGE_WITH_DCN: (False, True, True, True)
WITH_MODULATED_DCN: True
DEFORMABLE_GROUPS: 1
RPN:
USE_FPN: True
ANCHOR_STRIDE: (4, 8, 16, 32, 64)
PRE_NMS_TOP_N_TRAIN: 2000
PRE_NMS_TOP_N_TEST: 1000
POST_NMS_TOP_N_TEST: 1000
FPN_POST_NMS_TOP_N_TEST: 1000
ROI_HEADS:
USE_FPN: True
ROI_BOX_HEAD:
POOLER_RESOLUTION: 7
POOLER_SCALES: (0.25, 0.125, 0.0625, 0.03125)
POOLER_SAMPLING_RATIO: 2
FEATURE_EXTRACTOR: "FPN2MLPFeatureExtractor"
PREDICTOR: "FPNPredictor"
DATASETS:
TRAIN: ("coco_2014_train", "coco_2014_valminusminival")
TEST: ("coco_2014_minival",)
DATALOADER:
SIZE_DIVISIBILITY: 32
SOLVER:
# Assume 8 gpus
BASE_LR: 0.02
WEIGHT_DECAY: 0.0001
STEPS: (60000, 80000)
MAX_ITER: 90000
IMS_PER_BATCH: 16
TEST:
IMS_PER_BATCH: 8
54 changes: 54 additions & 0 deletions configs/dcn/e2e_mask_rcnn_dconv_R_50_FPN_1x.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
INPUT:
MIN_SIZE_TRAIN: (800,)
MAX_SIZE_TRAIN: 1333
MIN_SIZE_TEST: 800
MAX_SIZE_TEST: 1333
MODEL:
META_ARCHITECTURE: "GeneralizedRCNN"
WEIGHT: "catalog://ImageNetPretrained/MSRA/R-50"
BACKBONE:
CONV_BODY: "R-50-FPN"
RESNETS:
BACKBONE_OUT_CHANNELS: 256
STAGE_WITH_DCN: (False, True, True, True)
WITH_MODULATED_DCN: False
DEFORMABLE_GROUPS: 1
RPN:
USE_FPN: True
ANCHOR_STRIDE: (4, 8, 16, 32, 64)
PRE_NMS_TOP_N_TRAIN: 2000
PRE_NMS_TOP_N_TEST: 1000
POST_NMS_TOP_N_TEST: 1000
FPN_POST_NMS_TOP_N_TEST: 1000
ROI_HEADS:
USE_FPN: True
ROI_BOX_HEAD:
POOLER_RESOLUTION: 7
POOLER_SCALES: (0.25, 0.125, 0.0625, 0.03125)
POOLER_SAMPLING_RATIO: 2
FEATURE_EXTRACTOR: "FPN2MLPFeatureExtractor"
PREDICTOR: "FPNPredictor"
ROI_MASK_HEAD:
POOLER_SCALES: (0.25, 0.125, 0.0625, 0.03125)
FEATURE_EXTRACTOR: "MaskRCNNFPNFeatureExtractor"
PREDICTOR: "MaskRCNNC4Predictor"
POOLER_RESOLUTION: 14
POOLER_SAMPLING_RATIO: 2
RESOLUTION: 28
SHARE_BOX_FEATURE_EXTRACTOR: False
MASK_ON: True
DATASETS:
TRAIN: ("coco_2014_train", "coco_2014_valminusminival")
TEST: ("coco_2014_minival",)
DATALOADER:
SIZE_DIVISIBILITY: 32
SOLVER:
# Assume 8 gpus
BASE_LR: 0.02
WEIGHT_DECAY: 0.0001
STEPS: (60000, 80000)
MAX_ITER: 90000
IMS_PER_BATCH: 16
TEST:
IMS_PER_BATCH: 8

53 changes: 53 additions & 0 deletions configs/dcn/e2e_mask_rcnn_mdconv_R_50_FPN_1x.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
INPUT:
MIN_SIZE_TRAIN: (800,)
MAX_SIZE_TRAIN: 1333
MIN_SIZE_TEST: 800
MAX_SIZE_TEST: 1333
MODEL:
META_ARCHITECTURE: "GeneralizedRCNN"
WEIGHT: "catalog://ImageNetPretrained/MSRA/R-50"
BACKBONE:
CONV_BODY: "R-50-FPN"
RESNETS:
BACKBONE_OUT_CHANNELS: 256
STAGE_WITH_DCN: (False, True, True, True)
WITH_MODULATED_DCN: True
DEFORMABLE_GROUPS: 1
RPN:
USE_FPN: True
ANCHOR_STRIDE: (4, 8, 16, 32, 64)
PRE_NMS_TOP_N_TRAIN: 2000
PRE_NMS_TOP_N_TEST: 1000
POST_NMS_TOP_N_TEST: 1000
FPN_POST_NMS_TOP_N_TEST: 1000
ROI_HEADS:
USE_FPN: True
ROI_BOX_HEAD:
POOLER_RESOLUTION: 7
POOLER_SCALES: (0.25, 0.125, 0.0625, 0.03125)
POOLER_SAMPLING_RATIO: 2
FEATURE_EXTRACTOR: "FPN2MLPFeatureExtractor"
PREDICTOR: "FPNPredictor"
ROI_MASK_HEAD:
POOLER_SCALES: (0.25, 0.125, 0.0625, 0.03125)
FEATURE_EXTRACTOR: "MaskRCNNFPNFeatureExtractor"
PREDICTOR: "MaskRCNNC4Predictor"
POOLER_RESOLUTION: 14
POOLER_SAMPLING_RATIO: 2
RESOLUTION: 28
SHARE_BOX_FEATURE_EXTRACTOR: False
MASK_ON: True
DATASETS:
TRAIN: ("coco_2014_train", "coco_2014_valminusminival")
TEST: ("coco_2014_minival",)
DATALOADER:
SIZE_DIVISIBILITY: 32
SOLVER:
# Assume 8 gpus
BASE_LR: 0.02
WEIGHT_DECAY: 0.0001
STEPS: (60000, 80000)
MAX_ITER: 90000
IMS_PER_BATCH: 16
TEST:
IMS_PER_BATCH: 8
4 changes: 4 additions & 0 deletions maskrcnn_benchmark/config/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@
_C.MODEL.RESNETS.RES2_OUT_CHANNELS = 256
_C.MODEL.RESNETS.STEM_OUT_CHANNELS = 64

_C.MODEL.RESNETS.STAGE_WITH_DCN = (False, False, False, False)
_C.MODEL.RESNETS.WITH_MODULATED_DCN = False
_C.MODEL.RESNETS.DEFORMABLE_GROUPS = 1


# ---------------------------------------------------------------------------- #
# RetinaNet Options (Follow the Detectron version)
Expand Down
Loading