提交 6f13c5b7 编写于 作者: S stephon

rename PPLCNet_x2_5_Tanh

上级 df03b4a0
......@@ -61,7 +61,7 @@ from ppcls.arch.backbone.model_zoo.hardnet import HarDNet68, HarDNet85, HarDNet3
from ppcls.arch.backbone.model_zoo.cspnet import CSPDarkNet53
from ppcls.arch.backbone.variant_models.resnet_variant import ResNet50_last_stage_stride1
from ppcls.arch.backbone.variant_models.vgg_variant import VGG19Sigmoid
from ppcls.arch.backbone.variant_models.lcnet_variant import PPLCNet_x2_5Tanh
from ppcls.arch.backbone.variant_models.pp_lcnet_variant import PPLCNet_x2_5_Tanh
def get_apis():
......
from .resnet_variant import ResNet50_last_stage_stride1
from .vgg_variant import VGG19Sigmoid
from .lcnet_variant import PPLCNet_x2_5Tanh
from .pp_lcnet_variant import PPLCNet_x2_5Tanh
import paddle
from paddle.nn import Sigmoid
from paddle.nn import Tanh
from ppcls.arch.backbone.legendary_models.pp_lcnet import PPLCNet_x2_5
__all__ = ["PPLCNet_x2_5Tanh"]
class TanhSuffix(paddle.nn.Layer):
def __init__(self, origin_layer):
super(SigmoidSuffix, self).__init__()
self.origin_layer = origin_layer
self.tanh = Tanh()
def forward(self, input, res_dict=None, **kwargs):
x = self.origin_layer(input)
x = self.tanh(x)
return x
def PPLCNet_x2_5Tanh(pretrained=False, use_ssld=False, **kwargs):
def replace_function(origin_layer):
new_layer = TanhSuffix(origin_layer)
return new_layer
match_re = "linear_0"
model = PPLCNet_x2_5(pretrained=pretrained, use_ssld=use_ssld, **kwargs)
model.replace_sub(match_re, replace_function, True)
return model
......@@ -28,7 +28,7 @@ Arch:
infer_add_softmax: False
Backbone:
name: PPLCNet_x2_5Tanh
name: PPLCNet_x2_5_Tanh
pretrained: True
use_ssld: True
class_num: 512
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册