def VGG16Templet(input_channel=3, pretrained=False, **kwargs): """VGG 16-layer model (configuration "D") Args: pretrained (bool): If True, returns a model pre-trained on ImageNet """ model = VGGTemplet(make_layers(cfg['D'], input_channel), **kwargs) if pretrained: model_dict = LoadPretrainedModel(model, model_zoo.load_url(model_urls['vgg16'])) model.load_state_dict(model_dict) return model
def VGG19BNTemplet(input_channel=3, pretrained=False, **kwargs): """VGG 19-layer model (configuration 'E') with batch normalization Args: pretrained (bool): If True, returns a model pre-trained on ImageNet """ model = VGGTemplet(make_layers(cfg['E'], input_channel, batch_norm=True), **kwargs) if pretrained: model_dict = LoadPretrainedModel(model, model_zoo.load_url(model_urls['vgg19_bn'])) model.load_state_dict(model_dict) return model
def AlexnetTemplet(input_channel, pretrained=False, **kwargs): r"""AlexNet model architecture from the `"One weird trick..." <https://arxiv.org/abs/1404.5997>`_ paper. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet """ model = AlexNetTemplet(input_channel) if pretrained: model_dict = LoadPretrainedModel(model, model_zoo.load_url(model_urls['alexnet'])) model.load_state_dict(model_dict) return model
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