зеркало из
https://github.com/ssciwr/AMMICO.git
synced 2025-10-30 13:36:04 +02:00
* colors expression by KMean algorithm * object detection by imageai * object detection by cvlib * add encapsulation of object detection * remove encapsulation of objdetect v0 * objects expression to dict * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * added imageai to requirements * add objects to dictionary * update for AnalysisMethod baseline * add objects dection support explore_analysis display * extend python version of misinf to allow imageai * account for older python * use global functionality for dict to csv convert * update for docker build * docker will build now but ipywidgets still not working * test code * include test data folder in repo * add some sample images * load cvs labels to dict * add test data * retrigger checks * add map to human coding * get orders from dict, missing dep * add module to test accuracy * retrigger checks * retrigger checks * now removing imageai * removed imageai * move labelmanager to analyse * multiple faces in mydict * fix pre-commit issues * map mydict * hide imageai * objects default using cvlib, isolate and disable imageai * correct python version * refactor faces tests * refactor objects tests * sonarcloud issues * refactor utils tests * address code smells * update readme * update notebook without imageai Co-authored-by: Ma Xianghe <825074348@qq.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: iulusoy <inga.ulusoy@uni-heidelberg.de>
41 строка
1.2 KiB
Python
41 строка
1.2 KiB
Python
import json
|
|
import pandas as pd
|
|
import misinformation.utils as ut
|
|
|
|
|
|
def test_find_files():
|
|
result = ut.find_files(
|
|
path="./test/data/", pattern="*.png", recursive=True, limit=10
|
|
)
|
|
assert len(result) > 0
|
|
|
|
|
|
def test_initialize_dict():
|
|
result = [
|
|
"/test/data/image_faces.jpg",
|
|
"/test/data/image_objects.jpg",
|
|
]
|
|
mydict = ut.initialize_dict(result)
|
|
with open("./test/data/example_utils_init_dict.json", "r") as file:
|
|
out_dict = json.load(file)
|
|
assert mydict == out_dict
|
|
|
|
|
|
def test_append_data_to_dict():
|
|
with open("./test/data/example_append_data_to_dict_in.json", "r") as file:
|
|
mydict = json.load(file)
|
|
outdict = ut.append_data_to_dict(mydict)
|
|
print(outdict)
|
|
with open("./test/data/example_append_data_to_dict_out.json", "r") as file:
|
|
example_outdict = json.load(file)
|
|
|
|
assert outdict == example_outdict
|
|
|
|
|
|
def test_dump_df():
|
|
with open("./test/data/example_append_data_to_dict_out.json", "r") as file:
|
|
outdict = json.load(file)
|
|
df = ut.dump_df(outdict)
|
|
out_df = pd.read_csv("./test/data/example_dump_df.csv", index_col=[0])
|
|
pd.testing.assert_frame_equal(df, out_df)
|