Commit 0dd21139 authored by Fan Yang's avatar Fan Yang Committed by A. Unique TensorFlower
Browse files

Internal change

PiperOrigin-RevId: 411171872
parent db2fab99
...@@ -261,6 +261,10 @@ def convert_groundtruths_to_coco_dataset(groundtruths, label_map=None): ...@@ -261,6 +261,10 @@ def convert_groundtruths_to_coco_dataset(groundtruths, label_map=None):
np_mask[np_mask > 0] = 255 np_mask[np_mask > 0] = 255
encoded_mask = mask_api.encode(np.asfortranarray(np_mask)) encoded_mask = mask_api.encode(np.asfortranarray(np_mask))
ann['segmentation'] = encoded_mask ann['segmentation'] = encoded_mask
# Ensure the content of `counts` is JSON serializable string.
if 'counts' in ann['segmentation']:
ann['segmentation']['counts'] = six.ensure_str(
ann['segmentation']['counts'])
if 'areas' not in groundtruths: if 'areas' not in groundtruths:
ann['area'] = mask_api.area(encoded_mask) ann['area'] = mask_api.area(encoded_mask)
gt_annotations.append(ann) gt_annotations.append(ann)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment