GithubHelp home page GithubHelp logo

image-similarity's Introduction

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

image-similarity's People

Contributors

web-ho avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.