GithubHelp home page GithubHelp logo

error on cnn_minst about matconvnet HOT 12 CLOSED

vlfeat avatar vlfeat commented on May 2, 2024
error on cnn_minst

from matconvnet.

Comments (12)

amar2015 avatar amar2015 commented on May 2, 2024

I solved that problem but right now I have this error:
learning rate changed (0.000000 --> 0.001000): resetting momentum
training: epoch 01: processing batch 1 of 3 ... 0.11 s (874.0 images/s) err 85.0 err5 51.0
training: epoch 01: processing batch 2 of 3 ... 0.09 s (1122.3 images/s) err 87.0 err5 51.0
training: epoch 01: processing batch 3 of 3 ... 0.09 s (1113.6 images/s) err 88.3 err5 50.7
resuming by loading epoch 1
training: epoch 02: processing batch 1 of 3 ... 0.09 s (1055.9 images/s) err 87.0 err5 46.0
training: epoch 02: processing batch 2 of 3 ...Index exceeds matrix dimensions.

Error in vl_nnsoftmaxloss (line 58)
t = Xmax + log(sum(ex,3)) - reshape(X(c_), [sz(1:2) 1 sz(4)]) ;

Error in vl_simplenn (line 163)
res(i+1).x = vl_nnsoftmaxloss(res(i).x, l.class) ;

