Value error when testing with image
Hi,
I am getting the following error, when I try predicting with an image:
ValueError: Value::Create: The shape '[4 x 32 x 32]' of sequence #0 is not compatible with the sample shape '[3 x 32 x 32]'.
Are you sending in 4-channel images instead of 3-channel images?
I am not sure...what is the difference between an 4 channel image and 3 channel image, should I convert the images to 3 channel..
Some images are RGB (3 channel), some are RGBA (4 channel). You need to get rid of the 4th channel before sending it into eval.
Thanks! Do you have sample code?...
How do you feed your data? Via Numpy? Just slice the numpy array.
I am using the following statement myimg = np.array(PIL.Image.open(urlopen(url)), dtype=np.float32) this is the first I am working with python, could you give a suggestion as to how to slice the myimg array, thanks!
Then I suggest you check this example: https://github.com/Microsoft/CNTK/blob/master/Examples/Image/FeatureExtraction/FeatureExtraction.py This manual might also be helpful: https://github.com/Microsoft/CNTK/blob/master/Manual/Manual_How_to_feed_data.ipynb
BTW, PIL.Image.convert can do the conversion to RGB mode. You may still need to convert to BGR before sending into CNTK for eval.
Thank you so much! Should I also convert the images that I use for training to RGB mode and BGR?
Whatever format your input training data format was, you need to replicate the same format for testing/evaluating.
Hope this has been resolved. Close due to inactivity.