hubconf.py 27.4 KB
Newer Older
L
lyuwenyu 已提交
1
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
L
lyuwenyu 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14
#
# 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.

15
dependencies = ['paddle']
L
for hub  
lyuwenyu 已提交
16

L
lyuwenyu 已提交
17
import paddle
18 19 20 21 22
import os
import sys


class _SysPathG(object):
L
lyuwenyu 已提交
23 24 25 26 27 28 29 30 31
    """
    _SysPathG used to add/clean path for sys.path. Making sure minimal pkgs dependents by skiping parent dirs.

    __enter__
        add path into sys.path
    __exit__
        clean user's sys.path to avoid unexpect behaviors
    """

L
update  
lyuwenyu 已提交
32 33 34
    def __init__(self, path):
        self.path = path

35
    def __enter__(self, ):
L
update  
lyuwenyu 已提交
36
        sys.path.insert(0, self.path)
37 38

    def __exit__(self, type, value, traceback):
L
update  
lyuwenyu 已提交
39
        _p = sys.path.pop(0)
L
lyuwenyu 已提交
40 41
        assert _p == self.path, 'Make sure sys.path cleaning {} correctly.'.format(
            self.path)
42 43


L
lyuwenyu 已提交
44 45 46 47 48 49 50 51 52
with _SysPathG(os.path.dirname(os.path.abspath(__file__)), ):
    import ppcls
    import ppcls.arch.backbone as backbone

    def ppclas_init():
        if ppcls.utils.logger._logger is None:
            ppcls.utils.logger.init_logger()

    ppclas_init()
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70

    def _load_pretrained_parameters(model, name):
        url = 'https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/{}_pretrained.pdparams'.format(
            name)
        path = paddle.utils.download.get_weights_path_from_url(url)
        model.set_state_dict(paddle.load(path))
        return model

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

        return model

    def vgg11(pretrained=False, **kwargs):
        """
        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 已提交
87
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
88
        model = backbone.VGG11(**kwargs)
89 90 91 92 93 94 95 96 97 98 99 100 101 102

        return model

    def vgg13(pretrained=False, **kwargs):
        """
        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 已提交
103
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
104
        model = backbone.VGG13(**kwargs)
105 106 107 108 109 110 111 112 113 114 115 116 117 118

        return model

    def vgg16(pretrained=False, **kwargs):
        """
        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 已提交
119
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
120
        model = backbone.VGG16(**kwargs)
121 122 123 124 125 126 127 128 129 130 131 132 133 134

        return model

    def vgg19(pretrained=False, **kwargs):
        """
        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 已提交
135
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
136
        model = backbone.VGG19(**kwargs)
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151

        return model

    def resnet18(pretrained=False, **kwargs):
        """
        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 已提交
152
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
153
        model = backbone.ResNet18(**kwargs)
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168

        return model

    def resnet34(pretrained=False, **kwargs):
        """
        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 已提交
169
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
170
        model = backbone.ResNet34(**kwargs)
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185

        return model

    def resnet50(pretrained=False, **kwargs):
        """
        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 已提交
186
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
187
        model = backbone.ResNet50(**kwargs)
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202

        return model

    def resnet101(pretrained=False, **kwargs):
        """
        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
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
204
        model = backbone.ResNet101(**kwargs)
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219

        return model

    def resnet152(pretrained=False, **kwargs):
        """
        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 已提交
220
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
221
        model = backbone.ResNet152(**kwargs)
222 223 224 225 226 227 228 229 230 231 232 233 234

        return model

    def squeezenet1_0(pretrained=False, **kwargs):
        """
        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 已提交
235
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
236
        model = backbone.SqueezeNet1_0(**kwargs)
237 238 239 240 241 242 243 244 245 246 247 248 249

        return model

    def squeezenet1_1(pretrained=False, **kwargs):
        """
        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 已提交
250
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
251
        model = backbone.SqueezeNet1_1(**kwargs)
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266

        return model

    def densenet121(pretrained=False, **kwargs):
        """
        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 已提交
267
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
268
        model = backbone.DenseNet121(**kwargs)
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283

        return model

    def densenet161(pretrained=False, **kwargs):
        """
        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 已提交
284
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
285
        model = backbone.DenseNet161(**kwargs)
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300

        return model

    def densenet169(pretrained=False, **kwargs):
        """
        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 已提交
