Towards AI

The leading AI community and content platform focused on making AI accessible to all. Check out our new course platform: https://academy.towardsai.net/courses/beginner-to-advanced-llm-dev

Follow publication

Member-only story

Deep Learning

Multiclass Image Classification — Hands-On with Keras and TensorFlow

Carla Martins
Towards AI
Published in
10 min readDec 7, 2021

--

Part 1 — Xception

Image classification or computer vision is a branch of artificial intelligence where the task is to design systems that can recognize or classify objects based on digital images. It is a popular field due to the sheer breadth of applications — image classification can be used for applications as diverse as recognizing a particular flower from a photograph or classifying medical images as normal or disease.

In this article, I will cover the use of Keras for creating a Convolutional Neural Network to classify images in a dataset. Keras is a simple framework for constructing models using high-level API. I assume you have at least a basic understanding of Python.

There are two ways to create a Convolutional Neural Network for image classification with Keras. With the first one (the hard route), you can define what layers to use and how to link them together, compile your model, and then your model is ready to use. The second one (the easy and sometimes more efficient route) is to use transfer-learning and use pre-trained models that have already been shown to be robust enough for the task.

Keras already provides us with 26 pre-trained models that can be applied to our data. However, with 26 pre-trained models, how will we know which one is best for our data?

The answer is: We don’t know! We need to test them.

In this hands-on series, I will test some of the freely available pre-trained models on Keras and evaluate their performance on the Intel Image Classification dataset. This dataset has images in 6 categories: buildings, forests, glaciers, mountains, seas, and streets. This means that we will try the models in a categorical dataset. Binary datasets can also be used, by I will leave it to another article.

You can find the code used in this article on Github.

I strongly recommend you to run your code on Google Colab with GPU enabled (unless you have a powerful GPU configured for ML tasks on your laptop). To enable GPU, go to Edit>Notebook Settings and select GPU where default is None. Save your settings.

How to enable Google GPU. Image from the author.

--

--

Published in Towards AI

The leading AI community and content platform focused on making AI accessible to all. Check out our new course platform: https://academy.towardsai.net/courses/beginner-to-advanced-llm-dev

Written by Carla Martins

Compulsive learner. Passionate about technology. Speaks C, R, Python, SQL, Haskell, Java and LaTeX. Interested in creating solutions.

Responses (3)

Write a response