GithubHelp home page GithubHelp logo

victor-qtp / panda Goto Github PK

View Code? Open in Web Editor NEW

This project forked from james-oldfield/panda

0.0 0.0 0.0 7.52 MB

[ICLR'23] Code to reproduce the results in the paper "PandA: Unsupervised Learning of Parts and Appearances in the Feature Maps of GANs"

Home Page: https://eecs.qmul.ac.uk/~jo001/PandA

License: Apache License 2.0

Shell 0.05% C++ 0.45% Python 14.02% Cuda 1.40% Jupyter Notebook 84.08% Dockerfile 0.01%

panda's Introduction

PandA: Unsupervised Learning of Parts and Appearances in the Feature Maps of GANs

Open In Colab Hugging Face Spaces

main.jpg

PandA: Unsupervised Learning of Parts and Appearances in the Feature Maps of GANs
James Oldfield, Christos Tzelepis, Yannis Panagakis, Mihalis A. Nicolaou, and Ioannis Patras
International Conference on Learning Representations (ICLR), 2023
https://arxiv.org/abs/2206.00048

Abstract: Recent advances in the understanding of Generative Adversarial Networks (GANs) have led to remarkable progress in visual editing and synthesis tasks, capitalizing on the rich semantics that are embedded in the latent spaces of pre-trained GANs. However, existing methods are often tailored to specific GAN architectures and are limited to either discovering global semantic directions that do not facilitate localized control, or require some form of supervision through manually provided regions or segmentation masks. In this light, we present an architecture-agnostic approach that jointly discovers factors representing spatial parts and their appearances in an entirely unsupervised fashion. These factors are obtained by applying a semi-nonnegative tensor factorization on the feature maps, which in turn enables context-aware local image editing with pixel-level control. In addition, we show that the discovered appearance factors correspond to saliency maps that localize concepts of interest, without using any labels. Experiments on a wide range of GAN architectures and datasets show that, in comparison to the state of the art, our method is far more efficient in terms of training time and, most importantly, provides much more accurate localized control.

cat-gif

An example of using our learnt appearances and semantic parts for local image editing.

Experiments

We provide a number of notebooks to reproduce the experiments in the paper and to explore the model. Please see the following notebooks:

This notebook contains the code to learn the parts and appearance factors at a target layer in a target GAN. Contains code for local image editing using the learnt parts, and provides code for refining the parts factors.

Local image editing (at the learnt semantic parts)
image image

Provides code to localize/visualize concepts of interest for a model/dataset of interest (setup for the "background" concept in stylegan2_afhqdog512 as an example).

Localizing the learnt "background" concept vector
image image image

Quickly produce edits with annotated directions with pre-trained factors on FFHQ StyleGAN2.

Local image editing: "Big eyes"
image

Setup

Should you wish to run the notebooks, please consult this section below:

Install

First, please install the dependencies with pip install -r requirements.txt, or alternatively with conda using conda env create -f environment.yml

Pre-trained models

Should you wish to download the pre-trained models to run the notebooks, please first download them with:

wget -r -np -nH --cut-dirs=2 -R *index* http://eecs.qmul.ac.uk/~jo001/PandA-pretrained-models/

citation

If you find our work useful, please consider citing our paper:

@inproceedings{oldfield2023panda,
    title={PandA: Unsupervised Learning of Parts and Appearances in the Feature Maps of GANs},
    author={James Oldfield and Christos Tzelepis and Yannis Panagakis and Mihalis A. Nicolaou and Ioannis Patras},
    booktitle={Int. Conf. Learn. Represent.},
    year={2023}
}

contact

Please feel free to get in touch at: [email protected]


credits

panda's People

Contributors

james-oldfield avatar dependabot[bot] 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.