Training neural networks based on images

2 visualizzazioni (ultimi 30 giorni)
I trained neural networks with images as inputs. I was not sure how to do that. I did like this
a=imread('A.bmp'); %I have these image files
b=imread('B.bmp');
a=a(:); %To convert this into one column matrix
b=b(:);
x=[a b];
x1=double(x); %Input to the neural network
t=eye(2); %Target and there are two classes 'a' and 'b'
After this I trained the neural network(pattern recognition) and then it got trained and I stored the network in 'net'.
After this I tried this code to check my neural network
input=a; output=sim(net,input);
I got this error
Error in ==> network.sim>simargs at 236 switch class(P)
??? Output argument "Pi" (and maybe others) not assigned during call to "D:\MATLAB\toolbox\nnet\nnet\@network\sim.m>simargs".
Error in ==> network.sim at 173 case 2, [err,X,Xi,Ai,T,Q,TS,matrixForm] = simargs(net,X);
What is the problem? Is there any other way to solve my question which is training neural networks based on images.
Basically I don't know that much about neural networks in matlab so I would like to know if there is any tool in neural network that is specially used for image recognition.
NOTE: I trained neural networks without using images (just using normal sequences) and it worked perfectly. But I don't get the same for images. Plz help me.

Risposta accettata

Walter Roberson
Walter Roberson il 9 Ott 2011
This has been asked by several people in several years, but solid answers seem to be scarce on this.
I did find a posting in which one person discovered that things started to work for them when they changed their input data type to double. See http://www.mathworks.com/matlabcentral/newsreader/view_thread/99987
Notice that in your code, "a" is still the data type of the original image.

Più risposte (1)

padmavathi vattikonda
padmavathi vattikonda il 19 Dic 2016
how to give an image as input for neural network and how to train it in matlab

Community Treasure Hunt

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

Start Hunting!

Translated by