Skip to content

Conversation

@MuhsinFatih
Copy link
Contributor

While I was playing with exported annotations, I noticed that they are not exported correctly when there is a segment with a point outside the boundaries of the canvas.
In coco_utils.py, the following lines do this:

x = _fit(round(center[0] + point[0], 2), image_width, 0)
y = _fit(round(center[1] + point[1], 2), image_height, 0)

Which simply takes points outside canvas to the edges. However that breaks the geometry:
annotator

I don't know if making sure all the segments are in the canvas is needed, so I tested it with _fit removed, and exporting & importing kept annotations as-is. I also used pycocoutils and imantics to do use annotations for computer visionry stuff and everything worked as expected, such as coco.annToMask(), which I had initially suspected might fail with points out of canvas.

I tried to implement a version where the points are projected correctly, but quickly realized that there is lots of edge cases, i.e. if you do segmentations around 3 quadrants it will do a shortcut between two edges and miss some of the area. I couldn't think of a solution that doesn't involve a bazillion if statements yet so I left my attempt there in paperjs_to_coco_cliptobounds() function, in case someone wants to take over where I left it

@jsbroks jsbroks merged commit a76722b into jsbroks:master Feb 19, 2020
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

Successfully merging this pull request may close these issues.

2 participants