Image Analytics: Clustering

Data does not always come in a nice tabular form. It can also be a collection of text, audio recordings, video materials or even images. However, computers can only work with numbers, so for any data mining, we need to transform such unstructured data into a vector representation.

For retrieving numbers from unstructured data, Orange can use deep network embedders. We have just started to include various embedders in Orange, and for now, they are available for text and images.

Related: Video on image clustering

Here, we give an example of image embedding and show how easy is to use it in Orange. Technically, Orange would send the image to the server, where the server would push an image through a pre-trained deep neural network, like Google’s Inception v3. Deep networks were most often trained with some special purpose in mind. Inception v3, for instance, can classify images into any of 1000 image classes. We can disregard the classification, consider instead the penultimate layer of the network with 2048 nodes (numbers) and use that for image’s vector-based representation.

Let’s see this on an example.

Here we have 19 images of domestic animals. First, download the images and unzip them. Then use Import Images widget from Orange’s Image Analytics add-on and open the directory containing the images.

We can visualize images in Image Viewer widget. Here is our workflow so far, with images shown in Image Viewer:

But what do we see in a data table? Only some useless description of images (file name, the location of the file, its size, and the image width and height).

This cannot help us with machine learning. As I said before, we need numbers. To acquire numerical representation of these images, we will send the images to Image Embedding widget.

Great! Now we have the numbers we wanted. There are 2048 of them (columns n0 to n2047). From now on, we can apply all the standard machine learning techniques, say, clustering.

Let us measure the distance between these images and see which are the most similar. We used Distances widget to measure the distance. Normally, cosine distance works best for images, but you can experiment on your own. Then we passed the distance matrix to Hierarchical Clustering to visualize similar pairs in a dendrogram.

This looks very promising! All the right animals are grouped together. But I can’t see the results so well in the dendrogram. I want to see the images – with Image Viewer!

So cool! All the cow family is grouped together! Now we can click on different branches of the dendrogram and observe which animals belong to which group.

But I know what you are going to say. You are going to say I am cheating. That I intentionally selected similar images to trick you.

I will prove you wrong. I will take a new cow, say, the most famous cow in Europe – Milka cow.

This image is quite different from the other images – it doesn’t have a white background, it’s a real (yet photoshopped) photo and the cow is facing us. Will the Image Embedding find the right numerical representation for this cow?

Indeed it has. Milka is nicely put together with all the other cows.

Image analytics is such an exciting field in machine learning and now Orange is a part of it too! You need to install the Image Analytics add on and you are all set for your research!

  • guimby

    Hi, I just install the “image analytics” add on but the “image embedding” widget is lacking !
    Orange run from anaconda and my OS is windows 7 pro.
    Thanks for your help

  • sai sandeep

    I Was able to download the image analytics add on. However there is no image embeddings widget. I am using orange 3.8 on windows 10 any help would be appreciated.

    • Ajda Pretnar

      Please see the reply above (@guimby).

  • FruitBasket

    Hi I’m trying to install Image Analytics (latest version 0.1.7) for my Orange 3.4.5 on my Window machine. Got the following error:

    An error occurred while running a subprocess
    Command failed: python -m pip install Orange3-ImageAnalytics exited wtih non zero status

    After I clicked ‘Show Details’:

    Collecting Orange3-ImageAnalytics
    Using cached Orange3-ImageAnalytics-0.1.7.tar.gz
    Complete output from command python

    Command “python setup.py_egg_info” failed with error code 1 in C:UserssomethingAppDataLocalTemppip-build-59_vln2oOrange3-ImageAnalytics

    Any suggestion to get around it?

  • Konrad Hryniewicz

    Hey. It’s very nice solution! However I have e some problems. I want do something similar with my photos from holydays but i have problem {below}. What is wrong?

    • Ajda Pretnar

      Hi Konrad, could you please tell me which version of ImageAnalytics add-on you are using? Could it be that the issue has been fixed in the later release? You can update the add-on in Options – Add-ons, select the add-on and update it.
      If the issue persists, please report it to

      • Konrad Hryniewicz

        Thanks! I installed anaconda and now everthing working very well 🙂

  • Raja Rahul Ray

    Orange is by far the best image analytic solution ever….. It’s awesome…..Thanks to the community of developers for developing this great tool….

  • Kleyn Guerreiro

    Great tool! I imagine an Orange version for R with Caret embeded…it will win all tools!