This repository contains the result and the sample code for the work: GradAuto: Energy-oriented Attack on Dynamic Neural Networks by Jianhong Pan, Qichen Zheng, Zhipeng Fan, Hossein Rahmani, Qiuhong Ke, and Jun Liu
If you find our project useful in your research, please consider citing:
@inproceedings{pan2022gradauto,
title={Gradauto: Energy-oriented attack on dynamic neural networks},
author={Pan, Jianhong and Zheng, Qichen and Fan, Zhipeng and Rahmani, Hossein and Ke, Qiuhong and Liu, Jun},
booktitle={European Conference on Computer Vision},
pages={637--653},
year={2022},
organization={Springer}
}
- We support training with Pytorch 1.10.0. To install required packages
conda install pytorch=1.10 torchvision cudatoolkit=<the CUDA version you want> numpy
-
To prepare ImageNet dataset, please follow this link.
-
To prepare SkipNet pretrained model, please follow this link.
- To train the adversarial samples with
$K=1$ , run
python -u train_autograd.py --model-type rl --K 1
- To train the adversarial samples without accuracy drop, run
python -u train_autograd.py --model-type rl --K 1 --acc-maintain