Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a Image Dataset just like MNIST dataset?

Tags:

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 ?

like image 991
Md Shopon Avatar asked Sep 02 '16 09:09

Md Shopon


People also ask

What is the format of MNIST dataset?

The source MNIST data files are stored in a proprietary binary format. The program loads the binary pixel and label training files into memory, converts the data to tab-delimited text and saves just the first 1,000 training images and their "0" to "9" labels.


1 Answers

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.

like image 191
Mikael Rousson Avatar answered Sep 17 '22 17:09

Mikael Rousson