1

I am trying to train a model to predict from images 21 different categories. The proposed model is as follows:


model = Sequential()
model.add(Resizing(32,32, input_shape=img_size))
model.add(Rescaling(1./255))
model.add(Flatten())
model.add(Dense(units=1024, activation="relu", 
                kernel_initializer="random_normal", 
                bias_initializer="zeros"))
model.add(Dropout(rate=.5))
model.add(Dense(units=21, activation="softmax"))

model.compile(optimizer=Adam(learning_rate=l_rate),
              loss='sparse_categorical_crossentropy',
              metrics=['accuracy']
             )

call = EarlyStopping(monitor='val_loss', 
                     patience=10, 
                     verbose=1, 
                     restore_best_weights='True',
                     min_delta=0.1,
                     mode="min")
history = model.fit(train_data, validation_data = val_data, epochs=100, 
                    callbacks=[call])

However, when I train the model it reaches the callback but it does not stop the training as you can see here

enter image description here

Any ideas why this happens?

0 Answers0