Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can find a section on setting thresholds in the documentation on <code>cv::FaceRecognizer</code> at:</p> <ul> <li><a href="http://docs.opencv.org/trunk/modules/contrib/doc/facerec/facerec_api.html#setting-the-thresholds" rel="nofollow">http://docs.opencv.org/trunk/modules/contrib/doc/facerec/facerec_api.html#setting-the-thresholds</a></li> </ul> <p>It works just the same for the OpenCV Python Wrapper, which you can easily see when calling <code>help(cv2.createFaceRecognizer)</code> in Python:</p> <pre class="lang-none prettyprint-override"><code>Help on built-in function createEigenFaceRecognizer in module cv2: createEigenFaceRecognizer(...) createEigenFaceRecognizer([, num_components[, threshold]]) -&gt; retval </code></pre> <p>So in the code you would create the model with a threshold, I'll set it to <code>100.0</code>. Anything below this will yield <code>-1</code> in the prediction, which means this face is <code>unknown</code>:</p> <pre><code># Create the Eigenfaces model. We are going to use the default # parameters for this simple example, please read the documentation # for thresholding: model = cv2.createEigenFaceRecognizer(threshold=100.0) </code></pre> <p>As shown in the demo, you can get the prediction and associated confidence (which is the distance to the nearest neighbor in the your training dataset) with:</p> <pre><code>[predicted_label, predicted_confidence] = model.predict(image) </code></pre> <p>So if you train your model on the subjects <code>A</code>, <code>B</code>, <code>C</code> <strong>AND</strong> you are using a threshold, then a prediction for <code>D</code> should yield <code>-1</code>, while <code>A</code>, <code>B</code> or <code>C</code> should be recognized. Given the fact, that you are using a threshold. </p> <p>As for adding new faces iteratively without re-estimating the whole model. This is not possible for the Eigenfaces or Fisherfaces method. You always have to call <code>FaceRecognizer::train</code> for these two algorithms to learn the model. The Local Binary Patterns Histograms (LBPH) model, which you can create with <code>cv2.createLBPHFaceRecognizer</code>, supports updating a model without recalculating the other training samples. See the API Documentation on this:</p> <ul> <li><a href="http://docs.opencv.org/trunk/modules/contrib/doc/facerec/facerec_api.html#facerecognizer-update" rel="nofollow">http://docs.opencv.org/trunk/modules/contrib/doc/facerec/facerec_api.html#facerecognizer-update</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload