Coder Social home page Coder Social logo

unicr's Introduction

UniCR: Universally Approximated Certified Robustness via Randomized Smoothing

This is the official implementation for the ECCV22 paper "UniCR: Universally Approximated Certified Robustness via Randomized Smoothing". UniCR is to universally approximate the certified radius via randomized smoothing using any continuous i.i.d. pdf functions for any $\ell_p$ norm perturbation.

Pre-requirements:

pytorch
pyswarms
statsmodels
tqdm 

To train the smoothed model

python train.py cifar10 cifar_resnet110 ./model_saved/ --norm=2 --model_path="./model_saved/CIFAR_standard.tar" --MonteNum=1000 --input_size=3072 --iid=1 --pdf_args=-1 --pdf_args=1.0

To certify the inputs using the pre-defined General Normal distribution against $\ell_2$ perturbations:

python certification.py cifar10 cifar_resnet110 ./model_saved/ --norm=2 --model_path="./model_saved/CIFAR_Gaussian[-1.0, 1.0]_best.pth" --MonteNum=500 --input_size=3072 --batch=500 --iid=1 --gpu=0 --save_name=CIFAR10_Gaussian_L2_sigma1.0 --pdf_args=-1 --pdf_args=1.41 --pdf_args=2 --samples_begin=0 --samples_end=10000

To certify the inputs using noise optimization:

python noise_optimize.py cifar10 cifar_resnet110 ./model_saved/ --norm=2 --model_path="./model_saved/CIFAR_Gaussian[-1.0, 1.0]_best.pth" --MonteNum=1000 --input_size=3072 --batch=512 --iid=1 --save_name=test --pdf_args=-1 --pdf_args=1.41 --pdf_args=2 --opt_args_low=-1 --opt_args_low=0 --opt_args_low=0 --opt_args_high=-1 --opt_args_high=10 --opt_args_high=10 --opt_args_step=-1 --opt_args_step=0.14 --opt_args_step=0.2 --samples_begin=0 --samples_end=500 --gpu=0

unicr's People

Contributors

youbin2014 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.