How to use torch.cat to concat pictures belonging to two different folders

I think this thread is what you want, it is a custom dataset example.

You can do some transformation on the image and label, then I think you can cat them together in __getitem__ if you still need.