Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update face.py #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all 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
20 changes: 19 additions & 1 deletion aip/face.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class AipFace(AipBase):
__personVerifyUrl = 'https://aip.baidubce.com/rest/2.0/face/v3/person/verify'

__videoSessioncodeUrl = 'https://aip.baidubce.com/rest/2.0/face/v1/faceliveness/sessioncode'

__multisearchUrl = 'https://aip.baidubce.com/rest/2.0/face/v3/multi-search'


def detect(self, image, image_type, options=None):
Expand Down Expand Up @@ -83,6 +85,22 @@ def search(self, image, image_type, group_id_list, options=None):
'Content-Type': 'application/json',
})

def multisearch(self, image, image_type, group_id_list, options=None):
"""
M:N人脸搜索
"""
options = options or {}

data = {}
data['image'] = image
data['image_type'] = image_type
data['group_id_list'] = group_id_list

data.update(options)
return self._request(self.__multisearchUrl, json.dumps(data, ensure_ascii=False), {
'Content-Type': 'application/json',
})

def addUser(self, image, image_type, group_id, user_id, options=None):
"""
人脸注册
Expand Down Expand Up @@ -298,4 +316,4 @@ def match(self, images):

return self._request(self.__matchUrl, json.dumps(images, ensure_ascii=False), {
'Content-Type': 'application/json',
})
})