Giter VIP home page Giter VIP logo

partialpgd's Introduction

partialpgd

PGD attack on feature space

About multiple images and attempts:

  1. i thought since our final goal is to maximize the cost, so multiple images and attempts are ways to provide more cost values we could select from. so i use the max_cost to find the maximize one.

for multiple images:

  1. my return from that function is a stack which is 4D. [images per class*10, 128, 16, 16]
  2. before the multiple image, we only have 1 image per class, so we could get target output in this way: target_outputs = torch.stack([ref_outputs[i] for i in target_labels]) while we have multiple images, the ith ref_outputs is no longer the corresponding target label one, the ref_outputs[images_per_class * i : images_per_class * i+images_per_class] is the those correspond to the target label i.
  3. then the target_outputs we obtained are 5D. [16, images per class*10, 128, 16, 16]
  4. the next place use the target_outputs is using loss function to compute the cost, so i iter all the images_per_class, get that each target_output per image, using: for j in range(images_per_class): cost = -loss(outputs, target_outputs[:,j,:,:,:])
  5. and then save the max_cost by compare the cost each time. eventually use that max_cost to compute the grad.

for multiple attempts:

  1. since we want to have 10 times of 4 iters, we want the 10 times to be different, so i thought the attempts iter should start at first before any random directions were generated. and set the max_cost and max_image at first so that could compare to obtain the largest cost with its corresponding adv_images.
  2. everything happens after are the same, and i only compute the grad after all the iter ends, using the max_cost and max_image to get the final adv_images.

partialpgd's People

Contributors

haoranxi avatar moyix avatar

Watchers

 avatar  avatar

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.