added data tests
This commit is contained in:
Родитель
19bc33bf24
Коммит
907ac07a33
|
@ -1,14 +1,16 @@
|
||||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
# Licensed under the MIT License.
|
# Licensed under the MIT License.
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
from utils_cv.similarity.data import comparative_set_builder
|
from utils_cv.similarity.data import comparative_set_builder
|
||||||
|
|
||||||
|
|
||||||
def test_comparative_set_builder(testing_databunch):
|
def test_comparative_set_builder(testing_databunch):
|
||||||
resulting_set = comparative_set_builder(testing_databunch)
|
comparative_sets = comparative_set_builder(testing_databunch, num_sets = 20, num_negatives=50)
|
||||||
# first_key, first_value = next(iter(resulting_set.items()))
|
assert isinstance(comparative_sets, list)
|
||||||
|
assert len(comparative_sets) == 20
|
||||||
assert isinstance(resulting_set, list)
|
for cs in comparative_sets:
|
||||||
assert len(resulting_set) == len(testing_databunch.y)
|
assert len(cs.neg_im_paths) == 50
|
||||||
# assert isinstance(first_key, str)
|
neg_and_pos_label_identical = np.where(np.array(cs.neg_labels) == cs.pos_label)[0]
|
||||||
# assert isinstance(first_value, list)
|
assert len(neg_and_pos_label_identical)==0, "Negative contains at least one image with same label as the positive"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче