hubconf.py 26.5 KB
Newer Older
L
lyuwenyu 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

L
for hub  
lyuwenyu 已提交
15

L
lyuwenyu 已提交
16
dependencies = ['paddle', 'numpy']
L
for hub  
lyuwenyu 已提交
17

L
lyuwenyu 已提交
18
import paddle
L
for hub  
lyuwenyu 已提交
19

L
lyuwenyu 已提交
20 21
from ppcls.modeling.architectures import alexnet as _alexnet
from ppcls.modeling.architectures import vgg as _vgg 
L
lyuwenyu 已提交
22
from ppcls.modeling.architectures import resnet as _resnet 
L
lyuwenyu 已提交
23 24 25 26
from ppcls.modeling.architectures import squeezenet as _squeezenet
from ppcls.modeling.architectures import densenet as _densenet
from ppcls.modeling.architectures import inception_v3 as _inception_v3
from ppcls.modeling.architectures import inception_v4 as _inception_v4
L
lyuwenyu 已提交
27 28 29 30 31 32 33
from ppcls.modeling.architectures import googlenet as _googlenet
from ppcls.modeling.architectures import shufflenet_v2 as _shufflenet_v2
from ppcls.modeling.architectures import mobilenet_v1 as _mobilenet_v1
from ppcls.modeling.architectures import mobilenet_v2 as _mobilenet_v2
from ppcls.modeling.architectures import mobilenet_v3 as _mobilenet_v3
from ppcls.modeling.architectures import resnext as _resnext

L
lyuwenyu 已提交
34

L
lyuwenyu 已提交
35

L
lyuwenyu 已提交
36
def _load_pretrained_parameters(model, name):
L
lyuwenyu 已提交
37 38
    url = 'https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/{}_pretrained.pdparams'.format(name)
    path = paddle.utils.download.get_weights_path_from_url(url)
L
lyuwenyu 已提交
39 40 41
    model.set_state_dict(paddle.load(path))
    return model
    
L
lyuwenyu 已提交
42

L
lyuwenyu 已提交
43
def AlexNet(pretrained=False, **kwargs):
L
lyuwenyu 已提交
44 45 46 47 48 49 50 51 52
    """
    AlexNet
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `AlexNet` model depends on args.
    """
