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:
Now that you have the sources we can compile the realtime-image-recognition project:
And now we simply execute the java task:
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:
An example of a deer with a 10.91 score:
An example of an automobile with a 7.45 score:
And finally an example of an untrained object (motorcycle):
So let’s take a look at the code:
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.
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:
“Not Hotdog” reference is about HBO’s Silicon Valley: Season 4 Episode 4