question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to set a threshold for a realtime recognition

See original GitHub issue

Hello!I have already learned some principle of face-net and how your code work. But I have some question about the classifier.In the classifier.py and a threshold question . Classifier, it used SVC classifier.And when I looking for “predict_proba” I find a probability option.So I looking for some code about libsvm_sparse.libsvm_sparse_predict_proba. But I couldn`t find any code about how this probability work out. I just supposed it was a reflection of distance which refer to the input to each class.(?) So when I worked with a recognition program(based on your real time recogntion),it came out a quesiton.I trained 6 classes and because the principle,when a untrained input was recognized,facenet will found the most close class. To avoid this problem,I have two solutions. First is to set a “others” class, which contained ,for example,50 different people(DIFFERENT,because I want any un trained input was more close to the class “other” than classes I trained.In fact I used a Chinese face dataset called cas-peal - The PEAL Face Database. I used 300 pics for train and 300 pics for test(not a reasonable propotion),all of those pics are different from each other),and 10 pics for each man i want to train.After test by the test dataset ,i works perfect,all of those 300 test pics signed to be “other” class.But it will not work when i chose some one who looks like the trained class.I wondered if i will works when the other class was more strong like contain 10000 different pics which was not in the people i want to recognized. Second is to set a threshold to the propability/score the SVC figured. But how to calculate this threshold is the question.I read some papers and learned about F1,ROC.But I when i make test, all of test pics was recognized correct. Is that my test data are short or there is another way out to set this threshold?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:25

github_iconTop GitHub Comments

3reactions
priyakansalcommented, Jun 11, 2018

@skyWalker1997 I am working on my own dataset. So, should I add this “Untrained folder” with some images not in my range of recognition in my training image directory while training the classifier? eg. Training image directory should be structured as follows:

Person A A1.jpg A2.jpg . . . An.jpg

Person B B1.jpg B2.jpg . . . Bn.jpg

UNTRAINED any random image 1.jpg any random image 2.jpg . . . .

1reaction
priyakansalcommented, Oct 22, 2018

@susmith98 the “untrained class” here means that you can add one more category of totally random faces as “unknown category” to train the model. So when you will use this model to classify the unknown face (which you have not trained) , it will classify that face as unknown. I hope it would help you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fine Tuning The Threshold in Face Recognition
We will classify two face photos as same person if the distance is less than a threshold value. The question is that how...
Read more >
The Secret to Better Face Recognition Accuracy: Thresholds
Depending on your needs, you can set a threshold number between 0 and 1 where any value above that threshold would be considered...
Read more >
Fine Tuning The Threshold in Facial Recognition with Python
Face recognition models are regular convolutional neural networks. These models are responsible to represent face images as vectors.
Read more >
How to add Decision Threshold tuning to your end to end ML ...
In this article, I will introduce you to two packages I use when working with imbalanced data (imblearn, although I also use it...
Read more >
Decision Threshold In Machine Learning - GeeksforGeeks
What is Decision Threshold ? sklearn does not let us set the decision threshold directly, but it gives us the access to decision...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found