示例#1
0
 def postprocess(self, corrupted, masks, generated):
     corrupted = corrupted * 0.5 + 0.5
     generated = generated * 0.5 + 0.5
     corrupted = corrupted.permute(0, 3, 2, 1).cpu().numpy()
     processed = generated.permute(0, 3, 2, 1).cpu().detach().numpy()
     masks = np.transpose(masks, axes=(0, 3, 2, 1))
     for i in range(len(processed)):
         processed[i] = blending.blend(corrupted[i], processed[i],
                                       1 - masks[i])
     processed = torch.tensor(processed).permute(0, 3, 2, 1)
     return (processed * 2.0 - 1.0).cuda()
示例#2
0
 def poissonblending(img1, img2, mask):
     """Helper: interface to external poisson blending"""
     return blending.blend(img1, img2, 1 - mask)
 def poissonblending(img1, img2, mask):
     """Helper: interface to external poisson blending"""
     return blending.blend(img1, img2, 1 - mask)