% script Arch1.m % Finds ICA representation of train and test images under Architecture I, % described in Bartlett & Sejnowski (1997, 1998), and Bartlett, Movellan & % Sejnowski (2002): In Architecture I, we load N principal component % eigenvectors into rows of x, and then run ICA on x. % % Put the aligned training images in the rows of C, one image per row. % In the following examples, there are 500 images of aligned faces of size % 60x60 pixels, so C is 500x3600. % % You can use the following matlab code to create C: % markFeatures.m collects eye and mouth positions. % align_Faces.m crops, aligns, and scales the face images. % loadFaceMat.m loads the images into the rows of C. % % This script also calls the matrix of PCA eigenvectors organized in % the columns of V (3600x499), created by [V,R,E] = pcabigFn(C'); % % The ICA representation will be in the rows of F (called B in Bartlett, % Movellan & Sejnowski, 2002): function [F, Ftest] = arch (C, Ctest); [V,R,E] = pcabigFn(C'); x = V(:,1:3)'; runica F = R(:,1:3) * inv(w*wz); Dtest = zeroMn(Ctest')'; % For proper testing, subtract the mean of the % training images not the test images: % Dtest = Ctest-ones(500,1)*mean(C); Rtest = Dtest*V; %Ftest = Rtest(:,1:200) * inv(w*wz); Ftest = Rtest(:,1:3) * inv(w*wz);