Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Foolbox with custom dataset #735

Open
iamsh4shank opened this issue May 14, 2024 · 0 comments
Open

Using Foolbox with custom dataset #735

iamsh4shank opened this issue May 14, 2024 · 0 comments

Comments

@iamsh4shank
Copy link

I would like to use the foolbox my own dataset (say imagenet1k), here i wanted to know how could I find the robust accuracy after the attack as i am going to load the images in batch.

For example -

for _, (clean_x_test, clean_y_test) in enumerate(val_loader):
    clean_x_test = clean_x_test.to(device)
    clean_y_test = clean_y_test.to(device)
    _, advs, success = fb.attacks.LinfPGD(rel_stepsize=0.01, steps=attack_iterations)(fmodel, clean_x_test.to('cuda:0'), clean_y_test.to('cuda:0'), epsilons=eps)
    adv_accuracy = 1 - success.float().mean().item()`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant