Thread Subject: PCA and back propagation neural network

Subject: PCA and back propagation neural network

From: Kueh Lydia

Date: 25 Aug, 2011 10:39:13

Message: 1 of 2

Hi,

I am doing face recognition with PCA and back propagation neural network toolbox too.

I read your asking help in http://www.mathworks.fr/matlabcentral/newsreader/view_thread/302393.

Did you manage to implement the recognition task??

I am writting to ask help too.
Please respond as soon as possible.

I have calculated the eigenfaces but i dont know how to implement recognition task with neural network toolbox too.

My database is 175 images from 35 person (each person 5 images)

The out put of PCA algorithm is a weight matrix B of 103 *175 and I use it as the input of neural network.
The weight matrix means 1 image with 103 features. 175 for 35 person of 5 images

I have created the nn with newff and train the network too.
net = newff(minmax(B),[S1 S3],{'logsig' 'logsig'},'traingdm');

The target is an identity matrix T of 175 *175. How to set the target T??
[netl,trl, trlO, trlE] = train(net,B,T);

My testting database, BI1 is 175 images from 35 person (each person 5 images) too. They are different sets of images from 35 person.

I simulate using A=sim(net,BI1);
Follow by command AA = compet(A).
Then I calculated the error by errors1_1 = errors1_1 + sum(sum(abs(AA-T)))/2;

Does it correct?
 
Actually, I I divided my database as follow

Training set Testing set
5 images per person 5 images per person

4 images per person 6 images per person

3 images per person 7 images per person

2 images per person 8 images per person

1 images per person 9 images per person

But I don't know how to simulate the train net with the testing images from these 35 person of my database.

The target matrix for testing set and training set are not the same. The lengths are different. They are not match each other.

How to simulate them and how to count the error of testing set??

Could you please help me on this part. It is urgent

Subject: PCA and back propagation neural network

From: Greg Heath

Date: 25 Aug, 2011 18:05:37

Message: 2 of 2

On Aug 25, 6:39 am, "Kueh Lydia" <leehk...@naver.com> wrote:
> Hi,
>
> I am doing face recognition with PCA and back propagation neural network toolbox too.
>

backpropagation is the name of a type of optimization algorithm
that is used on many different topologies of neural networks

it is neither the name of a network nor the name of a toolbox

> I read your asking help inhttp://www.mathworks.fr/matlabcentral/newsreader/view_thread/302393.

I did not ask for help.

> Did you manage to implement the recognition task??

I have given advice on pretraining and code in many posts.
For advice, search the archives using

heath pretraining advice
heath face recognition

> I am writting to ask help too.
> Please respond as soon as possible.

 What image size?
What range of pixel values?
Converted to what vector length I0 = ?(eye-oh, not ten)

> I have calculated the eigenfaces

Using what eigenvalue threshold?

size(p0) = [I0 N] > PCA => size(p) = [I N]

>but i dont know how to implement recognition task with neural network toolbox too.
>
> My database is 175 images from 35 person (each person 5 images)
>
> The out put of PCA algorithm is a weight matrix B of 103 *175
> use it as the input of neural network.

delete the word "weight"
I doubt if you need that many input variables. Review your
eigenvalue threshold.

Original imput matrix

size(p0) = [I0 N] = [ I0 175]

PCA Transformation matrix

size(T) = [ I I0] = [ 103 I0 ]

Transformed input matrix

p = T*p0
size(p) = [ I N ] = [ 103 175]

Ourtput matrix

size(t) = [O N ] = [ 35 175 ] % Columns of eye(35)


> The weight matrix means 1 image with 103 features. 175 for
>35 person of 5 images

 Standardize (zero mean/unity variance) inputs
Training will yield Neq = N*O equations for Nw weights

Design a constant naive matrix model with constant outputs equal
to the mean of the targets forming Nw00 = O weights. Obtain
MSE00 = SSE00/Neq, the degee of freedom adjusted value
MSE00a =SSE00/(O*(N - Nw0)) and corresponding R^2 statistics.
(Also classification error rates for each person)

Design a linear matrix model with Nw0 weights. Obtain MSE0,
MSE0a, corresponding R^2 statistics with R20 = 1-MSE0/MSE00
and R20a = 1-MSE0a/MSE00a = 1-(N-Nw00)*(MSE0/MSE00)/(N-Nw0)
 and classification error rates for each person

> I have created the nn with newff and train the network too.
> net = newff(minmax(B),[S1 S3],{'logsig' 'logsig'},'traingdm');

Single hidden layer node topology I-H-O
Try to choose H so that there are many more training
equations than unknown weights with the constraint

Neq = N*O >> Nw = (I+1)*H+H*(I+1) ==> Hmax

Choose R2agoal (e.g., 0.99)
Choose or loop over 1 <= H <= Hmax

net = newff(minmax(p),[H O],{'tansig' 'logsig'});

Nw = O + (I+O+1)*H
MSEgoal = (1-R2agoal)*(Neq - Nw)*MSE00/(N - Nw00)
net.Parameter.goal = MSEgoal;
net.Parameter.show = 10;
[net tr Y E] = train(p,t);

Nepochs = tr.epochs(end);
MSE = tr.perf(end);
R2 = 1-MSE/MSE00
MSEa = N*MSE/(N-Nw)

> The target is an identity matrix T of 175 *175.

No. See above for size(t)

How to set the target T??
> [netl,trl, trlO, trlE] = train(net,B,T);
>
> My testting database, BI1 is 175 images from 35 person
(each person 5 images) too. They are different sets of images
from 35 person.
>
> I simulate using A=sim(net,BI1);
> Follow by command AA = compet(A).
> Then I calculated the error by errors1_1 = errors1_1 + sum(sum(abs(AA-T)))/2;
>
> Does it correct?
>
> Actually, I I divided my database as follow
>
> Training set Testing set
> 5 images per person 5 images per person
>
> 4 images per person 6 images per person
>
> 3 images per person 7 images per person
>
> 2 images per person 8 images per person
>
> 1 images per person 9 images per person
>
> But I don't know how to simulate the train net with the testing
> images from these 35 person of my database.
>
> The target matrix for testing set and training set are not the same.
The lengths are different. They are not match each other.
>
> How to simulate them and how to count the error of testing set??
>
> Could you please help me on this part. It is urgent

1. Normalize the test set ptst using the means and standard
deviations
of the unstandardized training set
2. ytst = sim(net,ptstn)
3. etst = (ttst-ttst),
4. MSEtst = mse(etst)
5. R2tst = 1-MSEtst/MSEtst00

Hope this helps

Greg

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com