The images were single channeled images, it required me to stack the images 3 times vertically to create an artificial 3-channel image.
I checked online for understanding this error and then proceeded to convert the data type to uint8 and multiply each pixel by 255, even though my data was not normalized. After doing so, I ran the learn.predict() function and it worked:
Wouldn’t converting them as RGB show unexpected behavior? As they are not necessarily RGB and are grayscale pixel values. Wouldn’t the image undergo changes ? Also, what do you imply by fname='...'? Should I replace the ... with my file name ?
I should’ve been more specific. As the error message shows, fastai requires the inputs to be of those specific types listed. On looking at the source, I see that PILImage.create is already doing Image.open(fname).convert('RGB') behind the scenes.
Technically, yes, but it’s not an issue. It’s still displaying the exact same information, and you can expect a well trained network to perform alright on it.
On a related note, if you’re seeing such data post training, it’s a good idea to include such one-channeled images in your training data as well, so the model has already trained on some images that were converted from 1 -> 3 channels