Replies: 2 comments
-
In the test code at, Why is it that in the |
Beta Was this translation helpful? Give feedback.
-
DPatch and RobustDPatch use
It seems that the To fix this issue, you should call nb_classes = 1000
data = next(iter(train_loader))
x_data = data[0].numpy() # 512 images
y_data = data[1] # 512 labels
one_hot = torch.nn.functional.one_hot(get_imagenet_labels(y_data), nb_classes)
patch_itself = patch_attack.generate(x_data, y=np.array(one_hot)) |
Beta Was this translation helpful? Give feedback.
-
It seems that either the patch attacks either do no update the patch itself, or I receive an error. The error itself is the following and occurs during the DPatch or the RobustDPatch. It seems that my PyTorch classifier does not have the ObjectDetectorMixin. Is that solvable with the given model?
For the more standard AdversarialPatchPyTorch, it appears to work, the code runs, however the patch itself is not adversarial and does not decrease the accuracy. It seems as if it the gradients are not being applied to the patch. I've tried both optimizer options as well as many other optional parameters. My model is a standard ResNet50 and the setup code is below. Again, patches are applied to images but they are not adversarial.
Further down in the code, I convert my labels to one hot encoding and imagenet size, (I am using Imagenette).
Please let me know what I am doing wrong, or if there is a bug in the implementation. In addition, is 512 images enough to generate a patch? I think it should be and as I scaled up the number of images, the accuracy was not affected.
Thank you for your help!
Beta Was this translation helpful? Give feedback.
All reactions