Created
March 14, 2022 12:53
-
-
Save Paulescu/c0eadc09283805c93e97f2c773912311 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# function 1 | |
# load image from the given url | |
response = requests.get(url) | |
img = Image.open(io.BytesIO(response.content)) | |
# function 2 | |
# load model. This is a time-consuming operation | |
model = load_model() | |
# function 3 | |
# returns a pair (x_adv, grad) after each FGSM step. | |
iterator = iterative_fast_gradient_sign_( | |
model, | |
preprocess(img), | |
epsilon, | |
n_steps=n_steps, | |
alpha=alpha | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment