예제 #1
0
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])
예제 #2
0
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)
예제 #3
0
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