From 8e26493c329f07623438c6c32824bb7bc8e29aa9 Mon Sep 17 00:00:00 2001 From: littletomatodonkey <2120160898@bit.edu.cn> Date: Thu, 7 Jan 2021 19:24:29 +0800 Subject: [PATCH] fix lr mult val (#551) --- docs/en/tutorials/quick_start_en.md | 2 +- docs/zh_CN/tutorials/quick_start.md | 2 +- ppcls/modeling/architectures/resnet_vd.py | 10 ++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/en/tutorials/quick_start_en.md b/docs/en/tutorials/quick_start_en.md index 473c43ef..840ce547 100644 --- a/docs/en/tutorials/quick_start_en.md +++ b/docs/en/tutorials/quick_start_en.md @@ -107,7 +107,7 @@ Note: when finetuning model, which has been trained by SSLD, please use smaller ARCHITECTURE: name: 'ResNet50_vd' params: - lr_mult_list: [0.1, 0.1, 0.2, 0.2, 0.3] + lr_mult_list: [0.5, 0.5, 0.6, 0.6, 0.8] pretrained_model: "./pretrained/ResNet50_vd_ssld_pretrained" ``` diff --git a/docs/zh_CN/tutorials/quick_start.md b/docs/zh_CN/tutorials/quick_start.md index 5c88bd0c..09c35a9d 100644 --- a/docs/zh_CN/tutorials/quick_start.md +++ b/docs/zh_CN/tutorials/quick_start.md @@ -108,7 +108,7 @@ python -m paddle.distributed.launch \ ARCHITECTURE: name: 'ResNet50_vd' params: - lr_mult_list: [0.1, 0.1, 0.2, 0.2, 0.3] + lr_mult_list: [0.5, 0.5, 0.6, 0.6, 0.8] pretrained_model: "./pretrained/ResNet50_vd_ssld_pretrained" ``` diff --git a/ppcls/modeling/architectures/resnet_vd.py b/ppcls/modeling/architectures/resnet_vd.py index 8b725477..5867261d 100644 --- a/ppcls/modeling/architectures/resnet_vd.py +++ b/ppcls/modeling/architectures/resnet_vd.py @@ -64,8 +64,10 @@ class ConvBNLayer(nn.Layer): self._batch_norm = BatchNorm( num_filters, act=act, - param_attr=ParamAttr(name=bn_name + '_scale'), - bias_attr=ParamAttr(bn_name + '_offset'), + param_attr=ParamAttr( + name=bn_name + '_scale', learning_rate=lr_mult), + bias_attr=ParamAttr( + bn_name + '_offset', learning_rate=lr_mult), moving_mean_name=bn_name + '_mean', moving_variance_name=bn_name + '_variance') @@ -118,6 +120,7 @@ class BottleneckBlock(nn.Layer): filter_size=1, stride=1, is_vd_mode=False if if_first else True, + lr_mult=lr_mult, name=name + "_branch1") self.shortcut = shortcut @@ -153,12 +156,14 @@ class BasicBlock(nn.Layer): filter_size=3, stride=stride, act='relu', + lr_mult=lr_mult, name=name + "_branch2a") self.conv1 = ConvBNLayer( num_channels=num_filters, num_filters=num_filters, filter_size=3, act=None, + lr_mult=lr_mult, name=name + "_branch2b") if not shortcut: @@ -168,6 +173,7 @@ class BasicBlock(nn.Layer): filter_size=1, stride=1, is_vd_mode=False if if_first else True, + lr_mult=lr_mult, name=name + "_branch1") self.shortcut = shortcut -- GitLab