1

I have a python face recognition where I am using open-face model and SVM to detect and recognize faces. The general steps I am following to recognize image is below:

  1. Detect face using face detection model: Reason for using open face model instead of HAAR cascase is that cascade is not able to detect side face
  2. Extracting face embedding: Extracting the 128 d face embedding using open face model
  3. Training: Using SVM I am training the face embedding with appropriate label like below:

    params = {"C": [0.001, 0.01, 0.1, 1.0, 10.0, 100.0, 1000.0], "gamma": [1e-1, 1e-2, 1e-3, 1e-4, 1e-5]}

    model = GridSearchCV(SVC(kernel="rbf", gamma="auto", probability=True), params, cv=3, n_jobs=-1)

    model.fit(data["embeddings"], labels)

  4. Testing: Extracting the face embedding of the test image, and predicting the results like below:

model.predict_proba()

I have unknown random face dataset and known person face dataset. The problem here is that if I add around 30 known person image and if I have around 10 unknown person image, it is recognizing the known person fine but if any unknown person comes in, it is also recognizing that unknown person as known person with high confidence which in actual should be unknown.

If I add more random person in unknown data set lets say around 50 images and if I have 30 known person image. It is recognizing known person image fine but confidence is low and if any unknown person comes in, it is now recognized as unknown

It looks like for good face recognition results we need to have appox same number of known and unknown person image which is practically not possible as known person images can increase to 100 or more than that for each known person we add. I am very confused here and not sure what to do. Is there any other way of recognizing known/unknown persons. Please help. Thanks

2 Answers 2

1

It is normal that confidence decreases as the number of possible persons (number of labels) increases, as there are more possibilities. I'm trying to understand what you meant: you have a label for each person and then an additional label for unknown? That is not the way to go, as unknown is treated as any other person embedding. You should use a cutoff probability, and everything that falls below that is considered unknown.

Remember that there is a trade-off between the size of your prediction (more persons, more possibilities) and accuracy

Sign up to request clarification or add additional context in comments.

2 Comments

How can I decide upon cutoff probability. Do you have any link to article/code.?
Just compute the optimal value on your test data, by optimizing the unknown person detection rate in function of the cutoff probability. It is only one parameter so I would just set it manually. You could just compute HITS@k = (number of faces correctly classified as unknown)/(total numer of unknown face) for some values k or use any other more advanced metric. I don't immediately have any code or article, but I I found this thread on github that I think relates to your issue: [github.com/cmusatyalab/openface/issues/144 ]
1

I don't think svm will work well here. It is binary classifier by native. It will try to compute the border between two 128D points sets (known and unknown classes), but these classes are not internally connected with any relations. Known may be similar to unknown more than to another known in embedding space. That will be a problem for generalization for SVM. SVM may be used on closed sets, but you have open set for unknown faces.

It is more practical to use non-parametric methods, and use Bayesian approach, computing likelihoods as function of distance for known data in embedding space. Like in your previous question.

5 Comments

May be this byclb.com/TR/Tutorials/neural_networks/ch11_1.htm there is also good book. Bishop "machine learning and pattern recognition".
You will have the same thresholds for all your known points as in your previous post. The rule is: distance > threshold for all photos of known persons -> unknown
This also may be useful: arxiv.org/pdf/1810.11160.pdf
Hi Andrey, one quick thing wanted to know. As you said that svm will not work well here. By this you did you mean that we can still use it for training purpose but cannot use it to predict. Or its not even good for training as well.?
SVM may be used for face recognition task. When you have fixed set of pesons and not need to identify unknown ones. Because SVM divides all available spaca by class regions, no unclassified regions in embedding space remains. So, there are stages to make recognizer: train feature space (very large DS) ( you have it done ), compute threshold (large DS), use your small DS to compute distances to quired face. If dist < thres, these faces are same. If no mathcing DS face, then it unknown.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.