GithubHelp home page GithubHelp logo

udp's Introduction

UDP

UDP: A Universal Framework to Generate Robust Adversarial Examples in the Physical World

Clone the repository; install dependencies

git clone https://github.com/hdhcy/UDP.git     
pip install requirements.txt

Download the dataset

The downloaded dataset should be placed in the data folder.

Train the UNet style Digital-to-Physical transformation model

python digital_to_physical_transformation.py --dataroot ./data/d2p --save_path ./data_saved/UNet_trans.pth batch_size --batch_size 32 --n_epochs 400 --lr 1e-3 --gpu 0

You can also use our trained transformation model. Please put it in the data_saved (may need to create) folder

Obtain correctly classified simulated physical images

python get_correct_images.py --model_trans_path ./data_saved/UNet_trans.pth --dataroot ./data/d2p/test --save_dir ./data/predict_right_images

Here the physical images simulated by the trained transformation model are judged and the correctly classified images are retained for the next step of the attack.

UDP attack method

python UDP_attack.py --model_trans_path ./data_saved/UNet_trans.pth --dataroot ./data/predict_right_images/digital --res_save_path ./data_saved/UDP_res --adv_label 521 --epsilon 16  --num_iter 15  --data_size 4000 --data_batch_size 32 --gpu 0

Can the attack be successful

After the UDP method, we obtain the corresponding adversarial samples, then print and captur them, and finally cropped them to get the adversarial examples in the physical world.

You can directly modify the adversarial sample path in show_and_get_predicted.py to get its adversarial strength.

udp's People

Contributors

hdhcy avatar

Stargazers

 avatar  avatar

Watchers

 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.