How to set a threshold for a realtime recognition
See original GitHub issueHello!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:
- Created 5 years ago
- Comments:25
Top GitHub Comments
@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 . . . .
@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.