Project 4: Eigenfaces for recognition

This project seemed to start okay. I got my eigenfaces and they looked like faces which led me to believe I was on the right track. I implimented the faster method of getting the eigenfaces which sped up the experiments. I wasn't able to project any faces very well, but I assumed I must be close to the solution because I had implemented the sped up eigenface computing method and would be able to compute new sets quickly.

Average Face:

eigenfaces:


main --eigenfaces 24 80 80 faceImages\class_images\nonsmiling_cropped\list.txt efaces

I ran a batch script to project each face onto the eigenfaces using the set described in the writeup 25x25 and 10 eigenfaces. The mse values ranged from approximately 695 to 2900. Those values were much higher than other students had and I began to realize that, in spite of having face-like eigenfaces, I had definitely taken a wrong turn somewhere.

To test face recognition, I computed a userbase and wrote a batch file with commands like the following for each smiling faced image:

main --recognizeface faceImages\class_images\smiling_cropped\01.tga userbase efaces 5

The results (full text in rec.txt):

Image
closest to:right
1v2: 10215.55

MSE:8376.35

MSE:18591.9

MSE:30185.9

MSE:33031.5

MSE:40517.4
Image
closest to:wrong
1v2: 37118.4
actual match not present

MSE:13761.3

MSE:50879.7

MSE:75091.5

MSE:77537.6

MSE:77870.3
Image
closest to:right
1v2: 26040.9

MSE:15718.1

MSE:41759

MSE:45028.9

MSE:46033

MSE:50721.1
Image
closest to:wrong
1v2: 6766.06
actual match ranked 3rd

MSE:8486.34

MSE:15252.4

MSE:22596.9

MSE:31642.9

MSE:39989.9
Image
closest to:right
1v2: 6796.4

MSE:30333.1

MSE:37129.5

MSE:44800.1

MSE:47175.5

MSE:60098.2
Image
closest to:wrong
1v2: 27791.1
actual match 2nd in the list

MSE:34407.6

MSE:62198.7

MSE:65019.6

MSE:93575.9

MSE:106346
Image
closest to:wrong
1v2: 13585.9
actual match not in list

MSE:23047.1

MSE:36633

MSE:37055.9

MSE:39730.8

MSE:41585.8
Image
closest to:right
1v2: 5074.7

MSE:61287.9

MSE:66362.6

MSE:66549.9

MSE:93916.8

MSE:103002
Image
closest to:right
1v2: 10299.7

MSE:47389.5

MSE:57689.2

MSE:58617.3

MSE:61105

MSE:61337.5
Image
closest to:right
1v2: 11766.03

MSE:8750.27

MSE:20516.3

MSE:46190.5

MSE:54908.7

MSE:56349.9
Image
closest to:wrong
1v2: 8203.7
actual match 2nd in list

MSE:18183.9

MSE:26387.6

MSE:43543.6

MSE:45512.9

MSE:51892.2
Image
closest to:right
1v2: 42445.3

MSE:14850.9

MSE:57296.2

MSE:62271.9

MSE:77948.5

MSE:78527
Image
closest to:wrong
1v2: 1913.8 actual match 2nd in list

MSE:24933.5

MSE:26847.3

MSE:42538.3

MSE:43397.6

MSE:52327.6
Image
closest to:wrong
1v2: 12312.7
actual match not in the list

MSE:17377.2

MSE:29689.9

MSE:39314.2

MSE:45674.2

MSE:53371.7
Image
closest to:right
1v2: 18792.97

MSE:4827.53

MSE:23620.5

MSE:35549.2

MSE:39465.6

MSE:55694
Image
closest to:right
1v2: 9831

MSE:28822.4

MSE:38653.4

MSE:39527.7

MSE:42273.2

MSE:44531.6
Image
closest to:right
1v2: 20199

MSE:31223

MSE:51422.9

MSE:54461.3

MSE:58734.1

MSE:59411.1
Image
closest to:wrong
1v2: 2679
actual match not in the list

MSE:47233.8

MSE:49912.4

MSE:80947.6

MSE:82772.1

MSE:90021.5
Image
closest to:right
1v2: 30104.8

MSE:11692.6

MSE:41796.8

MSE:48872.8

MSE:57370.4

MSE:58674.1
Image
closest to:right
1v2: 71770.6

MSE:15598.3

MSE:87368.9

MSE:93317.9

MSE:97798.7

MSE:97972.7
Image
closest to:right
1v2: 43487.8

MSE:6287.8

MSE:49775.6

MSE:90381.3

MSE:92695.2

MSE:112887
Image
closest to:wrong
1v2: 3561.8
actual match not in the list

MSE:26639.6

MSE:30201.4

MSE:60129.3

MSE:65613.5

MSE:66487.1
Image
closest to:right
1v2: 44617.5

MSE:18157.6

MSE:62775.1

MSE:71957.3

MSE:83668.9

MSE:99936.2

14 out of 25 smiling faces correctly matched to nonsmiling faces. 56% accurracy as expected.

other matching trials

# eigenfacescorrect matches out of 25
38
511
713
914
1114
1315
1515
1716
1917
2118
2318

The trend is solidly positive, and there was no appreciable performance difference. These results seem to indicate that more eigenfaces leads to better results for recognizing faces.

what goes wrong?

Of the 11 rows in the above table showing smiling faces that were not recognized correctly, 5 show that the correct match for the smiling face was not even in the list. The other six have the correct match in the top 5, but in no case was the right face in the number 2 slot.

All but one of the people wearing glasses in both pictures were recognized correctly. The software seems to do much better when there are some particularly distinctive features

Verify Faces

To test the verify face functionality. I worte an additional main command verifyFaces() that loops through all of the images testing each against all others at various different mse values and records the number of false negatives and false positives.

mse thresholdcorrectly verifiedfalse positivesfalse negatives
6000551124
16000556218
26000554715
360005481711
46000537327
56000520497
66000498726
76000473985
860004611123
960004471263

a threshold of 23000 mse seems to strike the best balance between false positives and false negatives, but 7 false positives in a set of only 25 people is not very good for any kind of security system. Maybe with more training images, it could be reliable enough to work in conjunction with conventional security measures

find faces

my find faces functionality didn't work at all.

I went over my code with other students repeatedly and couldn't find where I was going wrong. What really surprised me, was that after trying and repeatedly failing to get the find faces feature to work, my recognizeFace function worked just as well as other students who had working findFace functions. I would have done better to start my testing with the other features.