Skip to content
This repository was archived by the owner on Nov 8, 2021. It is now read-only.
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cognitive_face/face.py
Original file line number Diff line number Diff line change
Expand Up @@ -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='', recognition_model = 1):
"""Detect human faces in an image and returns face locations, and
optionally with `face_id`s, landmarks, and attributes.

Expand All @@ -23,6 +23,9 @@ 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.
recognition_model: [Optional] Choose which model to use. At this moment
there are two possibilites: 1 (the original model) or 2 (the updated
model). Both should be input as an integer.

Returns:
An array of face entries ranked by face rectangle size in descending
Expand All @@ -35,6 +38,8 @@ 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': "recognition_0"+str(recognition_model),
'returnRecognitionModel': 'true'
}

return util.request(
Expand Down