This repository is the official PyTorch implemetation of paper "X-Adv: Physical Adversarial Object Attacks against X-ray Prohibited Item Detection".
XAD download link: please go to this website to acquire download link.
-
Python >= 3.6
-
PyTorch >= 1.8
pip install -r requirements.txt
The XAD dataset will be released after accepted.
Please refer to this website to acquire download links.
The downloaded data should look like this:
dataset_root
|-- train
| |-- train_annotation
| |-- train_image
| |-- train_knife.txt
|-- test
|-- test_annotation
|-- test_image
|-- test_knife.txt
After acquiring the datasets, you should modify data/config.py
to set the dataset directory.
For SSD detection models, the pre-trained weight on VOC0712 can be found at here.
For Faster R-CNN models, we apply the pre-trained weight from this issue, which does not need to be converted from caffe.
Training for SSD models (original, DOAM, LIM):
python train_ssd.py --dataset OPIXray/HiXray/XAD \
--model_arch original/DOAM/LIM \
--transfer ./weights/ssd300_mAP_77.43_v2.pth \
--save_folder ./save
Training for Faster R-CNN:
python train_frcnn.py --dataset OPIXray/HiXray/XAD \
--transfer ./weights/vgg16-397923af.pth \
--save_folder ./save
Attack SSD models (original, DOAM, LIM) with X-Adv:
python attack_ssd.py --dataset OPIXray/HiXray/XAD \
--model_arch original/DOAM/LIM \
--ckpt_path ../weights/model.pth \
--patch_place reinforce \
--patch_material iron \
--save_path ./results
Attack Faster R-CNN with X-Adv:
python attack_frcnn.py --dataset OPIXray/HiXray/XAD \
--patch_place reinforce \
--ckpt_path ../weights/model.pth \
--patch_material iron \
--save_path ./results
Below are some combinations of patch_place
and patch_material
:
Method | patch_place |
patch_material |
---|---|---|
meshAdv | fix | iron_fix |
AdvPatch | fix_patch | iron |
X-Adv | reinforce | iron |
Evaluate SSD models (original, DOAM, LIM):
python test_ssd.py --dataset OPIXray/HiXray/XAD \
--model_arch original/DOAM/LIM \
--ckpt_path ../weights/model.pth \
--phase path/to/your/adver_image
Evaluate Faster R-CNN:
python test_frcnn.py --dataset OPIXray/HiXray/XAD \
--ckpt_path ../weights/model.pth \
--phase path/to/your/adver_image
If this work helps your research, please cite the following paper.
@inproceedings{liu2023xadv,
title={X-Adv: Physical Adversarial Object Attacks against X-ray Prohibited Item Detection},
author={Liu, Aishan and Guo, Jun and Wang, Jiakai and Liang, Siyuan and Tao, Renshuai and Zhou, Wenbo and Liu, Cong and Liu, Xianglong and Tao, Dacheng},
booktitle={32st USENIX Security Symposium (USENIX Security 23)},
year={2022}
}
Original implementation and pre-trained weight of SSD
Implementation and pre-trained weight of Faster R-CNN