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

'MultiPolygon' object has no attribute 'exterior' #9

Open
AhmadZobairSurosh opened this issue Mar 30, 2022 · 1 comment
Open

'MultiPolygon' object has no attribute 'exterior' #9

AhmadZobairSurosh opened this issue Mar 30, 2022 · 1 comment

Comments

@AhmadZobairSurosh
Copy link

AhmadZobairSurosh commented Mar 30, 2022

Hi
Thank you for putting the effort on creating this great repo.

I am trying to convert binary images to coco annotations, but i get this error. can you please explain why is this happening and how can i solve it. I also googled it, but have not been lucky yet.
"""

AttributeError Traceback (most recent call last)
Input In [5], in
84 coco_format["categories"] = create_category_annotation(category_ids)
86 # Create images and annotations sections
---> 87 coco_format["images"], coco_format["annotations"], annotation_cnt = images_annotations_info(mask_path)
89 with open("output/{}.json".format(keyword),"w") as outfile:
90 json.dump(coco_format, outfile)

Input In [5], in images_annotations_info(maskpath)
50 category_id = category_colors[color]
52 # "annotations" info
---> 53 polygons, segmentations = create_sub_mask_annotation(sub_mask)
55 # Check if we have classes that are a multipolygon
56 if category_id in multipolygon_ids:
57 # Combine the polygons to calculate the bounding box and area

File ~/Desktop/Py_js/Data/python_with_vlad/pycharm/polymore/Binary-Image_to_coco/image-to-coco-json-converter-master/src/create_annotations.py:56, in create_sub_mask_annotation(sub_mask)
52 continue
54 polygons.append(poly)
---> 56 segmentation = np.array(poly.exterior.coords).ravel().tolist()
57 segmentations.append(segmentation)
59 return polygons, segmentations

AttributeError: 'MultiPolygon' object has no attribute 'exterior'

"""

Thanks in advance.

@chrise96
Copy link
Owner

chrise96 commented Apr 6, 2022

See closed issue 6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants