Git Product home page Git Product logo

adversarial_image_defenses's People

Contributors

facebook-github-bot avatar lvdmaaten avatar mayankrana avatar nishamuktewar avatar wittgenst 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adversarial_image_defenses's Issues

FGS "Use logit mode if computing loss w.r.t. output scores rather than softmax"

So mode needs to be set to FGSMode.LOGIT, if I want to use the logits? If mode is 'None', the cross-entropy loss is used, if mode is 'FGSMode.CARLINI', the output is updated, then the FGSMode.LOGIT loss is used.

Not entirely sure what's going on. If I wanted to use the logits, and use the xent loss, what mode should I set?

Shift from 'async' to 'non_blocking' in cuda

async is a reserved word in Python 3.7 so cuda is deprecating the function parameter async in favor of non_blocking.

https://github.com/pytorch/pytorch/blob/4d28b65fb8978f1c34765d56f18c07042e70a43a/torch/_utils.py#L20-L21

flake8 testing of https://github.com/facebookresearch/adversarial_image_defenses on Python 3.7.0

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

./adversarial/lib/adversary.py:64:34: E999 SyntaxError: invalid syntax
        target = target.cuda(async=True)
                                 ^
./adversarial/lib/convnet.py:63:44: E999 SyntaxError: invalid syntax
                targets = targets.cuda(async=True)
                                           ^
2     E999 SyntaxError: invalid syntax
2

Error compiling Cython file: adversarial/lib/transformations/tv_bregman.pyx:10:0: relative cimport beyond main package is not allowed

Hi,

Any insights that you can share on this error? Attaching the complete output when I do "pip install .".

My current environment:
Python: 2.7

(FB_env) nisha@xxx:/adversarial_image_defenses$ python -c "import faiss"
(FB_env) nisha@xxx:/adversarial_image_defenses$ python -c "import torch; print(torch.version)"
0.4.0
(FB_env) nisha@xxx:/adversarial_image_defenses$ python -c "import torchvision; print(torchvision.version)"
0.2.1
(FB_env) nisha@xxx:/adversarial_image_defenses$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85
(FB_env) nisha@toymaker:/adversarial_image_defenses$ cython --version
Cython version 0.28.2

entire error text.txt

Segfault encountered when running demo.py

faiss with openblas on Ubuntu 16.
From gdb it seems to segfault on a dynamic cast.

gdb outputs:

==============================GENERATING QUILTING PATCHES AND INDICES==============================
| Input args are:
Namespace(batchsize=256, data_params={'IMAGE_SIZE': 224, 'IMAGE_SCALE_SIZE': 256}, data_root='/tmp/adverarial_dataset', defenses=None, device='gpu', imagenet_dir='/home/ssnl/anaconda3/lib/python3.6/site-packages/adversarial/lib/../test/images', index_file='/tmp/tmp.faiss', model='resnet50', models_root='/tmp/adverarial_dataset', normalize=False, num_patches=1000000, patches_file='/tmp/tmp.pickle', pca_dims=64, pixel_drop_rate=0.5, preprocessed_data=False, pretrained=False, quantize_depth=8, quilting_index_root='/tmp/adverarial_dataset', quilting_neighbors=1, quilting_patch_root='/tmp/adverarial_dataset', quilting_patch_size=5, quilting_random_stitch=False, tar_dir='/tmp/adverarial_dataset/imagenet_transformed_tarred', tar_index_dir='/tmp/adverarial_dataset/imagenet_transformed_tarred_index', tar_prefix='tmp/imagenet_transformed', tvm_method='bregman', tvm_weight=0.03)
| set up image loader...
/home/ssnl/anaconda3/lib/python3.6/site-packages/torchvision/transforms/transforms.py:397: UserWarning: The use of the transforms.RandomSizedCrop transform is deprecated, please use transforms.RandomResizedCrop instead.
  "please use transforms.RandomResizedCrop instead.")
| Loading data from /home/ssnl/anaconda3/lib/python3.6/site-packages/adversarial/lib/../test/images/train
| gather image patches...
| training faiss index...#############################################################################################################################################################################################################################################################################################|
| writing faiss index to /tmp/adverarial_dataset/index_5.faiss

