Reading multiple images as custom dataset for PyTorch?
I want to read in multiple images for the main_image set and blur_image set. For example, 5 main images and 5 blurred images. The goal is determine what values for the kernel in the convolutional layer convert the main images to the blurred images. The assumption is that the same kernel is used to blur each of the 5 original images to produce the 5 blurred images

My code is available at: https://pastebin.com/PWf7rjd4 and https://pastebin.com/VxryDb7g

However, it seems to only be processing the first image, that is "1.png" for the main and blurred images. It is not processing images 2.png, 3.png, 4.png, and 5.png

How can I fix this?

In your class BlurDataset you only return one image in the __getitem__ method. In your main method you call 

for batch_idx, (main, blur) in enumerate(train_loader)


The torch.utils.data.Dataset class that you inherit from then calls __getitem__ with the index given by enumerate. It will give you one pair of pictures in each iteration of the loop. If you want to get all 5 pairs of pictures in the first iteration you have to change your __getitem__ method to loop over images and return them all. 
