Q:

What is the meaning of this output in the console when I run model.fit_generator in Keras?

I am new working with Keras. The code works correctly, but I would like to know the meaning of the values shown in the epochs. I am using the following code.
Where it says 46/46 and 226/277, what is the meaning of these numbers? Why 2 appear when normally only appears for example 100/100?
import sys
import os
from tensorflow.python.keras.preprocessing.image import ImageDataGenerator
from tensorflow.python.keras import optimizers
from tensorflow.python.keras.models import Sequential
from tensorflow.python.keras.layers import Dropout, Flatten, Dense, Activation
from tensorflow.python.keras.layers import  Convolution2D, MaxPooling2D
from tensorflow.python.keras import backend as K

K.clear_session()

data_entrenamiento = '/content/DatosEntrenamiento' #images

"""
Parameters
"""
epocas=20
longitud, altura = 28, 28
batch_size = 32
pasos = 1000
validation_steps = 300
filtrosConv1 = 32
filtrosConv2 = 64
tamano_filtro1 = (3, 3)
tamano_filtro2 = (2, 2)
tamano_pool = (2, 2)
clases = 3
lr = 0.0004

##Preparamos nuestras imagenes

generator = ImageDataGenerator(
    rescale=1. / 255,
    shear_range=0.2,
    zoom_range=0.2,
    horizontal_flip=True,
    )

test_datagen = ImageDataGenerator(rescale=1. / 255,validation_split=0.2)

entrenamiento_generador = generator.flow_from_directory(
    data_entrenamiento,
    target_size=(altura, longitud),
    batch_size=batch_size,
    class_mode='categorical',
    subset='training')

validacion_generador = test_datagen.flow_from_directory(
    data_entrenamiento,
    target_size=(altura, longitud),
    batch_size=batch_size,
    class_mode='categorical',
    subset='validation')

cnn = Sequential()
cnn.add(Convolution2D(filtrosConv1, tamano_filtro1, padding ="same", input_shape=(longitud, altura, 3), activation='relu'))
cnn.add(MaxPooling2D(pool_size=tamano_pool))

cnn.add(Convolution2D(filtrosConv2, tamano_filtro2, padding ="same"))
cnn.add(MaxPooling2D(pool_size=tamano_pool))

cnn.add(Flatten())
cnn.add(Dense(256, activation='relu'))
cnn.add(Dropout(0.5))
cnn.add(Dense(clases, activation='softmax'))

cnn.compile(loss='categorical_crossentropy',
            optimizer=optimizers.Adam(lr=lr),
            metrics=['accuracy'])

his = cnn.fit_generator(
    entrenamiento_generador,
    steps_per_epoch=pasos,
    epochs=epocas,
    validation_data=validacion_generador,
    validation_steps=validation_steps)

The output is :
Found 7230 images belonging to 3 classes.
Found 1446 images belonging to 3 classes.

Epoch 1/20

46/46 [=========] - 1s 21ms/step...

226/226 [======] - 8s 36ms/step...

Epoch 2/20

46/46 [=========] - 1s 21ms/step ...

226/226 [=======] - 8s 35ms/step ... 

A:

steps_per_epoch: Total number of steps (batches of samples) to yield from generator before declaring one epoch finished and starting the next epoch. It should typically be equal to the number of unique samples of your dataset divided by the batch size.

For training you have 7230 images, it means 226 batches of 32 images. It is also the steps_per_epoch which is normally calculated by steps_per_epoch = train_generator.n/batch_size. But here you declare steps_per_epoch=pasos (=1000) which is larger than available training batches so it will take 226.

validation_steps: Total number of steps (batches of samples) to yield from validation_data generator before stopping at the end of every epoch. It should typically be equal to the number of samples of your validation dataset divided by the batch size. Optional for Sequence: if unspecified, will use the len(validation_data) as a number of steps.

Here again, you declare a validation_steps=300 which is higher than available validation batches (1446/32=46 batches). If you dont use validation_steps, you'll only see the training 226/226 [======] - 8s 36ms/step... every epoch.

