I am trying to port a Pascal 2007-based object detection application to fastai2, but it fails reading the Pascal data set into the dataloader.
Have created a dictionary of images and targets, a DataBlock, and a dataloader
img_y_dict = dict(zip(tot_img_names, tot_truths))
data = DataBlock(blocks=(ImageBlock, BBoxBlock, BBoxLblBlock),
get_items=get_image_files,
splitter=RandomSplitter(),
getters=[noop, lambda o: img_y_dict[o.name][0], lambda o: img_y_dict[o.name][1]],
item_tfms=Resize(sz),
batch_tfms=aug_transforms(),
n_inp=1)
dlrs = data.dataloaders(path)
It fails in the getters
in (o)
2 get_items=get_image_files,
3 splitter=RandomSplitter(),
----> 4 getters=[noop, lambda o: img_y_dict[o.name][0], lambda o: img_y_dict[o.name][1]],
5 #getters=[truth_data_func],
6 item_tfms=Resize(sz),KeyError: ā008673.jpgā
It fails with, at least, these images: ā008673.jpgā, ā005939.jpgā, ā004236.jpgā in the test.jason, and ā008359.jpgā in the valid.json folders. I know that "008359.jpgā has a header, but has missing the āsegmentationā entry. The other image/target tuples may have errors as well.
The error says: KeyError: ā008673.jpgā; I have inspected the img_y_dict dictionary:
for k in img_y_dict.keys():
print(k)
None of the failing tuples appear in the dictionary. They have been filtered out (by the get_annotations?)