I am currently playing around with MNIST data as part of course on using numpy and tensorflow. I was running the code they provided in course and I noticed a few warnings from tensorflow when running this snippet of code:
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("../data/mnist_data/", one_hot=True)
I looked into the documentation and read that this is deprecated and one should use MNIST from keras instead. So I changed the above code to this
from keras.datasets import mnist
from keras.models import Sequential, load_model
from keras.layers.core import Dense, Dropout, Activation
from keras.utils import np_utils
(X_train, y_train), (X_test, y_test) = mnist.load_data()
my issue now is that in the course material they use this function:
training_digits, training_labels = mnist.train.next_batch(5000)
that function next_batch() isn't available with keras and the original MNIST dataset is pretty large. Is there a clever way to this with keras?
Many thanks in advance!
you can set batch_size and use one shot iterator() as described here Keras Mnist documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With