diff --git a/aip/face.py b/aip/face.py index 58c4538..aa347db 100644 --- a/aip/face.py +++ b/aip/face.py @@ -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): @@ -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): """ 人脸注册 @@ -298,4 +316,4 @@ def match(self, images): return self._request(self.__matchUrl, json.dumps(images, ensure_ascii=False), { 'Content-Type': 'application/json', - }) \ No newline at end of file + })