Machine and Deep Learning (ML/DL) have brought unprecedented abilities to the software engineering field. ML/DL allows you to reason about and to solve otherwise “un-programmable” tasks such as computer-vision and language-processing. That’s why it’s so exciting to so many people.
But as a Java practitioner, how can you leverage ML/DL to deliver richer business solutions to your customers? My goal is to show you how Spring Cloud Stream and Spring Cloud Data Flow can make this much easier for you.
Let’s back up. The ML/DL paradigm works by making observations, running experiments, and using statistics to analyze the results from the experiments. Usually the process is divided in two phases: (1) model training on historical datasets and (2) using the pre-trained models for predictive analytics at run-time (called ML inference). While most ML tools will help you through the tasks of data exploration, preparation, and model training you are left on your own to figure out how to integrate and operationalize those tools.
Model inference for predictive analytics is the most common use of ML/DL in Java applications. You take a pre-trained (out-of-the-box) model and use it in your applications to do real-time predictions (e.g. fraud detection, vehicle predictive maintenance or telco churn analysis).
The ML inference requires a portable format for exchanging models between the training and the inference phases. Several initiatives such as PMML, PFA, MLeap and ONNX aim to a portable format.
Today we will focus on TensorFlow, an emerging DL framework that has gained a lot of momentum. This success is partly due to the model serialization capabilities it provides. TensorFlow’s pre-trained models can be serialized and reused across multiple programming languages, CPU & GPU processors and platform architectures.
The remaining of this article will demonstration how, Spring Cloud Stream (SCSt) and Spring Cloud Data Flow (SCDF) significantly simplify the tasks of deploying and operationalizing pre-trained Tensorflow models. You can build upon these concepts to add ML/DL capabilities for your own business solutions.
An out-of-the-box TensorFlow Processor is available to perform real-time predictive analytics using pre-trained TensorFlow models. Further extending upon this foundation, a use-case specific processors to perform Twitter Sentiment Analysis and Image Recognition are available for experimentation, too.
The new Object Detection processor provides out-of-the-box support for the Tensorflow Object Detection API. It allows for real-time, localization and identification of multiple objects in a single image or image stream. The object-detection processor uses one of the pre-trained object detection models and corresponding object labels.
Our in-house object detection system is now open source! Learn more about the #TensorFlow Object Detection API at https://t.co/rd6VcW9WRR
— Google Research (@googleresearch) June 15, 2017
https://research.googleblog.com/2017/06/supercharge-your-computer-vision-models.html
The following example illustrates a Spring Cloud Data Flow streaming pipeline that predicts object types from the images in real-time.
Real-time Object Detection using Spring Cloud Data Flow