午夜剧场伦理_日本一道高清_国产又黄又硬_91黄色网战_女同久久另类69精品国产_妹妹的朋友在线

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

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

瀏覽:3日期: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)文章:
主站蜘蛛池模板: 天堂资源中文在线 | 国产原创视频在线 | 国产成人二区 | 97黄色| 日韩一区二区三区在线观看视频 | 国产尻逼| 久久久久在线视频 | 久热精品视频在线播放 | 精品无码久久久久久国产 | 国内精品99 | 视频一区欧美 | 国产视频欧美 | 亚洲a在线播放 | 噜噜噜视频| 懂色av粉嫩av蜜臀av一区二区三区 | 免费污片在线观看 | 国产精品99视频 | 村上凉子av| 男人天堂网站 | 日本大片在线 | 亚洲资源在线播放 | 2019中文字幕在线视频 | 色先锋影音资源 | 你懂的免费在线观看 | 久草日韩| 中文字幕影音先锋 | 亚州av在线播放 | 成人免费播放 | 中文天堂av | 久久网免费视频 | 在线免费观看亚洲 | 国产成人精品一区二区三区福利 | 久久夜精 | 91美女在线| 天堂中文字幕在线 | 午夜精品在线播放 | 国产又爽 | 精品视频专区 | 精品一区二区在线播放 | 久久精品www人人爽人人 | 欧美人成在线 |