Skip to content

Commit

Permalink
[Dygraph] add ResNet-vd, ResNet-34, ResNeXt-101 (PaddlePaddle#2071)
Browse files Browse the repository at this point in the history
* add configs and modelzoo

* remove trainreader of batchsize 2

* add vd r34 x101

* fix typo

* add vd r34 x101

* add resnet dcn, clean code

* fix x101 width in py2

* add faster mask rcnn dcn configs and modelzoo

* fix dcn modelzoo

* clean dcn configs code
  • Loading branch information
nemonameless committed Jan 18, 2021
1 parent 3d13ead commit ac358bf
Show file tree
Hide file tree
Showing 30 changed files with 930 additions and 58 deletions.
33 changes: 33 additions & 0 deletions dygraph/configs/dcn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
### Deformable ConvNets v2

| 骨架网络 | 网络类型 | 卷积 | 每张GPU图片个数 | 学习率策略 |推理时间(fps)| Box AP | Mask AP | 下载 | 配置文件 |
| :------------------- | :------------- | :-----: |:--------: | :-----: | :-----------: |:----: | :-----: | :----------------------------------------------------------: | :----: |
| ResNet50-FPN | Faster | c3-c5 | 2 | 1x | - | 41.3 | - | [下载链接](https://paddlemodels.bj.bcebos.com/object_detection/dygraph/faster_rcnn_dcn_r50_fpn_1x_coco.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/master/dygraph/configs/dcn/faster_rcnn_dcn_r50_fpn_1x_coco.yml) |
| ResNet50-vd-FPN | Faster | c3-c5 | 2 | 2x | - | 42.4 | - | [下载链接](https://paddlemodels.bj.bcebos.com/object_detection/dygraph/faster_rcnn_dcn_r50_vd_fpn_2x.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/master/dygraph/configs/dcn/faster_rcnn_dcn_r50_vd_fpn_2x.yml) |
| ResNet101-vd-FPN | Faster | c3-c5 | 2 | 1x | - | 44.1 | - | [下载链接](https://paddlemodels.bj.bcebos.com/object_detection/dygraph/faster_rcnn_dcn_r101_vd_fpn_1x.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/master/dygraph/configs/dcn/faster_rcnn_dcn_r101_vd_fpn_1x.yml) |
| ResNeXt101-vd-FPN | Faster | c3-c5 | 1 | 1x | - | 45.2 | - | [下载链接](https://paddlemodels.bj.bcebos.com/object_detection/dygraph/faster_rcnn_dcn_x101_vd_64x4d_fpn_1x.pdparams) |[配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/master/dygraph/configs/dcn/faster_rcnn_dcn_x101_vd_64x4d_fpn_1x.yml) |
| ResNet50-FPN | Mask | c3-c5 | 1 | 1x | - | 41.9 | 37.3 | [下载链接](https://paddlemodels.bj.bcebos.com/object_detection/dygraph/mask_rcnn_dcn_r50_fpn_1x.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/master/dygraph/configs/dcn/mask_rcnn_dcn_r50_fpn_1x.yml) |
| ResNet50-vd-FPN | Mask | c3-c5 | 1 | 2x | - | 42.9 | 38.0 | [下载链接](https://paddlemodels.bj.bcebos.com/object_detection/dygraph/mask_rcnn_dcn_r50_vd_fpn_2x.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/master/dygraph/configs/dcn/mask_rcnn_dcn_r50_vd_fpn_2x.yml) |
| ResNet101-vd-FPN | Mask | c3-c5 | 1 | 1x | - | 44.6 | 39.2 | [下载链接](https://paddlemodels.bj.bcebos.com/object_detection/dygraph/mask_rcnn_dcn_r101_vd_fpn_1x.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/master/dygraph/configs/dcn/mask_rcnn_dcn_r101_vd_fpn_1x.yml) |
| ResNeXt101-vd-FPN | Mask | c3-c5 | 1 | 1x | - | 46.2 | 40.4 | [下载链接](https://paddlemodels.bj.bcebos.com/object_detection/dygraph/mask_rcnn_dcn_x101_vd_64x4d_fpn_1x.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/master/dygraph/configs/dcn/mask_rcnn_dcn_x101_vd_64x4d_fpn_1x.yml) |

**注意事项:**

- Deformable卷积网络v2(dcn_v2)参考自论文[Deformable ConvNets v2](https://arxiv.org/abs/1811.11168).
- `c3-c5`意思是在resnet模块的3到5阶段增加`dcn`.

## Citations
```
@inproceedings{dai2017deformable,
title={Deformable Convolutional Networks},
author={Dai, Jifeng and Qi, Haozhi and Xiong, Yuwen and Li, Yi and Zhang, Guodong and Hu, Han and Wei, Yichen},
booktitle={Proceedings of the IEEE international conference on computer vision},
year={2017}
}
@article{zhu2018deformable,
title={Deformable ConvNets v2: More Deformable, Better Results},
author={Zhu, Xizhou and Hu, Han and Lin, Stephen and Dai, Jifeng},
journal={arXiv preprint arXiv:1811.11168},
year={2018}
}
```
29 changes: 29 additions & 0 deletions dygraph/configs/dcn/faster_rcnn_dcn_r101_vd_fpn_1x_coco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
_BASE_: [
'faster_rcnn_dcn_r50_fpn_1x_coco.yml',
]
pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/ResNet101_pretrained.tar
weights: output/faster_rcnn_dcn_r101_fpn_1x_coco/model_final

ResNet:
# index 0 stands for res2
depth: 101
variant: d
norm_type: bn
freeze_at: 0
return_idx: [0,1,2,3]
num_stages: 4
dcn_v2_stages: [1,2,3]

epoch: 12
LearningRate:
base_lr: 0.02
schedulers:
- !PiecewiseDecay
gamma: 0.1
milestones: [8, 11]
- !LinearWarmup
start_factor: 0.1
steps: 1000

TrainReader:
batch_size: 2
30 changes: 30 additions & 0 deletions dygraph/configs/dcn/faster_rcnn_dcn_r50_fpn_1x_coco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
_BASE_: [
'../datasets/coco_detection.yml',
'../runtime.yml',
'../faster_rcnn/_base_/optimizer_1x.yml',
'../faster_rcnn/_base_/faster_rcnn_r50_fpn.yml',
'../faster_rcnn/_base_/faster_fpn_reader.yml',
]
weights: output/faster_rcnn_dcn_r50_fpn_1x_coco/model_final

ResNet:
depth: 50
norm_type: bn
freeze_at: 0
return_idx: [0,1,2,3]
num_stages: 4
dcn_v2_stages: [1,2,3]

epoch: 12
LearningRate:
base_lr: 0.02
schedulers:
- !PiecewiseDecay
gamma: 0.1
milestones: [8, 11]
- !LinearWarmup
start_factor: 0.1
steps: 1000

TrainReader:
batch_size: 2
29 changes: 29 additions & 0 deletions dygraph/configs/dcn/faster_rcnn_dcn_r50_vd_fpn_2x_coco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
_BASE_: [
'faster_rcnn_dcn_r50_fpn_1x_coco.yml',
]
pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/ResNet50_vd_pretrained.tar
weights: output/faster_rcnn_dcn_r50_vd_fpn_2x_coco/model_final

ResNet:
# index 0 stands for res2
depth: 50
variant: d
norm_type: bn
freeze_at: 0
return_idx: [0,1,2,3]
num_stages: 4
dcn_v2_stages: [1,2,3]

epoch: 24
LearningRate:
base_lr: 0.02
schedulers:
- !PiecewiseDecay
gamma: 0.1
milestones: [16, 22]
- !LinearWarmup
start_factor: 0.1
steps: 1000

TrainReader:
batch_size: 2
29 changes: 29 additions & 0 deletions dygraph/configs/dcn/faster_rcnn_dcn_x101_vd_64x4d_fpn_1x_coco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
_BASE_: [
'faster_rcnn_dcn_r50_fpn_1x_coco.yml',
]
pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/ResNeXt101_vd_64x4d_pretrained.tar
weights: output/faster_rcnn_dcn_x101_vd_64x4d_fpn_1x_coco/model_final.pdparams

ResNet:
# for ResNeXt: groups, base_width, base_channels
depth: 101
groups: 64
base_width: 4
base_channels: 64
variant: d
norm_type: bn
freeze_at: 0
return_idx: [0,1,2,3]
num_stages: 4
dcn_v2_stages: [1,2,3]

epoch: 12
LearningRate:
base_lr: 0.01
schedulers:
- !PiecewiseDecay
gamma: 0.1
milestones: [8, 11]
- !LinearWarmup
start_factor: 0.1
steps: 1000
26 changes: 26 additions & 0 deletions dygraph/configs/dcn/mask_rcnn_dcn_r101_vd_fpn_1x_coco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
_BASE_: [
'mask_rcnn_dcn_r50_fpn_1x_coco.yml',
]
pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/ResNet101_pretrained.tar
weights: output/mask_rcnn_dcn_r101_fpn_1x_coco/model_final.pdparams

ResNet:
# index 0 stands for res2
depth: 101
variant: d
norm_type: bn
freeze_at: 0
return_idx: [0,1,2,3]
num_stages: 4
dcn_v2_stages: [1,2,3]

epoch: 12
LearningRate:
base_lr: 0.01
schedulers:
- !PiecewiseDecay
gamma: 0.1
milestones: [8, 11]
- !LinearWarmup
start_factor: 0.1
steps: 1000
27 changes: 27 additions & 0 deletions dygraph/configs/dcn/mask_rcnn_dcn_r50_fpn_1x_coco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
_BASE_: [
'../datasets/coco_instance.yml',
'../runtime.yml',
'../mask_rcnn/_base_/optimizer_1x.yml',
'../mask_rcnn/_base_/mask_rcnn_r50_fpn.yml',
'../mask_rcnn/_base_/mask_fpn_reader.yml',
]
weights: output/mask_rcnn_dcn_r50_fpn_1x_coco/model_final

ResNet:
depth: 50
norm_type: bn
freeze_at: 0
return_idx: [0,1,2,3]
num_stages: 4
dcn_v2_stages: [1,2,3]

epoch: 12
LearningRate:
base_lr: 0.01
schedulers:
- !PiecewiseDecay
gamma: 0.1
milestones: [8, 11]
- !LinearWarmup
start_factor: 0.1
steps: 1000
26 changes: 26 additions & 0 deletions dygraph/configs/dcn/mask_rcnn_dcn_r50_vd_fpn_2x_coco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
_BASE_: [
'mask_rcnn_dcn_r50_fpn_1x_coco.yml',
]
pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/ResNet50_vd_pretrained.tar
weights: output/mask_rcnn_dcn_r50_vd_fpn_2x_coco/model_final

ResNet:
# index 0 stands for res2
depth: 50
variant: d
norm_type: bn
freeze_at: 0
return_idx: [0,1,2,3]
num_stages: 4
dcn_v2_stages: [1,2,3]

epoch: 24
LearningRate:
base_lr: 0.01
schedulers:
- !PiecewiseDecay
gamma: 0.1
milestones: [16, 22]
- !LinearWarmup
start_factor: 0.1
steps: 1000
29 changes: 29 additions & 0 deletions dygraph/configs/dcn/mask_rcnn_dcn_x101_vd_64x4d_fpn_1x_coco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
_BASE_: [
'mask_rcnn_dcn_r50_fpn_1x_coco.yml',
]
pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/ResNeXt101_vd_64x4d_pretrained.tar
weights: output/mask_rcnn_dcn_x101_vd_64x4d_fpn_1x_coco/model_final.pdparams

ResNet:
# for ResNeXt: groups, base_width, base_channels
depth: 101
variant: d
groups: 64
base_width: 4
base_channels: 64
norm_type: bn
freeze_at: 0
return_idx: [0,1,2,3]
num_stages: 4
dcn_v2_stages: [1,2,3]

epoch: 12
LearningRate:
base_lr: 0.01
schedulers:
- !PiecewiseDecay
gamma: 0.1
milestones: [8, 11]
- !LinearWarmup
start_factor: 0.1
steps: 1000
7 changes: 5 additions & 2 deletions dygraph/configs/faster_rcnn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@

| 骨架网络 | 网络类型 | 每张GPU图片个数 | 学习率策略 |推理时间(fps) | Box AP | Mask AP | 下载 | 配置文件 |
| :------------------- | :------------- | :-----: | :-----: | :------------: | :-----: | :-----: | :-----------------------------------------------------: | :-----: |
| ResNet50 | Faster | 1 | 1x | ---- | 35.1 | - | [下载链接](https://paddlemodels.bj.bcebos.com/object_detection/dygraph/faster_rcnn_r50_1x_coco.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/dygraph/configs/faster_rcnn_r50_1x_coco.yml) |
| ResNet50-FPN | Faster | 1 | 1x | ---- | 37.0 | - | [下载链接](https://paddlemodels.bj.bcebos.com/object_detection/dygraph/faster_rcnn_r50_fpn_1x_coco.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/dygraph/configs/faster_rcnn_r50_fpn_1x_coco.yml) |
| ResNet50 | Faster | 1 | 1x | ---- | 35.1 | - | [下载链接](https://paddlemodels.bj.bcebos.com/object_detection/dygraph/faster_rcnn_r50_1x_coco.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/dygraph/configs/faster_rcnn/faster_rcnn_r50_1x_coco.yml) |
| ResNet50-FPN | Faster | 1 | 1x | ---- | 37.0 | - | [下载链接](https://paddlemodels.bj.bcebos.com/object_detection/dygraph/faster_rcnn_r50_fpn_1x_coco.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/dygraph/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.yml) |
| ResNet34-FPN | Faster | 2 | 1x | ---- | 36.7 | - | [下载链接](https://paddlemodels.bj.bcebos.com/object_detection/dygraph/faster_rcnn_r34_fpn_1x_coco.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/dygraph/configs/faster_rcnn/faster_rcnn_r34_fpn_1x_coco.yml) |
| ResNet101 | Faster | 1 | 1x | ---- | 38.3 | - | [下载链接](https://paddlemodels.bj.bcebos.com/object_detection/dygraph/faster_rcnn_r101_1x_coco.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/dygraph/configs/faster_rcnn/faster_rcnn_r101_1x_coco.yml) |
| ResNet101-FPN | Faster | 1 | 1x | ---- | 38.7 | - | [下载链接](https://paddlemodels.bj.bcebos.com/object_detection/dygraph/faster_rcnn_r101_fpn_1x_coco.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/dygraph/configs/faster_rcnn/faster_rcnn_r101_fpn_1x_coco.yml) |

## Citations
```
Expand Down
14 changes: 14 additions & 0 deletions dygraph/configs/faster_rcnn/faster_rcnn_r101_1x_coco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
_BASE_: [
'faster_rcnn_r50_1x_coco.yml',
]

pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/ResNet101_pretrained.tar
weights: output/faster_rcnn_r101_1x_coco/model_final

ResNet:
# index 0 stands for res2
depth: 101
norm_type: bn
freeze_at: 0
return_idx: [0,1,2,3]
num_stages: 4
14 changes: 14 additions & 0 deletions dygraph/configs/faster_rcnn/faster_rcnn_r101_fpn_1x_coco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
_BASE_: [
'faster_rcnn_r50_fpn_1x_coco.yml',
]

pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/ResNet101_pretrained.tar
weights: output/faster_rcnn_r101_fpn_1x_coco/model_final

ResNet:
# index 0 stands for res2
depth: 101
norm_type: bn
freeze_at: 0
return_idx: [0,1,2,3]
num_stages: 4
25 changes: 25 additions & 0 deletions dygraph/configs/faster_rcnn/faster_rcnn_r101_fpn_2x_coco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
_BASE_: [
'faster_rcnn_r50_fpn_1x_coco.yml',
]

pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/ResNet101_pretrained.tar
weights: output/faster_rcnn_r101_fpn_2x_coco/model_final

ResNet:
# index 0 stands for res2
depth: 101
norm_type: bn
freeze_at: 0
return_idx: [0,1,2,3]
num_stages: 4

epoch: 24
LearningRate:
base_lr: 0.01
schedulers:
- !PiecewiseDecay
gamma: 0.1
milestones: [16, 22]
- !LinearWarmup
start_factor: 0.3333333333333333
steps: 500
26 changes: 26 additions & 0 deletions dygraph/configs/faster_rcnn/faster_rcnn_r101_vd_1x_coco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
_BASE_: [
'faster_rcnn_r50_1x_coco.yml',
]

pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/ResNet101_vd_pretrained.tar
weights: output/faster_rcnn_r101_vd_1x_coco/model_final

ResNet:
# index 0 stands for res2
depth: 101
variant: d
norm_type: bn
freeze_at: 0
return_idx: [0,1,2,3]
num_stages: 4

epoch: 12
LearningRate:
base_lr: 0.01
schedulers:
- !PiecewiseDecay
gamma: 0.1
milestones: [8, 11]
- !LinearWarmup
start_factor: 0.3333333333333333
steps: 1000
25 changes: 25 additions & 0 deletions dygraph/configs/faster_rcnn/faster_rcnn_r101_vd_fpn_1x_coco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
_BASE_: [
'faster_rcnn_r50_fpn_1x_coco.yml',
]
pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/ResNet101_vd_pretrained.tar
weights: output/faster_rcnn_r101_vd_fpn_1x_coco/model_final.pdparams

ResNet:
# index 0 stands for res2
depth: 101
variant: d
norm_type: bn
freeze_at: 0
return_idx: [0,1,2,3]
num_stages: 4

epoch: 12
LearningRate:
base_lr: 0.01
schedulers:
- !PiecewiseDecay
gamma: 0.1
milestones: [8, 11]
- !LinearWarmup
start_factor: 0.3333333333333333
steps: 1000
Loading

0 comments on commit ac358bf

Please sign in to comment.