I wish you a happy new year and I am trying to plot 5 random image paths in a for loop. Here is the code blocks:
test_img_number = random.randint(0, len(x_test))
test_img = x_test[test_img_number]
ground_truth=y_test_argmax[test_img_number]
test_img_input=np.expand_dims(test_img, 0)
prediction = (model.predict(test_img_input))
predicted_img=np.argmax(prediction, axis=3)[0,:,:]
plt.figure(figsize=(32, 32))
plt.subplot(131)
plt.title('Testing Image')
imshow(test_img)
plt.subplot(132)
plt.title('Testing Label')
imshow(ground_truth)
plt.subplot(133)
plt.title('Prediction on test image')
imshow(predicted_img)
plt.show()
The goal is to plot 5 different random image paths which are created by the upper side of the code block. In short, create 5 different random values and plot these images in a subplot(5,3). I have tried many different ways but I couldn't handle it.
Could you please help me? Thanks in advance.