Skip to content

Commit

Permalink
update timer's log level to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
vorozhkog committed Dec 2, 2024
1 parent 2f9a044 commit 1a4a56c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions src/convert_sly_to_yolov5.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down Expand Up @@ -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
)
Expand Down
6 changes: 3 additions & 3 deletions src/modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
title="Process shapes"
description="Select how to process shapes that are not supported by the current application."
>
<div style="margin-top: 1em;">
<div style="margin-top: 5px;">
<el-radio-group v-model="state.processShapes" size="normal">
<div style="margin-top: 1em;">
<div >
<el-radio label="skip"><span>Skip objects of unsupported geometries</span></el-radio>
</div>
<div>
<div style="margin-top: 5px;">
<el-radio label="transform"><span>Transform shapes to Rectangle (bbox)</span></el-radio>
</div>
</el-radio-group>
Expand Down

0 comments on commit 1a4a56c

Please sign in to comment.