My images are 3channel RGB images. I convert each image to vector form. I intend to feed this 'data' to caffe using HDF5 format.
My code to form the HDF5 data is(using matlab)
images=csvread('vectorized_image.txt');
labels_new=csvread('labels.txt');
images=images.';
% reshape images to 4-D: [rows,col,channel,numbers]
trainData=reshape(images,[99 99 3 size(images,2)]);
% permute to [cols,rows,channel,numbers]
%trainData=permute(trainData,[2 1 3 4]);
% permute lables to [labels, number of labels ]
%trainLabels4=permute(label4,[2,1]);
trainLabels=permute(labels_new,[2,1]);
h5create('hand_train.hdf5','/data',size(trainData),'Datatype','double');
h5create('hand_train.hdf5','/label',size(trainLabels),'Datatype','double');
h5write('hand_train.hdf5','/data',trainData);
h5write('hand_train.hdf5','/label',trainLabels);
The data blob above is of the format (row, col, channel, number_samples). The Data blob should be of form(number_samples,channel,width, height) as per `http://caffe.berkeleyvision.org/doxygen/classcaffe_1_1Blob.html
When i run training with (row, col, channel, number_samples), the code runs. When i run training with (number_samples, channels, row, col, ), the code gives error:
hdf5_data_layer.cpp:53] Check failed: hdf_blobs_[i]->shape(0) == num (7500 vs. 99)
where 7500 is the number of images in the dataset. What is the correct way to enter the data for HDF5 format?