Mean image subtraction result in negative values? Correct?

375 views
Skip to first unread message

Julian Kolarz

unread,
Dec 17, 2016, 5:19:10 PM12/17/16
to Caffe Users

Hi all,
i have a question regarding the preprocessing step "Image mean subtraction". I use the UCSD Dataset for my training http://www.svcl.ucsd.edu/projects/peoplecnt/
So one popular preprocessing step is the mean subtraction. Now i wonder if i am doing it right.
What i am doing is the following:

1. I have 200 gray scaled Train images
2. I put all images in a list and compute the mean with numpy: np.mean(ImageList, axis=0)
    This returns me a mean image
3. Now i subtract the mean image from all Train images

When i now visualize my preprocessed train images they are mostly black and have also negative values in it.
Is this correct? Or is my understanding of subtracting the mean image incorrect?

Here is one of my training images (before preprocessing), my mean image and the train image - image_mean:

Przemek D

unread,
Dec 19, 2016, 2:31:13 AM12/19/16
to Caffe Users
Yes it is correct, some of the pixels will end up negative. Consider trying out DIGITS: its extensive visualization functionality will let you analyze pixel value distributions for each blob of the network - you would find that indeed after subtracting the mean image, your data will be distributed closer to zero, with values spanning both towards the negative and positive direction.
Reply all
Reply to author
Forward
0 new messages