google-research / pix2seq

Pix2Seq codebase: multi-tasks with generative modeling (autoregressive and diffusion)
Apache License 2.0
857 stars 71 forks source link

Convert mask to polygon #45

Closed zkyseu closed 1 year ago

zkyseu commented 1 year ago

Hi, I have a question that how you convert the instance mask to polygon in your code? I find that codes used to generate polygons :

polygons = example['image/object/segmentation'].to_tensor(
        default_value=vocab.PADDING_FLOAT,
        shape=[None, max_points * 2])

but this codes do not contain instance mask from the given label. so how do you convert given instance mask label to a polygon? Thanks!

saxenasaurabh commented 1 year ago

The coco dataset provides the polygons. Please see https://cocodataset.org/#format-data

gg22mm commented 10 months ago

Do you have a more detailed explanation, just switching between datasets?