davidsandberg / facenet

Face recognition using Tensorflow
MIT License
13.76k stars 4.81k forks source link

How to judge a stranger in my dataset? #622

Open Tomhouxin opened 6 years ago

Tomhouxin commented 6 years ago

. I want to achieve real_time_face_recognition py, it mistook a stranger people in the dataset, it should be the most similar as the stranger in the dataset, then how should I process to determine the stranger unknowner? Thank you very much

Shahnawazgrewal commented 6 years ago

Can you please rephrase your question. @Tomhouxin

Tomhouxin commented 6 years ago

When I was doing face recognition, I found that I could only recognize faces in data sets. The problem is when I identify a face that is not in the data set. It actually discriminates me into the most similar human face in a dataset, not a stranger. @Shahnawazgrewal

Shahnawazgrewal commented 6 years ago

for previously unseen identities, you need to extract embedding and then a train classifier to recognize. @Tomhouxin

Tomhouxin commented 6 years ago

According to my understanding, I just need to decide that people I don't know are strangers, and I don't need to put them into the classifier. @Shahnawazgrewal

jax79sg commented 6 years ago

Maybe find out the distribution of confidence levels of different classes for unknown faces. Then from there, see if can come up with a heuristic to determine if its unknown.

Tomhouxin commented 6 years ago

You have a good idea, but people you know and people you don't know are very similar in terms of SVM classification results. @jax79sg

RedBugYO commented 6 years ago

@Tomhouxin How about create a category called as "unknown" and put a lots of face image which you don't have to classify in it then re-train the classifier? I think it may make the classifier better for usage.

Tomhouxin commented 6 years ago

This problem is solved by setting a threshold for the results of the classifier. At the very beginning, I saw that the results of the classification were very close, and there was no threshold. Now when I train the classifier, I add about 100 faces to each person. The result of the classification is obviously different, and then you can set the threshold.(这个问题解决了,把分类器出来的结果设一个阈值。最开始我看分类的结果都很接近,无法设阈值。现在我训练分类器的时候每人加到100张人脸左右。分类出来的结果就很明显有差距了,这时候就可以设阈值) @RedBugYO

niu-niu commented 6 years ago

@Tomhouxin try other classifier, if you find the classification results are very close to each other.

jiangzidong commented 6 years ago

hi @Tomhouxin What does the "threshold" mean in the SVM classifier? 1) check the probability by model.predict_proba(emb), if the max one is below a threshold, then it is a stranger? or 2) add a new class called "unknown" in to the classifier?

DawnHH commented 6 years ago

@Tomhouxin 所以你还是增加了一个新类叫stranger吗?和embedding预测的类别相似度小于阈值的都被分类为这个类别里?

rain2008204 commented 6 years ago

@DawnHH only add a threshold

Tomhouxin commented 6 years ago

@DawnHH yes

menon92 commented 6 years ago

Hello @Tomhouxin , Did you solve your problem ?

Tomhouxin commented 6 years ago

@menon92 , yes !

menon92 commented 6 years ago

Thanks @Tomhouxin Could you please help me that how can I do this. I have the same problem. I try to calculate `l2 distance' of two image. But it's not working well

Thanks

Tomhouxin commented 6 years ago

sorry,I'm not sure how good it is to calculate the distance. I'm using the classifier (SVM), but I'm also going to try to calculate the distance directly

menon92 commented 6 years ago

@Tomhouxin Do you just use classifier (SVM) prediction with a fix threshold to judge a stranger ?

Tomhouxin commented 6 years ago

@menon92 ,yes ,you are right

menon92 commented 6 years ago

@Tomhouxin But it's not working for me. what could be the cause of it . However my image quality is not very good

Tomhouxin commented 6 years ago

I don't know exactly what your question is, can't you find the appropriate threshold?

menon92 commented 6 years ago

@Tomhouxin Yes, I can't find the appropriate threshold for classifying the unknown images.

Tomhouxin commented 6 years ago

Well, please read the comments carefully. They say how to solve it.

ZhangYuef commented 5 years ago

hi @Tomhouxin What does the "threshold" mean in the SVM classifier? 1) check the probability by model.predict_proba(emb), if the max one is below a threshold, then it is a stranger? or 2) add a new class called "unknown" in to the classifier?

I think their method is as the same as the first one you mentioned.