GithubHelp home page GithubHelp logo

joeyy5588 / obj-gan Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jamesli1618/obj-gan

0.0 0.0 0.0 11.68 MB

Obj-GAN - Official PyTorch Implementation

Python 83.97% Shell 0.30% Cuda 6.07% C 9.32% C++ 0.33%

obj-gan's Introduction

Obj-GAN

Obj-GAN - Official PyTorch Implementation

Pytorch implementation for reproducing Obj-GAN results in the paper Object-driven Text-to-Image Synthesis via Adversarial Training by Wenbo Li*, Pengchuan Zhang*, Lei Zhang, Qiuyuan Huang, Xiaodong He, Siwei Lyu, Jianfeng Gao. (This work was performed when Wenbo was an intern with Microsoft Research).

Picture: If you are asked to draw a picture of several people in their ski gear are in the snow, chances are you will start with an outline of four persons with positioned reasonably in the center of the canvas, then add a sketch of the skis under their feet. Although it is not mentioned in the description, you may decide to add one backpack to each of them to match our common sense. Finally, you carefully finish the details, like painting their clothes blue, their scarves pink and the background white, to make the persons more realistic and the background matches the description better. To make the scene more vivid, you might sketch some brown stones in the snow which indicates that they are in mountains.

Now, there’s a bot that can do that, too.

Dependencies

python 3.6

Pytorch 0.4.1

In addition, please add the project folder to PYTHONPATH and pip install the following packages:

  • python-dateutil
  • easydict
  • pandas
  • torchfile
  • nltk
  • scikit-image
  • spacy
  • PyYAML
  • cffi
  • torchtext
  • dill
  • Cython

Data

  1. Download our preprocessed metadata for coco and merge them to data/coco
  2. Download coco dataset, extract the images to data/coco/images, and extract the annotations to data/coco/insanns

Training

  • Train box generator:
    • cd box_generation
    • python sample.py --is_training 1
  • Train shape generator:
    • cd shape_generation
    • ./make.sh
    • python main.py --gpu '0,1', --FLAG
  • Train image generator:
    • cd image_generation
    • ./make.sh
    • python main.py --gpu '0,1', --FLAG

Pretrained Model

Download and save them to data/coco/pretrained/

Sampling

  • Run box generator:
    • cd box_generation
    • python sample.py --is_training 0 --load_checkpoint [replace with your ckpt path]
  • Run shape generator:
    • cd shape_generation
    • python main.py --gpu '0,1', --NET_G [replace with your ckpt path]
  • Run image generator:
    • cd image_generation
    • python main.py --gpu '0,1', --NET_G [replace with your ckpt path]

More Results

Citing Obj-GAN

If you find Obj-GAN useful in your research, please consider citing:

@article{objgan19,
  author    = {Wenbo Li, Pengchuan Zhang, Lei Zhang, Qiuyuan Huang, Xiaodong He, Siwei Lyu, Jianfeng Gao},
  title     = {Object-driven Text-to-Image Synthesis via Adversarial Training},
  Year = {2019},
  booktitle = {{CVPR}}
}

obj-gan's People

Contributors

jamesli1618 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.