I'm looking for a way to calculate image similarity in Kotlin using cosine similarity.
Does someone know a lib where this algorithm has already been implemented?
The next best thing I was able to fnd is only a image hashing algorithm in Java which I could rewrite in Kotlin using skija. As far as I understood the cosine similarity algorithm has better results than image hashing, but I'm unfortunately now even able to find a Java implementation of this.
s
Shivashankar
11/22/2022, 6:00 AM
You need to use a model to get image embeddings from it and then do cosine similarity on those embeddings. Image embeddings provide the insights into feature space of an image
Shivashankar
11/22/2022, 6:00 AM
I've done that for face similarity using facenet model
s
Stefan Oltmann
11/25/2022, 8:57 AM
Thanks. With ML this takes quite long. I now use the pHash algorithm. JImageHash has a implementation of that.