【问题标题】:Annotate images in pascal voc xml [closed]在pascal voc xml中注释图像[关闭]
【发布时间】:2015-11-19 22:24:28
【问题描述】:

我需要一个工具来用矩形边界框注释图像。输出将采用 pascal voc xml 格式。注释和图像将成为卷积神经网络用于进行对象检测的训练数据集的一部分。我将自己手动注释图像。

我考虑过以下工具,但它们不支持 pascal-voc。

Labelme、Sloth、Pilab、No name

有没有可以节省我时间的注释工具?

【问题讨论】:

  • 我投票决定关闭,因为这是对工具的请求/建议。也许你最好在 SoftwareRecommendations StackExchange 中问这个问题。另请参阅:meta.stackoverflow.com/questions/254393/…
  • 我恭敬地建议,有效地管理深度学习数据集并不等同于寻找 pdf 推荐工具。
  • 您不是在问如何有效地管理大数据集;您询问用于注释图像的工具。你没有展示任何关于自己寻找这种工具的研究,也没有提供任何例子,也没有展示你的挑战是什么。请改进您的问题。
  • 正如我在最初的问题中所说,我使用的是深度学习的卷积神经网络。
  • @user3001937 我选择树懒来注释图像。它生成 json 作为输出。我写了一些将 json 转换为 pascal voc xml 的代码。您可以在底部看到代码(请参阅下面接受的答案)。 pascal voc 规范相当简单。看看一些现有的 pascal voc xml 文件。

标签: image-processing machine-learning computer-vision object-detection


【解决方案1】:

【讨论】:

  • pascal voc 格式是否接受旋转的矩形注释?我想检测划痕,但如果我不旋转矩形,当划痕是水平或垂直时,我会得到太多背景。
【解决方案2】:

这个 python 代码 sn-p 会将 Sloth json 转换为 pascal voc xml。

  def make_anno():
    zind = 0
    for z in data:
        print zind
        filename = data[zind]["filename"]
        print filename
        head, tail = os.path.split(filename)
        basename, file_extension = os.path.splitext(tail)    
        f = open(basename + '.xml','w') 
        line = "<annotation>" + '\n'
        f.write(line)
        line = '\t\t<folder>' + "folder" + '</folder>' + '\n'
        f.write(line)
        line = '\t\t<filename>' + tail + '</filename>' + '\n'
        f.write(line)
        line = '\t\t<source>\n\t\t<database>Source</database>\n\t</source>\n'
        f.write(line)
        im=Image.open('/home/location/VOCdevkit/newdataset/img/' + tail)
        (width, height) = im.size
        line = '\t<size>\n\t\t<width>'+ str(width) + '</width>\n\t\t<height>' + str(height) + '</height>\n\t'
        line += '\t<depth>Unspecified</depth>\n\t</size>'
        f.write(line)
        line = '\n\t<segmented>Unspecified</segmented>'
        f.write(line)
        ind = 0
        for i in data[zind]["annotations"]:
            line = '\n\t<object>'
            line += '\n\t\t<name>Name</name>\n\t\t<pose>Unspecified</pose>'
            line += '\n\t\t<truncated>Unspecified</truncated>\n\t\t<difficult>Unspecified</difficult>'
            xmin = (data[zind]["annotations"][ind]["x"])
            line += '\n\t\t<bndbox>\n\t\t\t<xmin>' + str(xmin) + '</xmin>'
            ymin = (data[zind]["annotations"][ind]["y"])
            line += '\n\t\t\t<ymin>' + str(ymin) + '</ymin>'
            width = (data[zind]["annotations"][ind]["width"])
            height = (data[zind]["annotations"][ind]["height"])
            xmax = xmin + width
            ymax = ymin + height
            line += '\n\t\t\t<xmax>' + str(xmax) + '</xmax>'
            line += '\n\t\t\t<ymax>' + str(ymax) + '</ymax>'
            line += '\n\t\t</bndbox>'
            line += '\n\t</object>'     
            f.write(line)
            ind +=1
            f.close()
        zind +=1

【讨论】:

    【解决方案3】:

    似乎没有工具可以输出您想要的格式。您可能想要使用以不同格式输出xml 的工具,并对其进行转换。不理想,但可能会起作用。

    例如,您可以构建一个 xslt 以将您的工具的 xml 输出转换为 Pascal VOC xml 标准。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-15
      • 1970-01-01
      • 2017-08-15
      • 2018-02-27
      • 2021-02-11
      • 1970-01-01
      • 2020-02-11
      • 2020-08-02
      相关资源
      最近更新 更多