referring to the above link to create pascal dataset and copied the code below
from gluoncv import data, utils
from matplotlib import pyplot as plt
from mxnet.gluon import data as gdata
train_dataset = data.VOCDetection(splits=[(2007, 'trainval')])
print('Num of training images:', len(train_dataset))
I am certain that train_dataset is built correctly since I can plot the image and the bounding box using the plotting code from the link above
gluoncv.data.pascal_voc.detection.VOCDetection is the type of train_dataset
I am trying to build an iterator out of train_dataset
train_dataset = data.VOCDetection(splits=[(2007, 'trainval')])
print('Num of training images:', len(train_dataset))
print(type(train_dataset))
batch_size = 32
num_workers=1
train_loader = gdata.DataLoader(train_dataset,
batch_size=batch_size,
num_workers=num_workers,
shuffle=True,
last_batch="rollover")
for img, label in train_loader:
print(f'img: {img.shape}')
print(f'label: {label.shape}')
break
Getting error below:
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/opt/conda/lib/python3.6/site-packages/mxnet/gluon/data/dataloader.py", line 400, in _worker_fn
batch = batchify_fn([_worker_dataset[i] for i in samples])
File "/opt/conda/lib/python3.6/site-packages/mxnet/gluon/data/dataloader.py", line 147, in default_mp_batchify_fn
return [default_mp_batchify_fn(i) for i in data]
File "/opt/conda/lib/python3.6/site-packages/mxnet/gluon/data/dataloader.py", line 147, in <listcomp>
return [default_mp_batchify_fn(i) for i in data]
File "/opt/conda/lib/python3.6/site-packages/mxnet/gluon/data/dataloader.py", line 151, in default_mp_batchify_fn
ctx=context.Context('cpu_shared', 0))
File "/opt/conda/lib/python3.6/site-packages/mxnet/ndarray/utils.py", line 146, in array
return _array(source_array, ctx=ctx, dtype=dtype)
File "/opt/conda/lib/python3.6/site-packages/mxnet/ndarray/ndarray.py", line 2504, in array
arr = empty(source_array.shape, ctx, dtype)
File "/opt/conda/lib/python3.6/site-packages/mxnet/ndarray/ndarray.py", line 3955, in empty
return NDArray(handle=_new_alloc_handle(shape, ctx, False, dtype))
File "/opt/conda/lib/python3.6/site-packages/mxnet/ndarray/ndarray.py", line 140, in _new_alloc_handle
ctypes.c_int(int(_DTYPE_NP_TO_MX[np.dtype(dtype).type])),
KeyError: <class 'numpy.object_'>
"""
The above exception was the direct cause of the following exception: