From 38a65564f24a1122c53d7badabda03d37bdef707 Mon Sep 17 00:00:00 2001 From: GoldenAnpu Date: Mon, 16 Oct 2023 19:46:08 +0200 Subject: [PATCH] add .venv to .gitignore; add exception handler for def sly.imgaug_utils.apply; --- .gitignore | 1 + src/main.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index bd8b0ba..f6dc079 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ secret_debug.env .idea venv +.venv supervisely_lib images/* src/conf.py diff --git a/src/main.py b/src/main.py index ab18212..e0f8fcb 100644 --- a/src/main.py +++ b/src/main.py @@ -62,7 +62,13 @@ def preview_augs(api: sly.Api, task_id, augs, infos, py_code=None): ann_json = api.annotation.download(img_info.id).annotation ann = sly.Annotation.from_json(ann_json, meta) - res_meta, res_img, res_ann = sly.imgaug_utils.apply(augs, meta, img, ann) + try: + res_meta, res_img, res_ann = sly.imgaug_utils.apply(augs, meta, img, ann) + except ValueError as e: + if str(e) == 'cannot convert float NaN to integer': + raise e('Please check the values of the augmentation parameters') + else: + raise e file_info = save_preview_image(api, task_id, res_img) # rename polygonal labels in existing annotation to keep them in gallery in before section