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

Function generagedImage

pix2pix/mainWindows.py:125–149  ·  view source on GitHub ↗

:param model: :return:

(model)

Source from the content-addressed store, hash-verified

123 return True
124
125def generagedImage(model):
126 """
127 :param model:
128 :return:
129 """
130 inputImg = np.array(Image.open(imagePath["filename"]))
131 # 图片由两张图片拼接的大小为1200 x 1200大小,
132 input_image = inputImg[:, :600, :]
133 target_image = inputImg[:, 600:, :]
134
135 # 图像增强
136 augmentations = config.both_transform(
137 image=input_image,
138 image0=target_image
139 )
140 input_image, target_image = augmentations["image"], augmentations["image0"]
141
142 input_image = config.transform_only_input(image=input_image)["image"]
143 target_image = config.transform_only_mask(image=target_image)["image"]
144
145 img_transform = torch.unsqueeze(input=input_image,dim=0)
146 transformImg = model(img_transform)
147 save_image(transformImg * 0.5 + 0.5,f"cur.png")
148 print('cur.type: {}'.format(type(transformImg)))
149 save_image(target_image * 0.5 + 0.5, f"label.png")
150
151tkImage0 = ''
152tkImage4 = ''

Callers 1

loadModelFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected