Adding labeled test set (Image Segmentation)

I’m new using Currently I’m trying to apply to an image segmentation problem that I have been facing through using Keras. I have created my custom ItemBase and ItemList classes and loaded train and validation datasets successfully. The problem that I’m facing now is how to add a custom labeled test set to databunch.

[1] data = ImageList.from_folder(…).split_by_valid_func(…).databunch() <- Here I have labeled train and valid set loaded.
[2] data.add_test(test_data) <- Here I add only the inputs of test set

What I’m missing?

Test sets are deliberately unlabeled by If you want to test the model on your test data:

data_test = ImageDataBunch.from_folder(
size=(336, 336),

After you’ve created your own ImageDataBunch, you can add that to your model after it’s finished its fitting by:


Considering learn is your learner and data_test is your ImageDataBunch. Have fun!

1 Like

@senecamanu right track, but the above won’t quite work. Please see my notebook and experiments here to see why :slight_smile:


Your examples are better!

1 Like