hello, i have a question about function tensor2im in util.py
why does image_numpy need to add one, then divide two,finally multipy 255. Thanks a lot
def tensor2im(image_tensor, imtype=np.uint8): image_numpy = image_tensor[0].cpu().float().numpy() image_numpy = (np.transpose(image_numpy, (1, 2, 0)) + 1) / 2.0 * 255.0 image_numpy = np.maximum(image_numpy, 0) image_numpy = np.minimum(image_numpy, 255) return image_numpy.astype(imtype)
hello, i have a question about function tensor2im in util.py why does image_numpy need to add one, then divide two,finally multipy 255. Thanks a lot
def tensor2im(image_tensor, imtype=np.uint8): image_numpy = image_tensor[0].cpu().float().numpy() image_numpy = (np.transpose(image_numpy, (1, 2, 0)) + 1) / 2.0 * 255.0 image_numpy = np.maximum(image_numpy, 0) image_numpy = np.minimum(image_numpy, 255) return image_numpy.astype(imtype)