Hi, I meet some problems when trying to understand the vgg_proprocess function that you provide.

def vgg_preprocess(x):

x = x - vgg_mean

return x[:,::-1] # reverse axis rgb->bgr

if theano store images in (channel, row, col), why this function reverse the second dimention to reverse axis rgb->bgr. And after I changed it to return x[::-1,:,:], the vgg_net does work very well. I was trying to understand this by thinking maybe the first dimmension describes the batch imformation, but in this case it will be four dimensions in total. is it possible to subtract vgg_mean in that case, which I think only has three dimensions.

vgg_mean = np.array([123.68, 116.779, 103.939], dtype=np.float32).reshape((3,1,1))

Thanks a lot for your help. It realy confused me.

Hi @charles

I believe I had a similar question. Check it out Why reshape(3,224,224) in vgg16.py? and @Gelu74’s response.

Hope it helps

Thanks a lot. That’s really helps!