参考地址百度ai

from aip import AipFace
import base64

""" 你的 APPID AK SK """
APP_ID = '你的 App ID'
API_KEY = '你的 Api Key'
SECRET_KEY = '你的 Secret Key'

client = AipFace(APP_ID, API_KEY, SECRET_KEY)

f = open(r'%s' % './images/hu1.jpg', 'rb')
pic = base64.b64encode(f.read())
image = str(pic, 'utf-8')

imageType = "BASE64"

""" 如果有可选参数 """
options = {}
options["face_field"] = "age,beauty,gender"
options["max_face_num"] = 10
options["face_type"] = "LIVE"

""" 带参数调用人脸检测 """
a = client.detect(image, imageType, options)

for item in a['result']['face_list']:
    print("年龄:",item['age'],"容貌评分:",item['beauty'],"性别:",item['gender'])

检测这张图片

python人脸试别——人脸检测(百度ai)

结果

python人脸试别——人脸检测(百度ai)

 

 

 

相关文章:

  • 2021-12-30
  • 2022-12-23
  • 2021-12-04
  • 2021-12-04
  • 2021-12-03
  • 2021-07-08
  • 2021-05-11
猜你喜欢
  • 2021-10-17
  • 2021-05-06
  • 2022-12-23
  • 2021-12-19
  • 2021-04-09
  • 2021-06-20
  • 2021-04-17
相关资源
相似解决方案