bethgelab / foolbox

A Python toolbox to create adversarial examples that fool neural networks in PyTorch, TensorFlow, and JAX
https://foolbox.jonasrauber.de
MIT License
2.77k stars 426 forks source link

Why are the results from fmodel.forward different from kmodel.predict #420

Closed jstagliano30 closed 4 years ago

jstagliano30 commented 4 years ago

I am trying foolbox using Keras with TensorFlow backend. I am learning with the ResNet50 model pretrained with imagenet.

My question is when I do a batch FGSM attack (basically loop over the different images) and then do a prediction step. the fmodel.forward_one is different than the kmodel.predict. In addition, the fmodel.forward_one will show different classes between the original image and the attack image, but the kmodel.predict there is no class difference, though the probability is decreased for some of the AA images.

Is this known behavior? Why the differences, is foolbox reimplementing the model in a different way?

Thank you.

jstagliano30 commented 4 years ago

Soon after asking the question, I found the issue. It was in the preprocessing of the input.

My apologies for distracting y'all.

Thank you