Code Monkey home page Code Monkey logo

patchattack's Introduction

chenglin-yang

patchattack's People

Contributors

chenglin-yang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

patchattack's Issues

How to visualize .pt file

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 TPA code general picture in the same place with same patch, Is this normal?

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

How visualize patch img?

Hi, I have download TextureDict_ImageNet_0, I want to ask how to visualize .pt files as patch patterns? Thanks~

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.