python第七天 人脸识别

2018-11-06  本文已影响0人  敏姐姐_e9d0

人脸识别(http://ai.baidu.com/tech/face

人脸识别1.png
from aip import AipFace
import base64
import pprint




APP_ID = ''
API_KEY = ''
SECRET_KEY = ''

aipFace = AipFace(APP_ID, API_KEY, SECRET_KEY)

filePath = ''#图片的位置和图片名称

def get_file_content(filePath):
    with open(filePath, 'rb') as fp:
        content = base64.b64encode(fp.read())
        return content.decode('utf-8')


imageType = "BASE64"

options = {}
options["face_field"] = "age,gender,beauty"



result = aipFace.detect(get_file_content(filePath), imageType, options)
print(result)
上一篇下一篇

猜你喜欢

热点阅读