source: proiecte/PPPP/ica/Arch1_tmp.m @ 138

Last change on this file since 138 was 138, checked in by (none), 14 years ago

PPPP - ica

File size: 1.3 KB
Line 
1% script Arch1.m
2% Finds ICA representation of train and test images under Architecture I,
3% described in Bartlett & Sejnowski (1997, 1998), and Bartlett, Movellan &
4% Sejnowski (2002):  In Architecture I, we load N principal component
5% eigenvectors into rows of x, and then run ICA on x.
6%
7% Put the aligned training images in the rows of C, one image per row. 
8% In the following examples, there are 500 images of aligned faces of size
9% 60x60 pixels, so C is 500x3600.
10%
11% You can use the following matlab code to create C:
12% markFeatures.m collects eye and mouth positions.
13% align_Faces.m crops, aligns, and scales the face images.
14% loadFaceMat.m loads the images into the rows of C.
15%
16% This script also calls the matrix of PCA eigenvectors organized in
17% the columns of V (3600x499), created by [V,R,E] = pcabigFn(C');
18%
19% The ICA representation will be in the rows of F (called B in Bartlett,
20% Movellan & Sejnowski, 2002):
21
22function [F, Ftest] = arch (C, Ctest);
23
24[V,R,E] = pcabigFn(C');
25
26x = V(:,1:3)';
27runica
28
29F = R(:,1:3) * inv(w*wz);
30
31Dtest = zeroMn(Ctest')'; % For proper testing, subtract the mean of the
32                         % training images not the test images:
33                         % Dtest = Ctest-ones(500,1)*mean(C);
34Rtest = Dtest*V;
35%Ftest = Rtest(:,1:200) * inv(w*wz);
36Ftest = Rtest(:,1:3) * inv(w*wz);
37
Note: See TracBrowser for help on using the repository browser.