|
@@ -17,20 +17,15 @@ from modelscope.utils.test_utils import test_level |
|
|
class FaceRecognitionTest(unittest.TestCase): |
|
|
class FaceRecognitionTest(unittest.TestCase): |
|
|
|
|
|
|
|
|
def setUp(self) -> None: |
|
|
def setUp(self) -> None: |
|
|
self.recog_model_id = 'damo/cv_ir101_facerecognition_cfglint' |
|
|
|
|
|
self.det_model_id = 'damo/cv_resnet_facedetection_scrfd10gkps' |
|
|
|
|
|
|
|
|
self.model_id = 'damo/cv_ir101_facerecognition_cfglint' |
|
|
|
|
|
|
|
|
@unittest.skipUnless(test_level() >= 1, 'skip test in current test level') |
|
|
@unittest.skipUnless(test_level() >= 1, 'skip test in current test level') |
|
|
def test_face_compare(self): |
|
|
def test_face_compare(self): |
|
|
img1 = 'data/test/images/face_recognition_1.png' |
|
|
img1 = 'data/test/images/face_recognition_1.png' |
|
|
img2 = 'data/test/images/face_recognition_2.png' |
|
|
img2 = 'data/test/images/face_recognition_2.png' |
|
|
|
|
|
|
|
|
face_detection = pipeline( |
|
|
|
|
|
Tasks.face_detection, model=self.det_model_id) |
|
|
|
|
|
face_recognition = pipeline( |
|
|
face_recognition = pipeline( |
|
|
Tasks.face_recognition, |
|
|
|
|
|
face_detection=face_detection, |
|
|
|
|
|
model=self.recog_model_id) |
|
|
|
|
|
|
|
|
Tasks.face_recognition, model=self.model_id) |
|
|
# note that for dataset output, the inference-output is a Generator that can be iterated. |
|
|
# note that for dataset output, the inference-output is a Generator that can be iterated. |
|
|
emb1 = face_recognition(img1)[OutputKeys.IMG_EMBEDDING] |
|
|
emb1 = face_recognition(img1)[OutputKeys.IMG_EMBEDDING] |
|
|
emb2 = face_recognition(img2)[OutputKeys.IMG_EMBEDDING] |
|
|
emb2 = face_recognition(img2)[OutputKeys.IMG_EMBEDDING] |
|
|