numpy.empty() data type not understood error on Google colab

Thanks to @user2357112 @Rika and @hpaulj ‘s great helps, I found the cause of the problem and here is solution for those who is struggling the same issue:

msk1 = msk1.numpy()

But then (probably) you will get ValueError: Floating point image RGB values must be in the 0..1 range. exception. You have to normalize your array. Thanks to him

def normalize(x):
    """
    Normalize a list of sample image data in the range of 0 to 1
    : x: List of image data.  The image shape is (32, 32, 3)
    : return: Numpy array of normalized data
    """
    return np.array((x - np.min(x)) / (np.max(x) - np.min(x)))

msk1 = normalize(msk1.numpy())

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top