diff --git a/local.env b/local.env index 319f259..b42a09a 100644 --- a/local.env +++ b/local.env @@ -1,6 +1,6 @@ TEAM_ID = 431 WORKSPACE_ID = 1019 -PROJECT_ID = 41703 +PROJECT_ID = 40721 # options: "images" "annotations" modal.state.selectedOutput="images" diff --git a/src/convert_geometry.py b/src/convert_geometry.py index ccd5f79..31ba5fe 100644 --- a/src/convert_geometry.py +++ b/src/convert_geometry.py @@ -5,6 +5,7 @@ from typing import List import uuid + def prepare_meta(meta: sly.ProjectMeta): new_classes = [] for cls in meta.obj_classes: diff --git a/src/main.py b/src/main.py index 0b84fa4..239efe7 100644 --- a/src/main.py +++ b/src/main.py @@ -10,7 +10,7 @@ import convert_geometry import functions as f import workflow as w -from tinytimer import Timer +import time # region constants USER_NAME = "Supervisely" @@ -43,6 +43,16 @@ ) +class Timer: + def __enter__(self): + self.start = time.perf_counter() + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.end = time.perf_counter() + self.elapsed = self.end - self.start + + def export_to_coco(api: sly.Api) -> None: project = api.project.get_info_by_id(project_id) project_meta = sly.ProjectMeta.from_json(api.project.get_meta(project_id)) @@ -90,10 +100,9 @@ def export_to_coco(api: sly.Api) -> None: image_ids = [image_info.id for image_info in images] paths = [os.path.join(dataset_path, image_info.name) for image_info in images] if api.server_address.startswith("https://"): - semaphore = asyncio.Semaphore(100) + semaphore = asyncio.Semaphore(10) else: semaphore = None - # api._get_default_semaphore() with Timer() as t: coro = api.image.download_paths_async(image_ids, paths, semaphore)