mean file is BGR or RGB?

1,585 views
Skip to first unread message

ngc...@gmail.com

unread,
Aug 5, 2015, 11:33:47 PM8/5/15
to Caffe Users
I am trying to determine whether ilsvrc_2012_mean.npy (and imagenet_mean.binaryproto) is in BGR or RGB. From the data loaded, the means for channels 0, 1 and 2 are 104,116.7 and 122.7 respectively, but i am unsure their order.
From the notebok tutorial on image recognition, the net is set so that the channels are swapped from RGB to BGR. The cat is RGB, the net swaps it to BGR and then subtracts the mean with  ilsvrc_2012_mean.npy. So  ilsvrc_2012_mean.npy must be BGR if  I understand pycaffe.py correctly (the preprocessing swaps the channels then subtract the means).
Now ilsvrc_2012_mean.npy  was generated using compute_image_mean.cpp which takes the input a leveldb file generated by convert_imageset.cpp. So this implies that  at some stage one of these tools swapped RGB to BGR. I am guessing convert_imageset.cpp does that.
 
Please correct me if I made any mistakes above as I have only superficial knowledge of Caffe's internals. Thanks.

Ronghang Hu

unread,
Aug 6, 2015, 2:29:13 AM8/6/15
to Caffe Users
It is BGR.

Ronghang Hu

unread,
Aug 6, 2015, 2:30:58 AM8/6/15
to Caffe Users
compute_image_mean.cpp relies on OpenCV, which uses BGR as default channels.


On Wednesday, August 5, 2015 at 8:33:47 PM UTC-7, ngc...@gmail.com wrote:

ngc...@gmail.com

unread,
Aug 6, 2015, 10:09:34 PM8/6/15
to Caffe Users
Thanks for the info.
Message has been deleted

ashenafi menza

unread,
May 4, 2016, 6:09:07 AM5/4/16
to Caffe Users
Hi,

I am sorry for jumping into this :)
I am new to caffe and have just finished installing it. I wanted to do classification with caffe. My data set images are divided into 10 categories, each category has 100 train images (train folder, a total of 1000), 20 test pictures (Val folder, a total of 200). I followed all the steps to train my model and I finished successfully with final accuracy rate 48.8%. when i try to classify a random input image with the python file,i received the following error. I know it is stupid question but i need help :)
Screenshot from 2016-05-04 11:03:52.png
Screenshot from 2016-05-04 11:04:18.png
prova.py
Reply all
Reply to author
Forward
0 new messages