L
lyuwenyu 已提交
53 54
    model = _alexnet.AlexNet(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
55
        model = _load_pretrained_parameters(model, 'AlexNet')
L
lyuwenyu 已提交
56 57 58 59

    return model


L
lyuwenyu 已提交
60
def VGG11(pretrained=False, **kwargs):
L
lyuwenyu 已提交
61 62 63 64 65 66 67 68 69 70
    """
    VGG11
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
            stop_grad_layers: int=0. The parameters in blocks which index larger than `stop_grad_layers`, will be set `param.trainable=False`
    Returns:
        model: nn.Layer. Specific `VGG11` model depends on args.
    """
L
lyuwenyu 已提交
71 72
    model = _vgg.VGG11(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
73
        model = _load_pretrained_parameters(model, 'VGG11')
L
lyuwenyu 已提交
74 75 76 77

    return model


L
lyuwenyu 已提交
78
def VGG13(pretrained=False, **kwargs):
L
lyuwenyu 已提交
79 80 81 82 83 84 85 86 87 88
    """
    VGG13
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
            stop_grad_layers: int=0. The parameters in blocks which index larger than `stop_grad_layers`, will be set `param.trainable=False`
    Returns:
        model: nn.Layer. Specific `VGG13` model depends on args.
    """
L
lyuwenyu 已提交
89 90
    model = _vgg.VGG13(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
91
        model = _load_pretrained_parameters(model, 'VGG13')
L
lyuwenyu 已提交
92 93 94 95

    return model


L
lyuwenyu 已提交
96
def VGG16(pretrained=False, **kwargs):
L
lyuwenyu 已提交
97 98 99 100 101 102 103 104 105 106
    """
    VGG16
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
            stop_grad_layers: int=0. The parameters in blocks which index larger than `stop_grad_layers`, will be set `param.trainable=False`
    Returns:
        model: nn.Layer. Specific `VGG16` model depends on args.
    """
L
lyuwenyu 已提交
107 108
    model = _vgg.VGG16(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
109
        model = _load_pretrained_parameters(model, 'VGG16')
L
lyuwenyu 已提交
110 111 112 113

    return model


L
lyuwenyu 已提交
114
def VGG19(pretrained=False, **kwargs):
L
lyuwenyu 已提交
115 116 117 118 119 120 121 122 123 124
    """
    VGG19
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
            stop_grad_layers: int=0. The parameters in blocks which index larger than `stop_grad_layers`, will be set `param.trainable=False`
    Returns:
        model: nn.Layer. Specific `VGG19` model depends on args.
    """
L
lyuwenyu 已提交
125 126
    model = _vgg.VGG19(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
127
        model = _load_pretrained_parameters(model, 'VGG19')
L
lyuwenyu 已提交
128 129 130 131 132 133

    return model




L
lyuwenyu 已提交
134
def ResNet18(pretrained=False, **kwargs):
L
lyuwenyu 已提交
135 136 137 138 139 140 141 142 143 144 145
    """
    ResNet18
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
            input_image_channel: int=3. The number of input image channels
            data_format: str='NCHW'. The data format of batch input images, should in ('NCHW', 'NHWC')
    Returns:
        model: nn.Layer. Specific `ResNet18` model depends on args.
    """
L
lyuwenyu 已提交
146
    model = _resnet.ResNet18(**kwargs)
L
lyuwenyu 已提交
147
    if pretrained:
L
lyuwenyu 已提交
148
        model = _load_pretrained_parameters(model, 'ResNet18')
L
lyuwenyu 已提交
149

L
for hub  
lyuwenyu 已提交
150 151
    return model

L
lyuwenyu 已提交
152

L
lyuwenyu 已提交
153
def ResNet34(pretrained=False, **kwargs):
L
lyuwenyu 已提交
154 155 156 157 158 159 160 161 162 163 164
    """
    ResNet34
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
            input_image_channel: int=3. The number of input image channels
            data_format: str='NCHW'. The data format of batch input images, should in ('NCHW', 'NHWC')
    Returns:
        model: nn.Layer. Specific `ResNet34` model depends on args.
    """
L
lyuwenyu 已提交
165 166
    model = _resnet.ResNet34(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
167
        model = _load_pretrained_parameters(model, 'ResNet34')
L
lyuwenyu 已提交
168

L
lyuwenyu 已提交
169
    return model
L
lyuwenyu 已提交
170 171


L
lyuwenyu 已提交
172
def ResNet50(pretrained=False, **kwargs):
L
lyuwenyu 已提交
173 174 175 176 177 178 179 180 181 182 183
    """
    ResNet50
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
            input_image_channel: int=3. The number of input image channels
            data_format: str='NCHW'. The data format of batch input images, should in ('NCHW', 'NHWC')
    Returns:
        model: nn.Layer. Specific `ResNet50` model depends on args.
    """
L
lyuwenyu 已提交
184 185
    model = _resnet.ResNet50(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
186 187
        model = _load_pretrained_parameters(model, 'ResNet50')
        
L
lyuwenyu 已提交
188 189 190
    return model


L
lyuwenyu 已提交
191
def ResNet101(pretrained=False, **kwargs):
L
lyuwenyu 已提交
192 193 194 195 196 197 198 199 200 201 202
    """
    ResNet101
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
            input_image_channel: int=3. The number of input image channels
            data_format: str='NCHW'. The data format of batch input images, should in ('NCHW', 'NHWC')
    Returns:
        model: nn.Layer. Specific `ResNet101` model depends on args.
    """
L
lyuwenyu 已提交
203 204
    model = _resnet.ResNet101(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
205
        model = _load_pretrained_parameters(model, 'ResNet101')
L
lyuwenyu 已提交
206 207 208 209

    return model


L
lyuwenyu 已提交
210
def ResNet152(pretrained=False, **kwargs):
L
lyuwenyu 已提交
211 212 213 214 215 216 217 218 219 220 221
    """
    ResNet152
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
            input_image_channel: int=3. The number of input image channels
            data_format: str='NCHW'. The data format of batch input images, should in ('NCHW', 'NHWC')
    Returns:
        model: nn.Layer. Specific `ResNet152` model depends on args.
    """
L
lyuwenyu 已提交
222 223
    model = _resnet.ResNet152(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
224
        model = _load_pretrained_parameters(model, 'ResNet152')
L
lyuwenyu 已提交
225 226

    return model
L
lyuwenyu 已提交
227 228 229



L
lyuwenyu 已提交
230
def SqueezeNet1_0(pretrained=False, **kwargs):
L
lyuwenyu 已提交
231 232 233 234 235 236 237 238 239
    """
    SqueezeNet1_0
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `SqueezeNet1_0` model depends on args.
    """
L
lyuwenyu 已提交
240 241
    model = _squeezenet.SqueezeNet1_0(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
242
        model = _load_pretrained_parameters(model, 'SqueezeNet1_0')
L
lyuwenyu 已提交
243 244 245 246

    return model


L
lyuwenyu 已提交
247
def SqueezeNet1_1(pretrained=False, **kwargs):
L
lyuwenyu 已提交
248 249 250 251 252 253 254 255 256
    """
    SqueezeNet1_1
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `SqueezeNet1_1` model depends on args.
    """
L
lyuwenyu 已提交
257 258
    model = _squeezenet.SqueezeNet1_1(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
259
        model = _load_pretrained_parameters(model, 'SqueezeNet1_1')
L
lyuwenyu 已提交
260 261 262 263

    return model


L
lyuwenyu 已提交
264 265


L
lyuwenyu 已提交
266
def DenseNet121(pretrained=False, **kwargs):
L
lyuwenyu 已提交
267 268 269 270 271 272 273 274 275 276 277
    """
    DenseNet121
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
            dropout: float=0. Probability of setting units to zero.
            bn_size: int=4. The number of channals per group
    Returns:
        model: nn.Layer. Specific `DenseNet121` model depends on args.
    """
L
lyuwenyu 已提交
278 279
    model = _densenet.DenseNet121(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
280
        model = _load_pretrained_parameters(model, 'DenseNet121')
L
lyuwenyu 已提交
281 282 283 284

    return model


L
lyuwenyu 已提交
285
def DenseNet161(pretrained=False, **kwargs):
L
lyuwenyu 已提交
286 287 288 289 290 291 292 293 294 295 296
    """
    DenseNet161
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
            dropout: float=0. Probability of setting units to zero.
            bn_size: int=4. The number of channals per group
    Returns:
        model: nn.Layer. Specific `DenseNet161` model depends on args.
    """
L
lyuwenyu 已提交
297 298
    model = _densenet.DenseNet161(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
299
        model = _load_pretrained_parameters(model, 'DenseNet161')
L
lyuwenyu 已提交
300 301 302 303

    return model


L
lyuwenyu 已提交
304
def DenseNet169(pretrained=False, **kwargs):
L
lyuwenyu 已提交
305 306 307 308 309 310 311 312 313 314 315
    """
    DenseNet169
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
            dropout: float=0. Probability of setting units to zero.
            bn_size: int=4. The number of channals per group
    Returns:
        model: nn.Layer. Specific `DenseNet169` model depends on args.
    """
L
lyuwenyu 已提交
316 317
    model = _densenet.DenseNet169(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
318
        model = _load_pretrained_parameters(model, 'DenseNet169')
L
lyuwenyu 已提交
319 320 321 322

    return model


L
lyuwenyu 已提交
323
def DenseNet201(pretrained=False, **kwargs):
L
lyuwenyu 已提交
324 325 326 327 328 329 330 331 332 333 334
    """
    DenseNet201
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
            dropout: float=0. Probability of setting units to zero.
            bn_size: int=4. The number of channals per group
    Returns:
        model: nn.Layer. Specific `DenseNet201` model depends on args.
    """
L
lyuwenyu 已提交
335 336
    model = _densenet.DenseNet201(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
337
        model = _load_pretrained_parameters(model, 'DenseNet201')
L
lyuwenyu 已提交
338 339 340 341

    return model


L
lyuwenyu 已提交
342
def DenseNet264(pretrained=False, **kwargs):
L
lyuwenyu 已提交
343 344 345 346 347 348 349 350 351 352 353
    """
    DenseNet264
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
            dropout: float=0. Probability of setting units to zero.
            bn_size: int=4. The number of channals per group
    Returns:
        model: nn.Layer. Specific `DenseNet264` model depends on args.
    """
L
lyuwenyu 已提交
354 355
    model = _densenet.DenseNet264(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
356
        model = _load_pretrained_parameters(model, 'DenseNet264')
L
lyuwenyu 已提交
357 358 359 360

    return model


L
lyuwenyu 已提交
361

L
lyuwenyu 已提交
362
def InceptionV3(pretrained=False, **kwargs):
L
lyuwenyu 已提交
363 364 365 366 367 368 369 370 371
    """
    InceptionV3
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `InceptionV3` model depends on args.
    """
L
lyuwenyu 已提交
372 373
    model = _inception_v3.InceptionV3(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
374
        model = _load_pretrained_parameters(model, 'InceptionV3')
L
lyuwenyu 已提交
375 376 377 378

    return model


L
lyuwenyu 已提交
379
def InceptionV4(pretrained=False, **kwargs):
L
lyuwenyu 已提交
380 381 382 383 384 385 386 387 388
    """
    InceptionV4
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `InceptionV4` model depends on args.
    """
L
lyuwenyu 已提交
389 390
    model = _inception_v4.InceptionV4(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
391
        model = _load_pretrained_parameters(model, 'InceptionV4')
L
lyuwenyu 已提交
392

L
lyuwenyu 已提交
393 394 395 396
    return model



L
lyuwenyu 已提交
397
def GoogLeNet(pretrained=False, **kwargs):
L
lyuwenyu 已提交
398 399 400 401 402 403 404 405 406
    """
    GoogLeNet
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `GoogLeNet` model depends on args.
    """
L
lyuwenyu 已提交
407 408
    model = _googlenet.GoogLeNet(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
409
        model = _load_pretrained_parameters(model, 'GoogLeNet')
L
lyuwenyu 已提交
410 411 412 413 414

    return model



L
lyuwenyu 已提交
415
def ShuffleNet(pretrained=False, **kwargs):
L
lyuwenyu 已提交
416 417 418 419 420 421 422 423 424
    """
    ShuffleNet
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `ShuffleNet` model depends on args.
    """
L
lyuwenyu 已提交
425 426
    model = _shufflenet_v2.ShuffleNet(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
427
        model = _load_pretrained_parameters(model, 'ShuffleNet')
L
lyuwenyu 已提交
428 429 430 431 432

    return model



L
lyuwenyu 已提交
433
def MobileNetV1(pretrained=False, **kwargs):
L
lyuwenyu 已提交
434 435 436 437 438 439 440 441 442
    """
    MobileNetV1
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `MobileNetV1` model depends on args.
    """
L
lyuwenyu 已提交
443 444
    model = _mobilenet_v1.MobileNetV1(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
445
        model = _load_pretrained_parameters(model, 'MobileNetV1')
L
lyuwenyu 已提交
446 447 448 449

    return model


L
lyuwenyu 已提交
450
def MobileNetV1_x0_25(pretrained=False, **kwargs):
L
lyuwenyu 已提交
451 452 453 454 455 456 457 458 459
    """
    MobileNetV1_x0_25
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `MobileNetV1_x0_25` model depends on args.
    """
L
lyuwenyu 已提交
460 461
    model = _mobilenet_v1.MobileNetV1_x0_25(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
462
        model = _load_pretrained_parameters(model, 'MobileNetV1_x0_25')
L
lyuwenyu 已提交
463 464 465 466

    return model


L
lyuwenyu 已提交
467
def MobileNetV1_x0_5(pretrained=False, **kwargs):
L
lyuwenyu 已提交
468 469 470 471 472 473 474 475 476
    """
    MobileNetV1_x0_5
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `MobileNetV1_x0_5` model depends on args.
    """
L
lyuwenyu 已提交
477 478
    model = _mobilenet_v1.MobileNetV1_x0_5(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
479
        model = _load_pretrained_parameters(model, 'MobileNetV1_x0_5')
L
lyuwenyu 已提交
480 481 482 483

    return model


L
lyuwenyu 已提交
484
def MobileNetV1_x0_75(pretrained=False, **kwargs):
L
lyuwenyu 已提交
485 486 487 488 489 490 491 492 493
    """
    MobileNetV1_x0_75
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `MobileNetV1_x0_75` model depends on args.
    """
L
lyuwenyu 已提交
494 495
    model = _mobilenet_v1.MobileNetV1_x0_75(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
496
        model = _load_pretrained_parameters(model, 'MobileNetV1_x0_75')
L
lyuwenyu 已提交
497 498 499 500

    return model


L
lyuwenyu 已提交
501
def MobileNetV2_x0_25(pretrained=False, **kwargs):
L
lyuwenyu 已提交
502 503 504 505 506 507 508 509 510
    """
    MobileNetV2_x0_25
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `MobileNetV2_x0_25` model depends on args.
    """
L
lyuwenyu 已提交
511 512
    model = _mobilenet_v2.MobileNetV2_x0_25(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
513
        model = _load_pretrained_parameters(model, 'MobileNetV2_x0_25')
L
lyuwenyu 已提交
514 515 516 517

    return model


L
lyuwenyu 已提交
518
def MobileNetV2_x0_5(pretrained=False, **kwargs):
L
lyuwenyu 已提交
519 520 521 522 523 524 525 526 527
    """
    MobileNetV2_x0_5
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `MobileNetV2_x0_5` model depends on args.
    """
L
lyuwenyu 已提交
528 529
    model = _mobilenet_v2.MobileNetV2_x0_5(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
530
        model = _load_pretrained_parameters(model, 'MobileNetV2_x0_5')
L
lyuwenyu 已提交
531 532 533 534

    return model


L
lyuwenyu 已提交
535
def MobileNetV2_x0_75(pretrained=False, **kwargs):
L
lyuwenyu 已提交
536 537 538 539 540 541 542 543 544
    """
    MobileNetV2_x0_75
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `MobileNetV2_x0_75` model depends on args.
    """
L
lyuwenyu 已提交
545 546
    model = _mobilenet_v2.MobileNetV2_x0_75(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
547
        model = _load_pretrained_parameters(model, 'MobileNetV2_x0_75')
L
lyuwenyu 已提交
548 549 550 551

    return model


L
lyuwenyu 已提交
552
def MobileNetV2_x1_5(pretrained=False, **kwargs):
L
lyuwenyu 已提交
553 554 555 556 557 558 559 560 561
    """
    MobileNetV2_x1_5
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `MobileNetV2_x1_5` model depends on args.
    """
L
lyuwenyu 已提交
562 563
    model = _mobilenet_v2.MobileNetV2_x1_5(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
564
        model = _load_pretrained_parameters(model, 'MobileNetV2_x1_5')
L
lyuwenyu 已提交
565 566 567 568

    return model


L
lyuwenyu 已提交
569
def MobileNetV2_x2_0(pretrained=False, **kwargs):
L
lyuwenyu 已提交
570 571 572 573 574 575 576 577 578
    """
    MobileNetV2_x2_0
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `MobileNetV2_x2_0` model depends on args.
    """
L
lyuwenyu 已提交
579 580
    model = _mobilenet_v2.MobileNetV2_x2_0(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
581
        model = _load_pretrained_parameters(model, 'MobileNetV2_x2_0')
L
lyuwenyu 已提交
582 583 584 585

    return model


L
lyuwenyu 已提交
586
def MobileNetV3_large_x0_35(pretrained=False, **kwargs):
L
lyuwenyu 已提交
587 588 589 590 591 592 593 594 595
    """
    MobileNetV3_large_x0_35
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `MobileNetV3_large_x0_35` model depends on args.
    """
L
lyuwenyu 已提交
596 597
    model = _mobilenet_v3.MobileNetV3_large_x0_35(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
598
        model = _load_pretrained_parameters(model, 'MobileNetV3_large_x0_35')
L
lyuwenyu 已提交
599 600 601 602

    return model


L
lyuwenyu 已提交
603
def MobileNetV3_large_x0_5(pretrained=False, **kwargs):
L
lyuwenyu 已提交
604 605 606 607 608 609 610 611 612
    """
    MobileNetV3_large_x0_5
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `MobileNetV3_large_x0_5` model depends on args.
    """
L
lyuwenyu 已提交
613 614
    model = _mobilenet_v3.MobileNetV3_large_x0_5(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
615
        model = _load_pretrained_parameters(model, 'MobileNetV3_large_x0_5')
L
lyuwenyu 已提交
616 617 618 619

    return model


L
lyuwenyu 已提交
620
def MobileNetV3_large_x0_75(pretrained=False, **kwargs):
L
lyuwenyu 已提交
621 622 623 624 625 626 627 628 629
    """
    MobileNetV3_large_x0_75
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `MobileNetV3_large_x0_75` model depends on args.
    """
L
lyuwenyu 已提交
630 631
    model = _mobilenet_v3.MobileNetV3_large_x0_75(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
632
        model = _load_pretrained_parameters(model, 'MobileNetV3_large_x0_75')
L
lyuwenyu 已提交
633 634 635 636

    return model


L
lyuwenyu 已提交
637
def MobileNetV3_large_x1_0(pretrained=False, **kwargs):
L
lyuwenyu 已提交
638 639 640 641 642 643 644 645 646
    """
    MobileNetV3_large_x1_0
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `MobileNetV3_large_x1_0` model depends on args.
    """
L
lyuwenyu 已提交
647 648
    model = _mobilenet_v3.MobileNetV3_large_x1_0(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
649
        model = _load_pretrained_parameters(model, 'MobileNetV3_large_x1_0')
L
lyuwenyu 已提交
650 651 652 653

    return model


L
lyuwenyu 已提交
654
def MobileNetV3_large_x1_25(pretrained=False, **kwargs):
L
lyuwenyu 已提交
655 656 657 658 659 660 661 662 663
    """
    MobileNetV3_large_x1_25
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `MobileNetV3_large_x1_25` model depends on args.
    """
L
lyuwenyu 已提交
664 665
    model = _mobilenet_v3.MobileNetV3_large_x1_25(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
666
        model = _load_pretrained_parameters(model, 'MobileNetV3_large_x1_25')
L
lyuwenyu 已提交
667 668 669 670

    return model


L
lyuwenyu 已提交
671
def MobileNetV3_small_x0_35(pretrained=False, **kwargs):
L
lyuwenyu 已提交
672 673 674 675 676 677 678 679 680
    """
    MobileNetV3_small_x0_35
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `MobileNetV3_small_x0_35` model depends on args.
    """
L
lyuwenyu 已提交
681 682
    model = _mobilenet_v3.MobileNetV3_small_x0_35(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
683
        model = _load_pretrained_parameters(model, 'MobileNetV3_small_x0_35')
L
lyuwenyu 已提交
684 685 686 687

    return model


L
lyuwenyu 已提交
688
def MobileNetV3_small_x0_5(pretrained=False, **kwargs):
L
lyuwenyu 已提交
689 690 691 692 693 694 695 696 697
    """
    MobileNetV3_small_x0_5
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `MobileNetV3_small_x0_5` model depends on args.
    """
L
lyuwenyu 已提交
698 699
    model = _mobilenet_v3.MobileNetV3_small_x0_5(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
700
        model = _load_pretrained_parameters(model, 'MobileNetV3_small_x0_5')
L
lyuwenyu 已提交
701 702 703 704

    return model


L
lyuwenyu 已提交
705
def MobileNetV3_small_x0_75(pretrained=False, **kwargs):
L
lyuwenyu 已提交
706 707 708 709 710 711 712 713 714
    """
    MobileNetV3_small_x0_75
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `MobileNetV3_small_x0_75` model depends on args.
    """
L
lyuwenyu 已提交
715 716
    model = _mobilenet_v3.MobileNetV3_small_x0_75(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
717
        model = _load_pretrained_parameters(model, 'MobileNetV3_small_x0_75')
L
lyuwenyu 已提交
718 719 720 721

    return model


L
lyuwenyu 已提交
722
def MobileNetV3_small_x1_0(pretrained=False, **kwargs):
L
lyuwenyu 已提交
723 724 725 726 727 728 729 730 731
    """
    MobileNetV3_small_x1_0
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `MobileNetV3_small_x1_0` model depends on args.
    """
L
lyuwenyu 已提交
732 733
    model = _mobilenet_v3.MobileNetV3_small_x1_0(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
734
        model = _load_pretrained_parameters(model, 'MobileNetV3_small_x1_0')
L
lyuwenyu 已提交
735 736 737 738

    return model


L
lyuwenyu 已提交
739
def MobileNetV3_small_x1_25(pretrained=False, **kwargs):
L
lyuwenyu 已提交
740 741 742 743 744 745 746 747 748
    """
    MobileNetV3_small_x1_25
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `MobileNetV3_small_x1_25` model depends on args.
    """
L
lyuwenyu 已提交
749 750
    model = _mobilenet_v3.MobileNetV3_small_x1_25(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
751
        model = _load_pretrained_parameters(model, 'MobileNetV3_small_x1_25')
L
lyuwenyu 已提交
752 753 754 755

    return model


L
lyuwenyu 已提交
756

L
lyuwenyu 已提交
757
def ResNeXt101_32x4d(pretrained=False, **kwargs):
L
lyuwenyu 已提交
758 759 760 761 762 763 764 765 766
    """
    ResNeXt101_32x4d
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `ResNeXt101_32x4d` model depends on args.
    """
L
lyuwenyu 已提交
767 768
    model = _resnext.ResNeXt101_32x4d(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
769
        model = _load_pretrained_parameters(model, 'ResNeXt101_32x4d')
L
lyuwenyu 已提交
770 771 772 773

    return model


L
lyuwenyu 已提交
774
def ResNeXt101_64x4d(pretrained=False, **kwargs):
L
lyuwenyu 已提交
775 776 777 778 779 780 781 782 783
    """
    ResNeXt101_64x4d
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `ResNeXt101_64x4d` model depends on args.
    """
L
lyuwenyu 已提交
784 785
    model = _resnext.ResNeXt101_64x4d(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
786
        model = _load_pretrained_parameters(model, 'ResNeXt101_64x4d')
L
lyuwenyu 已提交
787 788 789 790

    return model


L
lyuwenyu 已提交
791
def ResNeXt152_32x4d(pretrained=False, **kwargs):
L
lyuwenyu 已提交
792 793 794 795 796 797 798 799 800
    """
    ResNeXt152_32x4d
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `ResNeXt152_32x4d` model depends on args.
    """
L
lyuwenyu 已提交
801 802
    model = _resnext.ResNeXt152_32x4d(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
803
        model = _load_pretrained_parameters(model, 'ResNeXt152_32x4d')
L
lyuwenyu 已提交
804 805 806 807

    return model


L
lyuwenyu 已提交
808
def ResNeXt152_64x4d(pretrained=False, **kwargs):
L
lyuwenyu 已提交
809 810 811 812 813 814 815 816 817
    """
    ResNeXt152_64x4d
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `ResNeXt152_64x4d` model depends on args.
    """
L
lyuwenyu 已提交
818 819
    model = _resnext.ResNeXt152_64x4d(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
820
        model = _load_pretrained_parameters(model, 'ResNeXt152_64x4d')
L
lyuwenyu 已提交
821 822 823 824

    return model


L
lyuwenyu 已提交
825
def ResNeXt50_32x4d(pretrained=False, **kwargs):
L
lyuwenyu 已提交
826 827 828 829 830 831 832 833 834
    """
    ResNeXt50_32x4d
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `ResNeXt50_32x4d` model depends on args.
    """
L
lyuwenyu 已提交
835 836
    model = _resnext.ResNeXt50_32x4d(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
837
        model = _load_pretrained_parameters(model, 'ResNeXt50_32x4d')
L
lyuwenyu 已提交
838 839 840 841

    return model


L
lyuwenyu 已提交
842
def ResNeXt50_64x4d(pretrained=False, **kwargs):
L
lyuwenyu 已提交
843 844 845 846 847 848 849 850 851
    """
    ResNeXt50_64x4d
    Args:
        pretrained: bool=False. If `True` load pretrained parameters, `False` otherwise.
        kwargs: 
            class_dim: int=1000. Output dim of last fc layer.
    Returns:
        model: nn.Layer. Specific `ResNeXt50_64x4d` model depends on args.
    """
L
lyuwenyu 已提交
852 853
    model = _resnext.ResNeXt50_64x4d(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
854
        model = _load_pretrained_parameters(model, 'ResNeXt50_64x4d')
L
lyuwenyu 已提交
855 856

    return model