In [3]:
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow import keras
import numpy as np
fashion_mnist = keras.datasets.fashion_mnist
(train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data()
plt.figure()
plt.imshow(train_images[123])
plt.savefig('img/imagen1.png')
plt.show()
Si queremos visualizar mas de una imagen podemos usar la siguiente funcion
In [4]:
import math
def ver(imagenes,lista):
plt.figure(figsize=(5,5))
n = math.ceil(np.sqrt(len(lista)))
for i in range(n*n):
if i >= len(lista):
break
plt.subplot(n,n,i+1)
plt.xticks([])
plt.yticks([])
plt.imshow(imagenes[lista[i]])
plt.savefig('img/imagen2.png')
plt.show()
ver(train_images,[1,2,3,45])
No hay comentarios.:
Publicar un comentario