The following code
%matplotlib inline
for i in range(0, 5):
index = np.random.choice(len(dataset))
print('index:', index)
image = dataset[index, :, :]
print('image shape:', np.shape(image))
plt.imshow(image)
display five printouts and one single image at the end in jupyter notebook.
Is it possible, to display images on each loop iteration?
I was able to do this with image files with
for fullname in fullnames:
print('fullname:', fullname)
display(Image(filename=fullname))
Is it possible to do the same with ndarrays?
UPDATE
Writing
for i in range(0, 5):
...
plt.figure()
plt.imshow(image)
made it better, but not perfect. Images displayed in multiple, but all are AFTER the text.
Should be interleaved.