nupurkmr9 / vision-aided-gan

Ensembling Off-the-shelf Models for GAN Training (CVPR 2022 Oral)
https://www.cs.cmu.edu/~vision-aided-gan/
MIT License
379 stars 26 forks source link

the worst sample visualization #4

Closed 49xxy closed 2 years ago

49xxy commented 2 years ago

Thank you for your excellent work. I am wondering if you could share the code for the worst sample visualization.

Looking forward to your reply!

nupurkmr9 commented 2 years ago

Hi, The current code includes worst sample visualization for stylegan2 trained models. An example command will be:

python calc_metrics.py --metrics sort_likelihood --name afhq_dog --split custom --network https://www.cs.cmu.edu/~vision-aided-gan/models/main_paper_table3_afhq/vision-aided-gan-afhqdog-ada-3.pkl --data afhq_dog

where --name and --split=custom (by default) flag values are the ones used to create reference dataset statistics using clean-fid library. An example command for the same is:

from cleanfid import fid
fid.make_custom_stats( name, dataset_path, mode="clean")

The above command should be run before calling calc_metrics.py.

Thanks.

49xxy commented 2 years ago

Thank you very much for your guidance, but I have the following problems at present: image

My command is: !python calc_metrics.py --metrics sort_likelihood --name face --split custom --network "/content/drive/MyDrive/stylegan2-ada-pytorch-main/models/network-snapshot-001700.pkl" --data /content/drive/MyDrive/stylegan2-ada-pytorch-main/datasets/pv-face7k.zip

I also got two npz files from clean-FID saving custom FID stats to /content/drive/MyDrive/stylegan2-ada-pytorch-main/cleanfid/stats/face_clean_custom_na.npz

Sincerely hope to get your help!

nupurkmr9 commented 2 years ago

It looks like args.run_dir might be None while running calc_metrics.py. By default it is the folder with training_options.json file (the folder created during training stylegan2 model).

I have updated the code to set args.run_dir to out (in case its None) inside stylegan2 folder so should work now.

Thanks.

49xxy commented 2 years ago

Thanks again for your help, I made it! Best wishes to you!