我跟随datasets/detection_custom.html#derive-from-pascal-voc-format" rel="nofollow noreferrer">this example使用我自己的数据集在SSD模型中使用。我已经按照规定的格式准备了目录/文件。然而,这似乎对我不起作用,给了我相当奇怪的结果。在
from gluoncv.data import VOCDetection
class VOCLike(VOCDetection):
CLASSES = ['Class0', 'Class1', 'Class2']
def __init__(self, root, splits, transform=None, index_map=None, preload_label=True):
super(VOCLike, self).__init__(root, splits, transform, index_map, preload_label)
dataset = VOCLike(root='VOCtemplate_2', splits=((2018, 'train'),))
print('length of dataset:', len(dataset))
print('label example:')
print(dataset[0][1])
输出:
^{pr2}$注释文件如下所示(使用labelImg工具创建):
<annotation>
<folder>Class0</folder>
<filename>20180403-203558.jpg</filename>
<path>/some/file/path/20180403-203558.jpg</path>
<source>
<database>Unknown</database>
</source>
<size>
<width>2688</width>
<height>1520</height>
<depth>3</depth>
</size>
<segmented>0</segmented>
<object>
<name>Class0</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>489</xmin>
<ymin>1020</ymin>
<xmax>1514</xmax>
<ymax>1355</ymax>
</bndbox>
</object>
</annotation>
数据集的长度是正确的,但dataset
中的其他内容不正确。有没有关于我做错事的线索?在
问题是类名有大写字母;将类名(在
CLASSES
和注释xml
)改为所有小写字母就解决了这个问题。不确定这是故意的还是错误。在相关问题 更多 >
编程相关推荐