nntool problem
显示 更早的评论
I was trying to train the nntool with a feature vector of the no.of black pixels in a box in an image divided into 5*5 boxes where there is 5000 images for the digits from 0 to 9 .
so the input matrix for training is 25*50000
the target matrix dimensions is (as I think )10*50000
with a pattern of the following form:
target=zeros(25,50000);
target(1,1:5000)=ones(1,5000);%this correspond to zero
target(2,5001:10000)=ones(1,5000);%this corresponds to one
and so on
so my questions are:
are the dimensions of the target matrix correct?
and if so (if correct) i got an error message:
??? Insufficient number of outputs from right hand side of equal sign to satisfy assignment.
Error in ==> nntool at 681
[errmsg,errid] = me.message;
which I know from previous question on this forum that it is an out of memory error.
I'm having Matlab r2009 a,4GB RAM and 2.00 GHZ Intel core 2Duo .
so please what should i do?
回答(1 个)
TED MOSBY
2025-6-8
Hi,
Your target matrix dimensions should be 10 × 50000, not 25 × 50000. Your data must be arranged as:
- Inputs: an I × N matrix, where I is the number of features (25 here) and N is the number of samples (50000).
- Targets: an O × N matrix, where O is the number of output neurons (one per class—in your case 10 digits) and N is the number of samples.
T = zeros(10,50000); % 10 classes × 50000 samples
That error message inside nntool is actually masking an out-of-memory failure that happens earlier in the call to TRAIN.
Refer here for more details on the error: https://www.pianshen.com/ask/32443162216/
Workarounds:
- The simplest workaround is to upgrade MATLAB, then it can show you the real error and you can tune the memory usage accordingly.
- For your current version you can try training on a smaller or balanced subset, or stream your data in batches so you don’t build enormous temporary matrices.
Hope this helps!
类别
在 帮助中心 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!