Deep learning is notable for surpassing human level performance in image classification. In this post we will explain how to use a pretrained Convolutional Neural Network to classify images and how to deploy this classifier to the cloud through an API.

This post comes with a python notebook where we explain all the steps you need to follow for deploying a deep neural network through an API to perform image classification.

Deploying deep learning on the cloud

In a previous post we saw how to train a Convolutional Neural Network (CNN), now we are going to see how to create an API that classifies images in the cloud. The frameworks used in the solution are:

CNTK: Microsoft's Cognitive Toolkit is the deep learning library we used to compute the CNN model that identifies images.

Flask is one of the most popular frameworks to develop APIs in python.

CherryPy is a lightweight web framework for python. We use it as a web server to host the machine learning application.

The main procedure is executed by the CNTK CNN. The network is a pretrained ResNet with 152 layers. The CNN was trained on ImageNet dataset, which contains 1.2 million images divided into 1000 different classes.

The CNN is accessible through the flask API, which provides an end point /api/v1/classify_image that can be called to classify an image. CherryPy is the server framework where the application is hosted. It also balances the load, in such a way that several concurrent queries can be executed. Externally, there is the client, that can be any desktop or mobile. It sends an image to the application for analysis and receives the response.

If you want to understand the end to end process, take a look at this notebook.