Skip to content

web-ho/Image-similarity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Image similarity learning using PyTorch -

This repository explores two of the popular methods for image similarity, siamese network and triplet network. It is quiet challenging to implement these methods, given the typr of data required by models and the loss function, plus, the way of customizing models. Siamese networks aim to learn embeddings by making use of a similarity metric. Contrastive loss (there are alternatives) is used as a loss function in siamese network, which minimizes the distance between embeddings of similar pairs and maximize the distance between embeddings of dissimilar pairs. Siamese networks are trained using pairs of images, where each pair consists of two images and a flag indicating whether they are similar or dissimilar.

Notebook using siamese -

contrastive.ipynb

Triplet networks also aim to learn embeddings, but they use a triplet loss function. The idea is to learn embeddings in such a way that the distance between an anchor image and a positive (similar) image is smaller than the distance between the anchor image and a negative (dissimilar) image. Triplet networks are trained using triplets of images, an anchor, a positive example (similar to the anchor), and a negative example (dissimilar to the anchor).

Notebook using triplet -

triplet.ipynb

To learn more about this methods -

Siamese networks -

Triplet networks -

There are other methods too, for the task of finding similar images. Check out this competition hosted on drivendata by Meta AI. The winning solutions used self-supervised learning to detect whether a query video contains manipulated portions of one or more videos in a reference set. The dataset provided is very interesting, heavily edited, which would require novel solutions and heavy augmentations to perform well on the metric used to measure models performance.

Dataset-

Dataset used can be found here

To do -

  • Convert to python script
  • Explore other methods
  • Demo using streamlit

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published