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

what format is coco annotations? #102

Open
zbsean opened this issue Dec 26, 2017 · 9 comments
Open

what format is coco annotations? #102

zbsean opened this issue Dec 26, 2017 · 9 comments

Comments

@zbsean
Copy link

zbsean commented Dec 26, 2017

what format is coco annotations?my annotations format is [[x1,y1],[x2,y2],...[xn,yn]]. but coco annotation format is [[312.29, 562.89, 402.25, 232.61, 560.32, 300.72, 571.89]], what different?

@dexter1608
Copy link

#111 any suggestions ?
thank you

@rafaelpadilla
Copy link

According to here it should be "bbox" : [x,y,width,height]

@suhyunified
Copy link

Is it right that x means xmin?

@rafaelpadilla
Copy link

rafaelpadilla commented Aug 8, 2019

Is it right that x means xmin?

For object detection annotations, the format is "bbox" : [x,y,width,height]
Where:
x, y: the upper-left coordinates of the bounding box
width, height: the dimensions of your bounding box

@nirandiw
Copy link

Wasn't the question on the "segmentations" within "annotations". Did you figure out how to convert the [[x, y]...] to the values in "segmentations"?

I'm having the same problem.

@Atul997
Copy link

Atul997 commented Nov 26, 2020

@nirandiw use this to generate segmentation from bounding box
annotation["segmentation"] = [[x1,y1,x1,(y1 + y2), (x1 + x2), (y1 + y2), (x1 + x2), y1]]

@jpatrickpark
Copy link

@zbsean @nirandiw

COCO segmentation format seems to be a list which contains multiple polygons.
Each item in the list should be a separate polygon.
Each polygon consists of multiple points, which are stored in the following format of [x0, y0, x1, y1, ..., xn, yn].

For example, in the following segmentation [[224.24, 297.18, 228.29, 297.18, 234.91, 298.29, 243.0, 297.55, 249.25, 296.45, 252.19, 294.98, 256.61, 292.4, 254.4, 264.08, 251.83, 262.61, 241.53, 260.04, 235.27, 259.67, 230.49, 259.67, 233.44, 255.25, 237.48, 250.47, 237.85, 243.85, 237.11, 240.54, 234.17, 242.01, 228.65, 249.37, 224.24, 255.62, 220.93, 262.61, 218.36, 267.39, 217.62, 268.5, 218.72, 295.71, 225.34, 297.55]]:

  • There is one polygon corresponding for the current annotation
  • This polygon contains 24 points where the first point is (224.24, 297.18) and the last point is (225.34, 297.55)

For another example, I am visualizing an image that has 17 polygons inside a bbox below (using matplotlib.patches.Polygon). Blue lines indicate bbox, and the red lines indicate the polygons. To get segmentation, you should fill inside each of the polygons.
image

@ricber
Copy link

ricber commented Oct 26, 2022

Hi! May I know why the polygon coordinates are float and not integers? I was expecting integer numbers because I thought they were expressed in terms of pixels. Does it mean that I can have polygons' coordinates in the middle of pixels with a centesimal precision?

@Abhishek2271
Copy link

This could be because of resize, based on the discussions here: #34

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

9 participants