OpenCV face detection and face recognition

1. Description

Yesterday (2021/10/20), the official account of the OpenCV team released an article like "Use OpenCV's built-in deep learning face module to easily complete face detection and recognition with a few lines of code" .

The latest version of OpenCV 4.5.4 includes a face module based on deep learning neural network (hereinafter referred to as "OpenCV DNN Face"), including face detection (using the model YuNet, contributed by the OpenCV China team) and face recognition ( Use the model SFace, contributed by the research group of Professor Deng Weihong of Beijing University of Posts and Telecommunications).

Using the OpenCV DNN Face API, only a few lines of code can complete the entire face detection and face recognition processing, which greatly facilitates development.

Today (2021/10/21) I downloaded the latest OpenCV4.5.4, found an example of face detection and face recognition, tried it, it is really simple, and now record it.

Two, example

Examples are in opencv-4.5.4\sources\samples\dnn the directory
face detection: face_detect.cppor face_detect.py
face recognition: face_match.cpporface_match.py

For versions after opencv4.6, face detection and face recognition are both in face_detect.cppor face_detect.pyinside

3. Model

Face detection model: https://docs.opencv.org/4.5.4/df/d20/classcv_1_1FaceDetectorYN.html The first line of this page,
or this link to download: face_detection_yunet

Face recognition model: https://docs.opencv.org/4.5.4/da/d09/classcv_1_1FaceRecognizerSF.html The first line of this page,
or this link to download: face_recognition_sface

Guess you like

Origin blog.csdn.net/Jay_Xio/article/details/120885087