Object Recognition with PowerAI Vision

  • Tutorial


Software developers have been actively working with machine learning libraries for several years, solving computer vision and object detection tasks. But the implementation of such tasks (and each machine learning model needs to be designed, deployed, properly trained, configured and installed) usually requires deep knowledge and skills. With the new IBM PowerAI Vision product, you can avoid this. This product provides an interface in which you can train, customize and test your own model without going into the details of the implementation of machine learning.

In this tutorial, I’ll show you how to use PowerAI Vision to train the system and create a ready-to-use REST API service that you can use to detect and recognize objects in your applications.

PowerAI Vision - Technology Preview


As of December 2017, PowerAI Vision is available for testing as a Technology Preview software product (available for free download on the developerWorks page ), which is installed on Power Systems servers. If you do not have such a server, you can test this product (completely free!) In the SuperVessel cloud.
Note. This manual describes how to work with PowerAI Vision Technology Preview version 3.0.

Task


The purpose of this article is to talk about the basics of using machine learning to detect objects, and also to show how such learning can be implemented using the PowerAI Vision interface. Here's what you can do with it:

  • Create and tag data sets (DataSet) for object discovery
  • Train and apply a trained model on a dataset
  • Test models using REST services

Details of setting up frameworks, connecting and using GPU accelerators, deploying and configuring REST services are carried out automatically, inside the product. However, some training settings are available through the administration interface.
The end result is a ready-to-use REST API for object discovery.

What is needed for recognition?


Collection of sample images.


You can create your own collection of images based on the scenario you want to implement. Here are some questions PowerAI Vision can help answer:

  • Where are the objects in the image?
  • How many objects are in the image?

For example, take photos of Coca-Cola bottles. Our goal is to create an application that can find and count bottles on images or video clips.

Install PowerAI Vision on a Power System


If you already have an IBM Power server with the Nvidia GPU installed, you can install PowerAI Vision for testing. Click on the link and select «On Premise» - «Download Now ». Download PowerAI Vision and install it.


Note. The examples in this article assume that you are using SuperVessel, a cloud-based service for testing PowerAI products.

How long will it take?


The steps of preparing and deploying the model in the SuperVessel cloud will not take much time (less than an hour), but taking into account the model’s training, the whole process can take an hour and a half. This time, of course, depends on the complexity of the data set and other factors.

Create and train a model


Using SuperVessel Cloud


Sign up for the SuperVessel cloud service (it's free).

Create a dataset (DataSet)


PowerAI Vision supports two machine learning models:

  • Object Detection - detection and recognition of objects in the image
  • Image Classification - classification of objects in the image

The PowerAI Vision Object Detection model allows you to detect and recognize objects in the image, as well as calculate their number. In this article, we will consider the training of this particular model.

Create a new dataset for training the model:

  • In the “My Data Sets” view, click the “Add Dataset” button, and then select “For Object Detection” in the drop-down list:



  • Make a name for your data set (for example, “Coke Bottles”) and click “Add Dataset”:



  • Download one or more images by dragging them onto the gray rectangle, or click the “Select some” button, then select and load the images from the local disk:


  • You can upload several images at once in a zip archive.


Note. If you downloaded a zip file and don’t see the thumbnails of the files after downloading, then the download failed. Try using lowercase file names without special characters or spaces. You can try downloading the files individually to determine which file caused the problem.

Create tags and tag objects


  • Create one or more tags by clicking the + icon to add a new one. For each type of object to be recognized, you must create a separate tag.
  • Mark the object in the image (let's call such a process markup) - first click on the tag, and then on the image, around the corresponding object, as a result of which a rectangle bounding it will appear. Click Save when you're done marking up the object for this tag.
  • Repeat this process first for all tags in the photo, and then for all images. Here is an example of such a tagged image:


Tip. Use the “Only Show Unlabeled Files” option to not see already marked photos.

  • Click Export As Zip File to download the prepared Dataset. Now that you have spent some time marking, this zip file will allow you not to lose the result of the work done.

Creating DL (Deep Learning) tasks


  • Click on My DL in the My Workspace section , and then click the Create New Task button , then Object Detection .
  • Give the Detector a name and make sure you select the data set you want, then click Build Model




Deployment & Testing
  • After the model has been trained (the learning process can be controlled visually), click Deploy and Test .


  • Test the built model in the PowerAI Vision user interface: click Select to load the image for verification. After loading, an image with found objects and an assessment of recognition accuracy will be shown below. In our example, three bottles of Coca-cola with an accuracy of 99.9%



  • From the command line, you can test the program interface of the REST service using the curl command and the image file. Please note that JSON detected several bottles and indicated a tag and location for each of them.

$ curl --insecure -i -F files=@coke_bottle_23.png https://ny1.ptopenlab.com/AIVision/api/dlapis/9f9d6787-0183-4a1b-be49-751b6ca16724
HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Server: nginx/1.9.13
Date: Thu, 14 Dec 2017 21:58:26 GMT
Content-Type: application/json
Content-Length: 508
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: origin, content-type, accept, authorization
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS, HEAD
Access-Control-Allow-Origin: *
{ "classified" : [ { "confidence" : 0.9986369013786316 , "ymax" : 578 , "label" : "coca-cola" , "xmax" : 755 , "xmin" : 588 , "ymin" : 29} , { "confidence" : 0.9954010248184204 , "ymax" : 592 , "label" : "coca-cola" , "xmax" : 601 , "xmin" : 437 , "ymin" : 10} , { "confidence" : 0.8161203265190125 , "ymax" : 567 , "label" : "coca-cola" , "xmax" : 426 , "xmin" : 259 , "ymin" : 17}] , "imageUrl" : "http://ny1.ptopenlab.com:443/AIVision/temp/5a26dd3b-d8ba-4e01-8b93-5a43f28e97c7.png" , "result" : "success"}

The cloud-based free version limits the use of the REST API to 1 hour after deployment. After the service stops, it can be restarted to resume work

Brief Summary


You saw how machine learning can work with sample images and create object detection APIs. As the result is a full-fledged REST API that returns the results in JSON, it is easy to use in any application.
PowerAI Vision is simple and fast to use, providing GPU capabilities to accelerate learning.

The accuracy of the prediction will depend on the quality and size of the test sample. If the data set used for the experiments is too small, then this may affect the quality of the results ... The quality of training depends on time and data. You can increase your data set and thus improve your results.

PS


You can see PowerAI Vision, try it in action, discuss interesting scenarios for using the platform with IBM experts at the IBM booth at the Opentalks.AI conference .

In addition: employees of the IBM Client Center in Moscow possess unique experience working with PowerAI Vision, IBM Watson, and cognitive technologies . And they will be happy to answer your questions .

additional literature


Original article in English;
Object Detection : Object detection on Wikipedia;
PowerAI Vision : Deep Learning and PowerAI Development
TensorFlow Object Detection : Supercharge your Computer Vision models with the TensorFlow Object Detection API
AI Article : Can Artificial Intelligence Identify Pictures Better than Humans?
From the developers : IBM PowerAI Vision speeds transfer learning with greater accuracy - a real world example

A few product videos:
www.youtube.com/watch?v=0F5w6q0ZpBI
www.youtube.com/watch?v=nWft6tYVdrc
www.youtube.com / watch? v = qHZRnswzqUI

Also popular now: