diff --git a/ppcls/arch/backbone/variant_models/pp_lcnet_variant.py b/ppcls/arch/backbone/variant_models/pp_lcnet_variant.py index 5976ab1e881bbad12ffa0bf157bf4ef6e1518043..dc9747af0843b276249277a78d46c75da7209c57 100644 --- a/ppcls/arch/backbone/variant_models/pp_lcnet_variant.py +++ b/ppcls/arch/backbone/variant_models/pp_lcnet_variant.py @@ -19,11 +19,11 @@ class TanhSuffix(paddle.nn.Layer): def PPLCNet_x2_5_Tanh(pretrained=False, use_ssld=False, **kwargs): - def replace_function(origin_layer): + def replace_function(origin_layer, pattern): new_layer = TanhSuffix(origin_layer) return new_layer - match_re = "linear_0" + pattern = "fc" model = PPLCNet_x2_5(pretrained=pretrained, use_ssld=use_ssld, **kwargs) - model.replace_sub(match_re, replace_function, True) + model.upgrade_sublayer(pattern, replace_function) return model diff --git a/ppcls/configs/Vehicle/PPLCNet_2.5x_ReID.yaml b/ppcls/configs/Vehicle/PPLCNet_2.5x_ReID.yaml index 2387bff8328cbea7f7c7690eb66f3dd265f3787b..eb9f145a142d6a3571b56b4963046a99ce964760 100644 --- a/ppcls/configs/Vehicle/PPLCNet_2.5x_ReID.yaml +++ b/ppcls/configs/Vehicle/PPLCNet_2.5x_ReID.yaml @@ -27,7 +27,7 @@ Arch: pretrained: True use_ssld: True BackboneStopLayer: - name: "flatten_0" + name: "flatten" Neck: name: "FC" embedding_size: 1280 diff --git a/ppcls/configs/quick_start/MobileNetV1_retrieval.yaml b/ppcls/configs/quick_start/MobileNetV1_retrieval.yaml index 99f9a12508517eabd0de1b0e402d115afb659a29..f088e1cd9c9024fc80a3a171cee8d6865abd7dda 100644 --- a/ppcls/configs/quick_start/MobileNetV1_retrieval.yaml +++ b/ppcls/configs/quick_start/MobileNetV1_retrieval.yaml @@ -25,7 +25,7 @@ Arch: name: MobileNetV1 pretrained: False BackboneStopLayer: - name: flatten_0 + name: "flatten" Neck: name: FC embedding_size: 1024 diff --git a/ppcls/configs/slim/GeneralRecognition_PPLCNet_x2_5_quantization.yaml b/ppcls/configs/slim/GeneralRecognition_PPLCNet_x2_5_quantization.yaml index 3d2b0eb5e1dc32455cc5136eeea6ddae95b3207e..7b21d0ba853e6addbf56003540e9c42638ee691b 100644 --- a/ppcls/configs/slim/GeneralRecognition_PPLCNet_x2_5_quantization.yaml +++ b/ppcls/configs/slim/GeneralRecognition_PPLCNet_x2_5_quantization.yaml @@ -34,7 +34,7 @@ Arch: pretrained: False use_ssld: True BackboneStopLayer: - name: flatten_0 + name: "flatten" Neck: name: FC embedding_size: 1280 diff --git a/ppcls/configs/slim/ResNet50_vehicle_reid_prune.yaml b/ppcls/configs/slim/ResNet50_vehicle_reid_prune.yaml index 736c9847a41b5f190eb198cb522381730e58060c..63b87f1caf14a27270c18935eefac3fbc798d37d 100644 --- a/ppcls/configs/slim/ResNet50_vehicle_reid_prune.yaml +++ b/ppcls/configs/slim/ResNet50_vehicle_reid_prune.yaml @@ -31,7 +31,7 @@ Arch: name: "ResNet50_last_stage_stride1" pretrained: True BackboneStopLayer: - name: "adaptive_avg_pool2d_0" + name: "avg_pool" Neck: name: "VehicleNeck" in_channels: 2048 diff --git a/ppcls/configs/slim/ResNet50_vehicle_reid_quantization.yaml b/ppcls/configs/slim/ResNet50_vehicle_reid_quantization.yaml index 72dc318656939a1597f26258d44a8900fb21dec4..cca9915e2963520c97560b6eb2034ea046022676 100644 --- a/ppcls/configs/slim/ResNet50_vehicle_reid_quantization.yaml +++ b/ppcls/configs/slim/ResNet50_vehicle_reid_quantization.yaml @@ -30,7 +30,7 @@ Arch: name: "ResNet50_last_stage_stride1" pretrained: True BackboneStopLayer: - name: "adaptive_avg_pool2d_0" + name: "avg_pool" Neck: name: "VehicleNeck" in_channels: 2048