Skip to content

[AAAI 2023] Official repository of "Progressive Few-Shot Adaptation of Generative Model with Align-Free Spatial Correlation"

Notifications You must be signed in to change notification settings

arith3/Progressive-Few-Shot-GAN-Adaptation

Repository files navigation

[AAAI '23] Progressive Few-Shot Adaptation of Generative Model with Align-Free Spatial Correlation

Official PyTorch implementation of ASC adaptation.

Overall framework

Note: The base model is taken from Few-shot-gan-adaptation

  • Linux
  • NVIDIA GPU + CUDA CuDNN 10.2
  • PyTorch 1.7.0
  • Python 3.6.9
  • Install all the libraries through pip install -r requirements.txt

Training

Pretrained Source domain model

  • FFHQ Note: Please download it into your training path.

Dataset for training

10 shot

5 shot

Note: Please download it into your training <root/raw_data> path.

python prepare_data.py --out ./processed_data/<dataset_name> --size 256 ./raw_data/<dataset_name>
CUDA_VISIBLE_DEVICES=0 python train.py --ckpt_source /path/to/source_model --data_path /path/to/target_data --exp <exp_name> \
    --use_ema --use_rel_ema --k 1.0 --extra_ema \
    --use_flow --winsize_inc 1.0002 --winsize 16 --cutoff 0.6 \
    --use_pred --pred_noiseW 2.0 --use_flow_pred --blur 7 \
    --LFC --m 2 --LFCw 0.5 --extra_step 0

Evaluating

Dataset for FID evaluating

# if there is a large dataset of the target, use --test_imgs for FID evaluation
# if not, please remove this option. 
CUDA_VISIBLE_DEVICES=0 python evals.py --ckpt_source /path/to/source_model --model_ckpt /path/to/target_model \
    --out /path/to/out --train_imgs /path/to/processed_data/domain --source_key <domain_key> \
    --batch 64 --n_sample <test_sample_count> --seed <number> --test_imgs /path/raw_data/domain/images/

Dataset for Reconstruction evaluating

Note: To evaluate identity, please training source to target first, then try to re-train it to FFHQ again with this following ffhq-10s images:

After finish the reconstruction (source -> target -> source), evaluate it as this following step:

# if there is a large dataset of the target, use --test_imgs for FID evaluation
# if not, please remove this option. 
CUDA_VISIBLE_DEVICES=0 python evals.py --ckpt_source /path/to/source_model --model_ckpt /path/to/target_model \
    --out /path/to/out --train_imgs /path/to/processed_data/domain --source_key <domain_key> \
    --batch 64 --n_sample <test_sample_count> --seed <number> --test_imgs /path/raw_data/domain/images/
    
CUDA_VISIBLE_DEVICES=0 python recon_evals.py --source_ckpt /path/to/source_model --model_ckpt /path/to/target_model \
   --out /path/to/out --source_key <domain_key> \
   --batch 4 --n_sample <test_sample_count> --seed <number>

About

[AAAI 2023] Official repository of "Progressive Few-Shot Adaptation of Generative Model with Align-Free Spatial Correlation"

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages