【发布时间】:2022-01-09 10:39:37
【问题描述】:
我有这个代码。但是我无法将其作为函数运行。
def verify_result_same():
if verify_result_same.is_identical() & verify_result_same.confidence() > 0.5:
face_client.face.verify_face_to_face(source_image1_id, detected_faces_ids[0])
print('Faces from {} & {} are of the same person, with confidence: {}'
.format(source_image_file_name1, target_image_file_names[0], verify_result_same.confidence))
print("Valid face verification")
else:
print('Faces from {} & {} are of a different person, with confidence: {}'
.format(source_image_file_name1, target_image_file_names[0], verify_result_same.confidence))
print("Invalid face verification")
text = "Face verification is not valid. Please try again."
send_msg(text)
我收到如下错误:
AttributeError: 'function' object has no attribute 'is_identical'
AttributeError: 'function' object has no attribute 'confidence'
有人可以帮忙吗?
【问题讨论】:
-
is_identical和confidence是什么?你为什么要从verify_result_same给他们打电话? -
我不明白为什么这会起作用?这些变量声明在哪里,更重要的是,你不应该能够从函数中访问它们,也不能元调用函数并访问它。
-
你在检查什么是 is_identical 和 confidence,这个给定的函数?请扩展您的问题。
-
使用
f字符串:f"some text {some_var}"
标签: python function attributes 3-tier