SnehaShukla937 / MEDIS_ATTACK

This repository is an implementation of the paper "Exploring the feasibility of adversarial attacks on medical image segmentation" published in Multimedia Tools and Applications.
https://link.springer.com/article/10.1007/s11042-023-15575-8
0 stars 2 forks source link

a significant difference between the attacked adversarial samples and the original images #1

Open C-c-candy opened 1 week ago

C-c-candy commented 1 week ago

Hi author, When I was reproducing the code, I found that after saving the attacked adversarial examples, there was a significant difference between the attacked adversarial samples and the original images, whether it was targeted or untargeted attacks. However, in the images of your paper, I noticed that the difference between the attacked images and the original images after the attack was not very large. How was this issue resolved?

SnehaShukla937 commented 1 week ago

Hi, Would it be possible for you to provide a few sets of original and attacked image pairs for both attacks? Thanks.

C-c-candy commented 1 week ago

I've found the reason; it's because I have an issue with the way I'm saving images. My original image saving also has problems. Could you teach me how to save them properly? I'm currently unable to save adversarial samples and adversarial noise. Do you have any code for saving that you could conveniently share with me to take a look?Thank you for your reply!

C-c-candy commented 1 week ago

In dataloader.py,I see
self.transform = transforms.Compose([ transforms.Resize((self.testsize, self.testsize)), transforms.ToTensor(), transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])]) self.gt_transform = transforms.ToTensor() result

The saved results look a bit strange. How can I modify them?

C-c-candy commented 1 week ago

I use this code to save image:input_adv = input_adv.data.cpu().numpy() input_adv = input_adv.transpose(1, 2, 0)
input_adv = (input_adv * 255).astype('uint8') cv2.imwrite("result0905/pic.png", input_adv),The result like this picture ,there must something wrong with my code!If it convenient ,please help me~ QQ_1725531207619