GANimation conditional attacks
This commit is contained in:
@@ -416,14 +416,14 @@ class Solver(Utils):
|
||||
|
||||
for target_idx in range(targets.size(0)):
|
||||
# Transfer to different classes
|
||||
if target_idx == 0:
|
||||
# if target_idx == 0:
|
||||
# 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())
|
||||
|
||||
# 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())
|
||||
@@ -438,10 +438,10 @@ class Solver(Utils):
|
||||
|
||||
# x_adv, perturb = x_advs[target_idx]
|
||||
|
||||
x_adv = image_to_animate + perturb
|
||||
# x_adv = image_to_animate + perturb
|
||||
|
||||
# No Attack
|
||||
# x_adv = image_to_animate
|
||||
x_adv = image_to_animate
|
||||
|
||||
# print(image_to_animate.shape, x_adv.shape)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user