diff --git a/ppcls/arch/backbone/__init__.py b/ppcls/arch/backbone/__init__.py index fa515340c8b76e09cf9ea500ec9142774144756a..8c7945eaec433cb299e8e740415749fbf121c200 100644 --- a/ppcls/arch/backbone/__init__.py +++ b/ppcls/arch/backbone/__init__.py @@ -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(): diff --git a/ppcls/arch/backbone/variant_models/__init__.py b/ppcls/arch/backbone/variant_models/__init__.py index ef721b9a7df0bbc4581f0ff35fcb63568c7c4c23..90bb70794165e4424fbc37c3a7f18635e8e55709 100644 --- a/ppcls/arch/backbone/variant_models/__init__.py +++ b/ppcls/arch/backbone/variant_models/__init__.py @@ -1,3 +1,3 @@ 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 diff --git a/ppcls/arch/backbone/variant_models/lcnet_variant.py b/ppcls/arch/backbone/variant_models/lcnet_variant.py deleted file mode 100644 index 306c7cc66bb21a7cc4e8d88f1129ed4ade335422..0000000000000000000000000000000000000000 --- a/ppcls/arch/backbone/variant_models/lcnet_variant.py +++ /dev/null @@ -1,29 +0,0 @@ -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 diff --git a/ppcls/configs/GeneralRecognition/GeneralRecognition_PPLCNet_x2_5_binary.yaml b/ppcls/configs/GeneralRecognition/GeneralRecognition_PPLCNet_x2_5_binary.yaml index 4d03abdcf2adb718b50df0ff1afa9fecc2dc021b..8683a54dbbba9eacd513d9017b31886e79929d93 100644 --- a/ppcls/configs/GeneralRecognition/GeneralRecognition_PPLCNet_x2_5_binary.yaml +++ b/ppcls/configs/GeneralRecognition/GeneralRecognition_PPLCNet_x2_5_binary.yaml @@ -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