This repository implements the WGAN Domain Adaptation
model for single source and target in pytorch framework
The overall model architecture is as shown in the figure:
The code in this repository implements the following features:
- Discriminative domain adaptation (Gradient Reversal Layer)
- Adversarial Domain Adapatation
- WGAN loss + Lipschtiz penalty "On Regularization of WGANs"
- Adversairal Example Agumentation
- CLAHE: Contrast based augmentations
- WGAN Regularization
- Learning Rate Scheduler
- Contour Detection ( OpenCV)
- Ellipsoidal Fitting
- Area Computation
- Python 3.6
- Pytorch v0.4 (needs manual installation from source https://github.com/pytorch/pytorch)
- torchtext
- numpy
One can install the above packages using the requirements file.
pip install -r requirements.txt
python datasets/create_dataset.py -o output_folder
python train_gen.py --epochs 100 --batch-size 4 --lr 1e-3
python train_adv.py --epochs 100 --resume 'pretrained_model' --batch-size 4 --lr 1e-4 --gamma
python train_adv_wgan.py --epochs 100 --resume 'pretrained_model' --batch-size 4 --lr 1e-4 --gamma
Dataset Statistics included in data
directory are:
Dataset | Train Set | Dev Set | Test Set |
---|---|---|---|
REFUGE | 300 | 50 | 50 |
DRISHTI | 50 | 25 | 25 |
ORIGA | 650 | 50 | 50 |
All the experiments were performed on a modern GE-Force 1080
Metrics
- IOU for Cup and Disc
- CDR -> Cup to Disc Ratio
- AUROC Plot for Glaucoma and Non Glaucoma Detection
- Some parts of the code were borrowed from Deeplab V3+ Repo, AdaptSegNet Repo