MCPcopy Create free account
hub / github.com/KeepTryingTo/Pytorch-GAN / plot_examples

Function plot_examples

SRGAN/utils.py:59–72  ·  view source on GitHub ↗
(low_res_folder, gen)

Source from the content-addressed store, hash-verified

57
58
59def plot_examples(low_res_folder, gen):
60 files = os.listdir(low_res_folder)
61
62 gen.eval()
63 for file in files:
64 image = Image.open("test_images/" + file)
65 with torch.no_grad():
66 upscaled_img = gen(
67 config.test_transform(image=np.asarray(image))["image"]
68 .unsqueeze(0)
69 .to(config.DEVICE)
70 )
71 save_image(upscaled_img * 0.5 + 0.5, f"save/{file}")
72 gen.train()

Callers 1

train_fnFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected