Hello! I’m trying to access images from a testloader I made with dataloader so I can pass it onto a network. However, everytime I run the code cell with next(iter()) I keep getting the same images back to back even though there are so many to choose from! I thought every time I ran that cell block I’d get a new batch of images for test… Can someone help me with this?
# testing data
testset = datasets.ImageFolder('./data/test_data', transform=transform)
testloader = torch.utils.data.DataLoader(testset, batch_size=32, shuffle=True)

# Showing the images
test_images, test_labels = next(iter(testloader))
fig = plt.figure(figsize=(15,4))

for i in range(5):
    
    ax = fig.add_subplot(1, 5, i + 1)
    plt.imshow(images[i].permute(1, 2, 0))
    plt.axis("off")

This is the output every single time ):

image851×158 49.6 KB