This is a follow-up question from this. Basically what I want to do is to simply subtract each image from the mean.
Based on this issue on GitHub and this other similar question, and also this classification example When we feed the cropped version of images to the network, we need to subtract the mean pixel using something like this:
mu = mean_file.mean(1).mean(1)
but the irony is when I want to do this:
.. = (img[:,0:224,0:224] - mu)
I get ValueError: operands could not be broadcast together with shapes (3,224,224) (3,)
. I'm not well-versed at Python and Numpy and can't figure out what the error message is trying to convey.
Currently, I'm cropping the mean file, which is not ideal, but is better than nothing.
.. = (img[:,0:224,0:224] - mean_image[:,0:224,0:224])