From 5d41afc1b017f24265a49a720fa02a05cf56fa61 Mon Sep 17 00:00:00 2001 From: Antoine DESRUET Date: Fri, 10 Jun 2022 14:17:59 +0200 Subject: [PATCH] feat: print debug --- setup.py | 2 +- src/CVAT/utils.py | 3 +++ src/main.py | 8 ++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index f4cf554..80def23 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="CVAT wrapper", - version="0.0.11", + version="0.0.12", author="antwxne", author_email="antoine.desruet@epitech.eu", description="Python wrapper for CVAT API", diff --git a/src/CVAT/utils.py b/src/CVAT/utils.py index 420e954..54a6b84 100644 --- a/src/CVAT/utils.py +++ b/src/CVAT/utils.py @@ -1,6 +1,7 @@ #!/bin/python3 # Created by antoine.desruet@epitech.eu at 5/23/22 import re +import sys from os import walk from typing import Optional @@ -68,10 +69,12 @@ def image_content_from_kili_prediction(prediction: list[dict], directory: str) - paths: list[str] = [] current_files: list[str] = get_files_from_path(directory) files_without_extension: list[str] = [file.split(".")[0] for file in current_files] + print(f'all files {files_without_extension}', file=sys.stderr) for elem in tqdm(prediction, unit="Image"): path: str = f'{directory}/{elem["externalId"]}' if path not in files_without_extension: paths.append(CVAT.download_image(elem["content"], path)) + print(f"download {path}...", file=sys.stderr) else: paths.append(current_files[files_without_extension.index(path)]) return paths diff --git a/src/main.py b/src/main.py index 16c5020..9b59c75 100644 --- a/src/main.py +++ b/src/main.py @@ -14,11 +14,11 @@ # API.upload_predictions(task, prediction) if __name__ == "__main__": - API.create_user("oui", "oui@gmail.com", "kgjhagkjlhlaegkj", "aaa", "aaaa") - # prediction_json: list[dict] = CVAT.get_json_from_file("./foodvisor_valid_12_2021_Fromages_gmd_predictions.json") - # directory: str = "data/Images/Fromages" + # API.create_user("oui", "oui@gmail.com", "kgjhagkjlhlaegkj", "aaa", "aaaa") + prediction_json: list[dict] = CVAT.get_json_from_file("./foodvisor_valid_12_2021_Fromages_gmd_predictions.json") + directory: str = "data/Images/Fromages" # interface: dict = CVAT.get_json_from_file("../interface_foodvisor.json") - # images_path: list[str] = image_content_from_kili_prediction(prediction_json, directory) + images_path: list[str] = image_content_from_kili_prediction(prediction_json, directory) # project_id: int = API.create_project("TEST_API2", interface=interface) # task: Task = Task("jqefhgfdqf", project_id=project_id) # task: Task = API.get_task_by_name("qsfqsfqsf")