Visual Recognition with TensorFlow and OpenWhisk
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Visual Recognition with TensorFlow and OpenWhisk

This project contains a sample application which uses an extended MobileNet TensorFlow model to recognize different flower types. The predictions are executed by TensorFlow running in an OpenWhisk function.

This project is an extension of the TensorFlow tutorial TensorFlow for Poets which describes how to retrain MobileNet's final layer of a neural network for new categories.

The screenshot shows the sample web application:

alt text


Ansgar Schmidt and I have blogged about this project:


This project only contains the web application and an OpenWhisk function which provides the classify REST API. The project VisualRecognitionWithTensorflow contains the code to train the model as well as the code for a Docker image to classify flowers. You also need an instance of IBM Object Storage to store the images and the models. Check out the blog entries above.

Additionally you need an IBM Cloud account and two CLIs:

Clone the two projects:

$ git clone
$ git clone
$ cd visual-recognition-tensorflow-openwhisk

Setup OpenWhisk Functions

In order to deploy the two OpenWhisk functions and one sequence run the following commands from the 'openwhisk-api' directory:

$ cd openwhisk-api
$ bx login -a
$ bx target -o <your-organization> -s <your-space>
$ bx plugin install Cloud-Functions -r Bluemix
$ wsk package update visualRecognition
$ wsk action create visualRecognition/tensorflow-classify --docker <your-dockerhub-name>/tensorflow-openwhisk-classify:latest
$ npm install
$ sh ./deploy
$ wsk action create --sequence visualRecognition/classifyAPI visualRecognition/classifyImage,visualRecognition/tensorflow-classify --web raw

Setup Web Application

In the OpenWhisk web application choose your sequence and open 'Additional Details'. From there copy the URL into the clipboard. Create a new file '.env' in the 'web-app' directory. See .env-template for an example. Paste the URL in this file.

From the directory 'web-app' run these commands:

$ cd web-app
$ npm install
$ npm start

Open the web application via http://localhost:3000/.

Optionally: In order to deploy the application to the IBM Cloud change the application name in manifest.yml to something unique and run these commands:

$ bx login -a
$ bx target -o <your-organization> -s <your-space>
$ cf push

Open the web application via


This sample code is licensed under Apache 2.0. Full license text is available in LICENSE.

Open Source @ IBM

Find more open source projects on the IBM Github Page.