target and input matrix in Neural network (ANN)

2 Ansichten (letzte 30 Tage)
farheen asdf
farheen asdf am 15 Jun. 2015
Kommentiert: The Zed am 13 Apr. 2020
Hi. I'm trying to learn Artificial Neural Network in Matlab and i want to do a simple task of recognizing if an image is a flower or not. So, i have taken 2 pictures of flowers and extracted 8 features from each of them which means i have 16 features in total. I'm using GUI instead of matlab commands to train my network. My question is how do i define the input and target matrix? in=[fa1, fb1 ; fa2, fb2 ;fa3, fb3 ;fa4, fb4 ;fa5, fb5 ;fa6, fb6 ;fa7, fb7 ;fa8, fb8]
where fa1 is the first feature of the first sample image and so on and fb1 is the first feature of the second sample image and so on
is this the correct way to define the input matrix? or do i use this matrix
in=[fa1, fa2, fa3, fa4 ,fa5, fa6 ,fa7, fa8 ;fb1, fb2 ,fb3, fb4 ,fb5, fb6 ,fb7, fb8]
Also, how do i define the target matrix? what will be the size of the target matrix? should it constitute of only 0s and 1s?
And lastly, once i've trained my network, how will i use it to determine if an unknown image is a flower or not?
Thank you

Akzeptierte Antwort

Greg Heath
Greg Heath am 25 Jun. 2015
For good generalization to unseen data:
For each class the number of samples should exceed the number of input features by a large factor. The input matrix for N I-dimensional inputs has the shape
[ I N ] = size(input)% N >> I
Similarly, for the {0,1} c-class target matrix with columns from eye(c)
[ c N ] = size(target)% N >> c
The relationships between the class indices (1:c) and the target matrix are
target = ind2vec(trueclassindices)
trueclassindices = vec2ind(target)
Similarly, the relationships between the classifier output matrix and the assigned class indices are
assignedclassindices = vec2ind(outputt)
err = (assignedclassindices ~= trueclassindices)% (0,1) vector
Nerr = sum(err)
PctErr = 100*Nerr/N
Individual class errors are obtained by taking the class indices into account.
Hope this helps.
Thank you for formally accepting my answer
Greg

Weitere Antworten (1)

farheen asdf
farheen asdf am 2 Jul. 2015
I have finally trained my neural network and the results are good (87% accurate). That being said i'm still a little confused as to how it can be used practically. For example, in my case it takes the network several tries to get to 87% accuracy. Sometimes its accuracy is as bad as 26%. How can i make sure that my network remembers what it has learned when it gets to 87% accuracy? Second, i was wondering if i could use this network to find the class of an unknown image which i select at runtime. I've used indexing method to separate the training, validation and test data so that the network tests only the images i want it to. Thanks in advance. Have a nice day :)

Kategorien

Mehr zu Deep Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by