from __future__ import absolute_import, division, print_function, unicode_literals

import matplotlib.pyplot as plt 
import numpy as np
import tensorflow as tf 
import tensorflow_datasets as tfds 

# print(tfds.list_builders())

mnist_train, info = tfds.load(name="mnist", split="train", with_info=True,data_dir=".//datasets")
assert isinstance(mnist_train, tf.data.Dataset)
print(mnist_train)

# for mnist_example in mnist_train.take(1):
#     image, label = mnist_example["image"], mnist_example["label"]

#     plt.imshow(image.numpy()[:, :, 0].astype(np.float32), cmap = plt.get_cmap('gray'))
#     print("Label: %d" % label.numpy())


#     plt.pause(0) 

print(info)
fig = tfds.show_examples(info, mnist_train)

image.png

image.png


zeroyl
156 声望2 粉丝

引用和评论

0 条评论