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
|
|
|
| 1 |
+
# GoT: Unleashing Reasoning Capability of Multimodal Large Language Model for Visual Generation and Editing
|
| 2 |
+
<div align="center">
|
| 3 |
+
<a href="https://rongyaofang.github.io/"><img src="https://img.shields.io/badge/Project-Homepage-green" alt="Home"></a>
|
| 4 |
+
<a href="https://arxiv.org/abs/xxxx"><img src="https://img.shields.io/badge/ArXiv-xxxx-red"></a>
|
| 5 |
+
<img src="https://visitor-badge.laobi.icu/badge?page_id=rongyaofang/GoT" alt="visitors">
|
| 6 |
+
|
| 7 |
+
[Rongyao Fang](https://scholar.google.com/citations?user=FtH3CW4AAAAJ&hl=en)<sup>1\*</sup>, [Chengqi Duan](https://scholar.google.com/citations?user=r9qb4ZwAAAAJ&hl=zh-CN)<sup>2\*</sup>, [Kun Wang]()<sup>3</sup>, [Linjiang Huang](https://leonhlj.github.io/)<sup>6</sup>, [Hao Li](https://scholar.google.com/citations?user=qHqQsY4AAAAJ&hl=zh-CN)<sup>1,4</sup>, [Shilin Yan](https://scholar.google.com/citations?user=2VhjOykAAAAJ&hl=zh-CN), [Hao Tian]()<sup>3</sup>, [Xingyu Zeng]()<sup>3</sup>, [Rui Zhao]()<sup>3</sup>, [Jifeng Dai](https://jifengdai.org/)<sup>4,5</sup>, [Xihui Liu](https://xh-liu.github.io/)<sup>2 :envelope:</sup>, [Hongsheng Li](https://www.ee.cuhk.edu.hk/~hsli/)<sup>1 :envelope:</sup>
|
| 8 |
+
|
| 9 |
+
<sup>1</sup>CUHK MMLab, <sup>2</sup>HKU MMLab, <sup>3</sup>SenseTime, <sup>4</sup>Shanghai AI Laboratory, <sup>5</sup>Tsinghua University, <sup>6</sup>Beihang University
|
| 10 |
+
|
| 11 |
+
*Equal contribution, :envelope:Corresponding authors
|
| 12 |
+
</div>
|
| 13 |
+
|
| 14 |
+
<div align="center" style="line-height: 1.2;">
|
| 15 |
+
<a href="https://arxiv.org/abs/xxx" target="_blank"><b>Paper</b></a> β’
|
| 16 |
+
<a href="#introduction">Introduction</a> β’
|
| 17 |
+
<a href="#released-datasets">Datasets</a> β’
|
| 18 |
+
<a href="#released-model-got-framework">Model</a> β’
|
| 19 |
+
<a href="#results">Results</a> β’
|
| 20 |
+
<a href="https://huggingface.co/LucasFang/GoT-6B" target="_blank">π€ Hugging Face</a> β’
|
| 21 |
+
<a href="#license">License</a>
|
| 22 |
+
</div>
|
| 23 |
+
|
| 24 |
+
## Introduction
|
| 25 |
+
|
| 26 |
+
We present **Generation Chain-of-Thought (GoT)**, a novel paradigm that enables generation and editing through an explicit language reasoning process before outputting images. This approach transforms conventional text-to-image generation and editing into a reasoning-guided framework that analyzes semantic relationships and spatial arrangements.
|
| 27 |
+
|
| 28 |
+
GoT pioneers a new direction for reasoning-driven visual generation and editing, producing images that better align with human intent through:
|
| 29 |
+
|
| 30 |
+
- **Semantic-Spatial Reasoning**: Integrates both semantic understanding and explicit spatial coordinates
|
| 31 |
+
- **Unified Framework**: Handles both image generation and editing with the same architecture
|
| 32 |
+
|
| 33 |
+
## Released Datasets
|
| 34 |
+
|
| 35 |
+
| Dataset | Link | Amount |
|
| 36 |
+
|---------|------|--------|
|
| 37 |
+
| **Laion-Aesthetics-High-Resolution-GoT** | [π€ HuggingFace](https://huggingface.co/datasets/LucasFang/Laion-Aesthetics-High-Resolution-GoT) | 3.77M |
|
| 38 |
+
| **JourneyDB-GoT** | [π€ HuggingFace](https://huggingface.co/datasets/LucasFang/JourneyDB-GoT) | 4.09M |
|
| 39 |
+
| **OmniEdit-GoT** | [π€ HuggingFace](https://huggingface.co/datasets/LucasFang/OmniEdit-GoT) | 736K |
|
| 40 |
+
|
| 41 |
+
## Dataset Features
|
| 42 |
+
|
| 43 |
+
### Laion-Aesthetics-High-Resolution-GoT
|
| 44 |
+
- 3.77 million High-quality images filtered for sizes larger than 512 pixels from Laion-Aesthetics
|
| 45 |
+
- Prompts and GoT descriptions from Qwen2-VL
|
| 46 |
+
- Prompts averaging 110.81 characters
|
| 47 |
+
- GoT descriptions averaging 811.56 characters
|
| 48 |
+
- 3.78 bounding boxes per image on average
|
| 49 |
+
|
| 50 |
+
### JourneyDB-GoT
|
| 51 |
+
- 4.09 million high-quality AI-generated images
|
| 52 |
+
- Prompts and GoT descriptions from Qwen2-VL
|
| 53 |
+
- Prompts averaging 149.78 characters
|
| 54 |
+
- GoT descriptions averaging 906.01 characters
|
| 55 |
+
- 4.09 bounding boxes per image on average
|
| 56 |
+
- Please download the images from [JourneyDB dataset](https://opendatalab.com/OpenDataLab/JourneyDB/tree/main/raw/JourneyDB/train/imgs)
|
| 57 |
+
|
| 58 |
+
### OmniEdit-GoT
|
| 59 |
+
- 736K high-quality image editing samples from OmniEdit
|
| 60 |
+
- Diverse editing operations (addition, removal, swap, attribute changes, style transfer)
|
| 61 |
+
- Detailed reasoning chains with step-by-step editing processes
|
| 62 |
+
- Precise spatial coordinate annotations for editing regions
|
| 63 |
+
- Please download the images from [OmniEdit dataset](https://huggingface.co/datasets/TIGER-Lab/OmniEdit-Filtered-1.2M)
|
| 64 |
+
|
| 65 |
+
## Model Features
|
| 66 |
+
|
| 67 |
+
Our GoT framework consists of two key components:
|
| 68 |
+
|
| 69 |
+
1. **Semantic-Spatial MLLM**: Generates detailed reasoning chains with spatial information using Qwen2.5-VL as the backbone
|
| 70 |
+
2. **SSGM Diffusion Module**: Leverages the semantic guidance, spatial layouts, and reference images to create high-quality visual outputs
|
| 71 |
+
|
| 72 |
+
The Semantic-Spatial Guidance Module (SSGM) combines three guidance pathways:
|
| 73 |
+
- **Semantic Guidance**: Captures relationships and attributes
|
| 74 |
+
- **Spatial Guidance**: Controls precise object placement
|
| 75 |
+
- **Reference Guidance**: Provides context for editing tasks
|
| 76 |
+
|
| 77 |
+
## Results
|
| 78 |
+
|
| 79 |
+
### Text-to-Image Generation
|
| 80 |
+
|
| 81 |
+
GoT achieves state-of-the-art performance on the GenEval benchmark, particularly excelling in composition tasks:
|
| 82 |
+
|
| 83 |
+
<div align="center">
|
| 84 |
+
|
| 85 |
+
| Method | Architecture | Overall | Single Obj. | Two Obj. | Counting | Colors | Position | Attr. Binding |
|
| 86 |
+
|--------|--------------|---------|-------------|----------|----------|--------|----------|---------------|
|
| 87 |
+
| SD-XL | Unet+CLIP | 0.55 | 0.98 | 0.74 | 0.39 | 0.85 | 0.15 | 0.23 |
|
| 88 |
+
| SD3 | MMDIT+CLIP+T5 | 0.62 | 0.98 | 0.74 | 0.63 | 0.67 | 0.34 | 0.36 |
|
| 89 |
+
| Emu3-Gen | Autoregressive | 0.54 | 0.98 | 0.71 | 0.34 | 0.81 | 0.17 | 0.21 |
|
| 90 |
+
| Janus | Autoregressive | 0.61 | 0.97 | 0.68 | 0.30 | 0.84 | 0.46 | 0.42 |
|
| 91 |
+
| JanusFlow | Autoregressive | 0.63 | 0.97 | 0.59 | 0.45 | 0.83 | 0.53 | 0.42 |
|
| 92 |
+
| **GoT Framework** | Unet+Qwen2.5-VL | **0.64** | **0.99** | 0.69 | **0.67** | **0.85** | 0.34 | 0.27 |
|
| 93 |
+
|
| 94 |
+
</div>
|
| 95 |
+
|
| 96 |
+
### Image Editing
|
| 97 |
+
|
| 98 |
+
Our approach also demonstrates superior performance on image editing benchmarks:
|
| 99 |
+
|
| 100 |
+
<div align="center">
|
| 101 |
+
|
| 102 |
+
| Method | Emu-Edit | | ImagenHub | Reason-Edit |
|
| 103 |
+
|--------|----------|--------|-----------|------------|
|
| 104 |
+
| | CLIP-I | CLIP-T | GPT-4o Eval. | GPT-4o Eval. |
|
| 105 |
+
| IP2P | 0.834 | 0.219 | 0.308 | 0.286 |
|
| 106 |
+
| MagicBrush | 0.838 | 0.222 | 0.513 | 0.334 |
|
| 107 |
+
| SEED-X | 0.825 | 0.272 | 0.166 | 0.239 |
|
| 108 |
+
| CosXL-Edit | 0.860 | 0.274 | 0.464 | 0.325 |
|
| 109 |
+
| **GoT Framework** | **0.864** | **0.276** | **0.533** | 0.561 |
|
| 110 |
+
|
| 111 |
+
</div>
|
| 112 |
+
|
| 113 |
+
### Interactive Generation
|
| 114 |
+
|
| 115 |
+
One of the unique capabilities of GoT is interactive generation, allowing users to modify the reasoning chain to customize the generated images:
|
| 116 |
+
|
| 117 |
+
<div align="center">
|
| 118 |
+
<img src="figures/interactive.png" width="100%" alt="Interactive Generation" />
|
| 119 |
+
</div>
|
| 120 |
+
|
| 121 |
+
Users can interact with the reasoning chain to:
|
| 122 |
+
1. Replace objects
|
| 123 |
+
2. Adjust object positions
|
| 124 |
+
3. Modify object attributes
|
| 125 |
+
|
| 126 |
+
## Usage
|
| 127 |
+
|
| 128 |
+
### Dependencies
|
| 129 |
+
- Python >= 3.8 (Recommend to use [Anaconda](https://www.anaconda.com/download/#linux))
|
| 130 |
+
- [PyTorch >=2.0.1](https://pytorch.org/)
|
| 131 |
+
- NVIDIA GPU + [CUDA](https://developer.nvidia.com/cuda-downloads)
|
| 132 |
+
|
| 133 |
+
### Installation
|
| 134 |
+
Clone the repo and install dependent packages
|
| 135 |
+
|
| 136 |
+
```bash
|
| 137 |
+
git clone git@github.com:rongyaofang/GoT.git
|
| 138 |
+
cd GoT
|
| 139 |
+
pip install -r requirements.txt
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
### Model Weights
|
| 143 |
+
Place the required model weights in the `./pretrained` directory as follows:
|
| 144 |
+
|
| 145 |
+
1. GoT-6B model weights
|
| 146 |
+
2. [Qwen2.5-VL-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-3B-Instruct)
|
| 147 |
+
3. [Stable Diffusion XL Base 1.0](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0)
|
| 148 |
+
|
| 149 |
+
Your directory structure should match the following:
|
| 150 |
+
|
| 151 |
+
```
|
| 152 |
+
GoT
|
| 153 |
+
βββ pretrained
|
| 154 |
+
β βββ GoT-6B
|
| 155 |
+
β βββ Qwen2.5-VL-3B-Instruct
|
| 156 |
+
β βββ stable-diffusion-xl-base-1.0
|
| 157 |
+
βββ ...
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
## License
|
| 161 |
+
|
| 162 |
+
This code is released under the MIT License.
|