Open pxEkin opened 5 years ago
you need to denormalize the image. Check solver.denorm()
Disable this line.
model = model.eval()
It works for me.
Have you resolved the issue @ToBigboss by using these two methods given by @rex-yue-wu and @raikuma ? I tested the solver.denorm with the line 'model.eval()' commented but result didn't improve.
Disable this line.
model = model.eval()
It works for me.
Hi! What about your generated image quality?I got very ugly outputs when i loaded pretrained model 200000-G
Has someone investigated this .eval() issue. Is it an issue with the InstanceNorm2D layer?
code is: model = Generator() model = model.cuda() model.load_state_dict(torch.load("./stargan_celeba_256/models/200000-G.ckpt")) model = model.eval()
pilImg = Image.open("256x256.jpg") npImg = np.array(pilImg) example_img = torch.from_numpy(npImg).float().unsqueeze(0) print(example_img.shape) example_img = example_img.permute(0, 3, 1, 2) print(example_img.shape) print("======RGB data [0, 255]======") print(example_img) example_img = example_img.div(255) example_img = example_img.sub(0.5) example_img = example_img.div(0.5) example_img = example_img.cuda()
example_c = torch.cuda.FloatTensor([[0,0,1,0,0]])
imgGen = model(example_img, example_c) save_image(imgGen, "./%s.png" % 100, normalize=True)
result is: