You could write a custom Dataset
to load the images and their corresponding masks.
Have a look at the Data loading tutorial for a basic approach.
Here is a dummy implementation using the functional API of torchvision
to get identical transformations on the data and target images.
1 Like