Skip to content

Commit

Permalink
feature(batch caption): support add caption in batch_add_annotation f…
Browse files Browse the repository at this point in the history
…unction
  • Loading branch information
imhuwq committed Dec 29, 2023
1 parent 3cb3e79 commit db5dccc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Empty file modified build_doc.sh
100644 → 100755
Empty file.
8 changes: 6 additions & 2 deletions deepdataspace/model/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand All @@ -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,
):
"""
Expand All @@ -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)
Expand Down Expand Up @@ -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
"""
Expand Down

0 comments on commit db5dccc

Please sign in to comment.