av一区二区在线观看_亚洲男人的天堂网站_日韩亚洲视频_在线成人免费_欧美日韩精品免费观看视频_久草视

您的位置:首頁技術(shù)文章
文章詳情頁

python 使用百度AI接口進行人臉對比的步驟

瀏覽:63日期:2022-06-24 15:33:58
1. 注冊百度云賬號

注冊百度智能云,提交申請。

創(chuàng)建應(yīng)用獲取AppID,API Key,Secret Key。

2. 安裝baidu python api

人臉對比 API 文檔

pip install baidu-aip

調(diào)用:

import base64from aip import AipFaceAPP_ID = ’你的 App ID’API_KEY = ’你的 Api Key’SECRET_KEY = ’你的 Secret Key’client = AipFace(APP_ID, API_KEY, SECRET_KEY)result = client.match([ { ’image’: str(base64.b64encode(open(’D:/chenjy/1.png’, ’rb’).read()), ’utf-8’), ’image_type’: ’BASE64’, }, { ’image’: str(base64.b64encode(open(’D:/chenjy/2.png’, ’rb’).read()), ’utf-8’), ’image_type’: ’BASE64’, } ])print(result)

返回值:

python 使用百度AI接口進行人臉對比的步驟

返回主要參數(shù)說明:

參數(shù)名 必選 類型 說明 score 是 float 人臉相似度得分,推薦閾值80分 face_list 是 array 人臉信息列表 face_token 是 string 人臉的唯一標志 3.調(diào)用攝像頭

import cv2cap = cv2.VideoCapture(0) # 打開攝像頭while True: ret, frame = cap.read() frame = cv2.flip(frame, 1) cv2.imshow(’window’, frame) cv2.imwrite(’D:/chenjy/2.png’, frame) # 保存路徑 cv2.waitKey(2000)cap.release()cv2.destroyAllWindows()4.完整測試程序

import cv2import base64from aip import AipFaceAPP_ID = ’你的 App ID’API_KEY = ’你的 Api Key’SECRET_KEY = ’你的 Secret Key’client = AipFace(APP_ID, API_KEY, SECRET_KEY)def get_result(): result = client.match([ { ’image’: str(base64.b64encode(open(’D:/chenjy/1.png’, ’rb’).read()), ’utf-8’), ’image_type’: ’BASE64’, }, { ’image’: str(base64.b64encode(open(’D:/chenjy/2.png’, ’rb’).read()), ’utf-8’), ’image_type’: ’BASE64’, } ]) if result[’error_msg’] == ’SUCCESS’: score = result[’result’][’score’] print(result) print(’相似度:’+str(score)) else: print(’服務(wù)器錯誤’)cap = cv2.VideoCapture(0) # 打開攝像頭while True: ret, frame = cap.read() frame = cv2.flip(frame, 1) cv2.imshow(’window’, frame) cv2.imwrite(’D:/chenjy/2.png’, frame) # 保存路徑 cv2.waitKey(2000) get_result()cap.release()cv2.destroyAllWindows()

結(jié)果:

照片加了模糊處理

python 使用百度AI接口進行人臉對比的步驟

python 使用百度AI接口進行人臉對比的步驟

以上就是python 使用百度AI接口進行人臉對比的步驟的詳細內(nèi)容,更多關(guān)于python 人臉對比的資料請關(guān)注好吧啦網(wǎng)其它相關(guān)文章!

標簽: 百度 Python
相關(guān)文章:
主站蜘蛛池模板: 一级片网址 | 日韩欧美在线观看视频 | 日韩免费视频一区二区 | 91亚色视频 | 麻豆chinese新婚xxx | 国产黄a| 亚洲视频区 | 国产黄色精品 | 天海翼在线视频 | 女人久久久 | 国产免费一区 | 在线观看av片 | 日本xxxx69| 亚洲国产一区在线观看 | 欧美日韩亚洲视频 | 欧美精品网 | www.4hu.tv4| 国产精品一区二区三区免费 | 在线亚洲欧美 | 国产肉体xxxx裸体784大胆 | 国产精品成人免费精品自在线观看 | 国产福利视频在线观看 | 国产精品毛片一区二区在线看 | 在线网站免费观看18 | 欧美一区二区在线播放 | 日韩精品视频免费播放 | 日韩精品免费在线观看 | 午夜大片| 精品自拍视频 | 国产精品成人一区二区 | www.狠狠操.com | 免费一区二区 | 亚洲成人av在线 | 91在线看片| 天天拍夜夜操 | 日韩理论在线观看 | 国产九九热| 日韩一级在线 | 欧美 日韩 国产 成人 在线 | 日韩激情一区 | 茄子视频色 |