diff --git a/ganimation/attacks.py b/ganimation/attacks.py index 798dde1..b941a5e 100644 --- a/ganimation/attacks.py +++ b/ganimation/attacks.py @@ -30,7 +30,7 @@ class LinfPGDAttack(object): out = imFromAttReg(output_att, output_img, X) self.model.zero_grad() - loss = -self.loss_fn(output_att, y) + loss = self.loss_fn(output_att, y) # loss = -self.loss_fn(out, y) loss.backward() grad = X.grad diff --git a/ganimation/solver.py b/ganimation/solver.py index f62cea7..ab49291 100644 --- a/ganimation/solver.py +++ b/ganimation/solver.py @@ -420,7 +420,7 @@ class Solver(Utils): # img = regular_image_transform(Image.open(images_to_animate_path[idx])).unsqueeze(0).cuda() # Wrong Class - # x_adv, perturb = pgd_attack.perturb(image_to_animate, black, targets[0, :].unsqueeze(0).cuda()) + x_adv, perturb = pgd_attack.perturb(image_to_animate, black, targets[0, :].unsqueeze(0).cuda()) # Joint Class Conditional # x_adv, perturb = pgd_attack.perturb_joint_class(image_to_animate, black, targets[:, :].cuda()) @@ -434,9 +434,9 @@ class Solver(Utils): targets_au = targets[target_idx, :].unsqueeze(0).cuda() # Normal Attack - x_adv, perturb = pgd_attack.perturb(image_to_animate, black, targets_au) + # x_adv, perturb = pgd_attack.perturb(image_to_animate, black, targets_au) - # x_adv, perturb = x_advs[target_idx] + x_adv, perturb = x_advs[target_idx] # x_adv = image_to_animate + perturb