301
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
302
        model = backbone.DenseNet169(**kwargs)
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317

        return model

    def densenet201(pretrained=False, **kwargs):
        """
        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 已提交
318
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
319
        model = backbone.DenseNet201(**kwargs)
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334

        return model

    def densenet264(pretrained=False, **kwargs):
        """
        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 已提交
335
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
336
        model = backbone.DenseNet264(**kwargs)
337 338 339 340 341 342 343 344 345 346 347 348 349

        return model

    def inceptionv3(pretrained=False, **kwargs):
        """
        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 已提交
350
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
351
        model = backbone.InceptionV3(**kwargs)
352 353 354 355 356 357 358 359 360 361 362 363 364

        return model

    def inceptionv4(pretrained=False, **kwargs):
        """
        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 已提交
365
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
366
        model = backbone.InceptionV4(**kwargs)
367 368 369 370 371 372 373 374 375 376 377 378 379

        return model

    def googlenet(pretrained=False, **kwargs):
        """
        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 已提交
380
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
381
        model = backbone.GoogLeNet(**kwargs)
382 383 384 385 386 387 388 389 390 391 392 393 394

        return model

    def shufflenetv2_x0_25(pretrained=False, **kwargs):
        """
        ShuffleNetV2_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 `ShuffleNetV2_x0_25` model depends on args.
        """
L
lyuwenyu 已提交
395
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
396
        model = backbone.ShuffleNetV2_x0_25(**kwargs)
397 398 399 400 401 402 403 404 405 406 407 408 409

        return model

    def mobilenetv1(pretrained=False, **kwargs):
        """
        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 已提交
410
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
411
        model = backbone.MobileNetV1(**kwargs)
412 413 414 415 416 417 418 419 420 421 422 423 424

        return model

    def mobilenetv1_x0_25(pretrained=False, **kwargs):
        """
        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 已提交
425
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
426
        model = backbone.MobileNetV1_x0_25(**kwargs)
427 428 429 430 431 432 433 434 435 436 437 438 439

        return model

    def mobilenetv1_x0_5(pretrained=False, **kwargs):
        """
        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 已提交
440
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
441
        model = backbone.MobileNetV1_x0_5(**kwargs)
442 443 444 445 446 447 448 449 450 451 452 453 454

        return model

    def mobilenetv1_x0_75(pretrained=False, **kwargs):
        """
        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 已提交
455
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
456
        model = backbone.MobileNetV1_x0_75(**kwargs)
457 458 459 460 461 462 463 464 465 466 467 468 469

        return model

    def mobilenetv2_x0_25(pretrained=False, **kwargs):
        """
        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 已提交
470
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
471
        model = backbone.MobileNetV2_x0_25(**kwargs)
472 473 474 475 476 477 478 479 480 481 482 483 484

        return model

    def mobilenetv2_x0_5(pretrained=False, **kwargs):
        """
        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 已提交
485
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
486
        model = backbone.MobileNetV2_x0_5(**kwargs)
487 488 489 490 491 492 493 494 495 496 497 498 499

        return model

    def mobilenetv2_x0_75(pretrained=False, **kwargs):
        """
        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 已提交
500
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
501
        model = backbone.MobileNetV2_x0_75(**kwargs)
502 503 504 505 506 507 508 509 510 511 512 513 514

        return model

    def mobilenetv2_x1_5(pretrained=False, **kwargs):
        """
        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 已提交
515
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
516
        model = backbone.MobileNetV2_x1_5(**kwargs)
517 518 519 520 521 522 523 524 525 526 527 528 529

        return model

    def mobilenetv2_x2_0(pretrained=False, **kwargs):
        """
        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 已提交
530
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
531
        model = backbone.MobileNetV2_x2_0(**kwargs)
532 533 534 535 536 537 538 539 540 541 542 543 544

        return model

    def mobilenetv3_large_x0_35(pretrained=False, **kwargs):
        """
        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 已提交
545
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
546
        model = backbone.MobileNetV3_large_x0_35(**kwargs)
547 548 549 550 551 552 553 554 555 556 557 558 559

        return model

    def mobilenetv3_large_x0_5(pretrained=False, **kwargs):
        """
        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 已提交
