Open holmbuar opened 2 years ago
If it is of any help, here is the output of calling outputs
, after the error is thrown:
outputs
{'instances': Instances(num_instances=3, image_height=671, image_width=804, fields=[pred_boxes: Boxes(tensor([[ 2.0434, 116.0116, 802.5441, 665.5936],
[ 2.0434, 116.0116, 802.5441, 665.5936],
[ 2.0434, 116.0116, 802.5441, 665.5936]], device='cuda:0')), scores: tensor([0.8476, 0.6173, 0.5370], device='cuda:0'), pred_classes: tensor([382, 935, 559], device='cuda:0'), pred_masks: tensor([[[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
...,
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False]],
[[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
...,
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False]],
[[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
...,
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False]]], device='cuda:0')])}
Calling
data_iter = iter(test_loader)
i = 0
for x in data_iter:
if i % 1000 == 0:
print(x)
i = i + 1
returns
[{'file_name': '/home/jupyter/happy-whale-and-dolphin/train_images/00021adfb725ed.jpg', 'image_id': '00021adfb725ed.jpg', 'width': 804, 'height': 671, 'image': tensor([[[ 74, 74, 73, ..., 71, 72, 73],
[ 76, 76, 77, ..., 63, 64, 65],
[ 80, 81, 83, ..., 60, 60, 61],
...,
[ 44, 42, 43, ..., 50, 51, 51],
[ 43, 41, 42, ..., 49, 50, 50],
[ 43, 41, 41, ..., 50, 50, 50]],
[[120, 120, 119, ..., 113, 114, 115],
[122, 122, 123, ..., 104, 104, 105],
[126, 127, 130, ..., 99, 99, 100],
...,
[ 45, 43, 43, ..., 48, 49, 50],
[ 46, 44, 43, ..., 49, 50, 50],
[ 45, 43, 43, ..., 50, 50, 50]],
[[170, 170, 169, ..., 163, 164, 165],
[172, 172, 173, ..., 155, 155, 156],
[175, 177, 178, ..., 149, 149, 150],
...,
[ 54, 53, 53, ..., 58, 59, 60],
[ 55, 53, 53, ..., 57, 58, 58],
[ 57, 55, 55, ..., 58, 58, 58]]], dtype=torch.uint8)}]
I am having a curious problem with a custom dataset, registered with a custom dataset function.
The Detectron2 setup and
cfg
is copied from Detic Colab tutorialA snippet of my code:
which returns
Note that the output format of
my_dataset_generator()
islist[dict]
. Also, thedf
in the function is the actual image metadata Pandas dataframe.Running
produces this traceback:
So the
x
inbatched_inputs
is a list, not a dict as expected. When I trythe output is
In other words, my data loader seems to return
list[list[dict]]
, instead oflist[dict]
. Have I goofed, or is this error due to something else?