Skip to content
/ CG-GAN Public

This is the code for the paper "A Novel Confidence Guided Training Method for Conditional GANs with Auxiliary Classifier".

Notifications You must be signed in to change notification settings

cs911/CG-GAN

Repository files navigation

This is the code for the paper "A Novel Confidence Guided Training Method for Conditional GANs with Auxiliary Classifier". The code is modified from StudioGAN.

Requirements

First, install PyTorch meeting your environment (at least 1.7, recommmended 1.10):

pip3 install torch==1.10.0+cu111 torchvision==0.11.1+cu111 torchaudio==0.10.0+cu111 -f https://download.pytorch.org/whl/cu111/torch_stable.html

Then, use the following command to install the rest of the libraries:

pip3 install tqdm ninja h5py kornia matplotlib pandas scikit-learn scipy seaborn wandb PyYaml click requests pyspng imageio-ffmpeg

For installing all the requirements use the following command:

conda env create -f environment.yml -n base

Before starting, users should login wandb using their personal API key.

wandb login PERSONAL_API_KEY

Dataset

data
└── ImageNet, Tiny_ImageNet, Baby ImageNet, Papa ImageNet, or Grandpa ImageNet
    ├── train
    │   ├── cls0
    │   │   ├── train0.png
    │   │   ├── train1.png
    │   │   └── ...
    │   ├── cls1
    │   └── ...
    └── valid
        ├── cls0
        │   ├── valid0.png
        │   ├── valid1.png
        │   └── ...
        ├── cls1
        └── ...

When training and evaluating, we used the command below.

"nkl" in "ACGAN-Mod-Big-nkl.yaml" denotes our method rCG-GAN

"lab" in "ACGAN-Mod-Big-lab.yaml" denotes our method fCG-GAN

--------For CIFAR10/CIFAR100:

CUDA_VISIBLE_DEVICES=1   python3 code/main.py -t -hdf5 -l -batch_stat  -metrics is fid prdc -ref "test" -cfg ./code/configs/CIFAR100/ACGAN-Mod-Big-nkl.yaml -data cifar100 -save save 

--------For Baby/Papa/Grandpa-ImageNet and Tiny-ImageNet:

CUDA_VISIBLE_DEVICES=1  python3 code/main.py -t -hdf5 -l -batch_stat  -metrics is fid prdc -ref "valid" -cfg ./code/configs/Papa_ImageNet/ACGAN-Mod-Big-nkl.yaml -data Papa_ImageNet -save save 

--------For ImageNet

CUDA_VISIBLE_DEVICES=1  python3 code/main.py -t -hdf5 -l -sync_bn   -metrics is fid prdc -ref "valid" -cfg ./code/configs/ImageNet/ACGAN-Mod-Big-nkl.yaml -std_stat -std_max 256 -std_step 256 -mpc -data ImageNet -save save 

About

This is the code for the paper "A Novel Confidence Guided Training Method for Conditional GANs with Auxiliary Classifier".

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published