コード例 #1
0
ファイル: vgg.py プロジェクト: wangrui22/Pathology-1
def vgg19(pretrained=False, **kwargs):
    """VGG 19-layer model (configuration "E")

    Args:
        pretrained (bool): If True, returns a model pre-trained on ImageNet
    """
    model = VGG_FCN(make_layers(cfg['E']), **kwargs)
    if pretrained:
        pretrained_dict = model_zoo.load_url(model_urls['vgg19'])
        model = model_helper.get_not_fc_para(model, pretrained_dict)
        # model.load_state_dict(model_zoo.load_url(model_urls['vgg19']))
    return model
コード例 #2
0
ファイル: resnet.py プロジェクト: wangrui22/Pathology-1
def resnet152(pretrained=False, **kwargs):
    """Constructs a ResNet-152 model.

    Args:
        pretrained (bool): If True, returns a model pre-trained on ImageNet
    """
    model = ResNet(Bottleneck, [3, 8, 36, 3], **kwargs)
    if pretrained:
        pretrained_dict = model_zoo.load_url(model_urls['resnet152'])
        model = model_helper.get_not_fc_para(model, pretrained_dict)
        # model.load_state_dict(model_zoo.load_url(model_urls['resnet152']))
    return model
コード例 #3
0
ファイル: vgg.py プロジェクト: wangrui22/Pathology-1
def vgg13_bn(pretrained=False, **kwargs):
    """VGG 13-layer model (configuration "B") with batch normalization

    Args:
        pretrained (bool): If True, returns a model pre-trained on ImageNet
    """
    model = VGG(make_layers(cfg['B'], batch_norm=True), **kwargs)
    if pretrained:
        pretrained_dict = model_zoo.load_url(model_urls['vgg13_bn'])
        model = model_helper.get_not_fc_para(model, pretrained_dict)
        # model.load_state_dict(model_zoo.load_url(model_urls['vgg13_bn']))
    return model
コード例 #4
0
ファイル: resnet.py プロジェクト: wangrui22/Pathology-1
def resnet18(pretrained=False, **kwargs):
    """Constructs a ResNet-18 model.

    Args:
        pretrained (bool): If True, returns a model pre-trained on ImageNet
    """
    model = ResNet(BasicBlock, [2, 2, 2, 2], **kwargs)
    if pretrained:
        pretrained_dict = model_zoo.load_url(model_urls['resnet18'])
        model = model_helper.get_not_fc_para(model, pretrained_dict)
        # model.load_state_dict(model_zoo.load_url(model_urls['resnet18']))
    return model
コード例 #5
0
ファイル: inception_v3.py プロジェクト: wangrui22/Pathology-1
def inception_v3(pretrained=False, **kwargs):
    r"""Inception v3 model architecture from
    `"Rethinking the Inception Architecture for Computer Vision" <http://arxiv.org/abs/1512.00567>`_.

    Args:
        pretrained (bool): If True, returns a model pre-trained on ImageNet
    """
    if pretrained:
        if 'transform_input' not in kwargs:
            kwargs['transform_input'] = True
        model = Inception3(**kwargs)
        pretrained_dict = model_zoo.load_url(model_urls['inception_v3_google'])
        model = model_helper.get_not_fc_para(model, pretrained_dict)
        # model.load_state_dict(model_zoo.load_url(model_urls['inception_v3_google']))
        return model

    return Inception3(**kwargs)