简体   繁体   中英

What does eigenfaces training set have to look like?

I am using python and openCV to create face recognition with Eigenfaces. I stumbled on a problem, since I don't know how to create training set.

Do I need multiple faces of people I want to recognize(myself for example), or do I need a lot of different faces to train my model?

First I tried training my model with 10 pictures of my face and 10 pictures of ScarJo face, but my prediction was not working well.

Now I'm trying to train my model with 20 different faces (mine is one of them).

Am I doing it wrong and if so what am I doing wrong?

You can do both, actually. If you look at the FaceRecognizer train method, it takes in two arguments. The first is a list of pictures. The second is a list of labels (integers) that correspond to the pictures. Use the labels to designate which pictures are which faces. So in your case of just pictures of yourself, the labels would be all the same (0). In the case where there are pictures of yourself and someone else is where it would really matter. For example here's what your labels might look like if you had pictures of both yourself and ScarJo

faces =  [scarjo_1, scarjo_2, me_1, me_2, scar_jo_3]
labels = [       0,        0,    1,    1,         0]

Notice how the last index in labels has a value of 0 ...the label which corresponds to ScarJo's face.

I later found the answer and would like to share it if someone will be facing the same challenges.

You need pictures only for the different people you are trying to recognise. I created my training set with 30 images of every person (6 persons) and figured out that histogram equalisation can play an important role when creating the training set and later when recognising faces. Using the histogram equalisation model accuracy was greatly increased. Another thing to consider is eye axis alignment so that all pictures have their eye axis aligned before they enter face recognition.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM