未验证 提交 b5c534c2 编写于 作者: Z zhoujun 提交者: GitHub

add Lightweight backbone of centernet (#4586)

上级 b1c36d9c
......@@ -20,7 +20,11 @@
| DLA-34(paper) | 512x512 | 37.4 | - | - | - |
| DLA-34 | 512x512 | 37.6 | - | [下载链接](https://bj.bcebos.com/v1/paddledet/models/centernet_dla34_140e_coco.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/centernet/centernet_dla34_140e_coco.yml) |
| ResNet50 + DLAUp | 512x512 | 38.9 | - | [下载链接](https://bj.bcebos.com/v1/paddledet/models/centernet_r50_140e_coco.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/centernet/centernet_r50_140e_coco.yml) |
| GhostNet_x1_3 + DLAUp | 512x512 | 28.9 | - | [下载链接](https://paddledet.bj.bcebos.com/models/centernet_ghostnet_1_3x_140e_coco.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/centernet/centernet_ghostnet_1_3x_140e_coco.yml) |
| PP-LCNet_x1_0 + DLAUp | 512x512 | 26.9 | - | [下载链接](https://paddledet.bj.bcebos.com/models/centernet_lcnet_1x_140e_coco.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/centernet/centernet_lcnet_1x_140e_coco.yml) |
| MobileNetV1_1x + DLAUp | 512x512 | 28.2 | - | [下载链接](https://paddledet.bj.bcebos.com/models/centernet_mbv1_1x_140e_coco.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/centernet/centernet_mbv1_1x_140e_coco.yml) |
| MobileNetV3_large_x1_0 + DLAUp | 512x512 | 27.1 | - | [下载链接](https://paddledet.bj.bcebos.com/models/centernet_mbv3_large_1x_140e_coco.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/centernet/centernet_mbv3_large_1x_140e_coco.yml) |
| ShuffleNetV2_x1_0 + DLAUp | 512x512 | 23.8 | - | [下载链接](https://paddledet.bj.bcebos.com/models/centernet_shufflenetv2_1x_140e_coco.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/centernet/centernet_shufflenetv2_1x_140e_coco.yml) |
## 引用
```
......
_BASE_: [
'centernet_r50_140e_coco.yml'
]
pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/GhostNet_x1_3_ssld_pretrained.pdparams
weights: output/centernet_ghostnet_1_3x_140e_coco/model_final
CenterNet:
backbone: GhostNet
neck: CenterNetDLAFPN
head: CenterNetHead
post_process: CenterNetPostProcess
GhostNet:
scale: 1.3
conv_decay: 0.00004
feature_maps: [4, 6, 12, 17]
TrainReader:
batch_size: 32
\ No newline at end of file
_BASE_: [
'centernet_r50_140e_coco.yml'
]
pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/LCNet_x1_0_pretrained.pdparams
weights: output/centernet_lcnet_1x_140e_coco/model_final
CenterNet:
backbone: LCNet
neck: CenterNetDLAFPN
head: CenterNetHead
post_process: CenterNetPostProcess
LCNet:
scale: 1.0
feature_maps: [2, 3, 4, 5]
TrainReader:
batch_size: 32
\ No newline at end of file
_BASE_: [
'centernet_r50_140e_coco.yml'
]
pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/MobileNetV1_pretrained.pdparams
weights: output/centernet_mbv1_1x_140e_coco/model_final
CenterNet:
backbone: MobileNet
neck: CenterNetDLAFPN
head: CenterNetHead
post_process: CenterNetPostProcess
MobileNet:
scale: 1.
with_extra_blocks: false
extra_block_filters: []
feature_maps: [3, 5, 11, 13]
TrainReader:
batch_size: 32
\ No newline at end of file
_BASE_: [
'centernet_r50_140e_coco.yml'
]
pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/MobileNetV3_large_x1_0_ssld_pretrained.pdparams
weights: output/centernet_mbv3_large_1x_140e_coco/model_final
CenterNet:
backbone: MobileNetV3
neck: CenterNetDLAFPN
head: CenterNetHead
post_process: CenterNetPostProcess
MobileNetV3:
model_name: large
scale: 1.
with_extra_blocks: false
extra_block_filters: []
feature_maps: [4, 7, 13, 16]
TrainReader:
batch_size: 32
\ No newline at end of file
_BASE_: [
'centernet_r50_140e_coco.yml'
]
pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/ShuffleNetV2_x1_0_pretrained.pdparams
weights: output/centernet_shufflenetv2_1x_140e_coco/model_final
CenterNet:
backbone: ShuffleNetV2
neck: CenterNetDLAFPN
head: CenterNetHead
post_process: CenterNetPostProcess
ShuffleNetV2:
scale: 1.0
feature_maps: [5, 13, 17]
act: leaky_relu
CenterNetDLAFPN:
first_level: 0
last_level: 3
down_ratio: 8
dcn_v2: False
TrainReader:
batch_size: 32
TestReader:
sample_transforms:
- Decode: {}
- WarpAffine: {keep_res: False, input_h: 512, input_w: 512}
- NormalizeImage: {mean: [0.40789655, 0.44719303, 0.47026116], std: [0.2886383 , 0.27408165, 0.27809834]}
- Permute: {}
\ No newline at end of file
......@@ -77,10 +77,10 @@ def get_affine_transform(center,
np.ndarray: The transform matrix.
"""
assert len(center) == 2
assert len(input_size) == 2
assert len(output_size) == 2
assert len(shift) == 2
if not isinstance(input_size, (np.ndarray, list)):
input_size = np.array([input_size, input_size], dtype=np.float32)
scale_tmp = input_size
shift = np.array(shift)
......
......@@ -226,7 +226,7 @@ class MobileNet(nn.Layer):
norm_type=norm_type,
name="conv2_1"))
self.dwsl.append(dws21)
self._update_out_channels(64, len(self.dwsl), feature_maps)
self._update_out_channels(int(64 * scale), len(self.dwsl), feature_maps)
dws22 = self.add_sublayer(
"conv2_2",
sublayer=DepthwiseSeparable(
......@@ -242,7 +242,7 @@ class MobileNet(nn.Layer):
norm_type=norm_type,
name="conv2_2"))
self.dwsl.append(dws22)
self._update_out_channels(128, len(self.dwsl), feature_maps)
self._update_out_channels(int(128 * scale), len(self.dwsl), feature_maps)
# 1/4
dws31 = self.add_sublayer(
"conv3_1",
......@@ -259,7 +259,7 @@ class MobileNet(nn.Layer):
norm_type=norm_type,
name="conv3_1"))
self.dwsl.append(dws31)
self._update_out_channels(128, len(self.dwsl), feature_maps)
self._update_out_channels(int(128 * scale), len(self.dwsl), feature_maps)
dws32 = self.add_sublayer(
"conv3_2",
sublayer=DepthwiseSeparable(
......@@ -275,7 +275,7 @@ class MobileNet(nn.Layer):
norm_type=norm_type,
name="conv3_2"))
self.dwsl.append(dws32)
self._update_out_channels(256, len(self.dwsl), feature_maps)
self._update_out_channels(int(256 * scale), len(self.dwsl), feature_maps)
# 1/8
dws41 = self.add_sublayer(
"conv4_1",
......@@ -292,7 +292,7 @@ class MobileNet(nn.Layer):
norm_type=norm_type,
name="conv4_1"))
self.dwsl.append(dws41)
self._update_out_channels(256, len(self.dwsl), feature_maps)
self._update_out_channels(int(256 * scale), len(self.dwsl), feature_maps)
dws42 = self.add_sublayer(
"conv4_2",
sublayer=DepthwiseSeparable(
......@@ -308,13 +308,13 @@ class MobileNet(nn.Layer):
norm_type=norm_type,
name="conv4_2"))
self.dwsl.append(dws42)
self._update_out_channels(512, len(self.dwsl), feature_maps)
self._update_out_channels(int(512 * scale), len(self.dwsl), feature_maps)
# 1/16
for i in range(5):
tmp = self.add_sublayer(
"conv5_" + str(i + 1),
sublayer=DepthwiseSeparable(
in_channels=512,
in_channels=int(512 * scale),
out_channels1=512,
out_channels2=512,
num_groups=512,
......@@ -326,7 +326,7 @@ class MobileNet(nn.Layer):
norm_type=norm_type,
name="conv5_" + str(i + 1)))
self.dwsl.append(tmp)
self._update_out_channels(512, len(self.dwsl), feature_maps)
self._update_out_channels(int(512 * scale), len(self.dwsl), feature_maps)
dws56 = self.add_sublayer(
"conv5_6",
sublayer=DepthwiseSeparable(
......@@ -342,7 +342,7 @@ class MobileNet(nn.Layer):
norm_type=norm_type,
name="conv5_6"))
self.dwsl.append(dws56)
self._update_out_channels(1024, len(self.dwsl), feature_maps)
self._update_out_channels(int(1024 * scale), len(self.dwsl), feature_maps)
# 1/32
dws6 = self.add_sublayer(
"conv6",
......@@ -359,7 +359,7 @@ class MobileNet(nn.Layer):
norm_type=norm_type,
name="conv6"))
self.dwsl.append(dws6)
self._update_out_channels(1024, len(self.dwsl), feature_maps)
self._update_out_channels(int(1024 * scale), len(self.dwsl), feature_maps)
if self.with_extra_blocks:
self.extra_blocks = []
......
......@@ -270,6 +270,8 @@ class CenterNetDLAFPN(nn.Layer):
feat = ida_up_feats[-1]
if self.with_sge:
feat = self.sge_attention(feat)
if self.down_ratio != 4:
feat = F.interpolate(feat, scale_factor=self.down_ratio // 4, mode="bilinear", align_corners=True)
return feat
@property
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册