|
On Jul 17, 1:38 pm, sunny <sandeeprac...@gmail.com> wrote:
> Hi,
>
> I am working on a Project of face Recognition using PCA and Neural
> Network Toolbox.
Unfortunately, my other computer crashed and lost a lengthy reply.
So, I'll write another one.
> I have made a Code for PCA
Sometimes PCA is not the best choice for pattern recognition
because it chooses dominant directions to maximize total input
data variance, not to maximize class separability.
A viable alternative is PLS which chooses dominant directions
to maximize the covariance between inputs and targets.
> Here are some details of my Implementation.
> I have made two separate Database. 1) Train database and 2) Test
> Database
In addition to training and test subsets, sometimes you also need
a validation subset to determine ,by trial and error, the best
settings
for learning algorithm parameters, and number of hidden nodes.
> Train Database
> Image Size= 180*200
> No. of Images = 100
> No. of persons= 20
> No. of Images for each persons = 5
>
> Test Database
> Image Size = 180*200
> No. of Images = 20
> No. of Persons = 20
When images are converted to input vectors, the dimensionality
will be 36,000. However, there are only 100 training images.
These span a subspace with dimension no larger than 99.
Even worse, if you use a validation subset (and you should) with
the same size as the test subset, there will be only 80 training
images which span a subspace with dimension no larger than 79.
Therefore, there needs to be a very dramatic dimensionality
reduction of the original input matrices, assuming
size(ptrn0) = [36000 80]
size(pval0) = [36000 20]
size(ptst0) = [36000 20]
I will assume that the images are scaled, registered and
normalized.
Some dimensionality reduction has to be done before
calculating the training data covariance matrix because
MATLAB does not have enough memory to calculate a
36000 X 36000 covariance matrix,
Since you will be designing with only 5 images per person
(4 for training and 1 for validation), it might be useful, as an
early preprocessing step, to use a larger grid size and
replace the grid values with nearest neighbor averages.
For example, this may result in 18 x 20 2-D images unfolded
into 360 1-D input vectors. Then
size(ptrn1) = [360 80]
and similarly for val and tst.
Maybe another normalization and registering?
> I used the PCA and calculate covariance Matrix
How? Need details of your approach.
Please post relevant, commented, code.
> EigenVector( Size 100*100)
> and than Eigenfaces matrix( 36000*100)
36,000? ... Ugh. That is why you should reduce the size of the
original matrices.
C = cov(ptrn1'); % size(C) = [360 360]
totvar = trace(C) % total data variance
Use EIG to obtain the eigenstructure
Only keep enough eigenvalues/vectors to retain (say )
99% of the total variance % e.g., nkeep = 75 < 79
Obtain the nkeep x n transformation matrix that projects
ptrn1 into the dominant eigenvector space
ptrn2 = T*ptrn1;
size(ptrn2) = [ nkeep Ntrn] = [75 80]
Also use T to transform the val and tst input data.
size(pval2) = [nkeep 20]
size(ptst2) = [nkeep 20]
Now use ptrn2 and the 20 X 80 target matrix ttrn0 to design
candidate target nets. Use pval2 and tval0 to adjust
parameters and choose the best candidate net
Finally use ptst2 and ttst0 to estimate the generazation
mean-squared error and percent classification error..
Hope this is a helpful start.
Greg
|