Hazelcast Jet demonstration of Realtime Image Recognition

A lot has happened since Jet’s debut last year. For instance Emin Demirci and many others have assembled some fun and interesting demonstration applications for Hazelcast Jet. Today we will walk through a simple Jet demo that shows how to implement a custom streaming source and sink and how to make streaming aggregations in Hazelast Jet.

You will need the following tools installed:

First clone the hazelcast-jet-demos repo:

Screen Shot 2018-06-21 at 9.28.09 AM

Now that you have the sources we can compile the realtime-image-recognition project:

Screen Shot 2018-06-21 at 9.30.47 AM

And now we simply execute the java task:

Screen Shot 2018-06-21 at 9.31.16 AM

You will get two windows one that is a live feed from your web camera and the other is the Results window. So if you point your camera to a solid surface, contrasting color, you can then place an object in front of the camera to see the resulting confidence score.

An example of a horse with a 10.70 score:

Screen Shot 2018-06-21 at 9.37.41 AM

An example of a deer with a 10.91 score:

Screen Shot 2018-06-21 at 9.37.52 AM

An example of an automobile with a 7.45 score:

Screen Shot 2018-06-21 at 9.38.04 AM

And finally an example of an untrained object (motorcycle):

Screen Shot 2018-06-21 at 9.38.14 AM

So let’s take a look at the code:

Screen Shot 2018-06-21 at 9.45.13 AM

We can see the pipleline code is elegantly simple. Consumes from the WebcamSource, enriches with a timestamp, maps the classification score, employs a tumbling window of one second (same-length, non-overlapping chunks), aggregates the max value, and finally sends the results to a GUI.

The Classifier uses the CIFAR-10 dataset which is composed of 10 classes (airplane, automobile, bird, cat, deer, dog, frog, horse, ship, and truck).

Keeping with the Hazelcast spirit of speed, simplicity, and portability you can see how this could easily be embedded into your favorite application and harness the power of ad hoc grid computing.

More about Jet: