diff --git a/doc/tutorials/dnn/dnn_face/dnn_face.markdown b/doc/tutorials/dnn/dnn_face/dnn_face.markdown index e5092b8b92e8..202be3e0e302 100644 --- a/doc/tutorials/dnn/dnn_face/dnn_face.markdown +++ b/doc/tutorials/dnn/dnn_face/dnn_face.markdown @@ -12,7 +12,7 @@ ## Introduction -In this section, we introduce the DNN-based module for face detection and face recognition. Models can be obtained in [Models](#Models). The usage of `FaceDetectorYN` and `FaceRecognizer` are presented in [Usage](#Usage). +In this section, we introduce the DNN-based module for face detection and face recognition. Models can be obtained in [Models](#Models). The usage of `FaceDetectorYN` and `FaceRecognizerSF` are presented in [Usage](#Usage). ## Models @@ -58,8 +58,8 @@ x1, y1, w, h, x_re, y_re, x_le, y_le, x_nt, y_nt, x_rcm, y_rcm, x_lcm, y_lcm Following Face Detection, run codes below to extract face feature from facial image. ```cpp -// Initialize FaceRecognizer with model path (cv::String) -Ptr faceRecognizer = FaceRecognizer::create(model_path, ""); +// Initialize FaceRecognizerSF with model path (cv::String) +Ptr faceRecognizer = FaceRecognizerSF::create(model_path, ""); // Aligning and cropping facial image through the first face of faces detected by dnn_face::DNNFaceDetector Mat aligned_face; diff --git a/samples/dnn/face_match.py b/samples/dnn/face_match.py index b36c9f6367af..916c76abf1e8 100644 --- a/samples/dnn/face_match.py +++ b/samples/dnn/face_match.py @@ -38,20 +38,20 @@ face2_align = recognizer.alignCrop(img2, face2[1][0]) # Extract features -face1_feature = recognizer.faceFeature(face1_align) -face2_feature = recognizer.faceFeature(face2_align) +face1_feature = recognizer.feature(face1_align) +face2_feature = recognizer.feature(face2_align) # Calculate distance (0: cosine, 1: L2) cosine_similarity_threshold = 0.363 -cosine_score = recognizer.faceMatch(face1_feature, face2_feature, 0) +cosine_score = recognizer.match(face1_feature, face2_feature, 0) msg = 'different identities' if cosine_score >= cosine_similarity_threshold: msg = 'the same identity' print('They have {}. Cosine Similarity: {}, threshold: {} (higher value means higher similarity, max 1.0).'.format(msg, cosine_score, cosine_similarity_threshold)) l2_similarity_threshold = 1.128 -l2_score = recognizer.faceMatch(face1_feature, face2_feature, 1) +l2_score = recognizer.match(face1_feature, face2_feature, 1) msg = 'different identities' if l2_score <= l2_similarity_threshold: msg = 'the same identity' -print('They have {}. NormL2 Distance: {}, threshold: {} (lower value means higher similarity, min 0.0).'.format(msg, l2_score, l2_similarity_threshold)) \ No newline at end of file +print('They have {}. NormL2 Distance: {}, threshold: {} (lower value means higher similarity, min 0.0).'.format(msg, l2_score, l2_similarity_threshold))