问题描述
我有10000个BMP图像,其中包含一些手写数字.如果我想将数据馈送到神经网络,我该怎么办?对于MNIST数据集,我只需要写
(X_train, y_train), (X_test, y_test) = mnist.load_data()
我在python中使用Keras库.如何创建此类数据集?
您可以编写一个函数来加载所有图像,如果所有图像都适合RAM,则将它们堆叠到一个numpy数组中,或者使用Keras ImageDataGenerator( https://keras.io/preprocessing/image/),其中包含函数flow_from_directory
.您可以在此处找到示例 https://gist.github.com/fchollet/0830affa1f7f19fd47b06d4cf89ed44d . /p>
I have 10000 BMP images of some handwritten digits. If i want to feed the datas to a neural network what do i need to do ? For MNIST dataset i just had to write
(X_train, y_train), (X_test, y_test) = mnist.load_data()
I am using Keras library in python . How can i create such dataset ?
You can either write a function that loads all your images and stack them into a numpy array if all fits in RAM or use Keras ImageDataGenerator (https://keras.io/preprocessing/image/) which includes a function flow_from_directory
. You can find an example here https://gist.github.com/fchollet/0830affa1f7f19fd47b06d4cf89ed44d.
这篇关于如何像MNIST数据集一样创建图像数据集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!