Classify Images Using TensorFlow

1.5 hours
  • 5 Learning Objectives

About this Hands-on Lab

In this lab, you will build an image processing model using TensorFlow that will classify images into one of multiple categories. You will be performing the entire model creation process, from retrieving the data and formatting it properly, to designing a model architecture and training it to meet a desired metric score.

This lab is designed to be used as a practice exam to test your skills in preparation for the TensorFlow Developer Certificate, and thus, is a very challenging exercise.

Before beginning this lab, you should have PyCharm installed on your local computer. Additionally, you should have installed all packages required by the TensorFlow Developer Certificate exam.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Retrieve the ibean Datasets
  1. Retrieve the training, validation, and testing ibean datasets:

  2. Extract the compressed data.

Explore the ibean Data
  1. Explore the folder structure created by decompressing the data to understand how to load the images.
  2. Identify the data classes and the file naming convention.
  3. View some of the images from each class to help you understand the data.
Load the ibean Data, and Transform It to a Suitable Form for the Model
  1. Review the model expectations to understand how you should load the data.
  2. Load the training, validation, and test datasets into the program.
  3. Label your data according to the expected model output.
Build and Train a Model to Classify the Images
  1. Review the model expectations to know how the model should accept and output data.
  2. Create an appropriate neural network model using Keras.
  3. Compile your model with the correct loss function for the problem and label type.
  4. Train your model to reach the desired accuracy. Remember to capture the history!
  5. Save your model.
Evaluate Your Model with the Test Data
  1. Generate model statistics on the test data. Ensure you’ve met or exceeded the desired accuracy.
  2. Plot your model’s accuracy and loss for the training process.

Additional Resources


You need to build a model to identify bean plant diseases based on images of the leaves.

The data is already split and provided as training, validation, and test sets:

The data used to test the model will be the normalized, full-size test images. Make sure your model will accept data of this shape.

There are 3 classes in this dataset. The prediction output should be one-hot encoded. Your model should achieve at least 85% accuracy on the test data.

Lab Goals

  1. Retrieve and load the ibean datasets.
  2. Explore the ibean data.
  3. Transform the image data for the model.
  4. Build and train a model to classify the images.
  5. Evaluate your model with the test data.

As this is practice for the exam, you should attempt to solve the tasks on your own before checking the lab guide or the solution videos. Test your skills, and see what areas you need to review.

Logging In To the Lab Environment

No environment is provided for this lab. This lab, which is a practice exam for the TensorFlow Developer Certificate, is meant to be completed in PyCharm running on your own hardware. It is important that you complete this lab on your own computer so you know how long different model architectures will take you to train, which will help you budget your time during the exam.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?