So, I need to define a transform method internal to my dataset class and use the transforms.compose set of transforms to process the image and mask separately.
What is the recommended/torch framework compatible way of returning images and labels from a dataset? Is it better to return them separately or use a sample dict to return it?
The PyTorch tutorials use the sample dict approach: https://pytorch.org/tutorials/beginner/data_loading_tutorial.html 43

Sample of our dataset will be a dict {‘image’: image, ‘landmarks’: landmarks}. Our dataset will take an optional argument transform so that any required processing can be applied on the sample.

Its easy to miss the fact that torchvision transforms cannot handle both the image and mask in one go, without going through the sources.