Beispiel #1
0
    def __init__(self, device):
        self.dtype = torch.FloatTensor if device == 'cpu' else torch.cuda.FloatTensor

        VGG_FACE = vgg_face(pretrained=True)
        self.VGG_FACE_AC = VGG_Activations(VGG_FACE,
                                           [1, 6, 11, 18, 25]).type(self.dtype)
        VGG19 = vgg19(pretrained=True)
        self.VGG19_AC = VGG_Activations(VGG19,
                                        [1, 6, 11, 20, 29]).type(self.dtype)
Beispiel #2
0
    def __init__(self, feed_forward=True):
        super(LossEG, self).__init__()

        self.VGG_FACE_AC = VGG_Activations(vgg_face(pretrained=True),
                                           [1, 6, 11, 18, 25])
        self.VGG19_AC = VGG_Activations(vgg19(pretrained=True),
                                        [1, 6, 11, 20, 29])

        self.match_loss = not feed_forward
Beispiel #3
0
    def __init__(self, device, feed_forward=True):
        super(LossEG, self).__init__()
        self.dtype = torch.FloatTensor if device == 'cpu' else torch.cuda.FloatTensor

        self.VGG_FACE_AC = VGG_Activations(vgg_face(pretrained=True),
                                           [1, 6, 11, 18, 25]).type(self.dtype)
        self.VGG19_AC = VGG_Activations(vgg19(pretrained=True),
                                        [1, 6, 11, 20, 29]).type(self.dtype)

        self.match_loss = not feed_forward
Beispiel #4
0
    def __init__(self, feed_forward=True):
        super(LossEG, self).__init__()

        self.VGG_FACE_AC = VGG_Activations(vgg_face(pretrained=True), [1, 6, 11, 18, 25])
        self.VGG19_AC = VGG_Activations(vgg19(pretrained=True), [1, 6, 11, 20, 29])

        self.IMG_NET_MEAN = torch.Tensor([0.485, 0.456, 0.406]).reshape([1, 3, 1, 1])
        self.IMG_NET_STD = torch.Tensor([0.229, 0.224, 0.225]).reshape([1, 3, 1, 1])

        self.match_loss = not feed_forward
Beispiel #5
0
    def __init__(self, feed_forward=True, gpu=None):
        super(vgg_feature, self).__init__()

        self.VGG_FACE_AC = VGG_Activations_2(vgg_face(pretrained=True),
                                             [1, 6, 11, 18, 25])

        # self.match_loss = not feed_forward
        self.gpu = gpu
        if gpu is not None:
            self.cuda(gpu)