10from _testcapi
import FLT_MIN
13 def __init__(self, modelPath, disType=0, backendId=0, targetId=0):
17 self.
_model = cv.FaceRecognizerSF.create(
24 assert self.
_disType in [0, 1],
"0: Cosine similarity, 1: norm-L2 distance, others: invalid"
31 return self.__class__.__name__
35 self.
_model = cv.FaceRecognizerSF.create(
43 self.
_model = cv.FaceRecognizerSF.create(
53 return self.
_model.alignCrop(image, bbox)
55 def infer(self, image, bbox=None):
60 features = self.
_model.feature(inputBlob)
63 def match(self, image1, face1, image2, face2):
64 feature1 = self.
infer(image1, face1)
65 feature2 = self.
infer(image2, face2)
setBackend(self, backendId)
_preprocess(self, image, bbox)
setTarget(self, targetId)
__init__(self, modelPath, disType=0, backendId=0, targetId=0)
infer(self, image, bbox=None)
match(self, image1, face1, image2, face2)