Optimize your visual recognition classification
Build training and prediction apps with Java, Watson IoT Platform, Node-RED, and Watson Visual Recognition service
Because the data sets that are used in visual recognition classification processes are so large, developers can get bogged down in classifying the images instead of working on other AI and machine learning technologies. By integrating Watson IoT Platform with the Watson Visual Recognition service, you can optimize the processing time to identify objects using the Visual Recognition trained models. This code pattern will show you how to build a Java-based training app to capture images from an IoT-enabled device and subsequently create and train the custom classifier by calling a Java API that is passed a set of images. This code pattern then shows you how to build a prediction app that classifies a new set of images based on the trained model by using Watson IoT Platform, Node-RED, and the Watson Visual Recognition service.
Intelligent image recognition involves two processes:
- Building a training model
- Classifying images to identify objects based on the training model
This pattern consists of 2 apps: a training app and a prediction app. The prediction app provides an innovative solution for optimizing the classification process. Images are captured and published to Watson IoT Platform, and an IoT subscriber node in Node-RED then takes this published payload and passes it to the Watson Visual Recognition service invocation. The image classification results are stored in a Cloudant DB.
This pattern allows users to create and train a custom classifier using a Visual Recognition service instance. The Visual Recognition service identifies objects presented in an image using a pre-trained default classifier. Therefore, if someone wants VR to detect specific objects in a given image, then you need to create and train your own custom classifier.
In order to display identification results, you need to run the prediction app. IBM Watson IoT Platform gives a developer the flexibility to integrate and perform other services and tasks, such as analytics, storage, and so on. In this pattern, the Watson IoT Platform is used within the prediction app to call the Visual Recognition service to detect objects in an image. The advantage of this implementation is that it reduces the over all execution time for object detection.
- In the training app, the user enters the Classifier name.
- In the training app, the user enters the negative images zip path.
- In the training app, a camera window gets launched to capture the specified number of positive images.
- In the training app, positive images get zipped and pass into java api along with negative images zip. A custom classifier gets created in a Visual Recognition service instance.
- In the training app, once training is complete, a message is sent to the Watson Text to Speech service, which announces that training is complete.
- In the prediction app, images are captured using camera device and put into a processing queue.
- In the prediction app, an image picked from the queue and gets converted into Base64 encoding.
- In the prediction app, an encoded payload gets publishes to a topic on Watson IoT Platform.
- In Node-RED, the IoT-IN node receives the published payload on the topic.
- In Node-RED, Base-64 encoded payload getting passed to VR service node and internally checks 3 things(features of VR): classifyImg, faceDetection, textDetection.
- In Node-RED, the result is sent to CloudantDB node to store into the DB.
- In Node-RED, the device command is sent to the device through IoT-OUT node to notify the device to send the next image in the queue for processing and to refresh the GUI to display latest results.
See the README file for the complete instructions. Here are the main steps that you need to complete to use this code pattern:
- Create your IoT app using the Internet of Things Platform Starter boilerplate in IBM Cloud.
- Register your IoT device using the Watson IoT Platform dashboard.
- Create the Node-RED simulator to receive events from your IoT device and send notifications back to the IoT device.
- Build and run the training app and the prediction app.