Skip to main content Link Search Menu Expand Document (external link)

Table of contents

  1. What can I do with it?
  2. How do I use it?
    1. Using the classifier
    2. Using the embeddings
  3. Examples
  4. Credits and references


orml-image-classifier provides image classification and embedding based on ImageNet labelings.

What can I do with it?

orml-image-classifier performs two tasks: image classification and image embedding. Image classification finds which (predefined) classes best match an input image.

Image embedding finds a high dimensional vector (1001 dimensions) that can be seen as a fingerprint for the image. The idea is that similar images result in similar fingerprints.

How do I use it?

Using the classifier

First load the classifier model.

val classifier = ImageClassifier.load()

To classify an image we ask the classifier for classification scores for all classes.

val scores = classifier.classify(image)

Here scores is a FloatArray for which the i-th element describes the score for the i-th label in imagenetLabels.

val scoredLabels = (scores zip imagenetLabels)

Using the embeddings

To get the image embedding:

val embedding = classifier.embed(image)


In DemoClassifier.kt we show the complete process for classifying an image.


In DemoEmbedding.kt we demonstrate how to find an image embedding and show a simple way to visualize the embedding as a grid of circles.


Credits and references

Based on

  • Pretrained MobileNetv3
  • Simple Imagenet labels from @anishathalye (GitHub)