vlfeat / matconvnet

MatConvNet: CNNs for MATLAB
Other
1.4k stars 753 forks source link

error on using vl_nnconv using cpu #877

Closed shakediel closed 7 years ago

shakediel commented 7 years ago

hey there, I compiled matconvnet to use cpu only. i designed a finetunning net based on a previously existing network using my own loss layer as talked about here before(extending vl_simplenn etc..). while trying to run cnn_train from the matconvnet example files i get the following error: **Error using vl_nnconv An input is not a numeric array (or GPU support not compiled).

Error in vl_simplenn_extended (line 300) res(i+1).x = vl_nnconv(res(i).x, l.weights{1}, l.weights{2}, ...

Error in cnn_train>processEpoch (line 321) res = vl_simplenn_extended(net, im, dzdy, res, ...

Error in cnn_train (line 136) [net, state] = processEpoch(net, state, params, 'train') ;**

on the first layer of the network. thanks in advance for your help, Shaked

layumi commented 7 years ago

@shakediel What is the class of the 'res(i).x'? Add the breakpoint and type class(res(i).x) to check the class.

shakediel commented 7 years ago

hey @layumi this is the output i receive: K>> class(res(i).x)

ans =

cell

what does this mean?

layumi commented 7 years ago

@shakediel For simplenn, the input should be a matrix. (like 28*28*3*16 single) 28*28 is the size of the image. The 3 is the color channel. 16 is the batchsize. (In one iteration, we process several images together.)

So you may check your input. Do you add '{', '}' for mistake? And the example in (/examples/mnist/cnn_mnist.m) may be helpful.

% -------------------------------------------------------------------- function [images, labels] = getSimpleNNBatch(imdb, batch) % -------------------------------------------------------------------- images = imdb.images.data(:,:,:,batch) ; labels = imdb.images.labels(1,batch) ;

shakediel commented 7 years ago

thank you very much!

agarwal-ayushi commented 7 years ago

Hello @shakediel,

Did this work for you - changing the input image definition? Were you able to root cause this?

Error in vl_simplenn_extended (line 300)
res(i+1).x = vl_nnconv(res(i).x, l.weights{1}, l.weights{2}, ...

The error you are facing is basically while running the vl_nnconv function which is the convolution of the previous layer output and the weights. I am also getting the same error and I am working with different datatypes so I was wondering if this function only works with single/double precision floating points. I was wondering if you could help me if you were able to find the root cause of this issue?

Thanks, Ayushi