Reputation: 27
I am doing transfer learning with a CNN. I want to train the network with my data but I got this error when doing a forward pass:
Error using CHECK (line 4)
input data cell length must match input blob number
Error in caffe.Net/forward (line 92)
CHECK(length(input_data) == length(self.inputs), ...
Error in main (line 79)
results= Unet.forward({data});
To take it slow and solve errors step by step I have only a data layer in my network for now. This is my train.prototxt file :
name: 'my_phseg_v5-train'
force_backward: true
layer {top: 'image' top:'anno' name: 'loaddata' type: 'HDF5Data' hdf5_data_param { source: '/home/alexandra/Documents/my-u-net/my_data.txt' batch_size: 1} include: { phase: TRAIN }}
In matlab:
model = '/home/alexandra/Documents/my-u-net/my_phseg_v5-train.prototxt';
weights = '/home/alexandra/Documents/my-u-net/my_phseg_v5.caffemodel';
%defining the net:
Unet = caffe.Net(model, weights, 'train'); % create net and load weights
results= Unet.forward({'image'});
I don't really understand what I have to put as an argument in forward( argument ). Could someone help me on that point ?
I have also noticed that in my Unet the dimension of input cell was 0x1 ... I guess that also a reason why it is not working.
Does someone have an idea on how to solve this problem ?
Upvotes: 0
Views: 559
Reputation: 27
I found a solution to my problem:
for the input cell that had a dimension of 0x1:
I used the deploy.prototxt file instead of the train.prototxt file that I was using at the beginning. In this file the dimension of the input is defined.
I used this as an argument of the function forward :
output = Unet.blobs('image').get_data();
results= Unet.forward({output});
It is the data (in my case the images) itself that have to be put as the input.
Upvotes: 0