diff --git a/README.md b/README.md index b480fadbbde14658572f8b992f84f13410033b7b..5f1c923445527be89ff1266259cee31c78720594 100644 --- a/README.md +++ b/README.md @@ -286,8 +286,8 @@ ResNeSt与RegNet系列模型的精度、速度指标如下表所示,更多关 | 模型 | Top-1 Acc | Top-5 Acc | time(ms)
bs=1 | time(ms)
bs=4 | Flops(G) | Params(M) | 下载地址 | |------------------------|-----------|-----------|------------------|------------------|----------|-----------|------------------------------------------------------------------------------------------------------| -| ResNeSt50_
fast_1s1x64d | 0.8035 | 0.9528 | - | - | 8.68 | 26.3 | [下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/ResNeSt50_fast_1s1x64d_pretrained.pdparams) | -| ResNeSt50 | 0.8102 | 0.9542 | - | - | 10.78 | 27.5 | [下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/ResNeSt50_pretrained.pdparams) | +| ResNeSt50_
fast_1s1x64d | 0.8035 | 0.9528 | 3.45405 | 8.72680 | 8.68 | 26.3 | [下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/ResNeSt50_fast_1s1x64d_pretrained.pdparams) | +| ResNeSt50 | 0.8102 | 0.9542 | 6.69042 | 8.01664 | 10.78 | 27.5 | [下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/ResNeSt50_pretrained.pdparams) | | RegNetX_4GF | 0.785 | 0.9416 | 6.46478 | 11.19862 | 8 | 22.1 | [下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/RegNetX_4GF_pretrained.pdparams) | diff --git a/docs/en/models/ResNeSt_RegNet_en.md b/docs/en/models/ResNeSt_RegNet_en.md index 006ffd3b46b9e9b3f47b3f449b587f35daf44d6d..959597a827e1221057876bc17b34efbbf1fdf216 100644 --- a/docs/en/models/ResNeSt_RegNet_en.md +++ b/docs/en/models/ResNeSt_RegNet_en.md @@ -17,6 +17,6 @@ RegNet was proposed in 2020 by Facebook to deepen the concept of design space. B | Models | Crop Size | Resize Short Size | FP16
Batch Size=1
(ms) | FP16
Batch Size=4
(ms) | FP16
Batch Size=8
(ms) | FP32
Batch Size=1
(ms) | FP32
Batch Size=4
(ms) | FP32
Batch Size=8
(ms) | |--------------------|-----------|-------------------|------------------------------|------------------------------|------------------------------|------------------------------|------------------------------|------------------------------| -| ResNeSt50_fast_1s1x64d | 224 | 256 | - | - | - | - | - | - | -| ResNeSt50 | 224 | 256 | - | - | - | - | - | - | +| ResNeSt50_fast_1s1x64d | 224 | 256 | 3.46466 | 5.56647 | 9.11848 | 3.45405 | 8.72680 | 15.48710 | +| ResNeSt50 | 224 | 256 | 7.05851 | 8.97676 | 13.34704 | 6.16248 | 12.0633 | 21.49936 | | RegNetX_4GF | 224 | 256 | 6.69042 | 8.01664 | 11.60608 | 6.46478 | 11.19862 | 16.89089 | diff --git a/docs/zh_CN/models/ResNeSt_RegNet.md b/docs/zh_CN/models/ResNeSt_RegNet.md index 1960237bfb46d7da223b5d7c27f7c03623415cb7..a995347b0377c68a4139bcb93587da3f91e745d5 100644 --- a/docs/zh_CN/models/ResNeSt_RegNet.md +++ b/docs/zh_CN/models/ResNeSt_RegNet.md @@ -20,6 +20,6 @@ RegNet是由facebook于2020年提出,旨在深化设计空间理念的概念 | Models | Crop Size | Resize Short Size | FP16
Batch Size=1
(ms) | FP16
Batch Size=4
(ms) | FP16
Batch Size=8
(ms) | FP32
Batch Size=1
(ms) | FP32
Batch Size=4
(ms) | FP32
Batch Size=8
(ms) | |--------------------|-----------|-------------------|------------------------------|------------------------------|------------------------------|------------------------------|------------------------------|------------------------------| -| ResNeSt50_fast_1s1x64d | 224 | 256 | - | - | - | - | - | - | -| ResNeSt50 | 224 | 256 | - | - | - | - | - | - | +| ResNeSt50_fast_1s1x64d | 224 | 256 | 3.46466 | 5.56647 | 9.11848 | 3.45405 | 8.72680 | 15.48710 | +| ResNeSt50 | 224 | 256 | 7.05851 | 8.97676 | 13.34704 | 6.16248 | 12.0633 | 21.49936 | | RegNetX_4GF | 224 | 256 | 6.69042 | 8.01664 | 11.60608 | 6.46478 | 11.19862 | 16.89089 | diff --git a/ppcls/modeling/architectures/resnest.py b/ppcls/modeling/architectures/resnest.py index d5f1933b1c35410d2ab87c8f6598df3c20453ec6..e98e8bdcba2e74fc7dc1a1a6c8199ee227e43c7b 100644 --- a/ppcls/modeling/architectures/resnest.py +++ b/ppcls/modeling/architectures/resnest.py @@ -104,11 +104,7 @@ class ResNeSt(): is_first=False, name="layer1") x = self.resnest_layer( - x=x, - planes=128, - blocks=self.layers[1], - stride=2, - name="layer2") + x=x, planes=128, blocks=self.layers[1], stride=2, name="layer2") if self.dilated or self.dilation == 4: x = self.resnest_layer( x=x, @@ -152,10 +148,8 @@ class ResNeSt(): blocks=self.layers[3], stride=2, name="layer4") - x = fluid.layers.pool2d( - input=x, pool_type="avg", global_pooling=True) - x = fluid.layers.dropout( - x=x, dropout_prob=self.final_drop) + x = fluid.layers.pool2d(input=x, pool_type="avg", global_pooling=True) + x = fluid.layers.dropout(x=x, dropout_prob=self.final_drop) stdv = 1.0 / math.sqrt(x.shape[1] * 1.0) x = fluid.layers.fc( input=x, @@ -266,8 +260,7 @@ class ResNeSt(): param_attr=ParamAttr( name=name + "_splat_weights", initializer=MSRA()), bias_attr=False) - atten = self.rsoftmax( - x=atten, radix=radix, cardinality=groups) + atten = self.rsoftmax(x=atten, radix=radix, cardinality=groups) atten = fluid.layers.reshape(x=atten, shape=[-1, atten.shape[1], 1, 1]) if radix > 1: @@ -275,10 +268,10 @@ class ResNeSt(): input=atten, num_or_sections=radix, dim=1) out = fluid.layers.sum([ fluid.layers.elementwise_mul( - x=att, y=split) for (att, split) in zip(attens, splited) + x=split, y=att) for (att, split) in zip(attens, splited) ]) else: - out = fluid.layers.elementwise_mul(atten, x) + out = fluid.layers.elementwise_mul(x, atten) return out def bottleneck(self,