VITA-Group / AGD

[ICML2020] "AutoGAN-Distiller: Searching to Compress Generative Adversarial Networks" by Yonggan Fu, Wuyang Chen, Haotao Wang, Haoran Li, Yingyan Lin, Zhangyang Wang
MIT License
104 stars 19 forks source link

How to visualize the learned cell? #4

Closed yiyunchen closed 4 years ago

yiyunchen commented 4 years ago

Hello, would you mind tell me how to visualize the learned cell?

I see the related code "from utils.darts_utils import create_exp_dir, save, plot_op, plot_path_width, objective_acc_lat"? or how can I get the seach results?

Thank you !

tilmto commented 4 years ago

Hi, you can use the following script to visualize the searched architecture stored at ckpt/search-xxx/arch.pt with:

python print_arch.py ckpt/search-xxx/arch.pt

The code in print_arch.py:

# print_arch.py

import torch
import sys

model = torch.load(sys.argv[1])
alpha= model['alpha']
ratio = model['ratio']

print(alpha.argmax(-1)) # layerwise operator index, see genotypes.py for their corresponding operator
print(ratio.argmax(-1)) # layerwise width index, see C.width_mult_list in config_search.py
yiyunchen commented 4 years ago

Thank you!