The posted code looks alright, but doesn’t match
print(dataset[0][1].shape) gives (1,)

so could you check what exactly is returned in the __getitem__ method, as the second return value doesn’t seem to be the mask.