I'm using a dataset of movies and would like to group if a movie is the same across different retailers.


Movie: Beauty and the Beast

Platforms: Google, Netflix, iTunes, Amazon.

I have access to signals like: Studio, Movie Name, Runtime, Language, Release Year, etc. However, in this case some movies, which are not the same and signals mentioned before, are not capable of finding the right match. I need to do what a human would do: Check Movie cover. Example:

I have access to the art image. I'm using Python to do this comparison.

Is there a library that can help me compare 2 images and determine if they are similar?

  • 4
    $\begingroup$ Did you try Facebook's library? $\endgroup$
    – Emre
    Commented Mar 9, 2018 at 1:30
  • 1
    $\begingroup$ You can also check out the structural similarity metric. en.wikipedia.org/wiki/Structural_similarity $\endgroup$
    – JahKnows
    Commented Mar 9, 2018 at 1:50
  • 1
    $\begingroup$ This would better be a comment but I don't have enough 'reputation' for that. You can check Adrian Rosebrock's blog about comparing two images by making use of skimage library. He is showing examples with Mean Squared Error and Structured Similarity Measure techniques. pyimagesearch.com/2014/09/15/python-compare-two-images $\endgroup$
    – specstr
    Commented Sep 19, 2018 at 15:23

2 Answers 2


The problem you mention is not trivial. There is no library that out of the box will compare the pictures for you and give you a reliable similarity value. Therefore, you need to develop a system that works for both your problem and your dataset.

Having said that, since neural networks work better than any other method for image recognition you can try:

  • Autoencoders: (In case your data is unlabeled) The idea is that the model extracts the features for you and then you omit the output layers so you have a new representation of your image but in a new feature space the model has learnt from data. Once your images are in this new feature space, you can use whatever technique to compute similarity. You can have an example on how to do this here.

  • Hash binary codes: (In case your data is labeled). This is a supervised method based on CNNs that seems to work quite nice to find relevant features in your images. Have a look at this paper.

Working with images is normally not quite straighforward and it requires some effort and experimentation to master these techniques. However, it is absolutely worth it and fun.


You can use ImageHash

The difference between the hashed images will give you a similarity score

from PIL import Image
import imagehash

hash = imagehash.average_hash(Image.open('test.png'))
otherhash = imagehash.average_hash(Image.open('other.bmp'))

print(hash - otherhash)



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.