Self-Attention Context Network for Hyperspectral Image Classification

January 10, 2022 ยท View on GitHub

PyTorch implementation of SACNet for adversarial attacks and defenses in hyperspectral image classification.

Installation

git clone https://github.com/YonghaoXu/SACNet

Dataset

Usage

  • Data Preparation:

    • python GenSample.py --train_samples 300

    The default training set is generated by randomly selecting 300 samples from each category.

    You can change parameter --train_samples to check the performance in other training scenarios.

  • Performance on the Clean Test Set:

    To conduct HSI classification on the original clean test set without adversarial attack, simply run:

    • CUDA_VISIBLE_DEVICES=0 python Test_Clean.py --model SACNet

    You can also change parameter --model to check the performance with other models (e.g., --model SSFCN)

  • Adversarial Attack with the FGSM:

    • CUDA_VISIBLE_DEVICES=0 python Attack_FGSM.py --model SACNet
  • Adversarial Examples Visualization:

    • CUDA_VISIBLE_DEVICES=0 python GenAdvExample.py --model SACNet

Paper

Self-Attention Context Network: Addressing the Threat of Adversarial Attacks for Hyperspectral Image Classification

Please cite our paper if you find it useful for your research.

@article{sacnet,
  title={Self-Attention Context Network: Addressing the Threat of Adversarial Attacks for Hyperspectral Image Classification}, 
  author={Xu, Yonghao and Du, Bo and Zhang, Liangpei},
  journal={IEEE Trans. Image Process.}, 
  volume={30},
  pages={8671--8685},
  year={2021},
  doi={10.1109/TIP.2021.3118977}}
}

Acknowledgment

This code is partly borrowed from PyTorch-Encoding