April 2020
Intermediate to advanced
438 pages
12h 2m
English
Execute the following steps to complete the missing parts of an image:
def tensor2image(src): out = src.copy() * 255 out = out.transpose((1, 2, 0)).astype(np.uint8) out = cv2.cvtColor(out, cv2.COLOR_RGB2BGR) return outdef image2tensor(src): out = src.copy() out = cv2.cvtColor(out, cv2.COLOR_BGR2RGB) out = out.transpose((2,0,1)).astype(np.float64) / 255 return out
image_path = 'images/zebra.png'mask_path = 'images/inpaint_mask.png'model_path = 'models/completionnet_places2.t7' ...
Read now
Unlock full access