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

Question about image attack #6

Open
jiajiaxiaoskx opened this issue Jul 4, 2024 · 7 comments
Open

Question about image attack #6

jiajiaxiaoskx opened this issue Jul 4, 2024 · 7 comments

Comments

@jiajiaxiaoskx
Copy link

Your work is particularly amazing! I have two questions I’d like to ask.

  1. In your image attack code, you commented out the mask section, causing some variables to be referenced without being defined. How should I modify the code to run it properly?
image
  1. What is the purpose of the safetychecker.pt file in the image_space_attack folder in the GitHub repository, and how does it differ from the safety_checker.pt from Hugging Face?

Thank you!

@yangyijune
Copy link
Collaborator

Hi! For the first question, you can directly download the mask and image .png files from https://huggingface.co/datasets/YijunYang280/MMA_Diffusion_adv_images_benchmark

Regarding the .pt files, both are identical. We provided them to make it easier for users to employ our attack methods. You can also find the same safety checker in the SDv1.5 checkpoint by yourself.

@jiajiaxiaoskx
Copy link
Author

thanks!
When I was running image attack code, another error came.
attack successful top1 rate: 0.75
Traceback (most recent call last):
File "/data4/skx/MMA-Diffusion/src/image_space_attack/image_editing_attack.py", line 528, in
main(args)
File "/data4/skx/MMA-Diffusion/src/image_space_attack/image_editing_attack.py", line 476, in main
images_test = processor(img)[None]
File "/data3/skx/miniconda3/envs/mma/lib/python3.10/site-packages/torchvision/transforms/transforms.py", line 95, in call
img = t(img)
File "/data3/skx/miniconda3/envs/mma/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/data3/skx/miniconda3/envs/mma/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/data3/skx/miniconda3/envs/mma/lib/python3.10/site-packages/torchvision/transforms/transforms.py", line 980, in forward
return F.resized_crop(img, i, j, h, w, self.size, self.interpolation, antialias=self.antialias)
File "/data3/skx/miniconda3/envs/mma/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1695, in getattr
raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'")
AttributeError: 'RandomResizedCrop' object has no attribute 'antialias'

I do not if the error is related to the "open_clip_preprocess.pt" or the version of torchvision.
Thanks!

@yangyijune
Copy link
Collaborator

It seems there is a package conflict issue. The file open_clip_preprocess.pt is quite simple, containing only normalization parameters (i.e., mean and variance). If changing the version does not resolve the issue, you can rewrite this part by following OpenClip's preprocessing code.

@xlnn
Copy link

xlnn commented Oct 16, 2024

  1. How should I modify the code to run it properly?

How should I modify the code to run it properly? Thank you!
image

@xlnn
Copy link

xlnn commented Oct 18, 2024

thanks! When I was running image attack code, another error came. attack successful top1 rate: 0.75 Traceback (most recent call last): File "/data4/skx/MMA-Diffusion/src/image_space_attack/image_editing_attack.py", line 528, in main(args) File "/data4/skx/MMA-Diffusion/src/image_space_attack/image_editing_attack.py", line 476, in main images_test = processor(img)[None] File "/data3/skx/miniconda3/envs/mma/lib/python3.10/site-packages/torchvision/transforms/transforms.py", line 95, in call img = t(img) File "/data3/skx/miniconda3/envs/mma/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "/data3/skx/miniconda3/envs/mma/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl return forward_call(*args, **kwargs) File "/data3/skx/miniconda3/envs/mma/lib/python3.10/site-packages/torchvision/transforms/transforms.py", line 980, in forward return F.resized_crop(img, i, j, h, w, self.size, self.interpolation, antialias=self.antialias) File "/data3/skx/miniconda3/envs/mma/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1695, in getattr raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'") AttributeError: 'RandomResizedCrop' object has no attribute 'antialias'

I do not if the error is related to the "open_clip_preprocess.pt" or the version of torchvision. Thanks!

I have same problem. Do you know the problem? Thank you!

@tsrigo
Copy link

tsrigo commented Oct 23, 2024

I have same problem. Do you know the problem? Thank you!

I have same two problem. Do you slove the problem? Thank you! T_T

@xlnn
Copy link

xlnn commented Oct 23, 2024

I have same problem. Do you know the problem? Thank you!

I have same two problem. Do you slove the problem? Thank you! T_T

I couldn't solve this problem, so I gave up.

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

4 participants