I do not know what is wrong with my function

49 views Asked by At

I have this code. However I am not able to run it as a function.

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)

I am getting errors such as:

AttributeError: 'function' object has no attribute 'is_identical'
AttributeError: 'function' object has no attribute 'confidence'

Anyone can help?

2

There are 2 answers

0
Ayush K M On
if verify_result_same.is_identical() & verify_result_same.is_confident() < 0.5:

Here you have used "verify_result_same" object which is same as the function you defined in the previous line.

0
Steven-MSFT On

verify_result_same is a function, and you maybe have defined a class named verify_result_same. So you should rename your function name from verify_result_same to something others.