create target for neural network
显示 更早的评论
Hi all,
I had extracted feature vector of an image and saved it in a excel document. feature vector is 42x42 dimension. I don't know how to create target for this input so i can train the neural network. I need to do emotion classification. 5 classes. So, how do i create target vector and train the network?
采纳的回答
更多回答(1 个)
Greg Heath
2012-2-14
remo asked on 12 Feb 2012 at 12:29
>I had extracted feature vector of an image and saved it in a excel document. feature vector is 42x42 >dimension. I don't know how to create target for this input so i can train the neural network. I need to >do emotion classification. 5 classes
The input features must be column vectors. If you extract a feature matrix from an original matrix, you can convert it to a feature vector using the colon operator. For example, if you have a feature matrix fm with size(fm) = [ r, c ], then fv = fm(:) will be the corresponding feature vector with size(fv) = [ r*c, 1 ].
If you have N feature vectors from N images, the N columns form an input matrix, p, with size(p) = [ I N ] and I = r*c.
If the N images come from k classes, the corresponding target matrix, t, contains N columns of the k-dimensional unit matrix eye(k). The row containing the "1" is the class index for the corresponding input vector. size(t) = [ O N ] with O = k.
The output matrix is readily formed using the function IND2VEC. For example
>> t = full(ind2vec([ 1 3 5 2 4 ]))
t =
1 0 0 0 0
0 0 0 1 0
0 1 0 0 0
0 0 0 0 1
0 0 1 0 0
Given a feature vector, the resulting elements in the output vector can be interpreted as approximations to the input-conditional class posterior probabilities. The input vector is then assigned to the class corresponding to the maximum output.
A single hidden layer with H nodes is sufficient. The resulting node topology is I-H-O. This will result in Neq = N*O nonlinear equations to be "solved" for Nw = (I+1)*H+(H+1)*O unknown weights. For training to convergence, it is required that Neq >= Nw. However, the condition Neq >> Nw is preferable to mitigate real-world noise and measurement error. This is equivalent to requiring
H <= Hub is required but H << Hub is desired where the upper bound Hub is given by
Hub = ( Neq - O ) / ( I + O + 1 ).
A practical value for H can be obtained by trial and error keeping the above conditions in mind.
Hope this helps.
Greg
类别
在 帮助中心 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!