Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions models/face_recognition_sface/sface.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ def setTarget(self, targetId):
target_id=self._targetId)

def _preprocess(self, image, bbox):
return self._model.alignCrop(image, bbox)
if bbox is None:
return image
else:
return self._model.alignCrop(image, bbox)

def infer(self, image, bbox):
def infer(self, image, bbox=None):
# Preprocess
inputBlob = self._preprocess(image, bbox)

Expand All @@ -66,4 +69,5 @@ def match(self, image1, face1, image2, face2):
return 1 if cosine_score >= self._threshold_cosine else 0
else: # NORM_L2
norml2_distance = self._model.match(feature1, feature2, self._disType)
return 1 if norml2_distance <= self._threshold_norml2 else 0
return 1 if norml2_distance <= self._threshold_norml2 else 0