chenglin-yang / patchattack Goto Github PK
View Code? Open in Web Editor NEWPatchAttack (ECCV 2020)
License: MIT License
PatchAttack (ECCV 2020)
License: MIT License
Hi, I want to visualize the .pt file as patch img. E.g., I download “TextureDict_ImageNet_0.zip”, and I use the following code to visualize "E:\Code\TextureDict_ImageNet_0\TextureDict_ImageNet_0\attention-style_t-label_1\conv_5_cam-thred_0.8_n-clusters_30\cls-w_0_scale_1\cluster_0\iter_9999.pt"
a = torch.load('iter_9999.pt')
img = a.permute(1,2,0).numpy()
print(img.mean())
print(img.max())
plt.imshow(img)
plt.show()
But I notice that img.mean
is equal to -0.5, and img.max()
is equal to 2.6. I suppose this is the reason why my visualization result is different from that in your paper, so I would like to consult you, so as to show the same result as that in your paper.
Thanks~
the code I use is this ``configure_PA(
t_name='/home/host/mounted2/imagenet-/TextureDict/TextureDict_ImageNet',
t_labels = np.arange(1000).tolist(),
area_occlu = 0.1,
n_occlu = 1,
rl_batch=500, steps=50,
TPA_n_agents=4,
)
TPA = PA.TPA(dir_title)
criterion = torch.nn.CrossEntropyLoss()
metric_logger = utils.MetricLogger(delimiter=" ")
header = 'Test:'
for images, target in metric_logger.log_every(data_loader, 1000, header):
input_tensor = images.to(device, non_blocking=True)
label_tensor = target.to(device, non_blocking=True)
adv_img, rcd_list = TPA.attack(
model = model,
target = 723,
input_tensor = input_tensor[0,:,:,:],
label_tensor = label_tensor,
)`
I use dataloadr load data from imagenet-1k, the batch_size is 1 , so i use input_tensor[0,;.;.;] to get the picture and use for my model.
But the TPA code general picture in the same place with same patch, could you help me about this?
Thanks for your help
In the released dictionaries of patches (AdvPatchDict_ImageNet.zip), it looks like that the masks are always located in the top-left side of the images. Is it correct?
Hi, I have download TextureDict_ImageNet_0, I want to ask how to visualize .pt files as patch patterns? Thanks~
Hey there, sorry for posting an issue, I didn't find an Email address in your paper.
Quick question: when you refer to a "shape-biased network", which network are you referring to?
(https://github.com/rgeirhos/texture-vs-shape/blob/master/models/load_pretrained_models.py lists three different ResNet's with different degrees of stylized training)
Very interesting work! When will the code be released?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.