加载 PNG 图像到

Loading PNG image to

我正在寻找一种将 PNG 文件作为 TensorFlow 2.x 日期集加载的有效方法。这里有多个答案,它们都使用 Tensorflow 1.x 语法。我还检查了 official Tensorflow tutorial,但他们使用的是 tf.keras.preprocessing.image_dataset_from_directory API,它仅在 tf-nightly 中可用。

是否有任何 API 的 TensorFlow 2.x 能够从文件夹加载图像,将子文件夹指定为标签,以及 return TensorFlow 数据集?

我觉得你可以用flow_from_directory的方法。你可能会发现这个 useful