5fc9b0052b54e953a907895b0ecaf8f0174274a2,generate_from_imagenet.py,,,#,13

Before Change



        X = np.expand_dims(img, axis=0)

        pert = fgsm_minimal_perturbations(X, model, session, eps_step=9, eps_max=100, params={"clip_max":255})

        misc.imsave(filename.replace(".jpg", "_adv.jpg"), (X + pert)[0])
        misc.imsave(filename.replace(".jpg", "_pert.jpg"), pert[0])

After Change



attack = FastGradientMethod(model, session)

attack_params = {"clip_min": 0.,
                 "clip_max": 255,
                 "minimal": True,
                 "eps_step": 9,
                 "eps_max": 100.}

for file in os.listdir(PATH):

    if file.endswith(".jpg") and (not "adv" in file or "pert" in file):

        filename = os.path.join(PATH, file)\

        img = Image.open(filename)
        img = img.resize((width, height), Image.ANTIALIAS)

        X = np.expand_dims(img, axis=0)

        adv = attack.generate(X, **attack_params)

        misc.imsave(filename.replace(".jpg", "_adv.jpg"), adv[0])
        misc.imsave(filename.replace(".jpg", "_pert.jpg"), (adv - X)[0])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 5fc9b0052b54e953a907895b0ecaf8f0174274a2
Time: 2017-06-13
Author: valentina.zantedeschi@ibm.com
File Name: generate_from_imagenet.py
Class Name:
Method Name:


Project Name: tensorflow/cleverhans
Commit Name: f9dd2e3636db61ee1b4d32ee4f494fd9e71adc12
Time: 2017-03-29
Author: ngp5056@cse.psu.edu
File Name: cleverhans/attacks.py
Class Name: Attack
Method Name: generate_np


Project Name: tensorflow/cleverhans
Commit Name: f9dd2e3636db61ee1b4d32ee4f494fd9e71adc12
Time: 2017-03-29
Author: ngp5056@cse.psu.edu
File Name: cleverhans/attacks.py
Class Name: FastGradientMethod
Method Name: generate_np