Tensorflow used for Image Classification

Reading Time: 2 minutes

What is TensorFlow?

Tensorflow is an open-source library for numerical computation and large-scale machine learning that ease Google Brain TensorFlowthe process of acquiring data, training models, serving predictions, and refining future results.

How Tensorflow and Keras used for Image Classification

This blogs shows how to classify images of wheat classes. It creates an image classifier using a keras.Sequential model, and loads data using preprocessing.image_dataset_from_directory. You will gain practical experience with the following concepts:

  1. Examine and understand data
  2. Build an input pipeline
  3. Build the model
  4. Train the model
  5. Test the model
  6. Improve the model and repeat the process

Import TensorFlow and other libraries

Download and explore the dataset

Configure the Model for Training

Model Fitting


After Training the model we get the model file in .h5 filename. and by using that model file we can generate the probability score of grains in the image. As of now we have taken a healthy grains image so here the model has predicted 100 % healthy grains and as I have used object detection so the red mark have been showing few healthy grains on the image.


Official Colab notebook for Reference