Skip to content

Chapter 11 #84

@LucBourrat1

Description

@LucBourrat1

Is there a way to save attacked images after having performed adversarial attack?

I tried that:

img_mod = modified_images[0]
Image.fromarray(np.array(img_mod)).save("test.jpg")
img = Image.open("test.jpg")
predict_on_image(torch.tensor(np.array(img)))

And the prediction should be "lemon" but I still get "African elephant".

Then I tried saving as ".png" instead of ".jpg":

img_mod = modified_images[0]
Image.fromarray(np.array(img_mod)).save("test.png")
img = Image.open("test.png")
predict_on_image(torch.tensor(np.array(img)))

And this time I correctly get the label "lemon".

Can you explain why?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions