Example #1
0
def create_perceptualnet(opt):
    # Get the first 15 layers of vgg16, which is conv3_3
    perceptualnet = network.PerceptualNet()
    # Pre-trained VGG-16
    pretrained_dict = torch.load(opt.perceptual_path)
    load_dict(perceptualnet, pretrained_dict)
    # It does not gradient
    for param in perceptualnet.parameters():
        param.requires_grad = False
    return perceptualnet
Example #2
0
def create_perceptualnet():
    # Pre-trained VGG-16
    vgg16 = torch.load('vgg16_pretrained.pth')
    # Get the first 16 layers of vgg16, which is conv3_3
    perceptualnet = network.PerceptualNet()
    # Update the parameters
    load_dict(perceptualnet, vgg16)
    # It does not gradient
    for param in perceptualnet.parameters():
        param.requires_grad = False
    return perceptualnet
Example #3
0
def create_perceptualnet():
    # Get the first 15 layers of vgg16, which is conv3_3
    perceptualnet = network.PerceptualNet()
    # Pre-trained VGG-16
    vgg16 = torch.load('./vgg16_pretrained.pth')
    load_dict(perceptualnet, vgg16)
    # It does not gradient
    for param in perceptualnet.parameters():
        param.requires_grad = False
    print('Perceptual network is created!')
    return perceptualnet
def create_perceptualnet():
    # Initialize the network
    perceptualnet = network.PerceptualNet()
    vgg16 = tv.models.vgg16(pretrained = True)
    # Init the network
    load_dict(perceptualnet, vgg16)
    print('PerceptualNet is created!')
    # It does not gradient
    for param in perceptualnet.parameters():
        param.requires_grad = False
    return perceptualnet
Example #5
0
def create_perceptualnet():
    # Get the first 15 layers of vgg16, which is conv3_3
    perceptualnet = network.PerceptualNet()
    print('Perceptual network is created!')
    return perceptualnet