Skip to content

Latest commit

 

History

History
87 lines (56 loc) · 2.43 KB

README.md

File metadata and controls

87 lines (56 loc) · 2.43 KB

Semantic-Aware Adversarial Training for Reliable Deep Hashing Retrieval

This is the PyTorch code of the SAAT paper, which has been accepted by IEEE TIFS.

Requirements

The code has been tested on PyTorch 1.10. To install the dependencies, run

pip install -r requirements.txt

Usage

Training Deep Hashing Models

For example, training a deep hashing model with 32 code length on the NUS-WIDE dataset.

python hashing.py --train --bit 32 --dataset NUS-WIDE

After training, the well-trained models will be saved to checkpoint folder. We can evaluate its retrieval performance through MAP metric.

python hashing.py --test --bit 32 --dataset NUS-WIDE

Adversarial Attack

The following code performs adversarial attack against the well-trained model.

  • attack_method: name of adversarial attack algorithm, e.g., mainstay (our proposed mainstay codes-based semantic-aware attack).
python attack.py --bit 32 --dataset NUS-WIDE --attack_method mainstay

Adversarial Training

The following code performs adversarial training for the pre-trained model to alleviate the effects caused by adversarial perturbations.

  • adv_method: name of adversarial training algorithm, e.g., saat (the proposed semantic-aware adversarial training).
python defense.py --bit 32 --dataset NUS-WIDE --adv_method saat

Then, we again verify the robustness of the model trained with adversarial training.

  • adv: load model after adversarial training.
  • attack_method: name of adversarial attack algorithm.
  • adv_method: name of adversarial training algorithm.
python attack.py --bit 32 --dataset NUS-WIDE --attack_method mainstay --adv --adv_method saat 

Results

Comparison with other attack algorithms

adversarial attck

Precision-Recall curves

pr curves

Comparison with other adversarial training methods

adversarial training

Cite

If you find this work is useful, please cite the following:

@ARTICLE{10189878,
  author={Yuan, Xu and Zhang, Zheng and Wang, Xunguang and Wu, Lin},
  journal={IEEE Transactions on Information Forensics and Security}, 
  title={Semantic-Aware Adversarial Training for Reliable Deep Hashing Retrieval}, 
  year={2023},
  volume={18},
  number={},
  pages={4681-4694},
  doi={10.1109/TIFS.2023.3297791}}