Skip to content

Commit 66670b7

Browse files
committed
add tag in dataframe
1 parent f558d4e commit 66670b7

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

superannotate/analytics/common.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ def aggregate_annotations_as_df(
154154
"error": [],
155155
"locked": [],
156156
"visible": [],
157+
"tag": [],
157158
"trackingId": [],
158159
"probability": [],
159160
"pointLabels": [],
@@ -224,7 +225,7 @@ def __get_image_metadata(image_name, annotations):
224225
annotation_instance_id = 0
225226
for annotation in annotation_json:
226227
annotation_type = annotation.get("type", "mask")
227-
if annotation_type in ['tag', 'meta']:
228+
if annotation_type == "meta":
228229
continue
229230
if annotation_type == "comment":
230231
if include_comments:
@@ -243,6 +244,15 @@ def __get_image_metadata(image_name, annotations):
243244

244245
__append_annotation(annotation_dict)
245246
continue
247+
if annotation_type == "tag":
248+
annotation_tag = annotation["name"]
249+
annotation_dict = {
250+
"type": annotation_type,
251+
"tag": annotation_tag
252+
}
253+
annotation_dict.update(image_metadata)
254+
__append_annotation(annotation_dict)
255+
continue
246256
annotation_instance_id += 1
247257
annotation_class_name = annotation.get("className")
248258
if annotation_class_name is None:
@@ -322,8 +332,8 @@ def __get_image_metadata(image_name, annotations):
322332

323333
for attribute in attributes:
324334

325-
attribute_group = attribute["groupName"]
326-
attribute_name = attribute['name']
335+
attribute_group = attribute.get("groupName")
336+
attribute_name = attribute.get('name')
327337
annotation_dict = {
328338
"imageName": image_name,
329339
"instanceId": annotation_instance_id,

0 commit comments

Comments
 (0)