Solved by ptrblck in post #5 
              
              
                Currently you are just returning the length of the path, not the number of images. 
image_paths should be a list of all paths to your images. 
You can get all image paths using the file extension and a wildcard: 
folder_data = glob.glob("D:\\Neda\\Pytorch\\U-net\\BMMCdata\\data\\*.jpg")
folder_mask …