I am working on a segmentation task, where my original images and masked images are in separate folder namely images and segmentation. I tried to build the DataBlock with the code,
tree = DataBlock(blocks = (ImageBlock() , ImageBlock()), get_items = get_image_files , splitter = RandomSplitter(valid_pct= 0.2), item_tfms = Resize(224), get_x = get_img, get_y = get_seg) tree.summary('data/train')
This is how I built my learner and dls:
# Dataloaders dls = tree.dataloaders('data/train/' , bs=8) dls.c = 1 # Learner learn = unet_learner(dls, resnet18 , n_out= dls.c , loss_func= nn.MSELoss() , metrics = dice)
The loss function I am using is
Dice but when I fit the model, I am getting an assertion error.
I am not sure what I am doing wrong, can anyone help me with this?