小编sam*_*815的帖子

如何将 tf.data.Dataset 拆分为 keras 的 x_train、y_train、x_test、y_test

如果我有一个数据集

dataset = tf.keras.preprocessing.image_dataset_from_directory(
    directory,
    labels="inferred",
    label_mode="int",
    class_names=None,
    color_mode="rgb",
    batch_size=32,
    image_size=(32, 32),
    shuffle=True,
    seed=None,
    validation_split=None,
    subset=None,
    interpolation="bilinear",
    follow_links=False,
)
Run Code Online (Sandbox Code Playgroud)

如何将其分成 x 和 y 数组?x 数组将是 IMG 数组,y 数组将包含每个 img 的类别。

python image machine-learning tensorflow keras-2

5
推荐指数
1
解决办法
6792
查看次数

标签 统计

image ×1

keras-2 ×1

machine-learning ×1

python ×1

tensorflow ×1