Skip to content

Commit 7d7e240

Browse files
authored
SFace: allow bbox to be none for aligned images as input (#38)
1 parent cdfd1de commit 7d7e240

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

models/face_recognition_sface/sface.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@ def setTarget(self, targetId):
4747
target_id=self._targetId)
4848

4949
def _preprocess(self, image, bbox):
50-
return self._model.alignCrop(image, bbox)
50+
if bbox is None:
51+
return image
52+
else:
53+
return self._model.alignCrop(image, bbox)
5154

52-
def infer(self, image, bbox):
55+
def infer(self, image, bbox=None):
5356
# Preprocess
5457
inputBlob = self._preprocess(image, bbox)
5558

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

0 commit comments

Comments
 (0)