From 5f69bbf6ba0da875ade502cea62407f5fb0c81fd Mon Sep 17 00:00:00 2001 From: Nataniel Ruiz Date: Thu, 9 Jan 2020 18:52:32 -0400 Subject: [PATCH] GANimation conditional attacks --- ganimation/attacks.py | 2 +- ganimation/solver.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ganimation/attacks.py b/ganimation/attacks.py index cd35251..5916639 100644 --- a/ganimation/attacks.py +++ b/ganimation/attacks.py @@ -7,7 +7,7 @@ import torch import torch.nn as nn class LinfPGDAttack(object): - def __init__(self, model=None, device=None, epsilon=0.05, k=20, a=0.01): + def __init__(self, model=None, device=None, epsilon=0.03, k=80, a=0.01): self.model = model self.epsilon = epsilon self.k = k diff --git a/ganimation/solver.py b/ganimation/solver.py index e31cbea..eec1418 100644 --- a/ganimation/solver.py +++ b/ganimation/solver.py @@ -420,10 +420,10 @@ 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()) + # x_adv, perturb = pgd_attack.perturb_joint_class(image_to_animate, black, targets[:, :].cuda()) # Iterative Class Conditional # x_adv, perturb = pgd_attack.perturb_iter_class(image_to_animate, black, targets[:, :].cuda())