Hyperparticle / one-pixel-attack-keras

Keras implementation of "One pixel attack for fooling deep neural networks" using differential evolution on Cifar10 and ImageNet

Home Page:https://arxiv.org/abs/1710.08864

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About image processing

tuji-sjp opened this issue · comments

Hello, I would like to ask why CIFAR-10 was not pre-processed in your code, while the image of ImageNet was pre-processed?
In addition, does the adversarial examples need to be pre-processed (such as normalization) before being fed into the model for reclassification?

Also, I'm not quite sure whether we are attacking the original image or the pre-processed image? There seems to be a contradiction in your code.
微信截图_20191025223639
微信截图_20191025223603

The CIFAR10 images are preprocessed, just using a different preprocessing function. Each network defines color_process(), which is called on every predict() for CIFAR images. E.g., https://github.com/Hyperparticle/one-pixel-attack-keras/blob/master/networks/resnet.py#L165.

The ImageNet notebook is experimental for now. It uses imagenet_utils to do the preprocessing instead. This is a more general approach for arbitrary images, but the code isn't finished here.

As for your final point, the first bit of code is simply a demonstration. If it was preprocessed, it would be hard to view it as an image. The actual attack, however, should use the preprocessed image, as in the second bit.

Hope that helps.

The CIFAR10 images are preprocessed, just using a different preprocessing function. Each network defines color_process(), which is called on every predict() for CIFAR images. E.g., https://github.com/Hyperparticle/one-pixel-attack-keras/blob/master/networks/resnet.py#L165.

The ImageNet notebook is experimental for now. It uses imagenet_utils to do the preprocessing instead. This is a more general approach for arbitrary images, but the code isn't finished here.

As for your final point, the first bit of code is simply a demonstration. If it was preprocessed, it would be hard to view it as an image. The actual attack, however, should use the preprocessed image, as in the second bit.

Hope that helps.

Thank you very much. It helps me a lot!