Dataset used: COCO2017
Install MindSpore.
Download the dataset COCO2017.
We use COCO2017 as dataset in this example.
Install Cython and pycocotool, and you can also install mmcv to process data.
pip install Cython
pip install pycocotools
pip install mmcv==0.2.14
And change the COCO_ROOT and other settings you need in config.py
. The directory structure is as follows:
.
└─cocodataset
├─annotations
├─instance_train2017.json
└─instance_val2017.json
├─val2017
└─train2017
You can download the pre-trained model checkpoint file here.
python coco_attack_pgd.py --pre_trained [PRETRAINED_CHECKPOINT_FILE]
Adversarial samples will be generated and saved as pickle file.