Although RNN is mostly used for sequence data, it can also be used for image data. We know that images have minimum two dimensions - height and width. Now think of one of the dimensions as time steps, and other as features. For MNIST, the image size is 28 x 28 pixels, thus we can think of an MNIST image as having 28 time steps with 28 features in each timestep.
We would give examples from time series and text data in next chapters, but let us build and train an RNN for MNIST in Keras to quickly glance over the process of building and training the RNN models.
You can follow along with the code in the Jupyter notebook ch-06_RNN_MNIST_Keras.
Import the required modules:
import keras
from keras.models import Sequential
from keras.layers import Dense, Activation
from keras.layers.recurrent import SimpleRNN
from keras.optimizers import RMSprop
from keras.optimizers...