Hyperparticle / one-pixel-attack-keras

Keras implementation of "One pixel attack for fooling deep neural networks" using differential evolution on Cifar10 and ImageNet
https://arxiv.org/abs/1710.08864
MIT License
1.21k stars 213 forks source link

How to use this code to attack VGG16? #11

Closed tuji-sjp closed 5 years ago

tuji-sjp commented 5 years ago

Hello, could you please tell me about how to use? Thank you!

Hyperparticle commented 5 years ago

It should be straightforward to use VGG16. I included a vgg16.py file, which you can train. Alternatively, you can use Keras's pretrained model: https://keras.io/applications/#vgg16

You'll also need to wrap the code in a class like what you see in lenet.py, for example. You can copy the existing functions like color_preprocess.

Then it should be as simple as including it in the list of models. Let me know if you have any difficulty.

Hyperparticle commented 5 years ago

Are you still working on this?

tuji-sjp commented 5 years ago

Are you still working on this?

Oh, yes. I'm so sorry. Running statistics result is a bit slow. And how do I use the GPU to accelerate this process?

Hyperparticle commented 5 years ago

You should have CUDA, CuDNN, and tensorflow-gpu installed on your system. Then the library should automatically detect and use your GPU if it is available. To detect if the library is using GPU, see #9.

Alternatively, you can use Google Colab to run the notebook on a free GPU cloud instance.

tuji-sjp commented 5 years ago

You should have CUDA, CuDNN, and tensorflow-gpu installed on your system. Then the library should automatically detect and use your GPU if it is available. To detect if the library is using GPU, see #9.

Alternatively, you can use Google Colab to run the notebook on a free GPU cloud instance.

Yes, I did. But sometimes it takes about a day, with 500 samples.

Hyperparticle commented 5 years ago

Yes, that is very slow, shouldn't take longer than an hour. If your system is using a GPU, then that probably means you have a bottleneck somewhere. Have you tried running other code with Keras, like one of their tutorials with GPU?

tuji-sjp commented 5 years ago

Yes, that is very slow, shouldn't take longer than an hour. If your system is using a GPU, then that probably means you have a bottleneck somewhere. Have you tried running other code with Keras, like one of their tutorials with GPU?

Ok, I will continue to study the work. And I want to get a statistical success rate of 500 samples on ImageNet.