File size: 2,508 Bytes
746ec97
 
 
 
 
 
 
 
b70deaf
 
 
 
746ec97
 
aca16ac
746ec97
 
5c17cc3
 
 
 
746ec97
 
 
 
 
 
 
 
 
 
 
1627bf0
746ec97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5c17cc3
2dff806
 
 
 
 
 
 
5c17cc3
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
license: creativeml-openrail-m
language:
- en
library_name: diffusers
pipeline_tag: text-to-image
tags:
- stable-diffusion
- cvpr
- text-to-image
- image-generation
- compositionality
---
# 🧩 TokenCompose SD21 Model Card
## 🎬CVPR 2024
[TokenCompose_SD21_B](https://mlpc-ucsd.github.io/TokenCompose/) is a [latent text-to-image diffusion model](https://arxiv.org/abs/2112.10752) finetuned from the [**Stable-Diffusion-v2-1**](https://huggingface.co/stabilityai/stable-diffusion-2-1) checkpoint at resolution 768x768 on the [VSR](https://github.com/cambridgeltl/visual-spatial-reasoning) split of [COCO image-caption pairs](https://cocodataset.org/#download) for 32,000 steps with a learning rate of 5e-6. The training objective involves token-level grounding terms in addition to denoising loss for enhanced multi-category instance composition and photorealism. The "_A/B" postfix indicates different finetuning runs of the model using the same above configurations.

# 📄 Paper

Please follow [this](https://arxiv.org/abs/2312.03626) link.

# 🧨Example Usage

We strongly recommend using the [🤗Diffuser](https://github.com/huggingface/diffusers) library to run our model.

```python
import torch
from diffusers import StableDiffusionPipeline

model_id = "mlpc-lab/TokenCompose_SD21_B"
device = "cuda"

pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32)
pipe = pipe.to(device)

prompt = "A cat and a wine glass"
image = pipe(prompt).images[0]  
    
image.save("cat_and_wine_glass.png")
```

# ⬆️Improvements over SD21

| Model               | Object Accuracy | MG3 COCO | MG4 COCO | MG5 COCO | MG3 ADE20K | MG4 ADE20K | MG5 ADE20K | FID COCO |
|---------------------|-----------------|----------|----------|----------|------------|------------|------------|----------|
| SD21                | 47.82           | 70.14    | 25.57    | 3.27     | 75.13      | 35.07      | 7.16       | 19.59    |
| TokenCompose (SD21) | 60.10           | 80.48    | 36.69    | 5.71     | 79.51      | 39.59      | 8.13       | 19.15    |

# 📰 Citation
```bibtex
@InProceedings{Wang2024TokenCompose,
    author    = {Wang, Zirui and Sha, Zhizhou and Ding, Zheng and Wang, Yilin and Tu, Zhuowen},
    title     = {TokenCompose: Text-to-Image Diffusion with Token-level Supervision},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    month     = {June},
    year      = {2024},
    pages     = {8553-8564}
}
```