使用matcaffe运行正向传球时出错

时间:2016-07-25 09:27:04

标签: caffe conv-neural-network matcaffe

我正在与CNN进行转学。我想用我的数据训练网络,但是在做正面传​​球时我得到了这个错误:

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});

为了减慢速度并逐步解决错误我现在只在网络中有一个数据层。这是我的train.prototxt文件:

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 }}

在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'});

我真的不明白我必须把它作为一个参数放在前进(论证)中。在这一点上有人可以帮助我吗?

我也注意到在我的Unet中输入单元的维度是0x1 ... 我想这也是它无法正常工作的原因。

有人知道如何解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

我找到了解决问题的方法:

表示维度为0x1的输入单元格:

我使用了deploy.prototxt文件,而不是我在开头使用的train.prototxt文件。在此文件中,定义了输入的维度。

我用它作为函数转发的参数:

output = Unet.blobs('image').get_data();
results= Unet.forward({output});

必须将数据(在我的情况下是图像)本身作为输入。