How can Tensorflow be used with flower dataset to continue training the model?

PythonServer Side ProgrammingProgrammingTensorflow

To continue training the model on the flower dataset, the ‘fit’ method is used. To this method, the number of epochs (number of times the data is trained to build the model) is also specified. Some of the sample images are also displayed on the console.

Read More: What is TensorFlow and how Keras work with TensorFlow to create Neural Networks?

We will be using the flowers dataset, which contains images of several thousands of flowers. It contains 5 sub-directories, and there is one sub-directory for every class.  

We are using the Google Colaboratory to run the below code. Google Colab or Colaboratory helps run Python code over the browser and requires zero configuration and free access to GPUs (Graphical Processing Units). Colaboratory has been built on top of Jupyter Notebook.

print("The data is fit to the model")

Code credit:


The data is fit to the model
Epoch 1/3
92/92 [==============================] - 102s 1s/step - loss: 0.7615 - accuracy: 0.7146 - val_loss: 0.7673 - val_accuracy: 0.7180
Epoch 2/3
92/92 [==============================] - 95s 1s/step - loss: 0.5864 - accuracy: 0.7786 - val_loss: 0.6814 - val_accuracy: 0.7629
Epoch 3/3
92/92 [==============================] - 95s 1s/step - loss: 0.4180 - accuracy: 0.8478 - val_loss: 0.7040 - val_accuracy: 0.7575
<tensorflow.python.keras.callbacks.History at 0x7fda872ea940>


  • A dataset similar to this (which was built using keras.preprocessing) has been built using the
  • The model can be trained along.
  • A few epochs are trained so that it doesn't consume too much time.
Updated on 19-Feb-2021 17:55:53