Menx100
Menx100

Reputation: 13

Use mean file in hdf5 in caffe

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.

Upvotes: 0

Views: 762

Answers (1)

Shai
Shai

Reputation: 114796

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.

Upvotes: 0

Related Questions