Exemplo n.º 1
0
def test_make_pairs_negative_only_no_n(dummy_images):
    pairs = make_pairs(dummy_images, same=False, n=None)
    negative_pairs = [p for p in pairs if not p.same_identity]
    assert len(negative_pairs) == len(pairs) == 94
    assert negative_pairs[0].first.identity == 'TEST-1'
    assert negative_pairs[24].first.identity == 'TEST-2'
    assert negative_pairs[48].first.identity == 'TEST-3'
    assert negative_pairs[66].first.identity == 'TEST-4'
    assert negative_pairs[84].first.identity == 'TEST-5'
Exemplo n.º 2
0
def test_make_pairs_positive_only_no_n(dummy_images):
    pairs = make_pairs(dummy_images, same=True, n=None)
    positive_pairs = [p for p in pairs if p.same_identity]
    assert len(positive_pairs) == len(pairs) == 8
    assert positive_pairs[0].first.identity == 'TEST-1'
    assert positive_pairs[1].first.identity == 'TEST-1'
    assert positive_pairs[2].first.identity == 'TEST-1'
    assert positive_pairs[3].first.identity == 'TEST-2'
    assert positive_pairs[4].first.identity == 'TEST-2'
    assert positive_pairs[5].first.identity == 'TEST-2'
    assert positive_pairs[6].first.identity == 'TEST-3'
    assert positive_pairs[7].first.identity == 'TEST-4'
Exemplo n.º 3
0
def dummy_pairs() -> List[FacePair]:
    ids = [1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5]
    images = [DummyFaceImage(path='', identity=f'TEST-{idx}') for idx in ids]
    return make_pairs(images)
Exemplo n.º 4
0
def test_make_pairs_negative_only_large_n(dummy_images):
    n = 10000
    pairs = make_pairs(dummy_images, same=False, n=n)
    negative_pairs = [p for p in pairs if not p.same_identity]
    assert len(negative_pairs) == len(pairs) == n
Exemplo n.º 5
0
def test_make_pairs_negative_only_fixed_n_odd(dummy_images):
    n = 47
    pairs = make_pairs(dummy_images, same=False, n=n)
    negative_pairs = [p for p in pairs if not p.same_identity]
    assert len(negative_pairs) == len(pairs) == n
Exemplo n.º 6
0
def test_make_pairs_positive_only_large_n(dummy_images):
    n = 10000
    pairs = make_pairs(dummy_images, same=True, n=n)
    positive_pairs = [p for p in pairs if p.same_identity]
    assert len(positive_pairs) == len(pairs) == 8
Exemplo n.º 7
0
def test_make_pairs_positive_only_fixed_n_odd(dummy_images):
    n = 7
    pairs = make_pairs(dummy_images, same=True, n=n)
    positive_pairs = [p for p in pairs if p.same_identity]
    assert len(positive_pairs) == len(pairs) == 7
Exemplo n.º 8
0
def test_make_pairs_positive_and_negative_large_n(dummy_images):
    n = 10000
    pairs = make_pairs(dummy_images, same=None, n=n)
    assert len(pairs) == 16
Exemplo n.º 9
0
def test_make_pairs_positive_and_negative_fixed_n_odd(dummy_images):
    n = 7
    pairs = make_pairs(dummy_images, same=None, n=n)
    assert len(pairs) == n