Giter Site home page Giter Site logo

clip-robust-gen's Introduction

Robust CLIP Image Generation

Open In Colab

Motivation

In this minimalist notebook, we generate images from a given text prompt by traversing through the gradients of Robust CLIP (ICML 2024, Schlarman et al.) without a generative model. Generating images from the gradients of a classifier is by no means a novel idea (see, for example, this paper). Several approaches have used CLIP to synthesize/search for an image that is similar to a prompt (e.g., CLIPig). However, its gradients are not suitable for generation since CLIP's image encoder is sensitive to small imperceptible perturbations and adversarial attacks. As such, a naive gradient descent may result in semantically poor images that have high CLIP similarity scores. To alleviate this issue, CLIPig augments samples with noise, random rotations, etc. Contrary to this, robust classifiers have perceptually-aligned gradients and perform better at generative tasks, as shown by Srinivas et al. This motivated me to check how well Robust CLIP would work in straightforward settings (i.e., without the need to introduce tricky augmentations).

Results

The results are random and not cherry picked. image

Contribution

I welcome everyone who wishes to contribute. The main object of interest is experiments with different guidance schedulers and normalizations. If you have something to show or share, please do so in Discussions.

Acknowledgements

clip-robust-gen's People

Contributors

realfolkcode avatar

Stargazers

 avatar stefan berke avatar Christian avatar

Watchers

Malik Hashmat avatar  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.