Validate Model in a Custom Dataset

Hello, I’m creating a data object for Segmentation problem. For that, I did this:

data = (SegmentationItemList.from_folder(path_img)
                            .split_none()
                            .label_from_func(get_y_fn, classes=codes)
                            .transform(size=380)
                            .databunch(bs=4,num_workers=1)
                            .normalize(imagenet_stats))

That creates this object:

ImageDataBunch;

Train: LabelList (700 items)
x: SegmentationItemList
Image (3, 380, 380),Image (3, 380, 380),Image (3, 380, 380),Image (3, 380, 380),Image (3, 380, 380)
y: SegmentationLabelList
ImageSegment (1, 380, 380),ImageSegment (1, 380, 380),ImageSegment (1, 380, 380),ImageSegment (1, 380, 380),ImageSegment (1, 380, 380)
Path: ../data2/test/061_HE_aligned/patches;

Valid: LabelList (0 items)
x: SegmentationItemList

y: SegmentationLabelList

Path: ../data2/test/061_HE_aligned/patches;

Test: None

I have my images that I want to do segmentation on (x), and the masks(y). However, when I do `learn.validate(data.train_dl), I get the following error:

AttributeError: valid_dl

Am I loading my dataset properly? What is the best approach to create a train/validation dataloader?

I would highly appreciate any suggestion

Any idea what is wrong?

Well don’t use split_none(), as it basically means you don’t want to create a validation dataset. Use something like split_by_rand_pct() instead, and it should work for you.