From db5dccc501d57bc17e452b6a8eefafb330a1570d Mon Sep 17 00:00:00 2001 From: huweiqiang Date: Fri, 29 Dec 2023 16:54:41 +0800 Subject: [PATCH] feature(batch caption): support add caption in batch_add_annotation function --- build_doc.sh | 0 deepdataspace/model/image.py | 8 ++++++-- 2 files changed, 6 insertions(+), 2 deletions(-) mode change 100644 => 100755 build_doc.sh diff --git a/build_doc.sh b/build_doc.sh old mode 100644 new mode 100755 diff --git a/deepdataspace/model/image.py b/deepdataspace/model/image.py index d742636..24e5466 100644 --- a/deepdataspace/model/image.py +++ b/deepdataspace/model/image.py @@ -326,6 +326,7 @@ def _add_annotation(self, keypoint_colors: List[int] = None, keypoint_skeleton: List[int] = None, keypoint_names: List[str] = None, + caption: str = None, confirm_type: int = 0, ): if bbox: @@ -341,7 +342,7 @@ def _add_annotation(self, keypoint_skeleton, keypoint_names) anno_obj = Object(label_name=label, label_type=label_type, label_id=label_obj.id, - category_name=category, category_id=category_obj.id, + category_name=category, category_id=category_obj.id, caption=caption, bounding_box=bounding_box, segmentation=segmentation, alpha=alpha_uri, points=points, lines=lines, point_colors=colors, point_names=names, conf=conf, is_group=is_group, confirm_type=confirm_type) @@ -361,6 +362,7 @@ def add_annotation(self, keypoint_colors: List[int] = None, keypoint_skeleton: List[int] = None, keypoint_names: List[str] = None, + caption: str = None, confirm_type: int = 0, ): """ @@ -380,13 +382,14 @@ def add_annotation(self, :param keypoint_names: the key point names, ["nose", "left_eye", ...]. :param keypoint_colors: the key point colors, [255, 0, 0, ...]. :param keypoint_skeleton: the key point skeleton, [0, 1, 2, ...]. + :param caption: the caption of the annotation. :param confirm_type: the confirm_type of the annotation, 0 = not confirmed, 1 = gt may be fn, 2 = pred may be fp """ self._add_annotation(category, label, label_type, conf, is_group, bbox, segmentation, alpha_uri, keypoints, keypoint_colors, keypoint_skeleton, keypoint_names, - confirm_type) + caption, confirm_type) self.save() self._update_dataset(bbox, segmentation, alpha_uri, keypoints) @@ -434,6 +437,7 @@ def batch_add_annotation(self, :param keypoint_names: the key point names, ["nose", "left_eye", ...]. :param keypoint_colors: the key point colors, [255, 0, 0, ...]. :param keypoint_skeleton: the key point skeleton, [0, 1, 2, ...]. + :param caption: the caption of the annotation. :param confirm_type: the confirm_type of the annotation, 0 = not confirmed, 1 = gt may be fn, 2 = pred may be fp :return: None """