0

I'm preparing to train in Caffe using data in a hdf5 file. This file also contains the per-pixel mean data/image of the training set. In the file 'train_val.prototxt' for the input data layer in the section 'transform_params' it is possible to use a mean_file to normalize the data, usually in binaryproto format, for example for the ImageNet Caffe tutorial example:

transform_param {
  mirror: true
  crop_size: 227
  mean_file: "data/ilsvrc12/imagenet_mean.binaryproto"
}

For per-channel normalization one can instead use mean_value instead of mean_file.

But is there any way to use mean image data directly from my database (here hdf5) file?

I have extracted the mean from the hdf5 to a numpy file but not sure if that can be used in the prototxt either or converted. I can't find info about this in the Caffe documentation.

Shai
  • 111,146
  • 38
  • 238
  • 371
Menx100
  • 13
  • 5

1 Answers1

0

AFAIK, "HDF5Data" layer does not support transformations. You should subtract the mean values yourself when you store the data to HDF5 files.

If you want to save a numpy array in a binaryproto format, you can see this answer for more details.

Community
  • 1
  • 1
Shai
  • 111,146
  • 38
  • 238
  • 371
  • Thank's for the answer! Yes that seems to be the case. After writing this question I got this after a while from Caffe: "HDF5Data does not transform data." – Menx100 Sep 12 '16 at 11:31