Error in cnn_train (line 140)
res = vl_simplenn(net, im, one, res, ...

Error in cnn_mnist (line 118)
[net, info] = cnn_train(net, imdb, @GetBatch, ...

I guess because of bathes number does not fit with my data set. I have 300 training images. Would you please help me to choose the appropriate batch number.

from matconvnet.

lenck avatar lenck commented on May 2, 2024

This seems more like an error in the labels - softmax needs to have size(X,3) to be equal to number of classes, and also the labels must be among [1...NumClasses]. Isn't it possible that some of your labels are bigger than 2, considering that you are doing binary classification?

from matconvnet.

amar2015 avatar amar2015 commented on May 2, 2024

Thanks a lot for your quick response, I am not using binary classification I have 13 classes,
so do you think I can not use it for multiple classes?

from matconvnet.

lenck avatar lenck commented on May 2, 2024

Sure you can, it's just that the last conv layer must have 13 filters (so that you get 13 responses) and your labels must be between 1..13 (so that the indexing X(c_) won't fail).

from matconvnet.

amar2015 avatar amar2015 commented on May 2, 2024

Thanks a lot I changed the last layer but I have this error now:
Reference to non-existent field 'class'.

Error in vl_simplenn (line 163)
res(i+1).x = vl_nnsoftmaxloss(res(i).x, l.class) ;

Error in cnn_mnist (line 125)
res = vl_simplenn(net, im) ;

would you please help me to solve that error.

from matconvnet.

amar2015 avatar amar2015 commented on May 2, 2024

The training is working now but when I try test new image using vl_simplenn () I have this error :
Error using vl_nnsoftmaxloss (line 42)
Assertion failed.

Error in vl_simplenn (line 163)
res(i+1).x = vl_nnsoftmaxloss(res(i).x, l.class) ;

Error in cnn_mnist (line 125)
res = vl_simplenn(net, im) ;
would you please help me to solve that error.

from matconvnet.

felixachilles avatar felixachilles commented on May 2, 2024

Change the last layer of your network from softmaxloss() to softmax() and
compute the index of the largest element in the output vector, this is your
classification result.
On Jan 26, 2015 6:27 PM, "amar2015" [email protected] wrote:

The training is working now but when I try test new image using
vl_simplenn () I have this error :
Error using vl_nnsoftmaxloss (line 42)
Assertion failed.

Error in vl_simplenn (line 163)
res(i+1).x = vl_nnsoftmaxloss(res(i).x, l.class) ;

Error in cnn_mnist (line 125)
res = vl_simplenn(net, im) ;
would you please help me to solve that error.


Reply to this email directly or view it on GitHub
#51 (comment).

from matconvnet.

amar2015 avatar amar2015 commented on May 2, 2024

Thx , I did that but I have this error:
learning rate changed (0.000000 --> 0.001000): resetting momentum
training: epoch 01: processing batch 1 of 15 ...Error using .*
Array dimensions must match for binary array op.

Error in vl_nnsoftmax (line 30)
Y = Y .* bsxfun(@minus, dzdY, sum(dzdY .* Y, 3)) ;

Error in vl_simplenn (line 211)
res(i).dzdx = vl_nnsoftmax(res(i).x, res(i+1).dzdx) ;

Error in cnn_train (line 140)
res = vl_simplenn(net, im, one, res, ...

Error in cnn_mnist (line 118)
[net, info] = cnn_train(net, imdb, @GetBatch, ...

from matconvnet.

amar2015 avatar amar2015 commented on May 2, 2024

Should I change it before the training or after?

from matconvnet.

felixachilles avatar felixachilles commented on May 2, 2024

Only change it for testing. During training you always need a scalar loss
output, like in vl_softmaxloss().

2015-01-26 18:40 GMT+01:00 amar2015 [email protected]:

Should I change it before the training or after?


Reply to this email directly or view it on GitHub
#51 (comment).



Technische Universität München__Felix Achilles, M.Sc.* · *Faculty of
Informatics *· *Chair for Computer Aided Medical Procedures
Boltzmannstr. 3 *· *85748 Garching b. München · +49 (0)176 623 18 312

[email protected] *· *campar.in.tum.de


from matconvnet.

amar2015 avatar amar2015 commented on May 2, 2024

thank you so much, it worked out finally.

from matconvnet.

mudassarkazmi avatar mudassarkazmi commented on May 2, 2024

hi i am new to use CNN toolbox

i also have following error

learning rate changed (0.000000 --> 0.001000): resetting momentum
training: epoch 01: processing batch 1 of 4 ...Error using .*
Array dimensions must match for binary array op.

Error in vl_nnsoftmax (line 30)
Y = Y .* bsxfun(@minus, dzdY, sum(dzdY .* Y, 3)) ;

Error in vl_simplenn (line 211)
res(i).dzdx = vl_nnsoftmax(res(i).x, res(i+1).dzdx) ;

Error in cnn_train (line 140)
res = vl_simplenn(net, im, one, res, ...

Error in reidentification (line 75)
[net,info] = cnn_train(net, imdb, @GetBatch, opts.train) ;


i dont know whats wrong with the following network

net.layers = {} ;
% 1 conv1
net.layers{end+1} = struct('type', 'conv', ...
'filters', 1e-4*randn(5,5,3,32, 'single'), ...
'biases', zeros(1, 32, 'single'), ...
'stride', 1, ...
'pad', 2) ;

% 2 pool1 (max pool)
net.layers{end+1} = struct('type', 'pool', ...
'method', 'max', ...
'pool', [3 3], ...
'stride', 2, ...
'pad', [0 1 0 1]) ;

% 10 ip1
net.layers{end+1} = struct('type', 'conv', ...
'filters', 0.1*randn(16,16,32,64, 'single'),...
'biases', zeros(1,64,'single'), ...
'filtersLearningRate', 1, ...
'biasesLearningRate', 2, ...
'stride', 1, ...
'pad', 0) ;

% 11 ip2
net.layers{end+1} = struct('type', 'conv', ...
'filters', 0.1*randn(1,1,64,119, 'single'),...
'biases', zeros(1,119,'single'), ...
'filtersLearningRate', 1, ...
'biasesLearningRate', 2, ...
'stride', 1, ...
'pad', 0) ;
% 12 loss

net.layers{end+1} = struct('type', 'softmax') ;

Please guide me in this regard
I will be really thankful for this help

from matconvnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.