python_for_microscopists icon indicating copy to clipboard operation
python_for_microscopists copied to clipboard

Need help with RGB images

Open coder3210 opened this issue 4 years ago • 1 comments

Hello, I need help with reading RGB images for Multiclass segmentation in Unet. I tried using the code you provided in video lesson 208 but I don't know what I'm doing wrong. I was able to read images in RGB but I can't seem to predict the results. This is the error that I got

"ValueError: Input 0 of layer conv2d_19 is incompatible with the layer: expected axis -1 of input shape to have value 3 but received input with shape [None, 128, 128, 1]"

test_img_norm=test_img[ : , : , 0 ] [ : , : , None]

Can you please explain what this line above does and how can I get it to read an RGB image for prediction.

coder3210 avatar May 04 '21 16:05 coder3210

The model takes 3 channels as input and I believe your input consists of a single channel. Try to verify the dimensions. If the model takes an input of the form, (w, h, c), then your input should have the form (n, w, h, 3) where n is the number of images.

nitin-bommi avatar Aug 13 '21 06:08 nitin-bommi