Kalyan M
Kalyan M

Reputation: 325

How to load images for training a neural network in real time in Keras?

I'm using Keras with tensorflow backend. I have a large dataset (Caltech 256) that I want to train.

I've created four .npy files called training, trainlbl, testing, testlbl.

Now instead of running np.load() which almost completely occupies my ram, how can I load them from disk in real time while training itself? From searching on the internet I get an idea that it can be done through Keras's data generator, but I'm not able to understand how.

Upvotes: 0

Views: 2071

Answers (1)

Daniel Däschle
Daniel Däschle

Reputation: 807

Maybe it would be possible to answer your question in this post, but i think it isn't useful because you need more knowledge how to use or write deep learning networks.

My suggestion would be to use existing tutorials which shows you how to create neural networks for image classification. A very nice example is this blog post: https://www.pyimagesearch.com/2017/12/11/image-classification-with-keras-and-deep-learning/

This guy shows you how you use DataGenerator from Keras. DataGenerator can do many more things than just lazy loading images from disk.

Upvotes: 1

Related Questions