Thread 1 "python" received signal SIGSEGV, Segmentation fault.
__cxxabiv1::__dynamic_cast (src_ptr=src_ptr@entry=0x555601f4fb90, src_type=0x7fff8f336b90 <typeinfo for faiss::VectorTransform>, dst_type=dst_type@entry=0x7fff8f336ba0 <typeinfo for faiss::LinearTransform>, src2dst=src2dst@entry=0)
    at /opt/conda/conda-bld/compilers_linux-64_1505664199673/work/.build/src/gcc-7.2.0/libstdc++-v3/libsupc++/dyncast.cc:68
68	/opt/conda/conda-bld/compilers_linux-64_1505664199673/work/.build/src/gcc-7.2.0/libstdc++-v3/libsupc++/dyncast.cc: No such file or directory.

cc @taesung89

Generating transformed images on pre-generated adversarial images

https://github.com/facebookresearch/adversarial_image_defenses/blob/c5362e31f3e272139d65ad276ab7273f17df305a/adversarial/lib/dataset.py#L38

In the code above, we have 'if not preprocessed:and inload_adversarialwe havepreprocessed=args.preprocessed_data` :

https://github.com/facebookresearch/adversarial_image_defenses/blob/c5362e31f3e272139d65ad276ab7273f17df305a/adversarial/lib/dataset.py#L78-L80

But args.preprocessed_data is used for images that already have transformations/defenses applied (using your terminology, transformations and defenses are synonymous correct?), not when adversaries are already applied.

But how you are using "preprocessed" in _load_adversarial_helper implies you are speaking about if attacks have been preprocessed.

I think this might be a bug.

Modifications to C&W Attack

It is stated that: the attack has been 'modified with TV minimization, random cropping, and random pixel dropping'. What does this mean? No description was given on this in the paper. With what hyperparameter setting can all modifications be turned off?

Furthermore, with the modifications turned off, is the implementation here equivalent to Carlini's original formulation? Doesn't seem to be the case, for one, the 'binary_search_steps' hyperparameter is missing. If it isn't, can you please explain what the formulation is here? Also, can a formulation equivalent to the original C&W attack be added to the repository? The original formulation has been validated to be a very successful attack, so I feel it, without modification, should be included in this repository.

A Tensorflow implemenation of the C&W L2 attack is provided in the 'carlini/nn_robust_attacks' repository and in Tensorflow's Cleverhans repository.

Cannot open shared object file: No such file or directory

I installed Faiss and other packages followed instruction, but I got these errors when I try to run the demo. My environment is pytorch 0.4 and python 3.6.

Traceback (most recent call last):
File "adversarial/examples/demo.py", line 17, in
from adversarial.gen_transformed_images import generate_transformed_images
File "/home/shangqian/anaconda3/lib/python3.6/site-packages/adversarial/gen_transformed_images.py", line 14, in
from lib.defenses import get_defense
File "/home/shangqian/anaconda3/lib/python3.6/site-packages/adversarial/lib/defenses.py", line 20, in
from lib.transformations.quilting_fast import quilting
File "/home/shangqian/anaconda3/lib/python3.6/site-packages/adversarial/lib/transformations/quilting_fast.py", line 17, in
QUILTING_LIB = ctypes.cdll.LoadLibrary(os.path.join(os.path.dirname(file), "libquilting.so"))
File "/home/shangqian/anaconda3/lib/python3.6/ctypes/init.py", line 426, in LoadLibrary
return self._dlltype(name)
File "/home/shangqian/anaconda3/lib/python3.6/ctypes/init.py", line 348, in init
self._handle = _dlopen(self._name, mode)
OSError: /home/shangqian/anaconda3/lib/python3.6/site-packages/adversarial/lib/transformations/libquilting.so: cannot open shared object file: No such file or directory

Hyperparameters for pre-trained models

Thank you very much for providing ImageNet models trained on quilting and TVM. Were the hyperparameters for the transformations the same as presented in the paper?
"We fixed the hyperparameters of our defenses in all experiments: specifically, we set pixel dropout
probability p= 0.5 and the regularization parameter of the total variation minimizer λTV = 0.03. We
use a quilting patch size of 5×5 and a database of 1, 000, 000 patches that were randomly selected
from the ImageNet training set."
If not, what were the hyperparameters?

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.