# How to compute for the accuracy in LBPH Face recognition

**URL:** <https://forum.opencv.org/t/how-to-compute-for-the-accuracy-in-lbph-face-recognition/10997>\
**Category:** Python\
**Created:** [November 16, 2022, 6:41pm UTC](https://forum.opencv.org/t/how-to-compute-for-the-accuracy-in-lbph-face-recognition/10997 "2022-11-16T18:41:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mist](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@mist](https://forum.opencv.org/u/mist)\
**Post date:** [November 16, 2022, 6:41pm UTC](https://forum.opencv.org/t/how-to-compute-for-the-accuracy-in-lbph-face-recognition/10997/1 "2022-11-16T18:41:38Z")

</div>

I made a face recognition system that takes 300 images of individuals. As of now there are probably 5 persons in the local dataset that I have which contains 1,500 images. The prediction values if it is on multi faces play around 50-90% from a live feed. I would like to compute the accuracy of the face recognition in multi faces. I saw threads about TP? or True positives. And I am having difficulty understanding it. Is there like a layman’s term for computation of the accuracy? I am sorry if I sound really dumb, which I am. For added reference if needed I did not download any other dataset.

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [November 18, 2022, 11:32am UTC](https://forum.opencv.org/t/how-to-compute-for-the-accuracy-in-lbph-face-recognition/10997/2 "2022-11-18T11:32:04Z")

</div>

here, it’s as simple as:

```
accuracy = correct_predictions / all_predictions

```

also, setting up a _confusion matrix_, where you have “predicted” id’s on the columns and “expected” ids on the rows, will be quite useful:

```
conf = np.zeros((nclasses, nclasses))
#for each prediction:
    conf[predicted, expected] += 1
...
print(conf)

```

which should result in something like:

```
20 0 0 3 0 
2 10 0 0 0
0 0 16 0 0
1 2 0 20 0
0 0 0 0 20

```

(“true positives” are on the diagonal)

> [@mist](#):
>
> I saw threads about TP? or True positives. And I am having difficulty understanding it.

those terms are hard to apply in the multi-person, _identification_ setup here, e.g. there are no “false negatives” at all, while it makes a lot of sense for a _verification_ task (image a & b show the same person ?)

> [@mist](#):
>
> For added reference if needed I did not download any other dataset.

unclear, what do you mean, please ?
