实例9:在动态图中读取Dataset数据集
在TensorFlow2.0版本中,动态图已经取代静态图成为系统默认开发框架
1. 代码实现:添加动态图调用
import os
import tensorflow as tf
from sklearn.utils import shuffle
import numpy as np
import matplotlib.pyplot as plt
tf.compat.v1.enable_eager_execution()
print("Tensorflow版本:{}".format(tf.__version__))
print("Eager execution:{}".format(tf.executing_eagerly()))
2. 制作数据集
3. 代码实现:在动态图中显示数据
for step, value in enumerate(tdataset):
showing(step, value[1].numpy(), np.asarray(value[0]*255,np.uint8), 10)
本文介绍了如何在TensorFlow 2.0的动态图环境中使用Dataset加载和处理数据,通过示例展示了如何迭代并显示数据。
1140

被折叠的 条评论
为什么被折叠?



