This repository contains the code for evaluating adversarial attack and defense methods on SAR and optical images.
├── models/ # Implement models
├── attacks/ # Implement attack methods using advertorch
├── defenses/ # Implement defense methods
├── datasets/ # Implement the dataset class
├── config/ # Define configurations
├── train_config.py # Set configs for train.py
├── attack_config.py # Set configs for attack.py
├── checkpoints/ # Store checkpoints generated by train.py
├── attack_outputs/ # Save the results of attack.py
├── train.py # Train a model
└── attack.py # Attack a model
step1: get your dataset ready and implement the class under the folder datasets/
step2: revise the code in config/train_config.py
step3: run the script train.py.
You could simply run:
python train.py train
If you'd like to change the params when you run the script, you could try:
python train.py train --epochs=300
This works because we used the library fire.
step1: make sure you have trained a model and saved the checkpoints
step2: revise the code in config/attack_config.py
step3: run the script attack.py.
You could simply run:
python attack.py attack
If you'd like to change the params when you run the script, you could try:
python attack.py attack --defenses="['jpeg-filter']" --attack_name='mim'