1. 程式人生 > >Train an Anki Cozmo robot to recognize other toys

Train an Anki Cozmo robot to recognize other toys

Summary

This pattern shows how to create an app for an Anki Cozmo toy robot to recognize three types of other toys (a deer, adragon, and a dinosaur). The sample application uses an extended MobileNet model. Predictions against that model are executed by TensorFlow running in an OpenWhisk function. The training is done on Kubernetes on IBM Cloud.

Description

This code pattern contains a sample application that uses an extended MobileNet TensorFlow model to aid an Ansi Cozmo toy robot in recognizing different toys. The predictions are executed by TensorFlow running in an OpenWhisk function.

This code pattern is an extension of the TensorFlow for Poets

tutorial, which describes how to retrain MobileNet's final layer of a neural network for new categories. It is based on the previous work by Niklas Heidloff at Sample Application: how to use TensorFlow in OpenWhisk.

This code pattern works with the following components:

  • Cloud Object Storage: Store, manage, and access your data in a cloud data store.
  • Kubernetes: Manage highly available apps inside Docker containers and Kubernetes clusters on the IBM Cloud.
  • Cloud Functions (powered by Apache OpenWhisk): Execute code on demand in a highly scalable, serverless environment.
  • Tensorflow: Use an open source software library for numerical computation using data flow graphs.

This code pattern shows you how to complete the following tasks:

  • Create a TensorFlow model.
  • Deploy Docker images.
  • Create Cloud Functions.
  • Start a simple Cloud Foundry web app.

Flow

flow

  1. The developer takes pictures (possibly, but not necessarily with an Anzi Cozmo robot) and uploads them to IBM Cloud Object Storage.
  2. The developer builds a Docker image containing TensorFlow and triggers Kubernetes to run the "training" container.
  3. The training container loads images from Cloud Object Storage.
  4. TensorFlow trains the neural network and uploads the trained net back to Cloud Object Storage.
  5. The developer builds a "classifier" Docker image that contains TensorFlow and uses it to create an IBM Cloud Functions action/sequence.
  6. The developer triggers the Cloud Function with an image, either from the sample web app or from the robot.
  7. The pre-trained TensorFlow graph is retrieved from Cloud Object Storage.
  8. The image is classified and the result is returned.

Instructions

Find detailed technical steps for this code pattern in the README.md file in the GitHub repository.

  1. Take pictures.
  2. Upload pictures.
  3. Train the model.
  4. Deploy the model to Open Whisk.
  5. Test the model through the web application.
  6. Test the visual recognition with the Cozmo robot.