I’m just trying to set up the COCO segmentation dataset for a FastAI learner, but whenever I try to do anything with that learner I get the error:
TypeError: batch must contain tensors, numbers, dicts or lists; found <class 'PIL.Image.Image'>
Is there some kind of additional formatting I need to do before I wrap the DataLoaders in an ImageDataBunch or do I need to wrap them with a SegmentationItemList somehow?
This is the full code that I’m using right now:
path = Path('data/coco')
cocoTrain = dset.CocoDetection(root=path/'train', annFile=path/'annotations/instances_train2017.json')
cocoValid = dset.CocoDetection(root=path/'valid', annFile=path/'annotations/instances_val2017.json')
cocoTrain.c = 80
cocoValid.c = 80
train_loader = torch.utils.data.DataLoader(cocoTrain, batch_size=32, shuffle=True)
valid_loader = torch.utils.data.DataLoader(cocoValid, batch_size=32, shuffle=True)
data = DataBunch.create(cocoTrain, cocoValid, bs=32)
learn = unet_learner(data, models.resnet34, metrics=accuracy)