From: tarik bahraoui on 8 Mar 2010 14:03 "hulijo" <u44586(a)uwe> wrote in message <867359da739e0(a)uwe>... > Hy yonnas, > It seems that I am having a similar problem trying to implement the MACE > filter. I am quite sure my code is wright, but the results I get when using > MACE correlation filters for recognition are nothing like those reported in > the literature. I achieve lets say a equal error rate of 8% in my experiments > which, however, is comparable only to PCA not even to LDA or other > discriminative methods. > > I suspect two things, at least what face recognition is concerned. First, > most papers use a database were pleanty of images per client are available > for training, while I use only three. And second they perform identitfication > experiments, while I do verification. Anyhow, my code for constructing MACE > filters is a bit different from yours as I use training images of all > subjects to construct the filters. > > The code: > > %read files in the list called "ucn1" and do zero-mean-unit-variance > normalization > vector_size=10000; > number_of_training_images = 600; > Y=[]; > for i=1:number_of_training_images > X = double(imread(ucn1(i,:))); > x = reshape(X,[vector_size,1]); > means = mean(x); > vari = sqrt((sum((x-means).^2))/vector_size); > x = (x-means)/vari; > Y=[Y,x]; > end > Y=Y'; > > %transfrom to frequenca domain > im_hight = 100; > im_width = 100; > for i=1:number_of_training_images > X = reshape(Y(i,:),[im_hight,im_width]); > X_f = fft2(X); > X_f = reshape(X_f,[vector_size,1]); > Y_f(i,:)=X_f'; > end > Y_f = Y_f'; > > % MACE filter with all training images, result in "h" > counter=1; > X2 = Y_f; > D=mean((abs(X2)),2)); > faktor = repmat(1./D,1,number_of_training_images).*X2*inv((X2)'*(repmat(1./D, > 1,number_of_training_images).*X2)); > for i=1:3:number_of_training_images %I have three images per > subject > c=zeros(number_of_training_images,1); > c(i:i+2,1)=1; > h(:,counter) = (faktor*c); > counter=counter+1; > end > > %h now contains all the filters > > > > %for a test image > X = double(imread(ucn1(1,:))); > x = reshape(X,[vector_size,1]); > means = mean(x); > vari = sqrt((sum((x-means).^2))/vector_size); > x = (x-means)/vari; > X=reshape(x,[im_hight,im_width]); > out = real( ifftshift((ifft2(((fft2(X)).*(reshape(conj(h(:,1)),[im_hight, > im_width]))))))); > > > > I hope it the code will help you! > > Regards, > > hulijo > > > yonnas syams wrote: > >Hi everyone, > >I need help in Minimum Average Correlation Energy Filter > >(MACE)filter design.I am trying to make it according to > >http://s.i-techonline.com/Book/Face-Recognition/ISBN978-3-902613-03-5-fr26.pdf > > > >I think my program doesn't work well.When I apply it to the > >training image used, it's true that there is peak at the > >correlation output (positive or negative) peak.But when I > >apply the testing image(from the same class/person), there > >is no peak at all, and i think there's should be a peak. > >One more question,how to normalized the correlation output > >so in will be in range -1 to 1. > >Any help will be greatly appreciated. > > > >Here is my codes: > >%Filter Design > >% 3 iris input training , N=3 > >ans1=imread('001_1_1.bmp'); > >ans2=imread('001_1_2.bmp'); > >ans3=imread('001_1_3.bmp'); > >%change to domain frequency x[d1 d2] > >x1=fft2(im2double((ans1.hasil)); > >x2=fft2(im2double((ans2.hasil)); > >x3=fft2(im2double((ans3.hasil)); > >%change to vector kolom X[d 1] > >X1 =x1(:); > >X2 =x2(:); > >X3 =x3(:); > >%matrix X[d N] > >X=[X1 X2 X3]; > >%the output i wanted, 1 for authentic image > >u=[1 1 1]'; > >[d N]=size(X); > >%compute D, in the paper D is diagonal matrix, but not here > >because the result is the same > >D1 =X1 .* X1; > >D2 =X2 .* X2; > >D3 =X3 .* X3; > >D =(1/N*d) * (D1+D2+D3) ; > >%make inverse D > >for i=1:d > > D_inv(i,1)=1/D(i,1); > >end > >%a= inverse(ctranspose X[N d] * inverse D[d 1] * X[d N]) > >%temp[d N]=inv D[d 1] * X[d N] > >for i=1:d > > for j=1:N > > temp(i,j) = D_inv(i,1) * X(i,j); > > end > >end > >%a[N N]=inv(Xt[N d] * temp[d N]); > >a =inv(ctranspose(X) * temp); > >%h[d 1]=(inverse D[d 1] * X[d N])[d N] * a[N N] * u[N 1]; > >h =temp * a * u; > >%mace filter in domain frequency > >%change to the original size [d1 d2] > >[d1 d2]=size(x1); > >Hmace=reshape(h,d1,d2); > >save Hmace; > > > >%Aplly to Image > >iris=imread('001_2_1.bmp'); > >load Hmace; > >x=fft2(im2double(iris)); > >c=ifft2(x .* Hmace); > >figure, mesh(c) > > > >Note : My english is not so good, i am sorry ^_^ >
From: tarik bahraoui on 8 Mar 2010 14:05 "hulijo" <u44586(a)uwe> wrote in message <867359da739e0(a)uwe>... > Hy yonnas, > It seems that I am having a similar problem trying to implement the MACE > filter. I am quite sure my code is wright, but the results I get when using > MACE correlation filters for recognition are nothing like those reported in > the literature. I achieve lets say a equal error rate of 8% in my experiments > which, however, is comparable only to PCA not even to LDA or other > discriminative methods. > > I suspect two things, at least what face recognition is concerned. First, > most papers use a database were pleanty of images per client are available > for training, while I use only three. And second they perform identitfication > experiments, while I do verification. Anyhow, my code for constructing MACE > filters is a bit different from yours as I use training images of all > subjects to construct the filters. > > The code: > > %read files in the list called "ucn1" and do zero-mean-unit-variance > normalization > vector_size=10000; > number_of_training_images = 600; > Y=[]; > for i=1:number_of_training_images > X = double(imread(ucn1(i,:))); > x = reshape(X,[vector_size,1]); > means = mean(x); > vari = sqrt((sum((x-means).^2))/vector_size); > x = (x-means)/vari; > Y=[Y,x]; > end > Y=Y'; > > %transfrom to frequenca domain > im_hight = 100; > im_width = 100; > for i=1:number_of_training_images > X = reshape(Y(i,:),[im_hight,im_width]); > X_f = fft2(X); > X_f = reshape(X_f,[vector_size,1]); > Y_f(i,:)=X_f'; > end > Y_f = Y_f'; > > % MACE filter with all training images, result in "h" > counter=1; > X2 = Y_f; > D=mean((abs(X2)),2)); > faktor = repmat(1./D,1,number_of_training_images).*X2*inv((X2)'*(repmat(1./D, > 1,number_of_training_images).*X2)); > for i=1:3:number_of_training_images %I have three images per > subject > c=zeros(number_of_training_images,1); > c(i:i+2,1)=1; > h(:,counter) = (faktor*c); > counter=counter+1; > end > > %h now contains all the filters > > > > %for a test image > X = double(imread(ucn1(1,:))); > x = reshape(X,[vector_size,1]); > means = mean(x); > vari = sqrt((sum((x-means).^2))/vector_size); > x = (x-means)/vari; > X=reshape(x,[im_hight,im_width]); > out = real( ifftshift((ifft2(((fft2(X)).*(reshape(conj(h(:,1)),[im_hight, > im_width]))))))); > > > > I hope it the code will help you! > > Regards, > > hulijo > > > yonnas syams wrote: > >Hi everyone, > >I need help in Minimum Average Correlation Energy Filter > >(MACE)filter design.I am trying to make it according to > >http://s.i-techonline.com/Book/Face-Recognition/ISBN978-3-902613-03-5-fr26.pdf > > > >I think my program doesn't work well.When I apply it to the > >training image used, it's true that there is peak at the > >correlation output (positive or negative) peak.But when I > >apply the testing image(from the same class/person), there > >is no peak at all, and i think there's should be a peak. > >One more question,how to normalized the correlation output > >so in will be in range -1 to 1. > >Any help will be greatly appreciated. > > > >Here is my codes: > >%Filter Design > >% 3 iris input training , N=3 > >ans1=imread('001_1_1.bmp'); > >ans2=imread('001_1_2.bmp'); > >ans3=imread('001_1_3.bmp'); > >%change to domain frequency x[d1 d2] > >x1=fft2(im2double((ans1.hasil)); > >x2=fft2(im2double((ans2.hasil)); > >x3=fft2(im2double((ans3.hasil)); > >%change to vector kolom X[d 1] > >X1 =x1(:); > >X2 =x2(:); > >X3 =x3(:); > >%matrix X[d N] > >X=[X1 X2 X3]; > >%the output i wanted, 1 for authentic image > >u=[1 1 1]'; > >[d N]=size(X); > >%compute D, in the paper D is diagonal matrix, but not here > >because the result is the same > >D1 =X1 .* X1; > >D2 =X2 .* X2; > >D3 =X3 .* X3; > >D =(1/N*d) * (D1+D2+D3) ; > >%make inverse D > >for i=1:d > > D_inv(i,1)=1/D(i,1); > >end > >%a= inverse(ctranspose X[N d] * inverse D[d 1] * X[d N]) > >%temp[d N]=inv D[d 1] * X[d N] > >for i=1:d > > for j=1:N > > temp(i,j) = D_inv(i,1) * X(i,j); > > end > >end > >%a[N N]=inv(Xt[N d] * temp[d N]); > >a =inv(ctranspose(X) * temp); > >%h[d 1]=(inverse D[d 1] * X[d N])[d N] * a[N N] * u[N 1]; > >h =temp * a * u; > >%mace filter in domain frequency > >%change to the original size [d1 d2] > >[d1 d2]=size(x1); > >Hmace=reshape(h,d1,d2); > >save Hmace; > > > >%Aplly to Image > >iris=imread('001_2_1.bmp'); > >load Hmace; > >x=fft2(im2double(iris)); > >c=ifft2(x .* Hmace); > >figure, mesh(c) > > > >Note : My english is not so good, i am sorry ^_^ >
|
Pages: 1 Prev: line through a cylinder Next: making executable file from Guide GUI |