Update ilsvrc_2012_mean.mat to W x H x C, update demo and add comments #2527
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses #2505 (comment)
In MatCaffe, there are currently two (conflicting) ways to load mean:
image_meanvariable in height x width x 3, BGR channels. This is inconsistent with the way caffe stores data (WxHxCxN in Matlab).caffe.io.read_mean('./data/ilsvrc12/imagenet_mean.binaryproto'), which is also inherited from old wrapper, returnsmean_datain width x height x 3 (also BGR channels), which is consistent with the way a caffe's blob stores data.The inconsistency in ilsvrc_2012_mean.mat is very likely to confuse users when doing mean subtraction. Although this issue also existed in the old Matlab wrapper, it should be addressed somehow.
So this PR permute height and width in caffe/matlab/+caffe/imagenet/ilsvrc_2012_mean.mat, use a new variable name
mean_datainstead ofimage_meanin that file, and update classification_demo.m. Also, some comments are added in classification_demo.m and io.m (and also handle grayscale images).