算法流程:
1.载入预训练style GAN2生成器网络,载入目标图像;
# Load networks. print('Loading networks from "%s"...' % network_pkl) device = torch.device('cuda') with dnnlib.util.open_url(network_pkl) as fp: G = legacy.load_network_pkl(fp)['G_ema'].requires_grad_(False).to(device) # type: ignore # Load target image. target_pil = PIL.Image.open(target_fname).convert('