szagoruyko / torch-opencv-demos

Torch7+OpenCV+ConvNets
167 stars 56 forks source link

Unknown predict face_recognition #9

Open bbhushan-ds opened 8 years ago

bbhushan-ds commented 8 years ago

Hi

We have predict functionality in face_recognition which somehow predict the person. But do we have unknown person functionality which person is not available in training?

Thanks BB

shrubb commented 8 years ago

You can insert an extra "person" into the gallery called "Unknown" and assign this label to all the unknown people. Or, if you want to experiment with the code, you may try other classifiers besides SVM.

bbhushan-ds commented 8 years ago

Thanks for reply.

Logically I would not have pic for unknown persons. Or is it beneficial to have unknown person label?

Second, could you please give me some idea how I can try other classifier besides svm? It would be great if you help me for this. I would appreciate.

Thanks BB

bbhushan-ds commented 8 years ago

Hi,

Do you have any idea how we can calculate the confidence in SVM. which will allow me to predict the unknown person. Thanks

shrubb commented 8 years ago

Sorry for delay.You may get the wrong thing with SVM's "confidences" (which are not really a natural thing for it). I suggest 2 alternatives:* Read this research on open set learning. For example, the 2011 article proposes two SVM modifications for that.* Try nearest neighbors instead of SVM. Make sure you have a decent number of samples, maybe even more than #gallerySize. When predicting, get the distance to the nearest neighbor. If it's greater than X, then yield "unknown". Choose X empirically.

bbhushan-ds commented 8 years ago

is there any simple way to find the nearest neighbors of a person. And how to get the distance while predicting. I am asking any working example in lua language.

Thanks Bharat Bhushan

shrubb commented 8 years ago

There's kNN implementation in OpenCV: http://docs.opencv.org/trunk/dd/de1/classcv_1_1ml_1_1KNearest.html