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

Passing img instead of id #15

Closed pniedzwiedzinski closed 4 years ago

pniedzwiedzinski commented 4 years ago

Function attack_success takes argument img which is an id of the image in the dataset. Wouldn't it be clearer if this variable is called img_id or something like this? Or we could pass the whole image from the dataset instead.

Hyperparticle commented 4 years ago

Yes, I agree this could be clearer if it was either called img_id or passed in the image itself. Looking back, I notice that the attack_success function in attack.py actually does pass in the image, so I think I can modify the Jupyter notebook to be the same.

Hyperparticle commented 4 years ago

I refactored the code, should be good to go.