Artificial Neural Network back propagation image classification

5 次查看(过去 30 天)
Hello community,
I have novice in ANN, so please bare with me.
I have a image[mxnxp]which i want to classify with ANN back propagation. I have ground truth data for my 5 class. How would i represent my input vector? Is input vector will be AxP where A is total number of my samples with all classes! How would i represent my output vector? Since i have five classes, i think my output matrix would be Ax5.
In my understanding p and no. of classes certainly could be different. But when i want to train my ANN, with following cmd it says
net=newff(input_norm,output, [NUM_NEURON,5],{'logsig','logsig'},'traingd','learngdm','mse');
Error using traingd (line 102) Inputs and targets have different numbers of samples.
Though my no. of rows of both input and output matrix is same, no. of columns is different ( input column 4, output column 5), which i think is right.
But error " Inputs and targets have different numbers of samples" is always occuring.
any guidance, how i should build my input and output matrix?
In addition, please guide me, how would classify my image after training my ANN ?
sincerely Yours Sukuchha

采纳的回答

Paul Peeling
Paul Peeling 2011-12-13
In the Neural Network toolbox, each column is a sample, so you need to arrange your input matrix as PxA, and output matrix as 5xA.
You can then classify an image simply by passing the input vector into net, i.e. output = net(input); I have found the Getting Started guide for the Neural Network toolbox to be a very good and concise introduction to using these tools

更多回答(1 个)

Greg Heath
Greg Heath 2011-12-14
Your target matrix should contain columns of eye(5).
Assign inputs to the class corresponding to the maximum output.
You need to read and better understand the documentation
help newff, doc newff
help train, doc train
Do not include the number of output nodes in NEWFF and use as many defaults as possible. Standarize (zero-mean/unit-variance) inputs using MAPSTD and use tansig hidden nodes. For example
rand('state',0) % In case you need to duplicate results
net=newff(input,target,H); % Find H by trial and error
[net tr Y E] = train(net,p,t);
For details and examples, search the newsgroup using
heath newff close clear
heath newff Neq Nw Ntrials
Hope this helps.
Greg

类别

Help CenterFile Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by