- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
- Python Advanced Tutorial
- Python - Classes/Objects
- Python - Reg Expressions
- Python - CGI Programming
- Python - Database Access
- Python - Networking
- Python - Sending Email
- Python - Multithreading
- Python - XML Processing
- Python - GUI Programming
- Python - Further Extensions
How can Tensorflow be used with flower dataset to continue training the model?
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") model.fit( train_ds, validation_data=val_ds, epochs=3 )
Code credit: https://www.tensorflow.org/tutorials/load_data/images
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 tf.data.Dataset.
- The model can be trained along.
- A few epochs are trained so that it doesn't consume too much time.
- Related Articles
- How can Tensorflow be used to pre-process the flower training dataset?
- How can Tensorflow be used to split the flower dataset into training and validation?
- How can Tensorflow be used with the flower dataset to compile and fit the model?
- How can Tensorflow and pre-trained model be used to continue training the model using Python?
- How can Tensorflow be used with pre-trained model to build the training and validation dataset?
- How can Tensorflow be used to standardize the flower dataset?
- How can Tensorflow be used to load the flower dataset and model off the disk using Python?
- How can Tensorflow be used to load the flower dataset and work with it?
- How can Tensorflow be used to download flower dataset into the environment?
- How can Tensorflow be used to visualize the flower dataset using Python?
- How can Tensorflow be used to configure the flower dataset for performance?
- How can Tensorflow be used with abalone dataset to build a sequential model?
- How can Tensorflow be used with Estimators to train the model for titanic dataset?
- How can Tensorflow be used to prepare the IMDB dataset for training in Python?
- How can Tensorflow be used to download the flower dataset using keras sequential API?