DiegoHerrera262/Correlation-Techniques-for-Face-Recognition

Check MACE Filter and Implement program in MATLAB

Closed this issue · 10 comments

From the reference book find out the algorithm for the construction of the MACE filter and wrtie the actual code to build it using MATLAB. Follow checklist

  • Optimize matrix multiplication for faster filter synthesis.
  • Evaluate different sizes of reference images and possibly pooling.
  • Evaluate PCE for the reference images and some test images.
  • Asses accuracy using at least 20 images.

I tried computing the MACE filter and the MATLAB program took about 5 seconds. However, the output of the correlation is poor even for sample images. The way the filter is computed and its pertienence must be addressed in a fundamental level.

Checked whether the problem with correlation computation was the resizing of the image vector and discovered that was not the issue. The resize is ok, and the image is not distorted. However, I found out that in order to observe a peak, one has to apply fftshift to the ifft2 and not on the fft2.

In order to avoid confusion, I recommend not to conjugate the filter before computing correlation using fft2

I checked with the MACE of one reference image, and there is a sharp peak when convolved with its corresponding reference image. However, the intensity is reduced, probably because of the division by the power spectrum of the image. A sample output is in the images directory.

Added normalization to training images but performance is not adequate. To sensitive to intensity variations.

Due to the strange results, I decided to asses my previous work. One of the fundamental steps on computing correlation was using the DFT. I included a sqrt function in addition to the actual computation of correlation. So, the core of the computation was something like:

selfcorB = abs(fftshift(...
    ifft2(sqrt(fftim1 .* conj(fft_sample)))));

The issue is that this correlation always produces a sharp peak, even when images are very different. As the figures bellow show:

This taken with similar images
Captura de Pantalla 2020-05-23 a la(s) 5 15 28 p  m

"This taken with very different images"
Captura de Pantalla 2020-05-23 a la(s) 5 17 49 p  m

This correlation is computed between to images, no filter used. One might be inclined to believe that the PSE metric would decide the match and that's it. However:

  1. One must account for different face planes in order to make a robust application.
  2. One must account for different illumination conditions.

So, using sqrt is not enough. However, that function clearly creates a sharper correlation distribution. First need to see how the computation of the MACE affects the correlation output without adding sqrt, see if it sharpens the correlation, and then asses whether including the former function is appropriate or not.

So, I set to identifying the correct way to compute the correlation with the MACE. I computed a 1-Sample MACE Filter using sample1.png from my database. The computation was something like this:

x = fftim1(:);                  % Column vector with image
D = x .* conj(x);               % Average Spectrum
iDx = x .* (1.0 ./ D);          % D^{-1}X
MACE = iDx / (conj(x') * iDx);  % MACE Filter formula
% Resize for correlation computation
MACE = reshape(MACE,orgsize(1),orgsize(2));

I computed the selfcorrelation using the definition, the sqrt and the MACE. Below I include the results:

Captura de Pantalla 2020-05-23 a la(s) 5 43 51 p  m

So the MACE is quite sharp, even sharper than the sqrt. It looked promissing. But the real challenge was seeing no peak when the image is not similar at all to the filter. I captured a snapshot of the cover of a random notebook and computed the correlation. The results are shown bellow:

Captura de Pantalla 2020-05-23 a la(s) 5 53 26 p  m

It seems to me that the results are consistent. Then I combined sqrt and MACE. The results are shown below.

Captura de Pantalla 2020-05-23 a la(s) 5 56 50 p  m

As is evident, the sqrt sharpens the function even when it is not desirable. That might be the reason why the filter was not working properly before. The main conclusion of this exploration is to compute correlation with MACE, but without sqrt

I tested the MACE filter of 1 sample and the full MACE filter with the database, correlating with a snapshot of my face. The results are shown bellow.

Captura de Pantalla 2020-05-23 a la(s) 7 11 31 p  m

A peak is visible for the 1 sample MACE. However, for the full MACE, the results are not good at all. This suggests the following:

  1. The database of training images is not good enough. It must be limited to the facial region, and not include background.
  2. The filter is still not robust in terms of intensity, and this has to be corrected.

Tried with a completely random notebook cover, and a peak somewhat reminiscent of the one seen when trying a picture of my face, i.e. true class. So, perhaps the peak is not representative.

Used 1-Sample Filter for PSE computation and obtained baffling results. On one hand, the height of the peak for the selected training sample is independent of the image chosen for the filter synthesis. However, for other images, the correlation output is quite noisy. I notice that the peak intensity is quite lower for training images that are not the training sample. Included a set of false class images that wildly differ from the training set. Although there was no visible peak, the correlation output was still very noisy. This is a huge drawback, specially for the training set.

Captura de Pantalla 2020-06-05 a la(s) 5 45 23 p  m

Read a bit more about the MACE Filter, and found that MACE is quite sensitive to built-in noise and intraclass variation. That implies that some de-noising algorithm must be added to the filter synthesis, and the training set data has to be acquired in very good illumination conditions. With the PSE computation routine ad obtained not very good results.

Captura de Pantalla 2020-06-05 a la(s) 5 53 46 p  m

Used a window of roughly 80% the size of the image for PSE computation. In most of the cases, the training set has higher PSE than members of the impostor class. However, the separation between the curves is not large enough for a good verification. Even in some cases, the PSE of the false class images is higher. For illustration, I show the 13th images of the set. This shows that it sim important to reduce the noise in the correlation plane.

I also include the output for the best performing image in the training set. The peak is quite intense, and the noise i visible reduced. However, the noise still ruins the metric. Interestingly, the fake image includes a face.

Captura de Pantalla 2020-06-05 a la(s) 6 15 18 p  m

Captura de Pantalla 2020-06-05 a la(s) 6 13 07 p  m

Conclusion

The preprocessing of the images is important to reduce the noise in the correlation output. Even though the MACE produces somewhat sharp peaks for similar images, the noise in the correlation plane spoils the PSE metric. Noise robustness must be included by upgrading to a MINACE filter or a MACH filter if preprocessing does not improve results.