Giter Club home page Giter Club logo

odi's Introduction

Object-based Diverse Input (ODI)

Official PyTorch implementation of the CVPR 2022 paper:

"Improving the Transferability of Targeted Adversarial Examples Through Object-Based Diverse Input"

Junyoung Byun, Seungju Cho, Myung-Joon Kwon, Hee-Seon Kim, and Changick Kim

[Paper] | [arXiv] | [Poster]

ODI_fig1

ODI_fig2

Object-based Diverse Input (ODI) is a novel data augmentation technique for improving the transferability of targeted adversarial examples.

Dependencies

Tested in Anaconda3 with Python 3.6, PyTorch 1.9, and PyTorch3D 0.6.0

We have saved the conda environment for Ubuntu.

The conda environment can be installed by entering the following command at the conda prompt.

conda env create -f odi_env.yaml

Dataset

Due to upload file size limitations, we cannot include all the test images. Instead, we included 100 test images.

Please download full test images from the following link: Dataset for nips17 adversarial competition and place the images of the DEV set into './dataset/images'.

If you want to use full test images, please comment line 77 of 'eval_attacks.py' (-> # total_img_num=100).

Evaluation

You can perform a transfer-based targeted attack experiment by entering the following command:

python eval_attacks.py --config_idx=101

The 'eval_attacks.py' script receives config_idx as an execution argument, which designates the experiment configuration number.

The experiment configuration specifies the various parameters required for the experiment, such as epsilon, step size, various hyperparameters for ODI, etc. They are written in 'config.py,' and their summarized description is written in 'exp_info.xlsx.'

When an experiment is completed, the 'NEW_EXP_config_idx.xlsx' file is created in the results folder. Using gen_table.py and gen_plot.py, you can print and visualize the attack success rates for comparison.

ODI as a data augmentation technique

We expect that ODI can be useful in other computer vision tasks such as semantic segmentation and few-shot image classification.

For example, ODI can be utilized in few-shot segmentation as follows.

ODI_fig3

We used rigid body 3D models for the experiments, but one can use deformable 3D models with rigging for more versatile transformations.

Code release TODO:

  • An easy-to-use image transform version of ODI for application in other computer vision tasks
  • An efficient batched processing version of ODI
  • Example code of ODI to transform both an image and its label map (for semantic segmentation)

Acknowledgment

We thank the authors of VT and LogitAttack for sharing their code. We also thank the producers of the six 3D source objects for sharing their 3D models for free.

BibTeX

@InProceedings{Byun_2022_CVPR,
    author    = {Byun, Junyoung and Cho, Seungju and Kwon, Myung-Joon and Kim, Hee-Seon and Kim, Changick},
    title     = {Improving the Transferability of Targeted Adversarial Examples Through Object-Based Diverse Input},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    month     = {June},
    year      = {2022},
    pages     = {15244-15253}
}

odi's People

Contributors

dreamflake avatar

Stargazers

 avatar Meng Chen avatar  avatar  avatar KAI-AutoNavigation avatar  avatar Woo Jae Kim avatar  avatar  avatar HeBangYan avatar Sanghyun Jo avatar Shuwen Chen avatar Hao Wu avatar freeneuro avatar Chen Ma avatar Zhengyu Zhao avatar  avatar  avatar Rui Shao avatar

Watchers

 avatar

Forkers

repo-collection

odi's Issues

ImportError: cannot import name '_C'

After I installed the odi_env.yaml provided by you and ran it, the following error occurred:

Traceback (most recent call last):
File "/tmp/pycharm_project_181/ODI-main/eval_attacks.py", line 14, in
from attacks import *
File "/tmp/pycharm_project_181/ODI-main/attacks.py", line 28, in
from pytorch3d.io import load_objs_as_meshes, load_obj
File "/tmp/pycharm_project_181/ODI-main/pytorch3d/io/init.py", line 8, in
from .obj_io import load_obj, load_objs_as_meshes, save_obj
File "/tmp/pycharm_project_181/ODI-main/pytorch3d/io/obj_io.py", line 22, in
from pytorch3d.renderer import TexturesAtlas, TexturesUV
File "/tmp/pycharm_project_181/ODI-main/pytorch3d/renderer/init.py", line 7, in
from .blending import (
File "/tmp/pycharm_project_181/ODI-main/pytorch3d/renderer/blending.py", line 10, in
from pytorch3d import _C
ImportError: cannot import name '_C'

Do you know the reason for this?

conda 4.5.11
conda list:

packages in environment at /home/wk/anaconda3/envs/odi_env:

Name Version Build Channel

_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 1_gnu conda-forge
bcolz 1.2.1
blas 1.0 mkl anaconda
bzip2 1.0.8 h7b6447c_0 anaconda
ca-certificates 2021.10.8 ha878542_0 conda-forge
certifi 2021.5.30 py36h5fab9bb_0 conda-forge
cloudpickle 1.6.0 py_0 anaconda
colorama 0.4.4 py_0 anaconda
cudatoolkit 10.2.89 hfd86e86_1 anaconda
cycler 0.10.0 py36_0 anaconda
cytoolz 0.11.0 py36h7b6447c_0 anaconda
dask-core 2.30.0 py_0 anaconda
dataclasses 0.8 pyh787bdff_2 conda-forge
dbus 1.13.18 hb2f20db_0 anaconda
decorator 4.4.2 py_0 anaconda
easypyxl 0.4.1
et-xmlfile 1.1.0
expat 2.2.10 he6710b0_2 anaconda
ffmpeg 4.3 hf484d3e_0 pytorch
fontconfig 2.13.0 h9420a91_0 anaconda
freetype 2.10.4 h5ab3b9f_0 anaconda
fvcore 0.1.5.post20210915 py36 fvcore
glib 2.56.2 hd408876_0 anaconda
gmp 6.1.2 hb3b607b_0 anaconda
gnutls 3.6.5 h71b1129_1002 anaconda
gst-plugins-base 1.14.0 hbbd80ab_1 anaconda
gstreamer 1.14.0 hb453b48_1 anaconda
icu 58.2 he6710b0_3 anaconda
imageio 2.9.0 py_0 anaconda
intel-openmp 2021.3.0 h06a4308_3350 anaconda
iopath 0.1.9 py36 iopath
joblib 1.0.1 pyhd8ed1ab_0 conda-forge
jpeg 9b habf39ab_1 anaconda
kiwisolver 1.3.1 py36h605e78d_1 conda-forge
lame 3.100 h7b6447c_0 anaconda
lcms2 2.12 h3be6417_0 anaconda
ld_impl_linux-64 2.36.1 hea4e1c9_2 conda-forge
libblas 3.9.0 1_h86c2bf4_netlib conda-forge
libcblas 3.9.0 5_h92ddd45_netlib conda-forge
libffi 3.3 he6710b0_2 anaconda
libgcc-ng 11.2.0 h1d223b6_11 conda-forge
libgfortran-ng 11.2.0 h69a702a_11 conda-forge
libgfortran5 11.2.0 h5c6108e_11 conda-forge
libgomp 11.2.0 h1d223b6_11 conda-forge
libiconv 1.15 h63c8f33_5 anaconda
liblapack 3.9.0 5_h92ddd45_netlib conda-forge
libpng 1.6.37 hbc83047_0 anaconda
libstdcxx-ng 11.2.0 he4da1e4_11 conda-forge
libtiff 4.2.0 h85742a9_0.conda
libuuid 1.0.3 h1bed415_2 anaconda
libuv 1.40.0 h7b6447c_0 anaconda
libwebp-base 1.1.0 h7b6447c_3 anaconda
libxcb 1.14 h7b6447c_0 anaconda
libxml2 2.9.10 hb55368b_3 anaconda
lz4-c 1.9.3 h9c3ff4c_1 conda-forge
matplotlib 3.3.4 py36h5fab9bb_0 conda-forge
matplotlib-base 3.3.4 py36hd391965_0 conda-forge
mkl 2020.2 256 anaconda
mkl-service 2.3.0 py36h8c4c3a4_2 conda-forge
mkl_fft 1.3.0 py36h54f3939_0.conda
mkl_random 1.1.1 py36h0573a6f_0 anaconda
ncurses 6.2 he6710b0_1 anaconda
nettle 3.4.1 hbb512f6_0 anaconda
networkx 2.5 py_0 anaconda
ninja 1.10.2 h4bd325d_1 conda-forge
numpy 1.19.2 py36h54aff64_0.conda
numpy-base 1.19.2 py36hfa32c7d_0.conda
olefile 0.46 py36_0 anaconda
opencv-python 4.5.3.56
openh264 2.1.0 hd408876_0 anaconda
openjpeg 2.3.0 h05c96fa_1 anaconda
openpyxl 3.0.9
openssl 1.1.1l h7f98852_0 conda-forge
pcre 8.44 he6710b0_0 anaconda
pillow 8.3.1 py36h2c7a002_0 anaconda
pip 21.0.1 pyhd8ed1ab_0 conda-forge
plotly 5.3.1 py_0 plotly
portalocker 2.3.2 py36h5fab9bb_0 conda-forge
pyparsing 2.4.7 py_0 anaconda
pyqt 5.9.2 py36h05f1152_2 anaconda
python 3.6.13 hffdb5ce_0_cpython conda-forge
python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge
python_abi 3.6 2_cp36m conda-forge
pytorch 1.9.0 py3.6_cuda10.2_cudnn7.6.5_0 pytorch
pytorch3d 0.6.0 py36_cu102_pyt190 pytorch3d
pywavelets 1.1.1 py36h7b6447c_2 anaconda
pyyaml 5.4.1 py36h8f6f2f9_1 conda-forge
qt 5.9.7 h5867ecd_1 anaconda
readline 8.1 h46c0cb4_0 conda-forge
scikit-image 0.17.2 py36hdf5156a_0 anaconda
scikit-learn 0.24.2 py36hc89565f_1 conda-forge
scipy 1.5.2 py36h9e8f40b_2 conda-forge
setuptools 52.0.0 py36h06a4308_0 anaconda
sip 4.19.8 py36hf484d3e_0 anaconda
six 1.16.0 pyh6c4a22f_0 conda-forge
sqlite 3.36.0 h9cd32fc_2 conda-forge
tabulate 0.8.9 pyhd8ed1ab_0 conda-forge
tenacity 8.0.1 pyhd8ed1ab_0 conda-forge
termcolor 1.1.0 py36_1 anaconda
threadpoolctl 2.2.0 pyh8a188c0_0 conda-forge
tifffile 2020.10.1 py36hdd07704_2 anaconda
timm 0.4.12
tk 8.6.10 hbc83047_0 anaconda
toolz 0.11.1 py_0 anaconda
torchaudio 0.9.0 py36 pytorch
torchvision 0.10.0 py36_cu102 pytorch
tornado 6.1 py36h8f6f2f9_1 conda-forge
tqdm 4.62.3 pyhd8ed1ab_0 conda-forge
typing_extensions 3.10.0.0 pyha770c72_0 conda-forge
wheel 0.37.0 pyhd8ed1ab_1 conda-forge
xz 5.2.5 h7b6447c_0 anaconda
yacs 0.1.8
yaml 0.2.5 h7b6447c_0 anaconda
zlib 1.2.11 h7b6447c_3 anaconda
zstd 1.4.9 ha95c52a_0 conda-forge

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.