本文主要是介绍读取SBD实例分割数据集,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
VOC可以用于实例分割SegmentationObject: 也是物体分割后的结果,总共2913张png图片。
SegmentationClass: 语义分割标签,2913张png图片,图片是一样的,只是语义和实例分割的标签不一样,2913有1449用于validation,1464用于train,
SBD有11355张,训练集可以用于实例分割,实例分割标签在inst,语义分割是cls,不过都是mat,得转成png
想训练voc和SBD的实例分割,找了半天的VOC转COCO,大部分都是bbox的,实例分割的只找到一个链接: Pascal VOC转COCO数据_Python_风吴痕的博客-CSDN博客.
函数实现有一些报错,还有效果也一般,会漏掉一部分像素,如下图:
遇到的报错是091011年的xml格式跟0708不太一样,改下 def data_transfer(self)里面的内容
// A code block
i if '<object>' in p:# 类别if json_file[-12] == '7' or json_file[-12] == '8':d = [next(fp).split('>')[1].split('<')[0] for _ in range(9)]# 边界框x1 = int(float(d[-4]));y1 = int(float(d[-3]));x2 = int(float(d[-2]));y2 = int(float(d[-1]))self.rectangle = [x1, y1, x2, y2]self.bbox = [x1, y1, x2 - x1, y2 - y1] # COCO 对应格式[x,y,w,h]if json_file[-12] == '9' or json_file[-12] == '0'or json_file[-12] == '1':d = [next(fp).split('>')[1].split('<')[0] for _ in range(6)]x1 = int(float(d[-3]));y1 = int(float(d[-1]));x2 = int(float(d[-4]));y2 = int(float(d[-2]))self.rectangle = [x1, y1, x2, y2]self.bbox = [x1, y1, x2 - x1, y2 - y1] # COCO 对应格式[x,y,w,h]elif json_file[-12] == '2':d = [next(fp).split('>')[1].split('<')[0] for _ in range(20)]x1 = int(float(d[-3]));y1 = int(float(d[-1]));x2 = int(float(d[-4]));y2 = int(float(d[-2]))self.rectangle = [x1, y1, x2, y2]self.bbox = [x1, y1, x2 - x1, y2 - y1] # COCO 对应格式[x,y,w,h]self.supercategory = d[0]if self.supercategory not in self.label:self.categories.append(self.categorie())self.label.append(self.supercategory)self.annotations.append(self.annotation())self.annID += 1
torchvision有实现VOC和SBD的代码,不过只能加载SBD语义分割的数据集
最后使用chainercv的程序加载了SBD实例分割数据集
参考博客
(5条消息)深度学习图像分割(一)——PASCAL-VOC2012数据集(vocdevkit、Vocbenchmark_release)详细介绍_人工智能_OLDPAN的博客-CSDN博客 https://blog.csdn.net/iamoldpan/article/details/79196413
(5条消息)扩增的Pascal VOC 语义分割数据集制作_网络_cncyww的博客-CSDN博客
链接: https://blog.csdn.net/cncyww/article/details/89188506/.
(5条消息)MaskRCNN识别Pascal VOC 2007_人工智能_风吴痕的博客-CSDN博客 https://blog.csdn.net/wc781708249/article/details/79542655#t3
这篇关于读取SBD实例分割数据集的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!