From 7a63fca4bfe5b99cc60f750faa3c802a64ed660d Mon Sep 17 00:00:00 2001 From: huweiqiang Date: Mon, 25 Sep 2023 16:18:22 +0800 Subject: [PATCH] bugfix(import image): fix error of only saving the first object of image --- deepdataspace/io/importer.py | 1 + deepdataspace/model/image.py | 1 + 2 files changed, 2 insertions(+) diff --git a/deepdataspace/io/importer.py b/deepdataspace/io/importer.py index fe74555..b3f01c8 100644 --- a/deepdataspace/io/importer.py +++ b/deepdataspace/io/importer.py @@ -215,6 +215,7 @@ def run_import(self): self.add_user_data(image) for anno in anno_list: image.batch_add_annotation(**anno) + image.finish_batch_add_annotation() logger.debug(f"time cost of import one image: {int(time.time() * 1000) - beg}ms") logger.debug(f"imported image, id={image.id}, url={image.url}") self.dataset.finish_batch_add_image() diff --git a/deepdataspace/model/image.py b/deepdataspace/model/image.py index 0f85da7..d742636 100644 --- a/deepdataspace/model/image.py +++ b/deepdataspace/model/image.py @@ -456,6 +456,7 @@ def batch_add_annotation(self, conf=conf, is_group=is_group, confirm_type=confirm_type) self.objects.append(anno_obj) + def finish_batch_add_annotation(self): self.dataset.batch_save_image(self)