示例#1
0
 def __init__(self, opt=None):
     super(StyleContentLoss, self).__init__()
     self.vgg = VGG19().cuda()
     self.mse_loss = nn.MSELoss()
     self.mse_loss_sum = nn.MSELoss(reduction="sum")
     self.opt = opt
示例#2
0
 def __init__(self, gpu_ids):
     super(VGGLoss, self).__init__()
     self.vgg = VGG19().cuda()
     self.criterion = nn.L1Loss()
     self.weights = [1.0 / 32, 1.0 / 16, 1.0 / 8, 1.0 / 4, 1.0]
示例#3
0
文件: loss.py 项目: AhmadQasim/SPADE
 def __init__(self, gpu_ids):
     super(VGGLoss, self).__init__()
     # modification: change the pretrained vgg network to only use cuda if enabled
     self.vgg = VGG19().cuda() if len(gpu_ids) > 0 else VGG19()
     self.criterion = nn.L1Loss()
     self.weights = [1.0 / 32, 1.0 / 16, 1.0 / 8, 1.0 / 4, 1.0]