hubconf.py 27.3 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 36 37 38
def _load_pretrained_urls():
    '''Load pretrained model parameters url from README.md
    '''
    import re
L
lyuwenyu 已提交
39
    import os
L
lyuwenyu 已提交
40 41
    from collections import OrderedDict

L
lyuwenyu 已提交
42 43 44
    readme_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'README.md')

    with open(readme_path, 'r') as f:
L
lyuwenyu 已提交
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
        lines = f.readlines()
        lines = [lin for lin in lines if lin.strip().startswith('|') and 'Download link' in lin]
    
    urls = OrderedDict()
    for lin in lines:
        try:
            name = re.findall(r'\|(.*?)\|', lin)[0].strip().replace('<br>', '')
            url = re.findall(r'\((.*?)\)', lin)[-1].strip()
            if name in url:
                urls[name] = url
        except:
            pass

    return urls


_checkpoints = _load_pretrained_urls()
L
lyuwenyu 已提交
62

L
lyuwenyu 已提交
63

L
lyuwenyu 已提交
64 65 66 67 68 69
def _load_pretrained_parameters(model, name):
    assert name in _checkpoints, 'Not provide {} pretrained model.'.format(name)
    path = paddle.utils.download.get_weights_path_from_url(_checkpoints[name])
    model.set_state_dict(paddle.load(path))
    return model
    
L
lyuwenyu 已提交
70

L
lyuwenyu 已提交
71
def AlexNet(pretrained=False, **kwargs):
L
lyuwenyu 已提交
72 73 74 75 76 77 78 79 80
    """
    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 已提交
81 82
    model = _alexnet.AlexNet(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
83
        model = _load_pretrained_parameters(model, 'AlexNet')
L
lyuwenyu 已提交
84 85 86 87

    return model


L
lyuwenyu 已提交
88
def VGG11(pretrained=False, **kwargs):
L
lyuwenyu 已提交
89 90 91 92 93 94 95 96 97 98
    """
    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 已提交
