def test__given_diff_face_images__when_scanned__then_returns_diff_embeddings(scanner_cls): scanner: FaceScanner = get_scanner(scanner_cls) img1 = IMG_DIR / '007_B.jpg' img2 = IMG_DIR / '009_C.jpg' emb1 = first_and_only(scanner.scan(img1)).embedding emb2 = first_and_only(scanner.scan(img2)).embedding assert not embeddings_are_equal(emb1, emb2, DIFFERENCE_THRESHOLD[scanner_cls])
def test__given_diff_face_images__when_scanned__then_returns_diff_embeddings( scanner_cls): scanner: FaceScanner = scanner_cls() img1 = read_img(IMG_DIR / PERSON_B.img_names[0]) img2 = read_img(IMG_DIR / PERSON_C.img_names[0]) emb1 = first_and_only(scanner.scan(img1)).embedding emb2 = first_and_only(scanner.scan(img2)).embedding assert not embeddings_are_equal(emb1, emb2, scanner.difference_threshold)
def test__size_of_embeddings(scanner_cls): scanner: FaceScanner = scanner_cls() img = read_img(IMG_DIR / PERSON_B.img_names[0]) emb = first_and_only(scanner.scan(img)).embedding assert len(emb) == 512