FGSM
Let's say we are performing an image classification; in general, we train the model by computing the loss and trying to minimize the loss by calculating gradients of our loss with respect to our model parameters, such as weights, and updating our model parameter. To get the adversarial sample of our image, we calculate the gradients of our loss with respect to the input pixels of our image, instead of the model parameter. So, the adversarial sample of an image is basically the gradient of loss with respect to the image. We take only one gradient step and so it is computationally effective. After calculating the gradients, we take the sign of it.
An adversarial image can be calculated as follows:
In the previous equation, the following ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access