generation/util/util.py [42:60]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    if isinstance(image_tensor, list):
        image_numpy = []
        for i in range(len(image_tensor)):
            image_numpy.append(tensor2im(image_tensor[i], imtype, normalize))
        return image_numpy
    image_numpy = image_tensor.cpu().float().numpy()
    if normalize:
        # print(np.max(np.transpose(image_numpy, (1, 2, 0))[:,:,0]), np.max(np.transpose(image_numpy, (1, 2, 0))[:,:,1]), np.max(np.transpose(image_numpy, (1, 2, 0))[:,:,2]))
        image_numpy = (np.transpose(image_numpy, (1, 2, 0)) + 1) / 2.0 * 255.0
    else:
        # print('without normalize', np.max(np.transpose(image_numpy, (1, 2, 0))[:,:,0]), np.max(np.transpose(image_numpy, (1, 2, 0))[:,:,1]), np.max(np.transpose(image_numpy, (1, 2, 0))[:,:,2]))
        image_numpy = np.transpose(image_numpy, (1, 2, 0)) * 255.0
        # image_numpy = np.transpose(image_numpy, (1, 2, 0))
    image_numpy = np.clip(image_numpy, 0, 255)
    if image_numpy.shape[2] == 1 or image_numpy.shape[2] > 3:
        image_numpy = image_numpy[:,:,0]
    else: # 3-channel color image
        # LAB to RGB
        image_numpy = cv2.cvtColor(image_numpy.astype(np.uint8), cv2.COLOR_LAB2RGB) # our image tensor is float; cvtColor only reads uint8 dtype
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



generation/util/util.py [64:82]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    if isinstance(image_tensor, list):
        image_numpy = []
        for i in range(len(image_tensor)):
            image_numpy.append(tensor2im(image_tensor[i], imtype, normalize))
        return image_numpy
    image_numpy = image_tensor.cpu().float().numpy()
    if normalize:
        # print(np.max(np.transpose(image_numpy, (1, 2, 0))[:,:,0]), np.max(np.transpose(image_numpy, (1, 2, 0))[:,:,1]), np.max(np.transpose(image_numpy, (1, 2, 0))[:,:,2]))
        image_numpy = (np.transpose(image_numpy, (1, 2, 0)) + 1) / 2.0 * 255.0
    else:
        # print('without normalize', np.max(np.transpose(image_numpy, (1, 2, 0))[:,:,0]), np.max(np.transpose(image_numpy, (1, 2, 0))[:,:,1]), np.max(np.transpose(image_numpy, (1, 2, 0))[:,:,2]))
        image_numpy = np.transpose(image_numpy, (1, 2, 0)) * 255.0
        # image_numpy = np.transpose(image_numpy, (1, 2, 0))
    image_numpy = np.clip(image_numpy, 0, 255)
    if image_numpy.shape[2] == 1 or image_numpy.shape[2] > 3:
        image_numpy = image_numpy[:,:,0]
    else: # 3-channel color image
        # LAB to RGB
        image_numpy = cv2.cvtColor(image_numpy.astype(np.uint8), cv2.COLOR_LAB2RGB) # our image tensor is float; cvtColor only reads uint8 dtype
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



