Recycle with Watson


The recycling rate in the United States is less than 35 percent, and one of the major issues is improper disposal. This pattern describes how to create a mobile app that uses a Watson Visual Recognition custom classifier, an API server, and an iOS app to sort waste into three categories (landfill, recycling, or compost). You can use it as a base to help you build your own custom Visual Recognition classifier.


Excess trash is becoming a problem in the world today. So it’s helpful if we can reduce the amount of trash that goes into a landfill and recycle or compost it instead. In this code pattern, learn how to build a mobile app that can classify trash into three categories: landfill, recycling, or compost.

The app contains three major components: Watson Visual Recognition, an API server (in this case, a Python Server with Flask), and an iOS application. Using the mobile app, you can take a picture on your phone, then send the image to the server app. The server app sends the image to the Watson Visual Recognition service, which classifies the image and sends the result back to the server. Finally, the result is returned to the mobile app. The server application uses pictures of common trash to train Watson Visual Recognition to identify the various categories of waste.

When the reader has completed this Code Pattern, they will understand how to:

  • Create a Python server with Flask that can utilize the Watson Visual Recognition service for classifying images.
  • Create a Visual Recognition custom classifier using the Web UI or command line.
  • Create a mobile application that can send pictures to a server app for classification using Visual Recognition.



  1. Use the mobile app to capture an image.
  2. The app passes the image to the server application running in the cloud.
  3. The server sends the image to the Watson Visual Recognition Service for analysis and sends the classification result back to the mobile app.
  4. The Visual Recognition service classifies the image and returns the information to the server.


Ready to put this code pattern to use? Complete details on how to get started running and using this application are in the README.

Tommy Li
Weiwei Liu
Xiaoguang Mo
Yanyan Han
Christina Zhu