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.
The screenshot shows the sample web application:
Ansgar Schmidt and I have blogged about this project:
- Sample Application to classify Images with TensorFlow and OpenWhisk
- Accessing IBM Object Store from Python
- Image Recognition with Tensorflow training on Kubernetes
- Image Recognition with Tensorflow classification on OpenWhisk
- Visual Recognition with TensorFlow and OpenWhisk
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 https://github.com/nheidloff/visual-recognition-tensorflow-openwhisk.git $ git clone https://github.com/AnsgarSchmidt/VisualRecognitionWithTensorflow.git $ 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 api.ng.bluemix.net $ 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 api.ng.bluemix.net $ bx target -o <your-organization> -s <your-space> $ cf push
Open the web application via http://your-application-name.mybluemix.net/.
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.