From 1a4a56cd5cd7e9dfcfb3bf3926211eaf9a3b5b58 Mon Sep 17 00:00:00 2001 From: vorozhkog Date: Mon, 2 Dec 2024 12:36:45 +0000 Subject: [PATCH] update timer's log level to debug --- src/convert_sly_to_yolov5.py | 10 +++++++--- src/modal.html | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/convert_sly_to_yolov5.py b/src/convert_sly_to_yolov5.py index 91396f8..feec1f3 100644 --- a/src/convert_sly_to_yolov5.py +++ b/src/convert_sly_to_yolov5.py @@ -9,9 +9,13 @@ class Timer: - def __init__(self, message=None, items_cnt=None): + + def __init__(self, message=None, items_cnt=None, log_level=None): self.message = message self.items_cnt = items_cnt + self.log_level = "info" + if log_level is not None: + self.log_level = log_level self.elapsed = 0 def __enter__(self): @@ -26,7 +30,7 @@ def __exit__(self, exc_type, exc_val, exc_tb): log_msg = f"{msg} time: {self.elapsed:.3f} seconds per {self.items_cnt} items ({self.elapsed/self.items_cnt:.3f} seconds per item)" else: log_msg = f"{msg} time: {self.elapsed:.3f} seconds" - sly.logger.info(log_msg) + getattr(sly.logger, self.log_level)(log_msg) # region constants @@ -209,7 +213,7 @@ def _add_to_split(image_id, img_name, split_ids, split_image_paths, labels_dir, for batch_ids, batch_paths in zip( sly.batched(ids_to_download), sly.batched(paths_to_download) ): - with Timer("Images downloading", len(batch_ids)): + with Timer("Images downloading", len(batch_ids), "debug"): coro = api.image.download_paths_async( batch_ids, batch_paths, progress_cb=progress.iters_done_report ) diff --git a/src/modal.html b/src/modal.html index 28aa67b..704f816 100644 --- a/src/modal.html +++ b/src/modal.html @@ -9,12 +9,12 @@ title="Process shapes" description="Select how to process shapes that are not supported by the current application." > -
+
-
+
Skip objects of unsupported geometries
-
+
Transform shapes to Rectangle (bbox)