GilLevi / AgeGenderDeepLearning

628 stars 284 forks source link

order of mean #30

Closed photoszzt closed 5 years ago

photoszzt commented 5 years ago

What's the order of the mean.binaryblob? Is the order RGB or BGR? The confusion is from these lines in the demo code: The image is read by

caffe.io.load_image(example_image)

The resulting matrix is in RGB order with value ranges from 0 to 1.

In the caffe net definition:

gender_net = caffe.Classifier(gender_net_model_file, gender_net_pretrained,
                       mean=mean,
                       channel_swap=(2,1,0),
                       raw_scale=255,
                       image_dims=(256, 256))

It requests to swap the channel which gives BGR order. I think the mean usually is in RGB order so I want to make sure what's the order the mean.binaryblob is given.

The raw_scale=255 is also strange since the input matrix is in 0~1. If I miss anything above, please correct me.

photoszzt commented 5 years ago

I think I misunderstand the raw_scale api. You do need to scale in this case. But still wondering about the order of mean. It's not specify anywhere.

photoszzt commented 5 years ago

I think I figure out. The mean file is in BGR order.