未验证 提交 d2d89bec 编写于 作者: W Wei Shengyu 提交者: GitHub

Merge pull request #1184 from lyuwenyu/fix_hub_pretrained_cp_v1_L

Fix hub pretrained url cp 
...@@ -41,10 +41,15 @@ class _SysPathG(object): ...@@ -41,10 +41,15 @@ class _SysPathG(object):
self.path) self.path)
with _SysPathG( with _SysPathG(os.path.dirname(os.path.abspath(__file__)), ):
os.path.join( import ppcls
os.path.dirname(os.path.abspath(__file__)), 'ppcls', 'arch')): import ppcls.arch.backbone as backbone
import backbone
def ppclas_init():
if ppcls.utils.logger._logger is None:
ppcls.utils.logger.init_logger()
ppclas_init()
def _load_pretrained_parameters(model, name): def _load_pretrained_parameters(model, name):
url = 'https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/{}_pretrained.pdparams'.format( url = 'https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/{}_pretrained.pdparams'.format(
...@@ -63,9 +68,8 @@ with _SysPathG( ...@@ -63,9 +68,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `AlexNet` model depends on args. model: nn.Layer. Specific `AlexNet` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.AlexNet(**kwargs) model = backbone.AlexNet(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'AlexNet')
return model return model
...@@ -80,9 +84,8 @@ with _SysPathG( ...@@ -80,9 +84,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `VGG11` model depends on args. model: nn.Layer. Specific `VGG11` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.VGG11(**kwargs) model = backbone.VGG11(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'VGG11')
return model return model
...@@ -97,9 +100,8 @@ with _SysPathG( ...@@ -97,9 +100,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `VGG13` model depends on args. model: nn.Layer. Specific `VGG13` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.VGG13(**kwargs) model = backbone.VGG13(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'VGG13')
return model return model
...@@ -114,9 +116,8 @@ with _SysPathG( ...@@ -114,9 +116,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `VGG16` model depends on args. model: nn.Layer. Specific `VGG16` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.VGG16(**kwargs) model = backbone.VGG16(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'VGG16')
return model return model
...@@ -131,9 +132,8 @@ with _SysPathG( ...@@ -131,9 +132,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `VGG19` model depends on args. model: nn.Layer. Specific `VGG19` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.VGG19(**kwargs) model = backbone.VGG19(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'VGG19')
return model return model
...@@ -149,9 +149,8 @@ with _SysPathG( ...@@ -149,9 +149,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `ResNet18` model depends on args. model: nn.Layer. Specific `ResNet18` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.ResNet18(**kwargs) model = backbone.ResNet18(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'ResNet18')
return model return model
...@@ -167,9 +166,8 @@ with _SysPathG( ...@@ -167,9 +166,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `ResNet34` model depends on args. model: nn.Layer. Specific `ResNet34` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.ResNet34(**kwargs) model = backbone.ResNet34(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'ResNet34')
return model return model
...@@ -185,9 +183,8 @@ with _SysPathG( ...@@ -185,9 +183,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `ResNet50` model depends on args. model: nn.Layer. Specific `ResNet50` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.ResNet50(**kwargs) model = backbone.ResNet50(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'ResNet50')
return model return model
...@@ -203,9 +200,8 @@ with _SysPathG( ...@@ -203,9 +200,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `ResNet101` model depends on args. model: nn.Layer. Specific `ResNet101` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.ResNet101(**kwargs) model = backbone.ResNet101(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'ResNet101')
return model return model
...@@ -221,9 +217,8 @@ with _SysPathG( ...@@ -221,9 +217,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `ResNet152` model depends on args. model: nn.Layer. Specific `ResNet152` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.ResNet152(**kwargs) model = backbone.ResNet152(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'ResNet152')
return model return model
...@@ -237,9 +232,8 @@ with _SysPathG( ...@@ -237,9 +232,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `SqueezeNet1_0` model depends on args. model: nn.Layer. Specific `SqueezeNet1_0` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.SqueezeNet1_0(**kwargs) model = backbone.SqueezeNet1_0(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'SqueezeNet1_0')
return model return model
...@@ -253,9 +247,8 @@ with _SysPathG( ...@@ -253,9 +247,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `SqueezeNet1_1` model depends on args. model: nn.Layer. Specific `SqueezeNet1_1` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.SqueezeNet1_1(**kwargs) model = backbone.SqueezeNet1_1(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'SqueezeNet1_1')
return model return model
...@@ -271,9 +264,8 @@ with _SysPathG( ...@@ -271,9 +264,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `DenseNet121` model depends on args. model: nn.Layer. Specific `DenseNet121` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.DenseNet121(**kwargs) model = backbone.DenseNet121(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'DenseNet121')
return model return model
...@@ -289,9 +281,8 @@ with _SysPathG( ...@@ -289,9 +281,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `DenseNet161` model depends on args. model: nn.Layer. Specific `DenseNet161` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.DenseNet161(**kwargs) model = backbone.DenseNet161(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'DenseNet161')
return model return model
...@@ -307,9 +298,8 @@ with _SysPathG( ...@@ -307,9 +298,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `DenseNet169` model depends on args. model: nn.Layer. Specific `DenseNet169` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.DenseNet169(**kwargs) model = backbone.DenseNet169(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'DenseNet169')
return model return model
...@@ -325,9 +315,8 @@ with _SysPathG( ...@@ -325,9 +315,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `DenseNet201` model depends on args. model: nn.Layer. Specific `DenseNet201` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.DenseNet201(**kwargs) model = backbone.DenseNet201(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'DenseNet201')
return model return model
...@@ -343,9 +332,8 @@ with _SysPathG( ...@@ -343,9 +332,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `DenseNet264` model depends on args. model: nn.Layer. Specific `DenseNet264` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.DenseNet264(**kwargs) model = backbone.DenseNet264(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'DenseNet264')
return model return model
...@@ -359,9 +347,8 @@ with _SysPathG( ...@@ -359,9 +347,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `InceptionV3` model depends on args. model: nn.Layer. Specific `InceptionV3` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.InceptionV3(**kwargs) model = backbone.InceptionV3(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'InceptionV3')
return model return model
...@@ -375,9 +362,8 @@ with _SysPathG( ...@@ -375,9 +362,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `InceptionV4` model depends on args. model: nn.Layer. Specific `InceptionV4` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.InceptionV4(**kwargs) model = backbone.InceptionV4(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'InceptionV4')
return model return model
...@@ -391,9 +377,8 @@ with _SysPathG( ...@@ -391,9 +377,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `GoogLeNet` model depends on args. model: nn.Layer. Specific `GoogLeNet` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.GoogLeNet(**kwargs) model = backbone.GoogLeNet(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'GoogLeNet')
return model return model
...@@ -407,9 +392,8 @@ with _SysPathG( ...@@ -407,9 +392,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `ShuffleNetV2_x0_25` model depends on args. model: nn.Layer. Specific `ShuffleNetV2_x0_25` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.ShuffleNetV2_x0_25(**kwargs) model = backbone.ShuffleNetV2_x0_25(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'ShuffleNetV2_x0_25')
return model return model
...@@ -423,9 +407,8 @@ with _SysPathG( ...@@ -423,9 +407,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `MobileNetV1` model depends on args. model: nn.Layer. Specific `MobileNetV1` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.MobileNetV1(**kwargs) model = backbone.MobileNetV1(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'MobileNetV1')
return model return model
...@@ -439,9 +422,8 @@ with _SysPathG( ...@@ -439,9 +422,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `MobileNetV1_x0_25` model depends on args. model: nn.Layer. Specific `MobileNetV1_x0_25` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.MobileNetV1_x0_25(**kwargs) model = backbone.MobileNetV1_x0_25(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'MobileNetV1_x0_25')
return model return model
...@@ -455,9 +437,8 @@ with _SysPathG( ...@@ -455,9 +437,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `MobileNetV1_x0_5` model depends on args. model: nn.Layer. Specific `MobileNetV1_x0_5` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.MobileNetV1_x0_5(**kwargs) model = backbone.MobileNetV1_x0_5(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'MobileNetV1_x0_5')
return model return model
...@@ -471,9 +452,8 @@ with _SysPathG( ...@@ -471,9 +452,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `MobileNetV1_x0_75` model depends on args. model: nn.Layer. Specific `MobileNetV1_x0_75` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.MobileNetV1_x0_75(**kwargs) model = backbone.MobileNetV1_x0_75(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'MobileNetV1_x0_75')
return model return model
...@@ -487,9 +467,8 @@ with _SysPathG( ...@@ -487,9 +467,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `MobileNetV2_x0_25` model depends on args. model: nn.Layer. Specific `MobileNetV2_x0_25` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.MobileNetV2_x0_25(**kwargs) model = backbone.MobileNetV2_x0_25(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'MobileNetV2_x0_25')
return model return model
...@@ -503,9 +482,8 @@ with _SysPathG( ...@@ -503,9 +482,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `MobileNetV2_x0_5` model depends on args. model: nn.Layer. Specific `MobileNetV2_x0_5` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.MobileNetV2_x0_5(**kwargs) model = backbone.MobileNetV2_x0_5(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'MobileNetV2_x0_5')
return model return model
...@@ -519,9 +497,8 @@ with _SysPathG( ...@@ -519,9 +497,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `MobileNetV2_x0_75` model depends on args. model: nn.Layer. Specific `MobileNetV2_x0_75` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.MobileNetV2_x0_75(**kwargs) model = backbone.MobileNetV2_x0_75(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'MobileNetV2_x0_75')
return model return model
...@@ -535,9 +512,8 @@ with _SysPathG( ...@@ -535,9 +512,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `MobileNetV2_x1_5` model depends on args. model: nn.Layer. Specific `MobileNetV2_x1_5` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.MobileNetV2_x1_5(**kwargs) model = backbone.MobileNetV2_x1_5(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'MobileNetV2_x1_5')
return model return model
...@@ -551,9 +527,8 @@ with _SysPathG( ...@@ -551,9 +527,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `MobileNetV2_x2_0` model depends on args. model: nn.Layer. Specific `MobileNetV2_x2_0` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.MobileNetV2_x2_0(**kwargs) model = backbone.MobileNetV2_x2_0(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'MobileNetV2_x2_0')
return model return model
...@@ -567,10 +542,8 @@ with _SysPathG( ...@@ -567,10 +542,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `MobileNetV3_large_x0_35` model depends on args. model: nn.Layer. Specific `MobileNetV3_large_x0_35` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.MobileNetV3_large_x0_35(**kwargs) model = backbone.MobileNetV3_large_x0_35(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model,
'MobileNetV3_large_x0_35')
return model return model
...@@ -584,10 +557,8 @@ with _SysPathG( ...@@ -584,10 +557,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `MobileNetV3_large_x0_5` model depends on args. model: nn.Layer. Specific `MobileNetV3_large_x0_5` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.MobileNetV3_large_x0_5(**kwargs) model = backbone.MobileNetV3_large_x0_5(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model,
'MobileNetV3_large_x0_5')
return model return model
...@@ -601,10 +572,8 @@ with _SysPathG( ...@@ -601,10 +572,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `MobileNetV3_large_x0_75` model depends on args. model: nn.Layer. Specific `MobileNetV3_large_x0_75` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.MobileNetV3_large_x0_75(**kwargs) model = backbone.MobileNetV3_large_x0_75(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model,
'MobileNetV3_large_x0_75')
return model return model
...@@ -618,10 +587,8 @@ with _SysPathG( ...@@ -618,10 +587,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `MobileNetV3_large_x1_0` model depends on args. model: nn.Layer. Specific `MobileNetV3_large_x1_0` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.MobileNetV3_large_x1_0(**kwargs) model = backbone.MobileNetV3_large_x1_0(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model,
'MobileNetV3_large_x1_0')
return model return model
...@@ -635,10 +602,8 @@ with _SysPathG( ...@@ -635,10 +602,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `MobileNetV3_large_x1_25` model depends on args. model: nn.Layer. Specific `MobileNetV3_large_x1_25` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.MobileNetV3_large_x1_25(**kwargs) model = backbone.MobileNetV3_large_x1_25(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model,
'MobileNetV3_large_x1_25')
return model return model
...@@ -652,10 +617,8 @@ with _SysPathG( ...@@ -652,10 +617,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `MobileNetV3_small_x0_35` model depends on args. model: nn.Layer. Specific `MobileNetV3_small_x0_35` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.MobileNetV3_small_x0_35(**kwargs) model = backbone.MobileNetV3_small_x0_35(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model,
'MobileNetV3_small_x0_35')
return model return model
...@@ -669,10 +632,8 @@ with _SysPathG( ...@@ -669,10 +632,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `MobileNetV3_small_x0_5` model depends on args. model: nn.Layer. Specific `MobileNetV3_small_x0_5` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.MobileNetV3_small_x0_5(**kwargs) model = backbone.MobileNetV3_small_x0_5(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model,
'MobileNetV3_small_x0_5')
return model return model
...@@ -686,10 +647,8 @@ with _SysPathG( ...@@ -686,10 +647,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `MobileNetV3_small_x0_75` model depends on args. model: nn.Layer. Specific `MobileNetV3_small_x0_75` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.MobileNetV3_small_x0_75(**kwargs) model = backbone.MobileNetV3_small_x0_75(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model,
'MobileNetV3_small_x0_75')
return model return model
...@@ -703,10 +662,8 @@ with _SysPathG( ...@@ -703,10 +662,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `MobileNetV3_small_x1_0` model depends on args. model: nn.Layer. Specific `MobileNetV3_small_x1_0` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.MobileNetV3_small_x1_0(**kwargs) model = backbone.MobileNetV3_small_x1_0(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model,
'MobileNetV3_small_x1_0')
return model return model
...@@ -720,10 +677,8 @@ with _SysPathG( ...@@ -720,10 +677,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `MobileNetV3_small_x1_25` model depends on args. model: nn.Layer. Specific `MobileNetV3_small_x1_25` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.MobileNetV3_small_x1_25(**kwargs) model = backbone.MobileNetV3_small_x1_25(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model,
'MobileNetV3_small_x1_25')
return model return model
...@@ -737,9 +692,8 @@ with _SysPathG( ...@@ -737,9 +692,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `ResNeXt101_32x4d` model depends on args. model: nn.Layer. Specific `ResNeXt101_32x4d` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.ResNeXt101_32x4d(**kwargs) model = backbone.ResNeXt101_32x4d(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'ResNeXt101_32x4d')
return model return model
...@@ -753,9 +707,8 @@ with _SysPathG( ...@@ -753,9 +707,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `ResNeXt101_64x4d` model depends on args. model: nn.Layer. Specific `ResNeXt101_64x4d` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.ResNeXt101_64x4d(**kwargs) model = backbone.ResNeXt101_64x4d(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'ResNeXt101_64x4d')
return model return model
...@@ -769,9 +722,8 @@ with _SysPathG( ...@@ -769,9 +722,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `ResNeXt152_32x4d` model depends on args. model: nn.Layer. Specific `ResNeXt152_32x4d` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.ResNeXt152_32x4d(**kwargs) model = backbone.ResNeXt152_32x4d(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'ResNeXt152_32x4d')
return model return model
...@@ -785,9 +737,8 @@ with _SysPathG( ...@@ -785,9 +737,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `ResNeXt152_64x4d` model depends on args. model: nn.Layer. Specific `ResNeXt152_64x4d` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.ResNeXt152_64x4d(**kwargs) model = backbone.ResNeXt152_64x4d(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'ResNeXt152_64x4d')
return model return model
...@@ -801,9 +752,8 @@ with _SysPathG( ...@@ -801,9 +752,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `ResNeXt50_32x4d` model depends on args. model: nn.Layer. Specific `ResNeXt50_32x4d` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.ResNeXt50_32x4d(**kwargs) model = backbone.ResNeXt50_32x4d(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'ResNeXt50_32x4d')
return model return model
...@@ -817,9 +767,8 @@ with _SysPathG( ...@@ -817,9 +767,8 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `ResNeXt50_64x4d` model depends on args. model: nn.Layer. Specific `ResNeXt50_64x4d` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.ResNeXt50_64x4d(**kwargs) model = backbone.ResNeXt50_64x4d(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'ResNeXt50_64x4d')
return model return model
...@@ -833,8 +782,7 @@ with _SysPathG( ...@@ -833,8 +782,7 @@ with _SysPathG(
Returns: Returns:
model: nn.Layer. Specific `ResNeXt50_64x4d` model depends on args. model: nn.Layer. Specific `ResNeXt50_64x4d` model depends on args.
""" """
kwargs.update({'pretrained': pretrained})
model = backbone.DarkNet53(**kwargs) model = backbone.DarkNet53(**kwargs)
if pretrained:
model = _load_pretrained_parameters(model, 'DarkNet53')
return model return model
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册