MATLAB: Artificial Neural Network back propagation image classification

annDeep Learning Toolboximage classificationImage Processing Toolbox

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

Best Answer

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