Developers can build apps with computer vision and object detection by leveraging deep learning frameworks. A lot of the effort and expertise required to do this can be avoided by using IBM Maximo Visual Inspection to train and deploy your model. Maximo Visual Inspection provides a UI where you can train, deploy and test your own object detection model without needing any prior knowledge of deep learning.
In this how-to, you’ll learn how to use the Maximo Visual Inspection UI to turn your example images into a REST endpoint that can be used in an object detection app.
As of December 2017, Maximo Visual Inspection is a Tech Preview which can be installed on Power Systems or used with a trial account in the cloud.
Note: This how-to was written assuming the Maximo Visual Inspection Technology Preview v3.0.
Learning objectives
The goal of this tutorial is to show you the basics of deep learning for object detection while also making it extremely easy by using the Maximo Visual Inspection UI. This is a hands-on approach to accomplish the following:
- Create and label a data set for object detection
- Train and deploy a model based on the data set
- Test the model via REST calls
The details of setting up the frameworks, leveraging GPU power, and serving up your model as a REST endpoint are mostly hidden, because Maximo Visual Inspection handles that.
The end result is a ready-to-use custom-built object detection API.
Prerequisites
A collection of example images: You can choose your own collection of images. Keep in mind the object detection use case. You want a use case where one or both of these are interesting:
- Where are the target objects in the image?
- How many of the target objects are in the image?
In the example images, you’ll see that we collected images of Coca-Cola bottles. This allows us to create an app that can count the bottles as well as locate them.
Preview access to Maximo Visual Inspection: Go to Try Power AI and use
On Premise
to download an installer to deploy the preview on your Power Systems, or useSuperVessel
and register for access to the SuperVessel cloud where you can try the preview.
Note: The steps and examples in this how-to assume you are using SuperVessel.
Estimated time
The interactive steps take less than an hour, but when you start the training task it may take over an hour to complete (estimate 90 minutes but it will depend on your data set and other factors). So plan to start this exercise, take a break, and finish it later.
Steps
- Login to Maximo Visual Inspection
- Create a data set
- Create tags and label objects
- Create a DL task
- Deploy and test
Log in to Maximo Visual Inspection
If you are using SuperVessel, log in here: https://developer.ibm.com/linuxonpower/deep-learning-powerai/vision/access-registration-form/
Create a data set
Maximo Visual Inspection Object Detection discovers and labels objects within an image, enabling users and developers to count instances of objects within an image based on customized training.
To create a new data set for object detection training:
From the
My Data Sets
view, click theAdd Dataset
button and then selectFor Object Detection
in the pull-down.Provide a data set Name and click
Add Dataset
.Upload one or more images using drag-and-drop or
Select some
. You can use a zip file to upload many files at once, or use multi-select. Click here if you want to download the coke bottles example data set.Note: If you are using your own zip file and do not see file thumbnails after the upload, then the upload failed. Use lowercase file names without special characters or spaces. You can also upload individual files or multi-select several at a time to determine which file caused the upload to fail.
Create tags and label objects
Create one or more tags by clicking the
+
icon to add a new tag. Each tag will represent the training objects within the image based on specific use cases).Label the objects in each image by selecting a tag and dragging a bounding box around the object in the image. Press
Save
when done with each image.Repeat this process for all tags and all images.
Tip: Use the
Only Show Unlabeled Files
pull-down to help you see when you are done.Click
Export As Zip File
to save a copy of your work. Now that you’ve spent some time labeling, this zip will let you start over without losing your work.
Create a DL task
Click on
My DL Tasks
under My Workspace and then click theCreate New Task
button. Click onObject Detection
.Give the Object Detector a name and make sure your data set is selected, then click
Build Model
.A confirmation dialog will give you a time estimate. Click
Create New Task
to get it started.
Deploy and test
When the model is built, click on
Deploy and Test
.Test your model in the Maximo Visual Inspection UI. Use
Select some
to choose a test image. The result shows you how many objects were detected and the image is shown with bounding boxes, labels and confidence scores.From a command-line, you can test your deployed REST endpoint using an image file and the
curl
command. Notice the output JSON shows multiple bottles were detected and provides the confidence, label and location for each of them.Warning: this example used
--insecure
for convenience.$ 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"}
Summary
Now you’ve seen how deep learning technology is able to learn from labeled example images and create an object detection API. Since you created a REST endpoint which returns the results in JSON, it is easy to use this in any app.
Maximo Visual Inspection made it all very easy to do while harnessing GPU power to accelerate the training.
The accuracy of your object detection will depend on the examples provided. Most likely a data set used to experiment will be too small to give production quality results. Training takes time and good training data. You can grow your data set and improve your results.