Open wang1528186571 opened 1 week ago
images, labels = get_imagenet_data()
print('[Data loaded]') device = "cuda" model = models.resnet50(pretrained=True).to(device).eval() acc = get_accuracy(model, [(images.to(device), labels.to(device))]) atk = torchattacks.CW(model, c=0.1, kappa=14, steps=1000, lr=0.01) atk.set_normalization_used(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) atk.set_mode_targeted_least_likely(kth_min=1)
print('[Data loaded]')
device = "cuda"
model = models.resnet50(pretrained=True).to(device).eval()
acc = get_accuracy(model, [(images.to(device), labels.to(device))])
atk = torchattacks.CW(model, c=0.1, kappa=14, steps=1000, lr=0.01)
atk.set_normalization_used(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
atk.set_mode_targeted_least_likely(kth_min=1)
I also noticed that there is a question about the CW success rate in the issue. He said that the data was normalized. I did that too - removed the line of code atk.set_normalization_used, but it still doesn't work.
❔ Any questions
images, labels = get_imagenet_data()
print('[Data loaded]')
device = "cuda"
model = models.resnet50(pretrained=True).to(device).eval()
acc = get_accuracy(model, [(images.to(device), labels.to(device))])
atk = torchattacks.CW(model, c=0.1, kappa=14, steps=1000, lr=0.01)
atk.set_normalization_used(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
atk.set_mode_targeted_least_likely(kth_min=1)
I also noticed that there is a question about the CW success rate in the issue. He said that the data was normalized. I did that too - removed the line of code atk.set_normalization_used, but it still doesn't work.