Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix saving of instance data in JSON #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions instance_data.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
Expand Down Expand Up @@ -41,9 +41,12 @@ def extract_instance_single_core(proc_id, annotations_set, categories, segmentat
continue
mask = (pan == segm_info['id']).astype(np.uint8)
mask = np.expand_dims(mask, axis=2)
mask = COCOmask.encode(np.asfortranarray(mask))[0]
# 'counts' is returned as binary in Python 3, decode it into a UTF8 string
mask['counts'] = mask['counts'].decode('utf8')
segm_info.pop('id')
segm_info['image_id'] = annotation['image_id']
segm_info['segmentation'] = COCOmask.encode(np.asfortranarray(mask))[0]
segm_info['segmentation'] = mask
annotations_instance.append(segm_info)

print('Core: {}, all {} images processed'.format(proc_id, len(annotations_set)))
Expand Down
2 changes: 1 addition & 1 deletion semantic_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
Expand Down