Table of contents
- What can I do with it?
- How do I use it?
- 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)
scores is a
FloatArray for which the i-th element describes the score for the i-th label in
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
- Pretrained MobileNetv3
- Simple Imagenet labels from @anishathalye (GitHub)