Awesome
SAMix -- Spectral Adversarial MixUp for Few-Shot UDA
This repository includes open-source codes, detailed experimental results and full references of our MICCAI 2023 paper Spectral Adversarial MixUp for Few-Shot Unsupervised Domain Adaptation.
Overview
<p align='center'><img src="image/overview.png" width=90% height=90% /></p>The figure above summarizes our algorithm comparisons framework, Spectral Adversarial MixUp.
- Our method first computes DoDiSS map, which is a variant of our AAAI-23 paper.
- Then, we run SAMix to generate the augmented data and train the model with the ERM loss, normal UDA loss and the Jenssen-Shannon divergence regularization.
Prerequisites
- Python 3.8
- PyTorch 1.8.1+
- A computing device with GPU
Getting started
Installation
- (Not necessary) Install Anaconda3
- Install CUDA 11.0+
- Install PyTorch 1.12.1+
Noted that our code is tested based on PyTorch 1.12.1
Dataset & Preparation
The two medical image datasets used in our work are publicly available.
The Fundus datasets include the REFUGE and the RIM. We follow the DoFE to preprocess the datasets.
The Camelyon dataset is a subset from the WILDS. This dataset is already preprocessed by the challenge.
Measure the sensitivity map of an ERM model
Train and evaluate an ERM model by
python ./AAAIcodeSubmissoin__model_sensitivity_map/train_ERM.py
The model will be saved in ./AAAIcodeSubmissoin__model_sensitivity_map/save_dir
.
Measure the DoDiSS map of an ERM model by
python ./AAAIcodeSubmissoin__model_sensitivity_map/model_sensitivity_map.py
Train model with Spectral Adversarial Data Mixup (SAMix)
Train and evaluate the models with SADA by
python ./AAAIcodeSubmissoin__SADA/train_SADA.py
The key SAMix data augmentation module is in
./AAAIcodeSubmissoin__SADA/sada.py
Augmentation settings for all datasets:
--epsilon
iteration of the checkpoint to load. #Default: 0.2--step_size
step size of the adversarial attack on the amplitude spectrum. #Default: 0.08--num_steps
batch size of the attack steps. #Default: 5--tau
settings for the early stop acceleration. #Default: 1--random_init
if or not initializing amplitude spertrums with random perturbations. #Default: True--randominit_type
type of random init type. #Default: 'normal'--criterion
loss functions to attack. #Default: 'ce', choices=['ce', 'kl']--direction
neg: standard attack || pos:inverse attack. #Default: neg, choices=['pos','neg']
Citation
Please cite these papers in your publications if it helps your research:
@article{zhang2022spectral,
title={Spectral Adversarial MixUp for Few-Shot Unsupervised Domain Adaptation},
author={Zhang, Jiajin and Chao, Hanqing and Dhurandhar, Amit and Chen, Pin-Yu and Tajer, Ali and Xu, Yangyang and Yan, Pingkun},
journal={https://arxiv.org/abs/2309.01207},
year={2023}
}
Acknowledgement
We would like to thank the authors we cited in our paper for sharing their codes.