Hey guys,
I was implement a GAN network from online (followed by this github: https://github.com/AaronLeong/BigGAN-pytorch 3).
The test file is missing so I wrote it by myself.  The code ran successfully but the result didn’t show that the image is generated from learnt weights, but looks like generating from initial random noise. The code is as follows
model = Generator(z_dim,n_class,chn)
checkpoint = torch.load('./model/faces/241280_G.pth', map_location = str(device))
model.load_state_dict(checkpoint,strict=False)
model.to(device)
model.float()
model.eval()

def label_sampel():
    label = torch.LongTensor(batch_size, 1).random_()%n_class
    one_hot= torch.zeros(batch_size, n_class).scatter_(1, label, 1)
    print(device)
    return label.squeeze(1).to(device), one_hot.to(device)       

z = torch.randn(batch_size, z_dim).to(device)
z_class, z_class_one_hot = label_sampel()
fake_images = model(z, z_class_one_hot)
save_image(denorm(fake_images.data), os.path.join(path, '1_generated.png'))

These are face image samples that generated during training phase.

42900_fake.jpg1042×522 263 KB

This one is the image that I tried generate from trained generator via loading generator’s weights file.

Can some one help with it?
Thanks in advance.