File size: 703 Bytes
901e379
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import face_manage.manage as db_manage
from extract import GetImageInfo


def match_1_1(image1, image2):

    count1, boxes1, scores1, landmarks1, alignimgs1, features1 = GetImageInfo(image1, 1)
    count2, boxes2, scores2, landmarks2, alignimgs2, features2 = GetImageInfo(image2, 1)

    result = False
    sim = 0
    if count1 != 0 and count2 != 0:
        sim = db_manage.get_similarity(features1[0], features2[0])
        if sim > db_manage.threshold:
            result = True
        else:
            result = False

    response = {
        "confidence": sim,
        "threshold": db_manage.threshold,
        "result": "Same Person" if result else "Different Person"
    }
    return response