coco转labelme格式

Convert coco to labelme format

我想将现有的 coco 格式转换为 labelme 格式:

可可:

{"info":{"description":"my-project-name"},"images":[{"id":1,"width":3296,"height":2472,"file_name":"test.png"}],"annotations":[{"id":0,"iscrowd":0,"image_id":1,"category_id":1,"segmentation":[[1281.1870967741934,626.5437788018434,1235.6202764976958,726.7907834101383,1383.7124423963132,745.0175115207373,1547.752995391705,726.7907834101383,1595.5981566820276,624.2654377880185]],"bbox":[1235.6202764976958,624.2654377880185,359.97788018433175,120.75207373271883],"area":34552.81165112869},{"id":1,"iscrowd":0,"image_id":1,"category_id":1,"segmentation":[[474.6543778801842,776.9142857142858,460.98433179723486,895.3880184331798,823.2405529953916,870.3262672811061,807.2921658986174,758.6875576036867]],"bbox":[460.98433179723486,758.6875576036867,362.2562211981567,136.70046082949307],"area":40000.595896281506}],"categories":[{"id":1,"name":"leaf"}]}

标签:

{
  "version": "4.5.7",
  "flags": {},
  "shapes": [
    {
      "label": "frame",
      "points": [
        [
          1055.4444444444446,
          266.11111111111114
        ],
        [
          1038.7777777777778,
          2171.666666666667
        ],
        [
          1124.888888888889,
          2166.1111111111113
        ],
        [
          1144.3333333333335,
          343.8888888888889
        ],
        [
          1644.3333333333335,
          349.44444444444446
        ],
        [
          1644.3333333333335,
          2168.888888888889
        ],
        [
          1736.0,
          2171.666666666667
        ],
        [
          1727.6666666666667,
          260.55555555555554
        ]
      ],
      "group_id": 1,
      "shape_type": "polygon",
      "flags": {}
    },

我不清楚为什么 labelme 将多边形存储为点。如何将我的 coco 多边形列表转换为 labelme 的点多边形列表?

我和我的同学创建了一个名为 PyLabel to help others with this kind of task and other labelling tasks. You can see an example in this notebook: https://github.com/pylabel-project/samples/blob/main/coco2voc.ipynb

的 python 包

虽然这可能不会直接转到 labelme 格式,但您应该能够使用包的导入器工具将数据导入数据框,然后您可以使用该数据框将其转换为所需的格式。

如果您有兴趣在其他格式之间进行转换,可以在此处找到该包的代码:https://github.com/pylabel-project/