560
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
561
        model = backbone.MobileNetV3_large_x0_5(**kwargs)
562 563 564 565 566 567 568 569 570 571 572 573 574

        return model

    def mobilenetv3_large_x0_75(pretrained=False, **kwargs):
        """
        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 已提交
575
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
576
        model = backbone.MobileNetV3_large_x0_75(**kwargs)
577 578 579 580 581 582 583 584 585 586 587 588 589

        return model

    def mobilenetv3_large_x1_0(pretrained=False, **kwargs):
        """
        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 已提交
590
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
591
        model = backbone.MobileNetV3_large_x1_0(**kwargs)
592 593 594 595 596 597 598 599 600 601 602 603 604

        return model

    def mobilenetv3_large_x1_25(pretrained=False, **kwargs):
        """
        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 已提交
605
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
606
        model = backbone.MobileNetV3_large_x1_25(**kwargs)
607 608 609 610 611 612 613 614 615 616 617 618 619

        return model

    def mobilenetv3_small_x0_35(pretrained=False, **kwargs):
        """
        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 已提交
620
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
621
        model = backbone.MobileNetV3_small_x0_35(**kwargs)
622 623 624 625 626 627 628 629 630 631 632 633 634

        return model

    def mobilenetv3_small_x0_5(pretrained=False, **kwargs):
        """
        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 已提交
635
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
636
        model = backbone.MobileNetV3_small_x0_5(**kwargs)
637 638 639 640 641 642 643 644 645 646 647 648 649

        return model

    def mobilenetv3_small_x0_75(pretrained=False, **kwargs):
        """
        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 已提交
650
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
651
        model = backbone.MobileNetV3_small_x0_75(**kwargs)
652 653 654 655 656 657 658 659 660 661 662 663 664

        return model

    def mobilenetv3_small_x1_0(pretrained=False, **kwargs):
        """
        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 已提交
665
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
666
        model = backbone.MobileNetV3_small_x1_0(**kwargs)
667 668 669 670 671 672 673 674 675 676 677 678 679

        return model

    def mobilenetv3_small_x1_25(pretrained=False, **kwargs):
        """
        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 已提交
680
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
681
        model = backbone.MobileNetV3_small_x1_25(**kwargs)
682 683 684 685 686 687 688 689 690 691 692 693 694

        return model

    def resnext101_32x4d(pretrained=False, **kwargs):
        """
        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 已提交
695
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
696
        model = backbone.ResNeXt101_32x4d(**kwargs)
697 698 699 700 701 702 703 704 705 706 707 708 709

        return model

    def resnext101_64x4d(pretrained=False, **kwargs):
        """
        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 已提交
710
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
711
        model = backbone.ResNeXt101_64x4d(**kwargs)
712 713 714 715 716 717 718 719 720 721 722 723 724

        return model

    def resnext152_32x4d(pretrained=False, **kwargs):
        """
        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 已提交
725
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
726
        model = backbone.ResNeXt152_32x4d(**kwargs)
727 728 729 730 731 732 733 734 735 736 737 738 739

        return model

    def resnext152_64x4d(pretrained=False, **kwargs):
        """
        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 已提交
740
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
741
        model = backbone.ResNeXt152_64x4d(**kwargs)
742 743 744 745 746 747 748 749 750 751 752 753 754

        return model

    def resnext50_32x4d(pretrained=False, **kwargs):
        """
        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 已提交
755
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
756
        model = backbone.ResNeXt50_32x4d(**kwargs)
757 758 759 760 761 762 763 764 765 766 767 768 769

        return model

    def resnext50_64x4d(pretrained=False, **kwargs):
        """
        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 已提交
770
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
771
        model = backbone.ResNeXt50_64x4d(**kwargs)
772 773

        return model
L
lyuwenyu 已提交
774 775 776 777 778 779 780 781 782 783 784

    def darknet53(pretrained=False, **kwargs):
        """
        DarkNet53
        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 已提交
785
        kwargs.update({'pretrained': pretrained})
L
lyuwenyu 已提交
786 787 788
        model = backbone.DarkNet53(**kwargs)

        return model