测试人脸识别图片字节流
This commit is contained in:
parent
c078850c8b
commit
d7060b85ea
@ -5,6 +5,9 @@ import json
|
||||
|
||||
image_path = "./haotian1.jpg"
|
||||
|
||||
with open(image_path, "rb") as f:
|
||||
image_bytes = f.read() # 获取图片的字节流
|
||||
|
||||
# # 测试上传人脸图片
|
||||
# print(asyncio.run(ComprefaceUtil.face_addition(image_path, '刘昊天_访客')))
|
||||
|
||||
@ -12,14 +15,14 @@ image_path = "./haotian1.jpg"
|
||||
start_time = time.time()
|
||||
result = asyncio.run(
|
||||
ComprefaceUtil.face_recognition(
|
||||
image_path,
|
||||
image_bytes,
|
||||
options={
|
||||
"limit": 0,
|
||||
"det_prob_threshold": 0.8,
|
||||
"prediction_count": 5,
|
||||
"prediction_count": 1,
|
||||
# 可选参数 age,gender,landmarks,calculator
|
||||
"face_plugins": "age,gender,landmarks",
|
||||
"status": "false",
|
||||
"status": "true",
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
@ -64,15 +64,7 @@ class ComprefaceUtil:
|
||||
# 人脸识别
|
||||
@classmethod
|
||||
async def face_recognition(cls, image: str = '' or bytes, options: AllOptionsDict = {}) -> dict:
|
||||
# recognition: RecognitionService = compre_face.init_face_recognition(ComprefaceConfig.COMPREFACE_API_KEY)
|
||||
# print(recognition.recognize(image_path=image, options={
|
||||
# "limit": 0,
|
||||
# "det_prob_threshold": 0.8,
|
||||
# "prediction_count": 1,
|
||||
# "face_plugins": "calculator,age,gender,landmarks",
|
||||
# "status": "false"
|
||||
# }))
|
||||
|
||||
|
||||
client_url: str = RECOGNIZE_API
|
||||
url: str = ComprefaceConfig.COMPREFACE_BASE_URL + ':' + ComprefaceConfig.COMPERFACE_BASE_PORT + client_url+"?"
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user