提示“no module named aip ”
工作就是可是你 发布于2018-07 浏览:11243 回复:4
0
收藏

提示错误·“no module named aip ” 怎么解决?

收藏
点赞
0
个赞
共4条回复 最后由用户已被禁言回复于2022-04
#6用户已被禁言回复于2019-10
#5 王小菲356回复
[代码]

你好,人脸识别问题请在人脸论坛咨询交流 https://ai.baidu.com/forum/topic/list/165

0
#5王小菲356回复于2019-10
#人脸识别
from aip import AipFace
import cv2
# 定义常量
APP_ID = '10736496'
API_KEY = 'xLwFVx76ZmGujNxFGSGp8wUc'
SECRET_KEY = 'H6jpVPX3wRdcxKf59r0qoGvG6zfHnMEk'


# 初始化AipFace对象
aipFace = AipFace(APP_ID, API_KEY, SECRET_KEY)

# 读取图片
filePath = "5.jpg"
def get_file_content(filePath):
    with open(filePath, 'rb') as fp:
        return fp.read()

# 定义参数变量
options = {
    'max_face_num': 1,
    'face_fields': "age,beauty,expression,faceshape",
}
# 调用人脸属性检测接口
result = aipFace.detect(get_file_content(filePath),options)

# 解析位置信息
location=result['result'][0]['location']
left_top=(location['left'],location['top'])
right_bottom=(left_top[0]+location['width'],left_top[1]+location['height'])

img=cv2.imread(filePath)
cv2.rectangle(img,left_top,right_bottom,(0,0,255),2)


print("美丑打分:",result["result"][0]["beauty"])
print("年龄:",result["result"][0]["age"])

cv2.imshow('img',img)
cv2.waitKey(0)
0
#4于燕松_回复于2019-06

执行 pip install baidu-aip 安装包。

1
#2unitcommon回复于2018-07

哪个sdk?看下文档上的示例

0
TOP
切换版块