From 551136969b89c8aa50ee42159bd2b954f6a7d76b Mon Sep 17 00:00:00 2001 From: pierreyvesbaloche Date: Thu, 12 Mar 2020 15:08:15 +0100 Subject: [PATCH] Choose recognition model for face detect As the default value is "recognition_01" for recognition model, it can be necessary to choose alternative value to match the model used in the Person Group / Faces settings. Otherwise, this could result in mistaches, generating "BadArgument 'recognitionModel' is incompatible." errors when performing identify calls. --- cognitive_face/face.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cognitive_face/face.py b/cognitive_face/face.py index 1860cf2..8d15a9a 100644 --- a/cognitive_face/face.py +++ b/cognitive_face/face.py @@ -7,7 +7,7 @@ from . import util -def detect(image, face_id=True, landmarks=False, attributes=''): +def detect(image, face_id=True, landmarks=False, attributes='', recognitionModel="recognition_01"): """Detect human faces in an image and returns face locations, and optionally with `face_id`s, landmarks, and attributes. @@ -23,7 +23,8 @@ def detect(image, face_id=True, landmarks=False, attributes=''): headPose, smile, facialHair, glasses, emotion, makeup, accessories, occlusion, blur, exposure, noise. Note that each face attribute analysis has additional computational and time cost. - + recognitionModel: [Optional] Specify the recognition model to use. + Returns: An array of face entries ranked by face rectangle size in descending order. An empty response indicates no faces detected. A face entry may @@ -35,6 +36,7 @@ def detect(image, face_id=True, landmarks=False, attributes=''): 'returnFaceId': face_id and 'true' or 'false', 'returnFaceLandmarks': landmarks and 'true' or 'false', 'returnFaceAttributes': attributes, + 'recognitionModel': recognitionModel, } return util.request(