ry / tensorflow-vgg16

conversation of caffe vgg16 model to tensorflow
672 stars 285 forks source link

Image format confirmation #7

Closed markpwoodward closed 8 years ago

markpwoodward commented 8 years ago

First, thank you so much for this library. It is exactly what I was looking for and is working well. I do have a question about inputs.

On the caffe project page (https://gist.github.com/ksimonyan/211839e770f7b538e2d8#file-readme-md), linked in the https://github.com/ry/tensorflow-vgg16/blob/master/README.md it states the following:

The input images should be zero-centered by mean pixel (rather than mean image) subtraction. Namely, the following BGR values should be subtracted: [103.939, 116.779, 123.68].

Which suggests that, for the caffe model, images should be BGR with the specified vector subtracted. This is different from utils.load_image(), which provides RGB images with pixels scaled by 255.0. I just want to confirm that the format we should use is RGB, img /= 255.0, and not BGR, img -= [103.939, 116.779, 123.68] as specified on the caffe project page.

Note: I confirmed that skimage.io.imread() returns an RGB image by creating a blue jpg, loading it, and noting [0,0,255] for all pixels.

Thank you, Mark

markpwoodward commented 8 years ago

Scratch that, I see in vgg16.py the RGB->BGR and img*255-[103.939, 116.779, 123.68]. My apologies. And thank you again!