зеркало из
https://github.com/ssciwr/AMMICO.git
synced 2025-10-29 05:04:14 +02:00
Fix ID generation for relative paths (#35)
So far, there was implicit assumption on the used paths being absolute. Co-authored-by: Inga Ulusoy <inga.ulusoy@uni-heidelberg.de>
Этот коммит содержится в:
родитель
81838d0b86
Коммит
ef305ee94c
@ -1,6 +1,6 @@
|
||||
{
|
||||
"image_faces": {
|
||||
"filename": "/test/data/image_faces.jpg"},
|
||||
"image_objects":
|
||||
{"filename": "/test/data/image_objects.jpg"}
|
||||
"filename": "./test/data/image_faces.jpg"},
|
||||
"image_objects":
|
||||
{"filename": "./test/data/image_objects.jpg"}
|
||||
}
|
||||
@ -12,8 +12,8 @@ def test_find_files():
|
||||
|
||||
def test_initialize_dict():
|
||||
result = [
|
||||
"/test/data/image_faces.jpg",
|
||||
"/test/data/image_objects.jpg",
|
||||
"./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:
|
||||
|
||||
@ -75,8 +75,8 @@ def find_files(path=None, pattern="*.png", recursive=True, limit=20):
|
||||
def initialize_dict(filelist: list) -> dict:
|
||||
mydict = {}
|
||||
for img_path in filelist:
|
||||
id_ = img_path.split(".")[0].split("/")[-1]
|
||||
mydict[id_] = {"filename": img_path}
|
||||
id = os.path.splitext(os.path.basename(img_path))[0]
|
||||
mydict[id] = {"filename": img_path}
|
||||
return mydict
|
||||
|
||||
|
||||
|
||||
Загрузка…
x
Ссылка в новой задаче
Block a user