Code Monkey home page Code Monkey logo

Comments (3)

akshaychawla avatar akshaychawla commented on August 11, 2024

@animesh-007 Here is the code for SelfSimilarityHook

class SelfSimilarityHook():

There are no relevant papers because its just the cosine distance between vectors 😃
source: https://scikit-learn.org/stable/modules/metrics.html#cosine-similarity

If we can represent inputs (e.g images) as vectors (e.g x \in \mathcal{R}^n}) that contain semantically relevant features for those inputs, cosine distance tells us how close they are on the unit circle i.e the angle between the 2 vectors, don't care about the magnitude.

We tried to use it to reduce the similarity between the batch of images that are being optimized (with very little success), so that each image in the batch has different colors and textures. We saw that a batch of images optimized by DeepInversion on Yolo-V3 had the same blueish-greenish tinge with strokes as if drawn by a paint brush. I hoped that ssim would increase diversity, but it didn't help too much.

Interestingly, batch similarity is being heavily used by papers for learning backbones with contrastive learning without any labels! e.g https://arxiv.org/abs/2002.05709 uses self similarity between samples in a batch to pull together similar images and pull apart dissimilar images. For generative modelling, you may want to look at GAN papers that might be using self similarity to boost diversity.

from diode.

animesh-007 avatar animesh-007 commented on August 11, 2024

@animesh-007 Here is the code for SelfSimilarityHook

class SelfSimilarityHook():

There are no relevant papers because its just the cosine distance between vectors 😃 source: https://scikit-learn.org/stable/modules/metrics.html#cosine-similarity

If we can represent inputs (e.g images) as vectors (e.g x \in \mathcal{R}^n}) that contain semantically relevant features for those inputs, cosine distance tells us how close they are on the unit circle i.e the angle between the 2 vectors, don't care about the magnitude.

We tried to use it to reduce the similarity between the batch of images that are being optimized (with very little success), so that each image in the batch has different colors and textures. We saw that a batch of images optimized by DeepInversion on Yolo-V3 had the same blueish-greenish tinge with strokes as if drawn by a paint brush. I hoped that ssim would increase diversity, but it didn't help too much.

Interestingly, batch similarity is being heavily used by papers for learning backbones with contrastive learning without any labels! e.g https://arxiv.org/abs/2002.05709 uses self similarity between samples in a batch to pull together similar images and pull apart dissimilar images. For generative modelling, you may want to look at GAN papers that might be using self similarity to boost diversity.

Thanks, @akshaychawla for the detailed answer. I have looked at one GAN paper ref: https://arxiv.org/abs/2105.08584 in the past that uses contrastive learning too.

from diode.

akshaychawla avatar akshaychawla commented on August 11, 2024

@animesh-007 I am closing the issue since it seems to be resolved. If required, please re-open for further discussion on the same topic, else open a new issue.

from diode.

Related Issues (17)

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.