提交 ae2cbc31 编写于 作者: G gaotingquan

Merge remote-tracking branch 'upstream/dygraph' into dygraph

Update repo
...@@ -6,15 +6,13 @@ ...@@ -6,15 +6,13 @@
PaddleClas is a toolset for image classification tasks prepared for the industry and academia. It helps users train better computer vision models and apply them in real scenarios. PaddleClas is a toolset for image classification tasks prepared for the industry and academia. It helps users train better computer vision models and apply them in real scenarios.
**Recent update** **Recent update**
- 2020.09.17 Add `Res2Net50_vd_26w_4s_ssld` pretrained model, whose Top-1 Acc on ImageNet-1k dataset reaches 83.1%. Add `Res2Net101_vd_26w_4s_ssld` pretrained model, whose Top-1 Acc on ImageNet-1k dataset reaches 83.9%.
- 2020.10.12 Add Paddle-Lite demo。 - 2020.10.12 Add Paddle-Lite demo。
- 2020.10.10 Add cpp inference demo and improve FAQ tutorial. - 2020.10.10 Add cpp inference demo and improve FAQ tutorial.
- 2020.09.17 Add `HRNet_W48_C_ssld` pretrained model, whose Top-1 Acc on ImageNet-1k dataset reaches 83.62%. Add `ResNet34_vd_ssld` pretrained model, whose Top-1 Acc on ImageNet-1k dataset reaches 79.72%. - 2020.09.17 Add `HRNet_W48_C_ssld` pretrained model, whose Top-1 Acc on ImageNet-1k dataset reaches 83.62%. Add `ResNet34_vd_ssld` pretrained model, whose Top-1 Acc on ImageNet-1k dataset reaches 79.72%.
- 2020.09.07 Add `HRNet_W18_C_ssld` pretrained model, whose Top-1 Acc on ImageNet-1k dataset reaches 81.16%. - 2020.09.07 Add `HRNet_W18_C_ssld` pretrained model, whose Top-1 Acc on ImageNet-1k dataset reaches 81.16%.
- 2020.07.14 Add `Res2Net200_vd_26w_4s_ssld` pretrained model, whose Top-1 Acc on ImageNet-1k dataset reaches 85.13%. Add `Fix_ResNet50_vd_ssld_v2` pretrained model, whose Top-1 Acc on ImageNet-1k dataset reaches 84.00%. - 2020.07.14 Add `Res2Net200_vd_26w_4s_ssld` pretrained model, whose Top-1 Acc on ImageNet-1k dataset reaches 85.13%. Add `Fix_ResNet50_vd_ssld_v2` pretrained model, whose Top-1 Acc on ImageNet-1k dataset reaches 84.00%.
- 2020.06.17 Add English documents.
- 2020.06.12 Add support for training and evaluation on Windows or CPU.
- [more](./docs/en/update_history_en.md) - [more](./docs/en/update_history_en.md)
......
...@@ -7,13 +7,12 @@ ...@@ -7,13 +7,12 @@
飞桨图像分类套件PaddleClas是飞桨为工业界和学术界所准备的一个图像分类任务的工具集,助力使用者训练出更好的视觉模型和应用落地。 飞桨图像分类套件PaddleClas是飞桨为工业界和学术界所准备的一个图像分类任务的工具集,助力使用者训练出更好的视觉模型和应用落地。
**近期更新** **近期更新**
- 2020.10.20 添加 `Res2Net50_vd_26w_4s_ssld `模型,在ImageNet-1k上Top-1 Acc可达83.1%;添加 `Res2Net101_vd_26w_4s_ssld `模型,在ImageNet-1k上Top-1 Acc可达83.9%。
- 2020.10.12 添加Paddle-Lite demo。 - 2020.10.12 添加Paddle-Lite demo。
- 2020.10.10 添加cpp inference demo,完善`FAQ 30问`教程。 - 2020.10.10 添加cpp inference demo,完善`FAQ 30问`教程。
- 2020.09.17 添加 `HRNet_W48_C_ssld `模型,在ImageNet-1k上Top-1 Acc可达83.62%;添加 `ResNet34_vd_ssld `模型,在ImageNet-1k上Top-1 Acc可达79.72%。 - 2020.09.17 添加 `HRNet_W48_C_ssld `模型,在ImageNet-1k上Top-1 Acc可达83.62%;添加 `ResNet34_vd_ssld `模型,在ImageNet-1k上Top-1 Acc可达79.72%。
- 2020.09.07 添加 `HRNet_W18_C_ssld `模型,在ImageNet-1k上Top-1 Acc可达81.16%;添加 `MobileNetV3_small_x0_35_ssld `模型,在ImageNet-1k上Top-1 Acc可达55.55%。 - 2020.09.07 添加 `HRNet_W18_C_ssld `模型,在ImageNet-1k上Top-1 Acc可达81.16%;添加 `MobileNetV3_small_x0_35_ssld `模型,在ImageNet-1k上Top-1 Acc可达55.55%。
- 2020.07.14 添加 `Res2Net200_vd_26w_4s_ssld `模型,在ImageNet-1k上Top-1 Acc可达85.13%;添加 `Fix_ResNet50_vd_ssld_v2 `模型,在ImageNet-1k上Top-1 Acc可达84.0%。 - 2020.07.14 添加 `Res2Net200_vd_26w_4s_ssld `模型,在ImageNet-1k上Top-1 Acc可达85.13%;添加 `Fix_ResNet50_vd_ssld_v2 `模型,在ImageNet-1k上Top-1 Acc可达84.0%。
- 2020.06.17 添加英文文档。
- 2020.06.12 添加对windows和CPU环境的训练与评估支持。
- [more](./docs/zh_CN/update_history.md) - [more](./docs/zh_CN/update_history.md)
......
...@@ -2,7 +2,6 @@ mode: 'train' ...@@ -2,7 +2,6 @@ mode: 'train'
ARCHITECTURE: ARCHITECTURE:
name: "EfficientNetB0" name: "EfficientNetB0"
params: params:
is_test: False
padding_type : "SAME" padding_type : "SAME"
override_params: override_params:
drop_connect_rate: 0.1 drop_connect_rate: 0.1
......
...@@ -30,8 +30,10 @@ At present, there are a total of 24 pretrained models of the three categories op ...@@ -30,8 +30,10 @@ At present, there are a total of 24 pretrained models of the three categories op
|:--:|:--:|:--:|:--:|:--:|:--:|:--:| |:--:|:--:|:--:|:--:|:--:|:--:|:--:|
| Res2Net50_26w_4s | 0.793 | 0.946 | 0.780 | 0.936 | 8.520 | 25.700 | | Res2Net50_26w_4s | 0.793 | 0.946 | 0.780 | 0.936 | 8.520 | 25.700 |
| Res2Net50_vd_26w_4s | 0.798 | 0.949 | | | 8.370 | 25.060 | | Res2Net50_vd_26w_4s | 0.798 | 0.949 | | | 8.370 | 25.060 |
| Res2Net50_vd_26w_4s_ssld | 0.831 | 0.966 | | | 8.370 | 25.060 |
| Res2Net50_14w_8s | 0.795 | 0.947 | 0.781 | 0.939 | 9.010 | 25.720 | | Res2Net50_14w_8s | 0.795 | 0.947 | 0.781 | 0.939 | 9.010 | 25.720 |
| Res2Net101_vd_26w_4s | 0.806 | 0.952 | | | 16.670 | 45.220 | | Res2Net101_vd_26w_4s | 0.806 | 0.952 | | | 16.670 | 45.220 |
| Res2Net101_vd_26w_4s_ssld | 0.839 | 0.971 | | | 16.670 | 45.220 |
| Res2Net200_vd_26w_4s | 0.812 | 0.957 | | | 31.490 | 76.210 | | Res2Net200_vd_26w_4s | 0.812 | 0.957 | | | 31.490 | 76.210 |
| Res2Net200_vd_26w_4s_ssld | **0.851** | 0.974 | | | 31.490 | 76.210 | | Res2Net200_vd_26w_4s_ssld | **0.851** | 0.974 | | | 31.490 | 76.210 |
| ResNeXt50_32x4d | 0.778 | 0.938 | 0.778 | | 8.020 | 23.640 | | ResNeXt50_32x4d | 0.778 | 0.938 | 0.778 | | 8.020 | 23.640 |
......
# Release Notes # Release Notes
* 2020.10.20
* Add `Res2Net50_vd_26w_4s_ssld` pretrained model, whose Top-1 Acc on ImageNet1k dataset reaches 83.1%.
* Add `Res2Net101_vd_26w_4s_ssld` pretrained model, whose Top-1 Acc on ImageNet1k dataset reaches 83.9%.
- 2020.10.12 - 2020.10.12
* Add Paddle-Lite demo. * Add Paddle-Lite demo.
......
...@@ -29,8 +29,10 @@ Res2Net是2019年提出的一种全新的对ResNet的改进方案,该方案可 ...@@ -29,8 +29,10 @@ Res2Net是2019年提出的一种全新的对ResNet的改进方案,该方案可
|:--:|:--:|:--:|:--:|:--:|:--:|:--:| |:--:|:--:|:--:|:--:|:--:|:--:|:--:|
| Res2Net50_26w_4s | 0.793 | 0.946 | 0.780 | 0.936 | 8.520 | 25.700 | | Res2Net50_26w_4s | 0.793 | 0.946 | 0.780 | 0.936 | 8.520 | 25.700 |
| Res2Net50_vd_26w_4s | 0.798 | 0.949 | | | 8.370 | 25.060 | | Res2Net50_vd_26w_4s | 0.798 | 0.949 | | | 8.370 | 25.060 |
| Res2Net50_vd_26w_4s_ssld | 0.831 | 0.966 | | | 8.370 | 25.060 |
| Res2Net50_14w_8s | 0.795 | 0.947 | 0.781 | 0.939 | 9.010 | 25.720 | | Res2Net50_14w_8s | 0.795 | 0.947 | 0.781 | 0.939 | 9.010 | 25.720 |
| Res2Net101_vd_26w_4s | 0.806 | 0.952 | | | 16.670 | 45.220 | | Res2Net101_vd_26w_4s | 0.806 | 0.952 | | | 16.670 | 45.220 |
| Res2Net101_vd_26w_4s_ssld | 0.839 | 0.971 | | | 16.670 | 45.220 |
| Res2Net200_vd_26w_4s | 0.812 | 0.957 | | | 31.490 | 76.210 | | Res2Net200_vd_26w_4s | 0.812 | 0.957 | | | 31.490 | 76.210 |
| Res2Net200_vd_26w_4s_ssld | **0.851** | 0.974 | | | 31.490 | 76.210 | | Res2Net200_vd_26w_4s_ssld | **0.851** | 0.974 | | | 31.490 | 76.210 |
| ResNeXt50_32x4d | 0.778 | 0.938 | 0.778 | | 8.020 | 23.640 | | ResNeXt50_32x4d | 0.778 | 0.938 | 0.778 | | 8.020 | 23.640 |
......
# 更新日志 # 更新日志
- 2020.10.20
* 添加Res2Net50_vd_26w_4s_ssld模型,在ImageNet上Top-1 Acc可达0.831;添加Res2Net101_vd_26w_4s_ssld模型,在ImageNet上Top-1 Acc可达0.839。
- 2020.10.12 - 2020.10.12
* 添加Paddle-Lite demo。 * 添加Paddle-Lite demo。
......
...@@ -518,7 +518,6 @@ class MbConvBlock(nn.Layer): ...@@ -518,7 +518,6 @@ class MbConvBlock(nn.Layer):
use_se, use_se,
name=None, name=None,
drop_connect_rate=None, drop_connect_rate=None,
is_test=False,
model_name=None, model_name=None,
cur_stage=None): cur_stage=None):
super(MbConvBlock, self).__init__() super(MbConvBlock, self).__init__()
...@@ -530,7 +529,6 @@ class MbConvBlock(nn.Layer): ...@@ -530,7 +529,6 @@ class MbConvBlock(nn.Layer):
self.id_skip = block_args.id_skip self.id_skip = block_args.id_skip
self.expand_ratio = block_args.expand_ratio self.expand_ratio = block_args.expand_ratio
self.drop_connect_rate = drop_connect_rate self.drop_connect_rate = drop_connect_rate
self.is_test = is_test
if self.expand_ratio != 1: if self.expand_ratio != 1:
self._ecn = ExpandConvNorm( self._ecn = ExpandConvNorm(
...@@ -583,7 +581,7 @@ class MbConvBlock(nn.Layer): ...@@ -583,7 +581,7 @@ class MbConvBlock(nn.Layer):
self.block_args.stride == 1 and \ self.block_args.stride == 1 and \
self.block_args.input_filters == self.block_args.output_filters: self.block_args.input_filters == self.block_args.output_filters:
if self.drop_connect_rate: if self.drop_connect_rate:
x = _drop_connect(x, self.drop_connect_rate, self.is_test) x = _drop_connect(x, self.drop_connect_rate, not self.training)
x = paddle.elementwise_add(x, inputs) x = paddle.elementwise_add(x, inputs)
return x return x
...@@ -623,7 +621,6 @@ class ExtractFeatures(nn.Layer): ...@@ -623,7 +621,6 @@ class ExtractFeatures(nn.Layer):
_global_params, _global_params,
padding_type, padding_type,
use_se, use_se,
is_test,
model_name=None): model_name=None):
super(ExtractFeatures, self).__init__() super(ExtractFeatures, self).__init__()
...@@ -661,7 +658,7 @@ class ExtractFeatures(nn.Layer): ...@@ -661,7 +658,7 @@ class ExtractFeatures(nn.Layer):
num_repeat=round_repeats(block_args.num_repeat, num_repeat=round_repeats(block_args.num_repeat,
_global_params)) _global_params))
drop_connect_rate = self._global_params.drop_connect_rate if not is_test else 0 drop_connect_rate = self._global_params.drop_connect_rate
if drop_connect_rate: if drop_connect_rate:
drop_connect_rate *= float(idx) / block_size drop_connect_rate *= float(idx) / block_size
...@@ -682,7 +679,7 @@ class ExtractFeatures(nn.Layer): ...@@ -682,7 +679,7 @@ class ExtractFeatures(nn.Layer):
block_args = block_args._replace( block_args = block_args._replace(
input_filters=block_args.output_filters, stride=1) input_filters=block_args.output_filters, stride=1)
for _ in range(block_args.num_repeat - 1): for _ in range(block_args.num_repeat - 1):
drop_connect_rate = self._global_params.drop_connect_rate if not is_test else 0 drop_connect_rate = self._global_params.drop_connect_rate
if drop_connect_rate: if drop_connect_rate:
drop_connect_rate *= float(idx) / block_size drop_connect_rate *= float(idx) / block_size
_mc_block = self.add_sublayer( _mc_block = self.add_sublayer(
...@@ -711,7 +708,6 @@ class ExtractFeatures(nn.Layer): ...@@ -711,7 +708,6 @@ class ExtractFeatures(nn.Layer):
class EfficientNet(nn.Layer): class EfficientNet(nn.Layer):
def __init__(self, def __init__(self,
name="b0", name="b0",
is_test=True,
padding_type="SAME", padding_type="SAME",
override_params=None, override_params=None,
use_se=True, use_se=True,
...@@ -724,7 +720,6 @@ class EfficientNet(nn.Layer): ...@@ -724,7 +720,6 @@ class EfficientNet(nn.Layer):
model_name, override_params) model_name, override_params)
self.padding_type = padding_type self.padding_type = padding_type
self.use_se = use_se self.use_se = use_se
self.is_test = is_test
self._ef = ExtractFeatures( self._ef = ExtractFeatures(
3, 3,
...@@ -732,7 +727,6 @@ class EfficientNet(nn.Layer): ...@@ -732,7 +727,6 @@ class EfficientNet(nn.Layer):
self._global_params, self._global_params,
self.padding_type, self.padding_type,
self.use_se, self.use_se,
self.is_test,
model_name=self.name) model_name=self.name)
output_channels = round_filters(1280, self._global_params) output_channels = round_filters(1280, self._global_params)
...@@ -785,14 +779,12 @@ class EfficientNet(nn.Layer): ...@@ -785,14 +779,12 @@ class EfficientNet(nn.Layer):
return x return x
def EfficientNetB0_small(is_test=True, def EfficientNetB0_small(padding_type='DYNAMIC',
padding_type='DYNAMIC',
override_params=None, override_params=None,
use_se=False, use_se=False,
**args): **args):
model = EfficientNet( model = EfficientNet(
name='b0', name='b0',
is_test=is_test,
padding_type=padding_type, padding_type=padding_type,
override_params=override_params, override_params=override_params,
use_se=use_se, use_se=use_se,
...@@ -800,14 +792,12 @@ def EfficientNetB0_small(is_test=True, ...@@ -800,14 +792,12 @@ def EfficientNetB0_small(is_test=True,
return model return model
def EfficientNetB0(is_test=False, def EfficientNetB0(padding_type='SAME',
padding_type='SAME',
override_params=None, override_params=None,
use_se=True, use_se=True,
**args): **args):
model = EfficientNet( model = EfficientNet(
name='b0', name='b0',
is_test=is_test,
padding_type=padding_type, padding_type=padding_type,
override_params=override_params, override_params=override_params,
use_se=use_se, use_se=use_se,
...@@ -815,14 +805,12 @@ def EfficientNetB0(is_test=False, ...@@ -815,14 +805,12 @@ def EfficientNetB0(is_test=False,
return model return model
def EfficientNetB1(is_test=False, def EfficientNetB1(padding_type='SAME',
padding_type='SAME',
override_params=None, override_params=None,
use_se=True, use_se=True,
**args): **args):
model = EfficientNet( model = EfficientNet(
name='b1', name='b1',
is_test=is_test,
padding_type=padding_type, padding_type=padding_type,
override_params=override_params, override_params=override_params,
use_se=use_se, use_se=use_se,
...@@ -830,14 +818,12 @@ def EfficientNetB1(is_test=False, ...@@ -830,14 +818,12 @@ def EfficientNetB1(is_test=False,
return model return model
def EfficientNetB2(is_test=False, def EfficientNetB2(padding_type='SAME',
padding_type='SAME',
override_params=None, override_params=None,
use_se=True, use_se=True,
**args): **args):
model = EfficientNet( model = EfficientNet(
name='b2', name='b2',
is_test=is_test,
padding_type=padding_type, padding_type=padding_type,
override_params=override_params, override_params=override_params,
use_se=use_se, use_se=use_se,
...@@ -845,14 +831,12 @@ def EfficientNetB2(is_test=False, ...@@ -845,14 +831,12 @@ def EfficientNetB2(is_test=False,
return model return model
def EfficientNetB3(is_test=False, def EfficientNetB3(padding_type='SAME',
padding_type='SAME',
override_params=None, override_params=None,
use_se=True, use_se=True,
**args): **args):
model = EfficientNet( model = EfficientNet(
name='b3', name='b3',
is_test=is_test,
padding_type=padding_type, padding_type=padding_type,
override_params=override_params, override_params=override_params,
use_se=use_se, use_se=use_se,
...@@ -860,14 +844,12 @@ def EfficientNetB3(is_test=False, ...@@ -860,14 +844,12 @@ def EfficientNetB3(is_test=False,
return model return model
def EfficientNetB4(is_test=False, def EfficientNetB4(padding_type='SAME',
padding_type='SAME',
override_params=None, override_params=None,
use_se=True, use_se=True,
**args): **args):
model = EfficientNet( model = EfficientNet(
name='b4', name='b4',
is_test=is_test,
padding_type=padding_type, padding_type=padding_type,
override_params=override_params, override_params=override_params,
use_se=use_se, use_se=use_se,
...@@ -875,14 +857,12 @@ def EfficientNetB4(is_test=False, ...@@ -875,14 +857,12 @@ def EfficientNetB4(is_test=False,
return model return model
def EfficientNetB5(is_test=False, def EfficientNetB5(padding_type='SAME',
padding_type='SAME',
override_params=None, override_params=None,
use_se=True, use_se=True,
**args): **args):
model = EfficientNet( model = EfficientNet(
name='b5', name='b5',
is_test=is_test,
padding_type=padding_type, padding_type=padding_type,
override_params=override_params, override_params=override_params,
use_se=use_se, use_se=use_se,
...@@ -890,14 +870,12 @@ def EfficientNetB5(is_test=False, ...@@ -890,14 +870,12 @@ def EfficientNetB5(is_test=False,
return model return model
def EfficientNetB6(is_test=False, def EfficientNetB6(padding_type='SAME',
padding_type='SAME',
override_params=None, override_params=None,
use_se=True, use_se=True,
**args): **args):
model = EfficientNet( model = EfficientNet(
name='b6', name='b6',
is_test=is_test,
padding_type=padding_type, padding_type=padding_type,
override_params=override_params, override_params=override_params,
use_se=use_se, use_se=use_se,
...@@ -905,14 +883,12 @@ def EfficientNetB6(is_test=False, ...@@ -905,14 +883,12 @@ def EfficientNetB6(is_test=False,
return model return model
def EfficientNetB7(is_test=False, def EfficientNetB7(padding_type='SAME',
padding_type='SAME',
override_params=None, override_params=None,
use_se=True, use_se=True,
**args): **args):
model = EfficientNet( model = EfficientNet(
name='b7', name='b7',
is_test=is_test,
padding_type=padding_type, padding_type=padding_type,
override_params=override_params, override_params=override_params,
use_se=use_se, use_se=use_se,
......
...@@ -57,7 +57,6 @@ class ConvBNLayer(nn.Layer): ...@@ -57,7 +57,6 @@ class ConvBNLayer(nn.Layer):
stride=stride, stride=stride,
padding=(filter_size - 1) // 2, padding=(filter_size - 1) // 2,
groups=groups, groups=groups,
act=None,
weight_attr=ParamAttr(name=name + "_weights"), weight_attr=ParamAttr(name=name + "_weights"),
bias_attr=False) bias_attr=False)
if name == "conv1": if name == "conv1":
...@@ -111,8 +110,7 @@ class BottleneckBlock(nn.Layer): ...@@ -111,8 +110,7 @@ class BottleneckBlock(nn.Layer):
act='relu', act='relu',
name=name + '_branch2b_' + str(s + 1))) name=name + '_branch2b_' + str(s + 1)))
self.conv1_list.append(conv1) self.conv1_list.append(conv1)
self.pool2d_avg = AvgPool2d( self.pool2d_avg = AvgPool2d(kernel_size=3, stride=stride, padding=1)
kernel_size=3, stride=stride, padding=1, ceil_mode=True)
self.conv2 = ConvBNLayer( self.conv2 = ConvBNLayer(
num_channels=num_filters, num_channels=num_filters,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册