I assume self.transform is the transformer.
You cannot apply the transformation on a dict. You should apply it on PIL.Images.
So probably self.transform(sample['image']) will work.
If you need the exact same transformation for your sample and mask, which seems to be the case, have a look at this post 118.