Prev: Process memory leaks when called by Matlab
Next: about the parameter 'INPUTS' in the function 'connect'
From: muerte repentino on 25 May 2010 23:53 Hello all, I'm reading a few indexed images to a matrix, feeding them as input to the network to do some simple classification. That's how I create my matrix: (1) Initial step: y=imread('01.bmp') y=y(:) x=[y'] (2) Next step(s): y=imread('02.bmp') y=y(:) x=[x;y'] I repeat step 2 until I have 9 rows representing my 9 images as input. Matlab reads my variables well, it says they have the integers representing the images, the images are originally 16color, so the values range from 0 to 15. I create the Target matrix for the desired input neurons like that: z=[0 0;0 0;0 0;0 1;0 1;0 1;1 0;1 0;1 0] I shall have now 2 output neurons that represent the 3 possible output results. When I create the network like that: net =newff(x,z,500) I receive the error: ??? Error using ==> newff>new_5p1 at 132 Inputs are not a matrix or cell array. Error in ==> newff at 108 net = new_5p1(varargin{:}); And I can't see where my mistake is. Thanks in advance
From: Greg Heath on 27 May 2010 02:18
On May 25, 11:53 pm, "muerte repentino" <bhram...(a)yahoo.com> wrote: > Hello all, > > I'm reading a few indexed images to a matrix, feeding them as input to the network to do some simple classification. > > That's how I create my matrix: > (1) Initial step: > y=imread('01.bmp') > y=y(:) > x=[y'] > (2) Next step(s): > y=imread('02.bmp') > y=y(:) > x=[x;y'] > > I repeat step 2 until I have 9 rows representing my 9 images as input. > Matlab reads my variables well, it says they have the integers representing the images, the images are originally 16color, so the values range from 0 to 15. > > I create the Target matrix for the desired input neurons like that: > z=[0 0;0 0;0 0;0 1;0 1;0 1;1 0;1 0;1 0] > > I shall have now 2 output neurons that represent the 3 possible output results. > > When I create the network like that: > net =newff(x,z,500) > > I receive the error: > ??? Error using ==> newff>new_5p1 at 132 > Inputs are not a matrix or cell array. > > Error in ==> newff at 108 > net = new_5p1(varargin{:}); > > And I can't see where my mistake is. > > Thanks in advance 1. Each image should be a column, not a row. 2. If you have c classes use c outputs and code the training targets in terms of columns of the c-dimensional unit matrix. 3. The output activation function should be LOGSIG. 4. The number of hidden nodes should be chosen so that the number of estimated weights and thresholds is much less than the number of images. 5. See my post on pretraining advice. Search the CSSM archives using greg heath pre training advice (Note the space after "pre") 6. See my posts on determining the number of hidden nodes greg heath Neq Nw Hope this helps. Greg |