【发布时间】:2020-02-08 16:01:57
【问题描述】:
所以我将图像放在 numpy 数组中,但不在目录中。我有一个最终的 numpy 数组,它是一个 4d 形状的张量(样本、48、48、1)。我的目标是使用 keras 的图像数据生成器将它们转换为 (sample, 224, 224, 1)。请指导我如何做到这一点,因为到目前为止,我已经看到人们使用他们加载实际图像的目录中的图像数据生成器的示例。
我在本地存储了 4 个 numpy 数组 train_images.npy、train_labels.npy、test_images.npy 和 test_labels.npy。
这些 numpy 中图像的形状是 (sample, 48, 48, 1)
这些 numpy 中标签的形状是 (sample, number of classes),因为我已经将它们转换为 keras.utils.np_utils.to_categorical 方法。
【问题讨论】:
-
您能提供您已经尝试过的任何代码吗?为什么不能将图像保存到目录?
标签: python numpy tensorflow image-processing keras