99 100
    model = _vgg.VGG11(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
101
        model = _load_pretrained_parameters(model, 'VGG11')
L
lyuwenyu 已提交
102 103 104 105

    return model


L
lyuwenyu 已提交
106
def VGG13(pretrained=False, **kwargs):
L
lyuwenyu 已提交
107 108 109 110 111 112 113 114 115 116
    """
    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 已提交
117 118
    model = _vgg.VGG13(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
119
        model = _load_pretrained_parameters(model, 'VGG13')
L
lyuwenyu 已提交
120 121 122 123

    return model


L
lyuwenyu 已提交
124
def VGG16(pretrained=False, **kwargs):
L
lyuwenyu 已提交
125 126 127 128 129 130 131 132 133 134
    """
    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 已提交
135 136
    model = _vgg.VGG16(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
137
        model = _load_pretrained_parameters(model, 'VGG16')
L
lyuwenyu 已提交
138 139 140 141

    return model


L
lyuwenyu 已提交
142
def VGG19(pretrained=False, **kwargs):
L
lyuwenyu 已提交
143 144 145 146 147 148 149 150 151 152
    """
    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 已提交
153 154
    model = _vgg.VGG19(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
155
        model = _load_pretrained_parameters(model, 'VGG19')
L
lyuwenyu 已提交
156 157 158 159 160 161

    return model




L
lyuwenyu 已提交
162
def ResNet18(pretrained=False, **kwargs):
L
lyuwenyu 已提交
163 164 165 166 167 168 169 170 171 172 173
    """
    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 已提交
174
    model = _resnet.ResNet18(**kwargs)
L
lyuwenyu 已提交
175
    if pretrained:
L
lyuwenyu 已提交
176
        model = _load_pretrained_parameters(model, 'ResNet18')
L
lyuwenyu 已提交
177

L
for hub  
lyuwenyu 已提交
178 179
    return model

L
lyuwenyu 已提交
180

L
lyuwenyu 已提交
181
def ResNet34(pretrained=False, **kwargs):
L
lyuwenyu 已提交
182 183 184 185 186 187 188 189 190 191 192
    """
    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 已提交
193 194
    model = _resnet.ResNet34(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
195
        model = _load_pretrained_parameters(model, 'ResNet34')
L
lyuwenyu 已提交
196

L
lyuwenyu 已提交
197
    return model
L
lyuwenyu 已提交
198 199


L
lyuwenyu 已提交
200
def ResNet50(pretrained=False, **kwargs):
L
lyuwenyu 已提交
201 202 203 204 205 206 207 208 209 210 211
    """
    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 已提交
212 213
    model = _resnet.ResNet50(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
214 215
        model = _load_pretrained_parameters(model, 'ResNet50')
        
L
lyuwenyu 已提交
216 217 218
    return model


L
lyuwenyu 已提交
219
def ResNet101(pretrained=False, **kwargs):
L
lyuwenyu 已提交
220 221 222 223 224 225 226 227 228 229 230
    """
    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 已提交
231 232
    model = _resnet.ResNet101(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
233
        model = _load_pretrained_parameters(model, 'ResNet101')
L
lyuwenyu 已提交
234 235 236 237

    return model


L
lyuwenyu 已提交
238
def ResNet152(pretrained=False, **kwargs):
L
lyuwenyu 已提交
239 240 241 242 243 244 245 246 247 248 249
    """
    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 已提交
250 251
    model = _resnet.ResNet152(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
252
        model = _load_pretrained_parameters(model, 'ResNet152')
L
lyuwenyu 已提交
253 254

    return model
L
lyuwenyu 已提交
255 256 257



L
lyuwenyu 已提交
258
def SqueezeNet1_0(pretrained=False, **kwargs):
L
lyuwenyu 已提交
259 260 261 262 263 264 265 266 267
    """
    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 已提交
268 269
    model = _squeezenet.SqueezeNet1_0(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
270
        model = _load_pretrained_parameters(model, 'SqueezeNet1_0')
L
lyuwenyu 已提交
271 272 273 274

    return model


L
lyuwenyu 已提交
275
def SqueezeNet1_1(pretrained=False, **kwargs):
L
lyuwenyu 已提交
276 277 278 279 280 281 282 283 284
    """
    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 已提交
285 286
    model = _squeezenet.SqueezeNet1_1(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
287
        model = _load_pretrained_parameters(model, 'SqueezeNet1_1')
L
lyuwenyu 已提交
288 289 290 291

    return model


L
lyuwenyu 已提交
292 293


L
lyuwenyu 已提交
294
def DenseNet121(pretrained=False, **kwargs):
L
lyuwenyu 已提交
295 296 297 298 299 300 301 302 303 304 305
    """
    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 已提交
306 307
    model = _densenet.DenseNet121(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
308
        model = _load_pretrained_parameters(model, 'DenseNet121')
L
lyuwenyu 已提交
309 310 311 312

    return model


L
lyuwenyu 已提交
313
def DenseNet161(pretrained=False, **kwargs):
L
lyuwenyu 已提交
314 315 316 317 318 319 320 321 322 323 324
    """
    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 已提交
325 326
    model = _densenet.DenseNet161(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
327
        model = _load_pretrained_parameters(model, 'DenseNet161')
L
lyuwenyu 已提交
328 329 330 331

    return model


L
lyuwenyu 已提交
332
def DenseNet169(pretrained=False, **kwargs):
L
lyuwenyu 已提交
333 334 335 336 337 338 339 340 341 342 343
    """
    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 已提交
344 345
    model = _densenet.DenseNet169(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
346
        model = _load_pretrained_parameters(model, 'DenseNet169')
L
lyuwenyu 已提交
347 348 349 350

    return model


L
lyuwenyu 已提交
351
def DenseNet201(pretrained=False, **kwargs):
L
lyuwenyu 已提交
352 353 354 355 356 357 358 359 360 361 362
    """
    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 已提交
363 364
    model = _densenet.DenseNet201(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
365
        model = _load_pretrained_parameters(model, 'DenseNet201')
L
lyuwenyu 已提交
366 367 368 369

    return model


L
lyuwenyu 已提交
370
def DenseNet264(pretrained=False, **kwargs):
L
lyuwenyu 已提交
371 372 373 374 375 376 377 378 379 380 381
    """
    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 已提交
382 383
    model = _densenet.DenseNet264(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
384
        model = _load_pretrained_parameters(model, 'DenseNet264')
L
lyuwenyu 已提交
385 386 387 388

    return model


L
lyuwenyu 已提交
389

L
lyuwenyu 已提交
390
def InceptionV3(pretrained=False, **kwargs):
L
lyuwenyu 已提交
391 392 393 394 395 396 397 398 399
    """
    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 已提交
400 401
    model = _inception_v3.InceptionV3(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
402
        model = _load_pretrained_parameters(model, 'InceptionV3')
L
lyuwenyu 已提交
403 404 405 406

    return model


L
lyuwenyu 已提交
407
def InceptionV4(pretrained=False, **kwargs):
L
lyuwenyu 已提交
408 409 410 411 412 413 414 415 416
    """
    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 已提交
417 418
    model = _inception_v4.InceptionV4(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
419
        model = _load_pretrained_parameters(model, 'InceptionV4')
L
lyuwenyu 已提交
420

L
lyuwenyu 已提交
421 422 423 424
    return model



L
lyuwenyu 已提交
425
def GoogLeNet(pretrained=False, **kwargs):
L
lyuwenyu 已提交
426 427 428 429 430 431 432 433 434
    """
    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 已提交
435 436
    model = _googlenet.GoogLeNet(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
437
        model = _load_pretrained_parameters(model, 'GoogLeNet')
L
lyuwenyu 已提交
438 439 440 441 442

    return model



L
lyuwenyu 已提交
443
def ShuffleNet(pretrained=False, **kwargs):
L
lyuwenyu 已提交
444 445 446 447 448 449 450 451 452
    """
    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 已提交
453 454
    model = _shufflenet_v2.ShuffleNet(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
455
        model = _load_pretrained_parameters(model, 'ShuffleNet')
L
lyuwenyu 已提交
456 457 458 459 460

    return model



L
lyuwenyu 已提交
461
def MobileNetV1(pretrained=False, **kwargs):
L
lyuwenyu 已提交
462 463 464 465 466 467 468 469 470
    """
    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 已提交
471 472
    model = _mobilenet_v1.MobileNetV1(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
473
        model = _load_pretrained_parameters(model, 'MobileNetV1')
L
lyuwenyu 已提交
474 475 476 477

    return model


L
lyuwenyu 已提交
478
def MobileNetV1_x0_25(pretrained=False, **kwargs):
L
lyuwenyu 已提交
479 480 481 482 483 484 485 486 487
    """
    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 已提交
488 489
    model = _mobilenet_v1.MobileNetV1_x0_25(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
490
        model = _load_pretrained_parameters(model, 'MobileNetV1_x0_25')
L
lyuwenyu 已提交
491 492 493 494

    return model


L
lyuwenyu 已提交
495
def MobileNetV1_x0_5(pretrained=False, **kwargs):
L
lyuwenyu 已提交
496 497 498 499 500 501 502 503 504
    """
    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 已提交
505 506
    model = _mobilenet_v1.MobileNetV1_x0_5(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
507
        model = _load_pretrained_parameters(model, 'MobileNetV1_x0_5')
L
lyuwenyu 已提交
508 509 510 511

    return model


L
lyuwenyu 已提交
512
def MobileNetV1_x0_75(pretrained=False, **kwargs):
L
lyuwenyu 已提交
513 514 515 516 517 518 519 520 521
    """
    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 已提交
522 523
    model = _mobilenet_v1.MobileNetV1_x0_75(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
524
        model = _load_pretrained_parameters(model, 'MobileNetV1_x0_75')
L
lyuwenyu 已提交
525 526 527 528

    return model


L
lyuwenyu 已提交
529
def MobileNetV2_x0_25(pretrained=False, **kwargs):
L
lyuwenyu 已提交
530 531 532 533 534 535 536 537 538
    """
    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 已提交
539 540
    model = _mobilenet_v2.MobileNetV2_x0_25(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
541
        model = _load_pretrained_parameters(model, 'MobileNetV2_x0_25')
L
lyuwenyu 已提交
542 543 544 545

    return model


L
lyuwenyu 已提交
546
def MobileNetV2_x0_5(pretrained=False, **kwargs):
L
lyuwenyu 已提交
547 548 549 550 551 552 553 554 555
    """
    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 已提交
556 557
    model = _mobilenet_v2.MobileNetV2_x0_5(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
558
        model = _load_pretrained_parameters(model, 'MobileNetV2_x0_5')
L
lyuwenyu 已提交
559 560 561 562

    return model


L
lyuwenyu 已提交
563
def MobileNetV2_x0_75(pretrained=False, **kwargs):
L
lyuwenyu 已提交
564 565 566 567 568 569 570 571 572
    """
    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 已提交
573 574
    model = _mobilenet_v2.MobileNetV2_x0_75(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
575
        model = _load_pretrained_parameters(model, 'MobileNetV2_x0_75')
L
lyuwenyu 已提交
576 577 578 579

    return model


L
lyuwenyu 已提交
580
def MobileNetV2_x1_5(pretrained=False, **kwargs):
L
lyuwenyu 已提交
581 582 583 584 585 586 587 588 589
    """
    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 已提交
590 591
    model = _mobilenet_v2.MobileNetV2_x1_5(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
592
        model = _load_pretrained_parameters(model, 'MobileNetV2_x1_5')
L
lyuwenyu 已提交
593 594 595 596

    return model


L
lyuwenyu 已提交
597
def MobileNetV2_x2_0(pretrained=False, **kwargs):
L
lyuwenyu 已提交
598 599 600 601 602 603 604 605 606
    """
    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 已提交
607 608
    model = _mobilenet_v2.MobileNetV2_x2_0(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
609
        model = _load_pretrained_parameters(model, 'MobileNetV2_x2_0')
L
lyuwenyu 已提交
610 611 612 613

    return model


L
lyuwenyu 已提交
614
def MobileNetV3_large_x0_35(pretrained=False, **kwargs):
L
lyuwenyu 已提交
615 616 617 618 619 620 621 622 623
    """
    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 已提交
624 625
    model = _mobilenet_v3.MobileNetV3_large_x0_35(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
626
        model = _load_pretrained_parameters(model, 'MobileNetV3_large_x0_35')
L
lyuwenyu 已提交
627 628 629 630

    return model


L
lyuwenyu 已提交
631
def MobileNetV3_large_x0_5(pretrained=False, **kwargs):
L
lyuwenyu 已提交
632 633 634 635 636 637 638 639 640
    """
    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 已提交
641 642
    model = _mobilenet_v3.MobileNetV3_large_x0_5(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
643
        model = _load_pretrained_parameters(model, 'MobileNetV3_large_x0_5')
L
lyuwenyu 已提交
644 645 646 647

    return model


L
lyuwenyu 已提交
648
def MobileNetV3_large_x0_75(pretrained=False, **kwargs):
L
lyuwenyu 已提交
649 650 651 652 653 654 655 656 657
    """
    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 已提交
658 659
    model = _mobilenet_v3.MobileNetV3_large_x0_75(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
660
        model = _load_pretrained_parameters(model, 'MobileNetV3_large_x0_75')
L
lyuwenyu 已提交
661 662 663 664

    return model


L
lyuwenyu 已提交
665
def MobileNetV3_large_x1_0(pretrained=False, **kwargs):
L
lyuwenyu 已提交
666 667 668 669 670 671 672 673 674
    """
    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 已提交
675 676
    model = _mobilenet_v3.MobileNetV3_large_x1_0(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
677
        model = _load_pretrained_parameters(model, 'MobileNetV3_large_x1_0')
L
lyuwenyu 已提交
678 679 680 681

    return model


L
lyuwenyu 已提交
682
def MobileNetV3_large_x1_25(pretrained=False, **kwargs):
L
lyuwenyu 已提交
683 684 685 686 687 688 689 690 691
    """
    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 已提交
692 693
    model = _mobilenet_v3.MobileNetV3_large_x1_25(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
694
        model = _load_pretrained_parameters(model, 'MobileNetV3_large_x1_25')
L
lyuwenyu 已提交
695 696 697 698

    return model


L
lyuwenyu 已提交
699
def MobileNetV3_small_x0_35(pretrained=False, **kwargs):
L
lyuwenyu 已提交
700 701 702 703 704 705 706 707 708
    """
    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 已提交
709 710
    model = _mobilenet_v3.MobileNetV3_small_x0_35(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
711
        model = _load_pretrained_parameters(model, 'MobileNetV3_small_x0_35')
L
lyuwenyu 已提交
712 713 714 715

    return model


L
lyuwenyu 已提交
716
def MobileNetV3_small_x0_5(pretrained=False, **kwargs):
L
lyuwenyu 已提交
717 718 719 720 721 722 723 724 725
    """
    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 已提交
726 727
    model = _mobilenet_v3.MobileNetV3_small_x0_5(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
728
        model = _load_pretrained_parameters(model, 'MobileNetV3_small_x0_5')
L
lyuwenyu 已提交
729 730 731 732

    return model


L
lyuwenyu 已提交
733
def MobileNetV3_small_x0_75(pretrained=False, **kwargs):
L
lyuwenyu 已提交
734 735 736 737 738 739 740 741 742
    """
    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 已提交
743 744
    model = _mobilenet_v3.MobileNetV3_small_x0_75(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
745
        model = _load_pretrained_parameters(model, 'MobileNetV3_small_x0_75')
L
lyuwenyu 已提交
746 747 748 749

    return model


L
lyuwenyu 已提交
750
def MobileNetV3_small_x1_0(pretrained=False, **kwargs):
L
lyuwenyu 已提交
751 752 753 754 755 756 757 758 759
    """
    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 已提交
760 761
    model = _mobilenet_v3.MobileNetV3_small_x1_0(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
762
        model = _load_pretrained_parameters(model, 'MobileNetV3_small_x1_0')
L
lyuwenyu 已提交
763 764 765 766

    return model


L
lyuwenyu 已提交
767
def MobileNetV3_small_x1_25(pretrained=False, **kwargs):
L
lyuwenyu 已提交
768 769 770 771 772 773 774 775 776
    """
    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 已提交
777 778
    model = _mobilenet_v3.MobileNetV3_small_x1_25(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
779
        model = _load_pretrained_parameters(model, 'MobileNetV3_small_x1_25')
L
lyuwenyu 已提交
780 781 782 783

    return model


L
lyuwenyu 已提交
784

L
lyuwenyu 已提交
785
def ResNeXt101_32x4d(pretrained=False, **kwargs):
L
lyuwenyu 已提交
786 787 788 789 790 791 792 793 794
    """
    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 已提交
795 796
    model = _resnext.ResNeXt101_32x4d(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
797
        model = _load_pretrained_parameters(model, 'ResNeXt101_32x4d')
L
lyuwenyu 已提交
798 799 800 801

    return model


L
lyuwenyu 已提交
802
def ResNeXt101_64x4d(pretrained=False, **kwargs):
L
lyuwenyu 已提交
803 804 805 806 807 808 809 810 811
    """
    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 已提交
812 813
    model = _resnext.ResNeXt101_64x4d(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
814
        model = _load_pretrained_parameters(model, 'ResNeXt101_64x4d')
L
lyuwenyu 已提交
815 816 817 818

    return model


L
lyuwenyu 已提交
819
def ResNeXt152_32x4d(pretrained=False, **kwargs):
L
lyuwenyu 已提交
820 821 822 823 824 825 826 827 828
    """
    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 已提交
829 830
    model = _resnext.ResNeXt152_32x4d(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
831
        model = _load_pretrained_parameters(model, 'ResNeXt152_32x4d')
L
lyuwenyu 已提交
832 833 834 835

    return model


L
lyuwenyu 已提交
836
def ResNeXt152_64x4d(pretrained=False, **kwargs):
L
lyuwenyu 已提交
837 838 839 840 841 842 843 844 845
    """
    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 已提交
846 847
    model = _resnext.ResNeXt152_64x4d(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
848
        model = _load_pretrained_parameters(model, 'ResNeXt152_64x4d')
L
lyuwenyu 已提交
849 850 851 852

    return model


L
lyuwenyu 已提交
853
def ResNeXt50_32x4d(pretrained=False, **kwargs):
L
lyuwenyu 已提交
854 855 856 857 858 859 860 861 862
    """
    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 已提交
863 864
    model = _resnext.ResNeXt50_32x4d(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
865
        model = _load_pretrained_parameters(model, 'ResNeXt50_32x4d')
L
lyuwenyu 已提交
866 867 868 869

    return model


L
lyuwenyu 已提交
870
def ResNeXt50_64x4d(pretrained=False, **kwargs):
L
lyuwenyu 已提交
871 872 873 874 875 876 877 878 879
    """
    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 已提交
880 881
    model = _resnext.ResNeXt50_64x4d(**kwargs)
    if pretrained:
L
lyuwenyu 已提交
882
        model = _load_pretrained_parameters(model, 'ResNeXt50_64x4d')
L
lyuwenyu 已提交
883 884

    return model