如何像MNIST数据集一样创建图像数据集? [英] How to create a Image Dataset just like MNIST dataset?

查看:363
本文介绍了如何像MNIST数据集一样创建图像数据集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有10000个BMP图像,其中包含一些手写数字.如果我想将数据馈送到神经网络,我该怎么办?对于MNIST数据集,我只需要写

(X_train, y_train), (X_test, y_test) = mnist.load_data()

我在python中使用Keras库.如何创建此类数据集?

解决方案

您可以编写一个函数来加载所有图像,如果所有图像都适合RAM,则将它们堆叠到一个numpy数组中,或者使用Keras ImageDataGenerator( 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数据集一样创建图像数据集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