Skip to content

Universal Adversarial Perturbations based on the (p, q)-singular vectors.

License

Notifications You must be signed in to change notification settings

KhrulkovV/singular-fool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TensorFlow implementation of the algorithm for generating universal adversarial perturbations based on the (p, q) - singular vectors (see https://arxiv.org/abs/1709.03582 for details).

Installation

For the installation do the following

git clone https://github.com/KhrulkovV/singular-fool
cd singular-fool
python setup.py install

Usage

An example using Keras for loading pretrained models is given here.

In general, given a DNN with e.g. the following architecture

x = tf.placeholder(tf.float32, (None, 28, 28, 1))
w = tf.Variable(np.random.rand(784, 128), dtype=tf.float32)
fc1 = tf.nn.relu(tf.matmul(tf.reshape(x, (-1, 784)), w))
...

it is possible to call

v = singular_fool.get_adversary(x, fc1, img_batch, sess)

where

img_batch

is a collection of images (e.g. in this case it might be a numpy tensor of size [32, 28, 28, 1]). A very basic example is given here.

About

Universal Adversarial Perturbations based on the (p, q)-singular vectors.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages