Skip to content

Using Foolbox with custom dataset #735

@iamsh4shank

Description

@iamsh4shank

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()`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions