将coco转换为labelme格式



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

Coco:

{"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的python包,以帮助其他人完成这类任务和其他标签任务。您可以在此笔记本中看到一个示例:https://github.com/pylabel-project/samples/blob/main/coco2voc.ipynb

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

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

相关内容

  • 没有找到相关文章

最新更新