【问题标题】:create tfrecord from labelme json file从 labelme json 文件创建 tfrecord
【发布时间】:2019-05-11 22:53:32
【问题描述】:

我想用有限 相对较小图像数据集的一些特殊形状的特殊项目创建一个对象检测神经网络。为此,我使用了 labelme 我认为由于对象的形状,多边形标签的性能会比普通的拳击标签更好。 我想使用一个来自 coco Tensorflow 检测模型的预训练模型,但我 努力从 json 文件创建 tfrecord 文件。正如您在下面看到的那样,它同时包含多边形和圆形形状类型。提前感谢您的帮助。 如果您知道如何将其转换为 tfrecord 或其他更适合我的问题的标记程序,请告诉我,如果它解决了我的问题,我将重新标记我的图像。 json 文件 例如:

    {
  "version": "3.5.0",
  "flags": {},
  "shapes": [
    {
      "label": "polygon",
      "line_color": null,
      "fill_color": null,
      "points": [
        [
          447,
          110
        ],
        [
          491,
          63
        ],
        [
          531,
          47
        ],
        [
          559,
          79
        ],
        [
          544,
          121
        ],
        [
          532,
          128
        ],
        [
          536,
          139
        ],
        [
          516,
          148
        ],
        [
          497,
          174
        ]
      ],
      "shape_type": "polygon"
    },
    {
      "label": "circle",
      "line_color": null,
      "fill_color": null,
      "points": [
        [
          403,
          317
        ],
        [
          377,
          262
        ]
      ],
      "shape_type": "circle"
    }
  ],
  "lineColor": [
    0,
    255,
    0,
    128
  ],
  "fillColor": [
    255,
    0,
    0,
    128
  ],
  "imagePath": "teszt.jpg",
  imageData ...(long data) 

【问题讨论】:

  • 你在这方面有什么进展吗?我也想知道。如果您取得了进展,您可以分享作为答案

标签: python json tensorflow object-detection tfrecord


【解决方案1】:

从 JSON 文件的外观来看,我相信您正在执行实例分割。 您可以使用labelme 示例目录中提供的脚本。

Instance Segmentation folder 有两个脚本labelme2coco.pylabelme2voc.py

因此您可以将labelme JSON 转换为 COCO 格式或 VOC 格式并使用它们来构建 TFRecords

tensorflow models repo 有一堆脚本可以帮助你做到这一点

【讨论】:

    猜你喜欢
    • 2022-10-08
    • 1970-01-01
    • 2021-04-23
    • 2021-06-27
    • 2018-12-21
    • 2021-12-08
    • 1970-01-01
    • 2018-06-19
    • 2023-04-04
    相关资源
    最近更新 更多