コード例 #1
0
def VGG19Templet(input_channel=3, pretrained=False, **kwargs):
    """VGG 19-layer model (configuration "E")

    Args:
        pretrained (bool): If True, returns a model pre-trained on ImageNet
    """
    model = VGGTemplet(make_layers(cfg['E'], input_channel), **kwargs)
    if pretrained:
        model_dict = LoadPretrainedModel(
            model, model_zoo.load_url(model_urls['vgg19']))
        model.load_state_dict(model_dict)
    return model
コード例 #2
0
def Resnet152Templet(input_channel, pretrained=False, **kwargs):
    """Constructs a ResNet-152 model.

    Args:
        pretrained (bool): If True, returns a model pre-trained on ImageNet
    """
    model = ResNetTemplet(Bottleneck, [3, 8, 36, 3], input_channel, **kwargs)
    if pretrained:
        model_dict = LoadPretrainedModel(
            model, model_zoo.load_url(model_urls['resnet152']))
        model.load_state_dict(model_dict)
    return model
コード例 #3
0
def VGG16BNTemplet(input_channel=3, pretrained=False, **kwargs):
    """VGG 16-layer model (configuration "D") with batch normalization

    Args:
        pretrained (bool): If True, returns a model pre-trained on ImageNet
    """
    model = VGGTemplet(make_layers(cfg['D'], input_channel, batch_norm=True),
                       **kwargs)
    if pretrained:
        model_dict = LoadPretrainedModel(
            model, model_zoo.load_url(model_urls['vgg16_bn']))
        model.load_state_dict(model_dict)
    return model