1 Star 0 Fork 0

tmacli / Obj-GAN

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

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/

Note that we have made some modifications (changing the obj attention estimation from "dot product between Glove embeddings" to "cosine similarity between Glove embeddings") based on the code for CVPR submission, and trained 120 epochs using batch size 16. Compared to the results in the paper, the updated results are better on FID and R-prsn scores, and worse on Inception score (because we do not get a chance to train the model using larger batch size).

Methods Inception :arrow_up: FID :arrow_down: R-prsn :arrow_up:
Obj-GAN (pred box & pred shp) 27.32 ± 0.40 24.70 91.91 ± 2.37
Obj-GAN (gt box & pred shp) 28.22 ± 0.35 22.67 93.00 ± 2.15
Obj-GAN (gt box & gt shp) 31.01 ± 0.27 17.03 94.42 ± 2.03

Tips for optimizing the Inception score (though it is boring):

  • Increase the batch size as large as possible via distributed training
  • Increase the weight for the DAMSM loss

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 - Official PyTorch Implementation 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/tmacli/Obj-GAN.git
git@gitee.com:tmacli/Obj-GAN.git
tmacli
Obj-GAN
Obj-GAN
master

搜索帮助