【发布时间】:2020-09-24 10:37:28
【问题描述】:
使用 TensorFlow 遍历目录并拍摄我想用于训练 NN 的图像。
train_ds = tf.keras.preprocessing.image_dataset_from_directory(
wk_dir,
labels="inferred",
label_mode="int",
class_names=None,
color_mode="grayscale",
batch_size=batches,
image_size=image_dim,
shuffle=True,
seed=1968,
validation_split=0.2,
subset="training",
interpolation="bilinear",
follow_links=False,
)
找到属于 3 个类的 127561 个文件。 使用 102049 文件进行训练。
结果 - 它有效....现在我正在尝试使用它来输入模型,但不知道如何管理它...
print(train_ds)
<BatchDataset shapes: ((None, 576, 432, None), (None,)), types: (tf.float32, tf.int32)>
那么我在数组中是否有 2 个元素,一个有 4 个元素,其中 2 个是空的,第二个元素是他的分类?
我试图拆分 BatchDatashape 并得到错误TypeError: 'BatchDataset' object is not subscriptable
如何操作对象类型为 python.data.ops.dataset_ops.BatchDataset 的 TF?
【问题讨论】:
标签: python tensorflow split