Convert float image array to int in pil via Image.fromarray

Hi Nik,

FIRSTLY, thank you VERY much for your advice and help.
I do follow what you are saying, but for some reason, I still get the same error.

I added the transforms as you suggested, passed it to imageloader class, and then I do something like this in __getitem__:

def __getitem__(self, index):
    imgs, labels = self.train_data[index], self.train_labels[index]
        
    img_ar = []
    for i in range(len(imgs)):
        print(imgs[i].numpy().shape) #output: (3, 256, 256)
        img = Image.fromarray(imgs[i].permute(1, 2, 0).numpy())
        img = self.train_data_transforms(img)
        ..<do more stuff>
    return img_ar, labels

But I get:

    raise TypeError("Cannot handle this data type: %s, %s" % typekey)

TypeError: Cannot handle this data type: (1, 1, 3), <f4

Shouldnt it be (256,256,3)? :frowning: