我正在Mxnet中进行图像分类。我用RecordFileDetection类加载了数据集。我想打印数据和标签的形状。但这显示了错误。
我的代码段是:
from gluoncv.data import RecordFileDetection
train_data_loader=RecordFileDetection('/home/vj/
Desktop/example_rec.rec',coord_normalized=True)
print(len(train_data_loader))
data =train_data_loader[0][1]
print(data.shape)
跟踪
IndexError Traceback (most recent call
last)
<ipython-input-70-3bc3bb8bd0b5> in <module>()
2
train_data_loader=RecordFileDetection('/home/vj/
Desktop/example_rec.rec',coord_normalized=True)
3 print(len(train_data_loader))
----> 4 data =train_data_loader[0][1]
5 print(data.shape)
/usr/local/lib/python2.7/dist-packages/gluoncv/data/
recordio/detection.pyc in __getitem__(self, idx)
71 h, w, _ = img.shape
72 if self._coord_normalized:
---> 73 label = _transform_label(label, h, w)
74 else:
75 label = _transform_label(label)
/usr/local/lib/python2.7/dist-
packages/gluoncv/data/recordio/detection.pyc in
_transform_label(label, height, width)
8 label = np.array(label).ravel()
9 header_len = int(label[0]) # label header
---> 10 label_width = int(label[1]) # the label width for each
object, >= 5
11 if label_width < 5:
12 raise ValueError(
IndexError: index 1 is out of bounds for axis 0 with size 1
我没有得到什么错误。请帮助我。
预先感谢