# Training Haar Cascades to recognise 1 face

**URL:** <https://forum.opencv.org/t/training-haar-cascades-to-recognise-1-face/1805>\
**Category:** Uncategorized\
**Tags:** opencv\_traincascade, face, objdetect\
**Created:** [February 25, 2021, 1:54pm UTC](https://forum.opencv.org/t/training-haar-cascades-to-recognise-1-face/1805 "2021-02-25T13:54:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MagnusBC98](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@MagnusBC98](https://forum.opencv.org/u/MagnusBC98)\
**Post date:** [February 25, 2021, 1:54pm UTC](https://forum.opencv.org/t/training-haar-cascades-to-recognise-1-face/1805/1 "2021-02-25T13:54:00Z")

</div>

I want to train an algorithm to detect only my face and no others. I am planning to do this by training a Haar cascade file with the positive images being just images of my face and probably have various other faces and objects as the negatives - would this be a good approach? I have seen various tutorials on training cascade files for object detection, for example a phone or a watch, but none for specific facial recognition. Any advice would be much appreciated!

---

<div class="post-metadata">

**Author:** ![kbarni](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/kbarni/32/26_2.png) [@kbarni](https://forum.opencv.org/u/kbarni)\
**Post date:** [February 25, 2021, 2:17pm UTC](https://forum.opencv.org/t/training-haar-cascades-to-recognise-1-face/1805/2 "2021-02-25T14:17:42Z")

</div>

Haar filters detect dark/light patterns in the image (like a vertical dark/light/dark pattern for eye/nose/eye area); it is not suited for face recognition.  
For face recognition methods in OpenCV refer to this [document](https://docs.opencv.org/3.4/da/d60/tutorial_face_main.html).

Note that the computer doesn’t _learn_ your face for recognition, it _learns to make the difference_ from other faces. So it’s best to use an available face database with your face added to it for training. The document above details this aspect, too.

---

<div class="post-metadata">

**Author:** ![MagnusBC98](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@MagnusBC98](https://forum.opencv.org/u/MagnusBC98)\
**Post date:** [February 25, 2021, 3:50pm UTC](https://forum.opencv.org/t/training-haar-cascades-to-recognise-1-face/1805/4 "2021-02-25T15:50:43Z")

</div>

Thanks for your reply, I will give this approach a go
