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

DPatch Attack Error in PyTorchObjectDetector #2248

Closed
f4str opened this issue Aug 17, 2023 · 0 comments · Fixed by #2249
Closed

DPatch Attack Error in PyTorchObjectDetector #2248

f4str opened this issue Aug 17, 2023 · 0 comments · Fixed by #2249
Assignees
Labels
bug Something isn't working
Milestone

Comments

@f4str
Copy link
Collaborator

f4str commented Aug 17, 2023

Describe the bug
When running the DPatch attack for the PyTorchObjectDetector and PyTorchFasterRCNN, an error can occur when using any PyTorch-specific preprocessors.

To Reproduce
Run the DPatch patch attack on the PyTorchObjectDetector while using a Faster R-CNN model. When using additional PyTorch-specific preprocessors, the error above will occur.

Expected behavior
The attacks should run without error. It can be easily fixed by adding the following line to the _get_losses method in the PyTorchObjectDetector class:

if x_preprocessed.is_leaf:
    x_preprocessed.requires_grad = True
else:
    x_preprocessed.retain_grad()

This error occurs because the gradient retention property is lost when moving a tensor to a different device.

Screenshots
If applicable, add screenshots to help explain your problem.

System information (please complete the following information):

  • OS
  • Python version
  • ART version or commit number
  • TensorFlow / Keras / PyTorch / MXNet version
@beat-buesser beat-buesser linked a pull request Aug 18, 2023 that will close this issue
14 tasks
@beat-buesser beat-buesser added the bug Something isn't working label Aug 18, 2023
@beat-buesser beat-buesser added this to the ART 1.15.1 milestone Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants