From a quick look at your code, it seems like your image and mask are the return type of imread which are imageio Arrays.
As the error message states, the dataloader cannot handle such type.
You will need to convert it either to a numpy array or a torch Tensor before returning them from your Dataset __getitem__ function.