We want to find similar images — Easily calculate the similarity between images with Python Library.

MLBoy
1 min readJan 22, 2022

--

How to make the similarity between images numerical in Python

It’s hard to find similar images from a huge number of images

Today is an era full of images, but it is difficult to find similar images by eye.

If you quantify the similarity, you can find it automatically.

If you can quantify the degree of similarity in image quality, you can easily find the most similar image by comparing the values.

Imgsim that quantifies image similarity using a machine learning model

procedure

Install imgsim, embed the image in 768 numbers and calculate the difference between embeddings.

distance = 20.859903

The smaller the number, the more similar the two images.

In the example below, the first distance is 0 because the strawberry cake and the strawberry cake are the same image.
It means that the strawberry cake and the strawberry pancake are more similar than the strawberry cake and the lion.

🐣

I’m a freelance engineer.
Work consultation
Please feel free to contact us with a brief development description.
rockyshikoku@gmail.com

I am making an app that uses Core ML and ARKit.
We send machine learning / AR related information.

GitHub

Twitter
Medium

--

--