Этот коммит содержится в:
Petr Andriushchenko 2023-03-24 11:01:35 +01:00
родитель cc3d7f3aa8
Коммит 7732b802b8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4C4A5DCF634115B6
3 изменённых файлов: 27 добавлений и 15 удалений

Просмотреть файл

@ -22,7 +22,7 @@ testdict = {
"pic1": {"filename": "./test/data/pic1.png"},
}
related_error = 1e-3
related_error = 1e-2
gpu_is_not_available = not cuda.is_available()
@ -251,18 +251,18 @@ pre_extracted_feature_text_clip_vitl14_336 = [
]
simularity_blip2 = [
[0.05826476216316223, -0.03215287625789642],
[0.12869958579540253, 0.005234059877693653],
[0.11073512583971024, 0.12327003479003906],
[0.08743024617433548, 0.05598106235265732],
[0.04591086134314537, 0.48981112241744995],
[0.06297147274017334, 0.4728018641471863],
[0.18486255407333374, 0.635167121887207],
[0.015356295742094517, 0.015282897278666496],
[-0.008485622704029083, 0.010882291942834854],
[-0.04328630864620209, -0.13117870688438416],
[-0.025470387190580368, 0.13175423443317413],
[-0.05090826004743576, 0.05902523919939995],
[0.05826476216316223, -0.02717375010251999],
[0.12869958579540253, 0.006344856694340706],
[0.11073512583971024, 0.12327021360397339],
[0.08743024617433548, 0.058944884687662125],
[0.04591086134314537, 0.4905201494693756],
[0.06297147274017334, 0.47339022159576416],
[0.18486255407333374, 0.6350338459014893],
[0.015455856919288635, 0.018462061882019043],
[-0.008606988936662674, 0.00741103570908308],
[-0.0415784977376461, -0.1267213076353073],
[-0.025470387190580368, 0.1315656304359436],
[-0.05090826004743576, 0.059172093868255615],
]
sorted_blip2 = [
@ -383,6 +383,16 @@ sorted_clip_vitl14_336 = [
"pre_sorted",
),
[
(
device("cpu"),
"blip2",
pre_proc_pic_blip2_blip_albef,
pre_proc_text_blip2_blip_albef,
pre_extracted_feature_img_blip2,
pre_extracted_feature_text_blip2,
simularity_blip2,
sorted_blip2,
),
pytest.param(
device("cuda"),
"blip2",

Просмотреть файл

@ -56,10 +56,11 @@ def test_init_default_objects():
def test_analyse_image_from_file_cvlib(get_path):
file_path = get_path + TEST_IMAGE_1
objs = ob_cvlib.ObjectCVLib().analyse_image_from_file(get_path + file_path)
objs = ob_cvlib.ObjectCVLib().analyse_image_from_file(file_path)
with open(get_path + JSON_1, "r") as file:
out_dict = json.load(file)
out_dict["filename"] = get_path + out_dict["filename"]
for key in objs.keys():
assert objs[key] == out_dict[key]
@ -86,5 +87,6 @@ def test_analyse_image(get_path):
ob.ObjectDetector(mydict).analyse_image()
with open(get_path + JSON_1, "r") as file:
out_dict = json.load(file)
out_dict["filename"] = get_path + out_dict["filename"]
assert str(mydict) == str(out_dict)

Просмотреть файл

@ -116,7 +116,7 @@ def test_analyse_image():
"a table that has some chairs on top of it",
"a view of a city from a window of a building",
"a view of a city from a window",
"a city street filled with lots of traffic",
"a city street with cars and people on it",
"an open book with german text on it",
"a close up of a book on a table",
"a book with a green cover on a table",