stdKonjac commited on
Commit
9901164
·
verified ·
1 Parent(s): 7dbf739

Update README

Browse files
Files changed (1) hide show
  1. README.md +211 -210
README.md CHANGED
@@ -1,119 +1,131 @@
1
  ---
2
  license: cc-by-nc-4.0
 
 
3
  tags:
4
- - diffusion
5
  - image-editing
6
- - text-to-image
7
  ---
8
 
9
- # Draw-In-Mind: Rebalancing Designer-Painter Roles in Unified Multimodal Models Benefits Image Editing
10
 
11
- [![arXiv](https://img.shields.io/badge/Paper-arXiv-b31b1b.svg?logo=arxiv)](https://arxiv.org/abs/2509.01986)
12
- [![Code](https://img.shields.io/badge/Code-GitHub-blue?logo=github)](https://github.com/showlab/DIM)
13
- [![Hugging Face Datasets](https://img.shields.io/badge/🤗%20%20Dataset-DIM--Edit-yellow.svg)](https://huggingface.co/datasets/stdKonjac/DIM-Edit)
14
- [![Hugging Face Models](https://img.shields.io/badge/🤗%20%20Model-DIM--4.6B--T2I-orange.svg)](https://huggingface.co/stdKonjac/DIM-4.6B-T2I)
15
- [![Hugging Face Models](https://img.shields.io/badge/🤗%20%20Model-DIM--4.6B--Edit-orange.svg)](https://huggingface.co/stdKonjac/DIM-4.6B-Edit)
 
 
 
 
 
16
 
17
  ![DIM-Edit](assets/dim_edit.png)
18
 
19
  ## 📰 News
20
 
21
- **[2025-10-08]** We release the **DIM-Edit** dataset and the **DIM-4.6B-T2I** / **DIM-4.6B-Edit** models.
 
 
 
22
 
23
- **[2025-09-26]** We upload a new version of the paper, including more results across various designers.
24
 
25
- **[2025-09-02]** The **DIM** paper is released.
 
 
 
 
 
 
26
 
27
- ## Introduction
28
 
29
  Unified models achieve strong results in text-to-image generation but remain weak in precise editing. This limitation
30
  arises from an *imbalanced division of responsibilities*. The understanding module is usually treated as a translator
31
- that encodes instructions into conditions, while the generation module must act as both designer and painter. The result
32
- is that the generation module carries too much responsibility, even though it is not optimized for complex reasoning.
 
 
33
 
34
  To address this, we introduce **Draw-In-Mind (DIM)**, a dataset with two complementary parts:
35
 
36
- - **DIM-T2I**: 14M long-context image–text pairs that strengthen instruction comprehension.
37
- - **DIM-Edit**: 233K chain-of-thought imaginations from GPT-4o that provide explicit design blueprints.
38
 
39
  We connect a frozen **Qwen2.5-VL-3B** with a trainable **SANA1.5-1.6B** via a lightweight MLP, forming
40
  **DIM-4.6B-T2I/Edit**. With this setup, the understanding module takes on the *designer responsibility*, while the
41
  generation module focuses on rendering. Despite its modest size, DIM-4.6B-Edit achieves SOTA or competitive results on
42
- ImgEdit and GEdit-Bench, outperforming much larger models.
43
 
44
- ## Performance
45
 
46
  <details>
 
47
 
48
- <summary><b>GenEval and MJHQ-30K</b></summary>
49
-
50
- *: <sup>†</sup> denotes using an LLM rewriter. For MJHQ(-30K), we report FID.
51
 
52
- | Model | Params | Sin. | Two | CT. | Colors | Pos. | Attr. | Overall | MJHQ |
53
- |----------------------------------------------------------------|:----------------:|:----:|:----:|:----:|:------:|:----:|:-----:|:-------:|:-----:|
54
  | <tr><td colspan="10" align="center"><b>Gen. Only</b></td></tr> |
55
- | PixArt-α | 0.6B🔥 | 0.98 | 0.50 | 0.44 | 0.80 | 0.08 | 0.07 | 0.48 | 6.14 |
56
- | SDXL | 2.6B🔥 | 0.98 | 0.74 | 0.39 | 0.85 | 0.15 | 0.23 | 0.55 | 8.76 |
57
- | DALL-E·3 | - | 0.96 | 0.87 | 0.47 | 0.83 | 0.43 | 0.45 | 0.67 | - |
58
- | SD3-Medium | 2.0B🔥 | 0.99 | 0.94 | 0.72 | 0.89 | 0.33 | 0.60 | 0.74 | 11.92 |
59
  | <tr><td colspan="10" align="center"><b>Unified</b></td></tr> |
60
- | Janus | 1.3B🔥 | 0.97 | 0.68 | 0.30 | 0.84 | 0.46 | 0.42 | 0.61 | 10.10 |
61
- | Emu3-Gen<sup>†</sup> | 8.0B🔥 | 0.99 | 0.81 | 0.42 | 0.80 | 0.49 | 0.45 | 0.66 | - |
62
- | Show-o | 1.3B🔥 | 0.98 | 0.80 | 0.66 | 0.84 | 0.31 | 0.50 | 0.68 | 15.18 |
63
- | Show-o2-7B | 7.0B🔥 | 1.00 | 0.87 | 0.58 | 0.92 | 0.52 | 0.62 | 0.76 | - |
64
- | Janus-Pro-7B | 7.0B🔥 | 0.99 | 0.89 | 0.59 | 0.90 | 0.79 | 0.66 | 0.80 | 13.48 |
65
- | BAGEL | 14.0B🔥 | 0.99 | 0.94 | 0.81 | 0.88 | 0.64 | 0.63 | 0.82 | - |
66
- | MetaQuery-L<sup>†</sup> | 3.0B❄️ \| 3.2B🔥 | - | - | - | - | - | - | 0.78 | 6.35 |
67
- | **DIM-4.6B-T2I<sup>†</sup>** | 3.0B❄️ \| 1.6B🔥 | 0.99 | 0.89 | 0.63 | 0.86 | 0.62 | 0.61 | 0.77 | 5.50 |
68
 
69
  </details>
70
 
71
  <details>
72
-
73
- <summary><b>ImgEdit Overall</b></summary>
74
-
75
- *: Q3/7B indicates using Qwen2.5-VL-3/7B as the external designer during inference. By default, GPT-4o is employed
76
- as the external designer to ensure the best performance. All models are evaluated using GPT-4.1.
77
-
78
- | Model | Add | Adj. | Ext. | Rep. | Rem. | Back. | Sty. | Hyb. | Act. | Overall |
79
- |-------------------|:----:|:----:|:----:|:----:|:----:|:-----:|:----:|:----:|:----:|:-------:|
80
- | MagicBrush | 2.84 | 1.58 | 1.51 | 1.97 | 1.58 | 1.75 | 2.38 | 1.62 | 1.22 | 1.83 |
81
- | Instruct-P2P | 2.45 | 1.83 | 1.44 | 2.01 | 1.50 | 1.44 | 3.55 | 1.20 | 1.46 | 1.88 |
82
- | AnyEdit | 3.18 | 2.95 | 1.88 | 2.47 | 2.23 | 2.24 | 2.85 | 1.56 | 2.65 | 2.45 |
83
- | UltraEdit | 3.44 | 2.81 | 2.13 | 2.96 | 1.45 | 2.83 | 3.76 | 1.91 | 2.98 | 2.70 |
84
- | Step1X-Edit | 3.88 | 3.14 | 1.76 | 3.40 | 2.41 | 3.16 | 4.63 | 2.64 | 2.52 | 3.06 |
85
- | BAGEL | 3.56 | 3.31 | 1.70 | 3.30 | 2.62 | 3.24 | 4.49 | 2.38 | 4.17 | 3.20 |
86
- | UniWorld-V1 | 3.82 | 3.64 | 2.27 | 3.47 | 3.24 | 2.99 | 4.21 | 2.96 | 2.74 | 3.26 |
87
- | Janus-4o | 3.35 | 3.35 | 2.25 | 3.01 | 2.18 | 3.32 | 4.71 | 2.49 | 4.04 | 3.19 |
88
- | GPT-4o-Image | 4.61 | 4.33 | 2.90 | 4.35 | 3.66 | 4.57 | 4.93 | 3.96 | 4.89 | 4.20 |
89
- | **DIM-4.6B-Edit** | 4.09 | 3.47 | 2.30 | 4.00 | 3.43 | 3.87 | 4.92 | 2.85 | 4.08 | 3.67 |
90
 
91
  </details>
92
 
93
  <details>
 
94
 
95
- <summary><b>ImgEdit Designer Ablation</b></summary>
96
-
97
- <sup>†</sup>: The default setting.
98
 
99
- | Designer | Add | Adj. | Ext. | Rep. | Rem. | Back. | Sty. | Hyb. | Act. | Overall |
100
- |:-------------------|:----:|:----:|:----:|:----:|:----:|:-----:|:----:|:----:|:----:|:-------:|
101
- | – | 3.53 | 3.23 | 2.01 | 3.49 | 1.47 | 3.42 | 4.79 | 2.35 | 3.64 | 3.10 |
102
- | Qwen2.5-VL-3B | 3.80 | 3.24 | 2.03 | 3.89 | 3.21 | 3.52 | 4.92 | 2.71 | 4.05 | 3.49 |
103
- | Qwen2.5-VL-7B | 3.95 | 3.35 | 2.25 | 3.85 | 3.31 | 3.57 | 4.88 | 2.81 | 4.02 | 3.55 |
104
- | MiMo-VL-7B | 3.95 | 3.32 | 2.20 | 3.75 | 2.46 | 3.82 | 4.88 | 2.52 | 3.93 | 3.43 |
105
- | InternVL3.5-8B | 3.98 | 3.40 | 2.05 | 4.14 | 3.30 | 3.84 | 4.94 | 2.77 | 3.89 | 3.59 |
106
- | GLM-4.1V-9B | 3.95 | 3.27 | 2.23 | 3.90 | 2.64 | 3.81 | 4.92 | 2.23 | 4.02 | 3.44 |
107
- | GPT-4o<sup>†</sup> | 4.09 | 3.47 | 2.30 | 4.00 | 3.43 | 3.87 | 4.92 | 2.85 | 4.08 | 3.67 |
108
 
109
  </details>
110
 
111
  <details>
 
112
 
113
- <summary><b>Visualization</b></summary>
114
-
115
- *:**Green** and **Blue** denote the edits of *Janus-4o* and *Step1X-Edit* respectively; **Red** denotes the edits of our
116
- models trained on different data corpora.
117
 
118
  ![Overall](assets/vis_overall.png)
119
  ![Add](assets/vis_add.png)
@@ -124,48 +136,42 @@ models trained on different data corpora.
124
 
125
  </details>
126
 
127
- ## Dataset Usage
128
-
129
- ### DIM-T2I
130
-
131
- Not available yet.
132
 
133
  ### DIM-Edit
134
 
135
- Please first download [**DIM-Edit**](https://huggingface.co/datasets/stdKonjac/DIM-Edit) from our 🤗HF repo. You can use
136
- `huggingface-cli` to download it quickly:
137
 
138
- ```
139
- # 1. Install the huggingface hub tools (if not yet installed)
140
  pip install -U huggingface_hub
141
 
142
  # 2. Log in with your Hugging Face account token
143
- huggingface-cli login
144
 
145
  # 3. Download the dataset
146
- huggingface-cli download stdKonjac/DIM-Edit --repo-type dataset --local-dir ./DIM-Edit
147
  ```
148
 
149
- After downloading, navigate into the dataset folder, merge and extract the split archives using the following bash
150
- commands:
151
 
152
- ```
153
  cd DIM-Edit
154
  cat images.tar.gz.part* > images.tar.gz
155
  tar -xvzf images.tar.gz
156
  ```
157
 
158
- In the meantime, you will find a JSONL file named `tos_dataset_edit.jsonl` in the root directory, which records all
159
- image editing samples. Each line in this file corresponds to a single sample containing four fields:
160
 
161
- | Field | Description |
162
- |:----------------------|:----------------------------------------------------------------------------------|
163
- | **id** | Unique identifier for each sample. |
164
- | **image_path** | Path to the **source** image, beginning with `image/`. |
165
- | **image_path_target** | Path to the **target** image, beginning with `image/`. |
166
- | **prompt** | The CoT-style instruction describing how to transform the source into the target. |
167
 
168
- We recommend using the huggingface `datasets` library to load the dataset efficiently:
169
 
170
  ```python
171
  from datasets import load_dataset, Features, Value
@@ -187,28 +193,36 @@ ds = load_dataset(
187
  print(ds[0])
188
  ```
189
 
190
- ## Model Usage
191
 
192
- ### Environment Setup
193
 
194
- Run the following script to set up the Python environment.
195
 
196
- ```
 
 
 
 
 
 
197
  pip install -r requirements.txt
198
  ```
199
 
200
  ### 🦙 Model Zoo
201
 
202
- Please first create a `checkpoints` folder in the root directory:
 
203
 
204
- ```
205
  mkdir checkpoints
206
  ```
207
 
208
- Then download the models from our 🤗HF repo below, and move them to the `checkpoints` folder.
209
-
210
- *: To facilitate reproducibility, we release [**DIM-4.6B-Edit-Stage1**](https://huggingface.co/stdKonjac/DIM-4.6B-Edit-Stage1), which is trained solely on the **UltraEdit** dataset.
211
- By fine-tuning this checkpoint on our proposed [**DIM-Edit**](https://huggingface.co/datasets/stdKonjac/DIM-Edit) dataset, you should obtain [**DIM-4.6B-Edit**](https://huggingface.co/stdKonjac/DIM-4.6B-Edit).
 
212
 
213
  | Model | Task | Training Data | ImgEdit | Parameters |
214
  |:----------------------------------------------------------------------------------|:-------------:|:--------------------------:|:-------:|:---------------:|
@@ -216,7 +230,7 @@ By fine-tuning this checkpoint on our proposed [**DIM-Edit**](https://huggingfac
216
  | [**DIM-4.6B-Edit-Stage1**](https://huggingface.co/stdKonjac/DIM-4.6B-Edit-Stage1) | Image Editing | UltraEdit | 2.76 | 3.0B❄️ + 1.6B🔥 |
217
  | [**DIM-4.6B-Edit**](https://huggingface.co/stdKonjac/DIM-4.6B-Edit) | Image Editing | UltraEdit → DIM-Edit | 3.67 | 3.0B❄️ + 1.6B🔥 |
218
 
219
- The checkpoints should be organized like:
220
 
221
  ```
222
  DIM/
@@ -232,56 +246,58 @@ DIM/
232
  └── ...
233
  ```
234
 
235
- ### Inference
236
 
237
  <details>
 
238
 
239
- <summary><b>T2I Generation</b></summary>
240
-
241
- The demo T2I instructions are provided in `cache/demo/tos_dataset_demo.jsonl`, where each line is an instruction in json
242
- format like:
243
 
244
- ```
245
- {"id": "0000", "image_path": "./cache/demo/edit_demo_0000.png", "prompt": "A yummy cupcake floating in the air dark background"}
 
 
 
 
246
  ```
247
 
248
- The `image_path` is just a placeholder, and you can modify `prompt` to create your own image.
249
 
250
- To generate images from the jsonl file, run the following script:
251
 
252
- ```
253
  bash scripts/demo_t2i.sh
254
  ```
255
 
256
- For each instruction, the generated image will be saved at `cache/inference/demo/DIM-4.6B-T2I/{id}_gen.jpg`.
257
 
258
  </details>
259
 
260
  <details>
 
261
 
262
- <summary><b>Image Editing</b></summary>
263
 
264
- The demo edit instructions are provided in `cache/demo/tos_dataset_edit_demo.jsonl`, where each line is an instruction
265
- in json
266
- format like:
267
-
268
- ```
269
- {"id": "0", "image_path": "./cache/demo/edit_demo_0000.png", "prompt": "Remove the lemons on the table.", "image_path_target": "./cache/demo/edit_demo_0000.png"}
 
270
  ```
271
 
272
- The `image_path` corresponds to the source image, and the `prompt` is the edit instruction. The `image_path_target` is
273
- just a placeholder.
274
 
275
- In `infer/demo_edit.py`, use the `set_designer_gpt` API with your own key to set GPT-4o as the external designer for
276
- optimal performance.
277
 
278
  ```python
279
  # GPT-4o as external designer
280
- model.set_designer_gpt(api_key='')
281
  ```
282
 
283
- You can also use the `set_designer_X` API to set various open-source VLMs as the external designer. The VLMs will be
284
- automatically downloaded to local disk.
285
 
286
  ```python
287
  # Qwen2.5-VL as external designer
@@ -298,59 +314,64 @@ model.set_designer_mimo(version='XiaomiMimo/MiMo-VL-7B-RL-2508')
298
  model.set_designer_glm(version='THUDM/GLM-4.1V-9B-Thinking')
299
  ```
300
 
301
- To generate edited images from the jsonl file, run the following script:
302
 
303
- ```
304
  bash scripts/demo_edit.sh
305
  ```
306
 
307
- The model will first generate a CoT-guided edit instruction for each prompt and save it to
308
- `cache/inference/demo/DIM-4.6B-Edit/tos_dataset_edit_cot_demo_gen.jsonl`. Then the generated images will be saved at
309
- `cache/inference/demo/DIM-4.6B-Edit/{id}_edited.jpg`.
310
 
311
- We also provide a sample GPT-4o generated CoT jsonl file at `cache/demo/tos_dataset_edit_cot_demo.jsonl` for reference.
312
 
313
  </details>
314
 
315
- ### Evaluation
316
 
317
- <details>
 
 
 
 
 
 
318
 
319
- <summary><b>GenEval</b></summary>
320
 
321
- We provide two evaluation jsonl files according to prompt types in `cache/GenEval`:
 
322
 
323
- 1. `tos_dataset.jsonl`: Origin prompts.
324
- 2. `tos_dataset_rewritten.jsonl`: LLM-rewritten prompts.
325
 
326
- The `image_path` field in each line of the jsonl is just a
327
- placeholder, please replace it with a pseudo image on your local disk first.
328
 
329
- Run the following script to generate images:
330
 
331
- ```
 
 
332
  bash scripts/eval_geneval.sh
333
  ```
334
 
335
- The generated images will be saved to `cache/inference/DIM-4.6B-T2I/GenEval(_rewritten)`.
336
- Please follow the guide in [GenEval](https://github.com/djghosh13/geneval) official repo for metrics calculation.
337
 
338
  </details>
339
 
340
  <details>
 
341
 
342
- <summary><b>MJHQ-30K</b></summary>
343
-
344
- First download [MJHQ-30K](https://huggingface.co/datasets/playgroundai/MJHQ-30K) from the HF repo. You only need to
345
- download `mjhq30k_imgs.zip`. Then extract all images in
346
- the `cache` folder and organize them as follows:
347
 
348
  ```
349
  cache
350
  └── MJHQ-30K
351
  ├── animals
352
  │ ├── {id}.jpg
353
- │ ├── {id}.jpg
354
  │ └── ...
355
  ├── art
356
  ├── fashion
@@ -363,24 +384,21 @@ cache
363
  └── vehicles
364
  ```
365
 
366
- We have provided all prompts of MJHQ-30K in `cache/MJHQ-30K/tos_dataset.jsonl`. Run the following script to
367
- generate images:
368
 
369
- ```
370
  bash scripts/eval_mjhq30k.sh
371
  ```
372
 
373
- The generated images will be saved to `cache/inference/DIM-4.6B-T2I/MJHQ-30K`. We
374
- use [pytorch-fid](https://github.com/mseitzer/pytorch-fid) to calculate the FID on MJHQ-30K.
375
 
376
  </details>
377
 
378
  <details>
 
379
 
380
- <summary><b>ImgEdit</b></summary>
381
-
382
- First download [ImgEdit](https://huggingface.co/datasets/sysuyy/ImgEdit/tree/main) from the HF repo. Put the dataset in
383
- the `cache` folder, and organize it as follows:
384
 
385
  ```
386
  cache
@@ -404,30 +422,29 @@ cache
404
  └── singleturn.json
405
  ```
406
 
407
- We provide four evaluation jsonl files according to prompt types in `cache/ImgEdit`:
408
 
409
- 1. `tos_dataset_edit.jsonl`: Origin prompts.
410
- 2. `tos_dataset_edit_cot.jsonl`: CoT-style prompts generated by GPT-4o.
411
- 3. `tos_dataset_edit_cot_Qwen2.5-VL-3B-Instruct.jsonl`: CoT-style prompts generated by Qwen2.5-VL-3B.
412
- 4. `tos_dataset_edit_cot_Qwen2.5-VL-7B-Instruct.jsonl`: CoT-style prompts generated by Qwen2.5-VL-7B.
413
 
414
- Run the following script to generate images:
415
 
416
- ```
417
  bash scripts/eval_imgedit.sh
418
  ```
419
 
420
- The generated images will be saved to `cache/inference/DIM-4.6B-Edit/ImgEdit`. Please follow the guide
421
- in [ImgEdit](https://github.com/PKU-YuanGroup/ImgEdit) official repo for metrics calculation.
422
 
423
  </details>
424
 
425
  <details>
 
426
 
427
- <summary><b>GEdit-Bench-EN</b></summary>
428
-
429
- First download [GEdit-Bench](https://huggingface.co/datasets/stepfun-ai/GEdit-Bench) from the HF repo. Extract all raw
430
- images from the dataset and put them in the `cache` folder. Organize them as follows:
431
 
432
  ```
433
  cache
@@ -436,55 +453,39 @@ cache
436
  ├── {id}.png
437
  ├── {id}.png
438
  ├── {id}.png
439
- ├── {id}.png
440
  └── ...
441
  ```
442
 
443
- We provide four evaluation jsonl files according to prompt types in `cache/GEdit-Bench`:
444
 
445
- 1. `tos_dataset_edit_en.jsonl`: Origin prompts.
446
- 2. `tos_dataset_edit_en_cot.jsonl`: CoT-style prompts generated by GPT-4o.
447
- 3. `tos_dataset_edit_en_ot_Qwen2.5-VL-3B-Instruct.jsonl`: CoT-style prompts generated by Qwen2.5-VL-3B.
448
- 4. `tos_dataset_edit_en_cot_Qwen2.5-VL-7B-Instruct.jsonl`: CoT-style prompts generated by Qwen2.5-VL-7B.
449
 
450
- Run the following script to generate images:
451
 
452
- ```
453
  bash scripts/eval_gedit_bench.sh
454
  ```
455
 
456
- The generated images will be saved to `cache/inference/DIM-4.6B-Edit/GEdit-Bench`. Please follow the guide
457
- in [GEdit-Bench](https://github.com/stepfun-ai/Step1X-Edit) official repo for metrics calculation.
458
 
459
  </details>
460
 
461
- ## License
462
-
463
- ### Dataset
464
 
465
- The dataset is licensed under the [CC-BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/) license.
466
 
467
- ### Model
468
-
469
- The models are developed based on [Qwen2.5-VL-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-3B-Instruct) (subject
470
- to [Qwen RESEARCH LICENSE AGREEMENT](https://huggingface.co/Qwen/Qwen2.5-VL-3B-Instruct/blob/main/LICENSE)) and
471
- [SANA1.5_1.6B_1024px](https://huggingface.co/Efficient-Large-Model/SANA1.5_1.6B_1024px) (subject
472
- to [NVIDIA License](https://huggingface.co/Efficient-Large-Model/SANA1.5_1.6B_1024px/blob/main/LICENSE.txt)). We retain
473
- ownership of all intellectual property rights in and to any
474
- derivative works and modifications that we made.
475
-
476
- ## Citation
477
-
478
- If you find our work useful or helpful for your R&D works, please feel free to cite our paper as below.
479
-
480
- ```
481
- @misc{zeng2025drawinmindrebalancingdesignerpainterroles,
482
- title={Draw-In-Mind: Rebalancing Designer-Painter Roles in Unified Multimodal Models Benefits Image Editing},
483
- author={Ziyun Zeng and Junhao Zhang and Wei Li and Mike Zheng Shou},
484
- year={2025},
485
- eprint={2509.01986},
486
- archivePrefix={arXiv},
487
- primaryClass={cs.CV},
488
- url={https://arxiv.org/abs/2509.01986},
489
  }
490
  ```
 
1
  ---
2
  license: cc-by-nc-4.0
3
+ task_categories:
4
+ - image-to-image
5
  tags:
 
6
  - image-editing
 
7
  ---
8
 
9
+ # [ICLR 2026] Draw-In-Mind: Rebalancing Designer-Painter Roles in Unified Multimodal Models Benefits Image Editing
10
 
11
+ [Ziyun Zeng](https://stdkonjac.icu/), [David Junhao Zhang](https://junhaozhang98.github.io/), Wei Li,
12
+ and [Mike Zheng Shou](https://cde.nus.edu.sg/ece/staff/shou-zheng-mike/)
13
+
14
+ [![arXiv](https://img.shields.io/badge/arXiv-Paper-b31b1b.svg?logo=arxiv)](https://arxiv.org/abs/2509.01986)
15
+ [![Project Page](https://img.shields.io/badge/Website-Project%20Page-green?logo=googlechrome&logoColor=white)](https://showlab.github.io/DIM/)
16
+ [![Code](https://img.shields.io/badge/Code-GitHub%20Repo-blue?logo=github)](https://github.com/showlab/DIM)
17
+ [![Hugging Face Datasets](https://img.shields.io/badge/🤗%20Dataset-DIM--Edit-orange.svg)](https://huggingface.co/datasets/stdKonjac/DIM-Edit)
18
+ [![Hugging Face Datasets](https://img.shields.io/badge/🤗%20Dataset-DIM--T2I-orange.svg)](https://huggingface.co/datasets/stdKonjac/DIM-T2I)
19
+ [![Hugging Face Models](https://img.shields.io/badge/🤗%20Model-DIM--4.6B--Edit-orange.svg)](https://huggingface.co/stdKonjac/DIM-4.6B-Edit)
20
+ [![Hugging Face Models](https://img.shields.io/badge/🤗%20Model-DIM--4.6B--T2I-orange.svg)](https://huggingface.co/stdKonjac/DIM-4.6B-T2I)
21
 
22
  ![DIM-Edit](assets/dim_edit.png)
23
 
24
  ## 📰 News
25
 
26
+ - **`[2026-05-12]`** The **DIM** [project page](https://showlab.github.io/DIM/) is available.
27
+ - **`[2026-01-26]`** 🎉 **DIM** is accepted to **ICLR 2026**!
28
+ - **`[2025-10-08]`** 🚀 Released the **DIM-Edit** dataset and the **DIM-4.6B-T2I** / **DIM-4.6B-Edit** models.
29
+ - **`[2025-09-02]`** 📝 The **DIM** paper is released on arXiv.
30
 
31
+ ## 🌟 Highlights
32
 
33
+ - 🧠 **Rebalanced architecture**: Let the understanding module be the *designer*, while the generation module focuses on
34
+ *painting*.
35
+ - 📚 **Two complementary datasets**: **DIM-T2I** (long-context T2I pairs) and **DIM-Edit** (CoT imaginations from
36
+ GPT-4o).
37
+ - ⚡ **Lightweight & efficient**: A ❄️frozen 3.0B VLM and a 🔥trainable 1.6B DiT connected via a single MLP (4.6B params
38
+ in total).
39
+ - 🏆 **SOTA-competitive**: DIM-4.6B-Edit matches or surpasses much larger models on **ImgEdit** and **GEdit-Bench**.
40
 
41
+ ## 💡 Introduction
42
 
43
  Unified models achieve strong results in text-to-image generation but remain weak in precise editing. This limitation
44
  arises from an *imbalanced division of responsibilities*. The understanding module is usually treated as a translator
45
+ that encodes instructions into conditions, while the generation module must act as both **designer** and **painter**.
46
+ The
47
+ result is that the generation module carries too much responsibility, even though it is not optimized for complex
48
+ reasoning.
49
 
50
  To address this, we introduce **Draw-In-Mind (DIM)**, a dataset with two complementary parts:
51
 
52
+ - 🖼️ **DIM-T2I**: Millions of long-context image–text pairs that strengthen instruction comprehension.
53
+ - ✏️ **DIM-Edit**: 233K chain-of-thought imaginations from GPT-4o that provide explicit design blueprints.
54
 
55
  We connect a frozen **Qwen2.5-VL-3B** with a trainable **SANA1.5-1.6B** via a lightweight MLP, forming
56
  **DIM-4.6B-T2I/Edit**. With this setup, the understanding module takes on the *designer responsibility*, while the
57
  generation module focuses on rendering. Despite its modest size, DIM-4.6B-Edit achieves SOTA or competitive results on
58
+ **ImgEdit** and **GEdit-Bench**, outperforming much larger models.
59
 
60
+ ## 📊 Performance
61
 
62
  <details>
63
+ <summary><b>📈 GenEval & MJHQ-30K</b></summary>
64
 
65
+ > <sup></sup> denotes using an LLM rewriter. For MJHQ(-30K), we report FID.
 
 
66
 
67
+ | Model | Params | Sin. | Two | CT. | Colors | Pos. | Attr. | Overall | MJHQ |
68
+ |----------------------------------------------------------------|:----------------:|:----:|:----:|:----:|:------:|:----:|:-----:|:-------:|:--------:|
69
  | <tr><td colspan="10" align="center"><b>Gen. Only</b></td></tr> |
70
+ | PixArt-α | 0.6B🔥 | 0.98 | 0.50 | 0.44 | 0.80 | 0.08 | 0.07 | 0.48 | 6.14 |
71
+ | SDXL | 2.6B🔥 | 0.98 | 0.74 | 0.39 | 0.85 | 0.15 | 0.23 | 0.55 | 8.76 |
72
+ | DALL-E·3 | - | 0.96 | 0.87 | 0.47 | 0.83 | 0.43 | 0.45 | 0.67 | - |
73
+ | SD3-Medium | 2.0B🔥 | 0.99 | 0.94 | 0.72 | 0.89 | 0.33 | 0.60 | 0.74 | 11.92 |
74
  | <tr><td colspan="10" align="center"><b>Unified</b></td></tr> |
75
+ | Janus | 1.3B🔥 | 0.97 | 0.68 | 0.30 | 0.84 | 0.46 | 0.42 | 0.61 | 10.10 |
76
+ | Emu3-Gen<sup>†</sup> | 8.0B🔥 | 0.99 | 0.81 | 0.42 | 0.80 | 0.49 | 0.45 | 0.66 | - |
77
+ | Show-o | 1.3B🔥 | 0.98 | 0.80 | 0.66 | 0.84 | 0.31 | 0.50 | 0.68 | 15.18 |
78
+ | Show-o2-7B | 7.0B🔥 | 1.00 | 0.87 | 0.58 | 0.92 | 0.52 | 0.62 | 0.76 | - |
79
+ | Janus-Pro-7B | 7.0B🔥 | 0.99 | 0.89 | 0.59 | 0.90 | 0.79 | 0.66 | 0.80 | 13.48 |
80
+ | BAGEL | 14.0B🔥 | 0.99 | 0.94 | 0.81 | 0.88 | 0.64 | 0.63 | 0.82 | - |
81
+ | MetaQuery-L<sup>†</sup> | 3.0B❄️ \| 3.2B🔥 | - | - | - | - | - | - | 0.78 | 6.35 |
82
+ | **DIM-4.6B-T2I<sup>†</sup>** | 3.0B❄️ \| 1.6B🔥 | 0.99 | 0.89 | 0.63 | 0.86 | 0.62 | 0.61 | 0.77 | **5.50** |
83
 
84
  </details>
85
 
86
  <details>
87
+ <summary><b>🖌️ ImgEdit Overall</b></summary>
88
+
89
+ > Q3/7B indicates using Qwen2.5-VL-3/7B as the external designer during inference. By default, GPT-4o is employed
90
+ > as the external designer to ensure the best performance. All models are evaluated using GPT-4.1.
91
+
92
+ | Model | Add | Adj. | Ext. | Rep. | Rem. | Back. | Sty. | Hyb. | Act. | Overall |
93
+ |-------------------|:----:|:----:|:----:|:----:|:----:|:-----:|:----:|:----:|:----:|:--------:|
94
+ | MagicBrush | 2.84 | 1.58 | 1.51 | 1.97 | 1.58 | 1.75 | 2.38 | 1.62 | 1.22 | 1.83 |
95
+ | Instruct-P2P | 2.45 | 1.83 | 1.44 | 2.01 | 1.50 | 1.44 | 3.55 | 1.20 | 1.46 | 1.88 |
96
+ | AnyEdit | 3.18 | 2.95 | 1.88 | 2.47 | 2.23 | 2.24 | 2.85 | 1.56 | 2.65 | 2.45 |
97
+ | UltraEdit | 3.44 | 2.81 | 2.13 | 2.96 | 1.45 | 2.83 | 3.76 | 1.91 | 2.98 | 2.70 |
98
+ | Step1X-Edit | 3.88 | 3.14 | 1.76 | 3.40 | 2.41 | 3.16 | 4.63 | 2.64 | 2.52 | 3.06 |
99
+ | BAGEL | 3.56 | 3.31 | 1.70 | 3.30 | 2.62 | 3.24 | 4.49 | 2.38 | 4.17 | 3.20 |
100
+ | UniWorld-V1 | 3.82 | 3.64 | 2.27 | 3.47 | 3.24 | 2.99 | 4.21 | 2.96 | 2.74 | 3.26 |
101
+ | Janus-4o | 3.35 | 3.35 | 2.25 | 3.01 | 2.18 | 3.32 | 4.71 | 2.49 | 4.04 | 3.19 |
102
+ | GPT-4o-Image | 4.61 | 4.33 | 2.90 | 4.35 | 3.66 | 4.57 | 4.93 | 3.96 | 4.89 | 4.20 |
103
+ | **DIM-4.6B-Edit** | 4.09 | 3.47 | 2.30 | 4.00 | 3.43 | 3.87 | 4.92 | 2.85 | 4.08 | **3.67** |
 
104
 
105
  </details>
106
 
107
  <details>
108
+ <summary><b>🔬 ImgEdit Designer Ablation</b></summary>
109
 
110
+ > <sup></sup> The default setting.
 
 
111
 
112
+ | Designer | Add | Adj. | Ext. | Rep. | Rem. | Back. | Sty. | Hyb. | Act. | Overall |
113
+ |:-------------------|:----:|:----:|:----:|:----:|:----:|:-----:|:----:|:----:|:----:|:--------:|
114
+ | – | 3.53 | 3.23 | 2.01 | 3.49 | 1.47 | 3.42 | 4.79 | 2.35 | 3.64 | 3.10 |
115
+ | Qwen2.5-VL-3B | 3.80 | 3.24 | 2.03 | 3.89 | 3.21 | 3.52 | 4.92 | 2.71 | 4.05 | 3.49 |
116
+ | Qwen2.5-VL-7B | 3.95 | 3.35 | 2.25 | 3.85 | 3.31 | 3.57 | 4.88 | 2.81 | 4.02 | 3.55 |
117
+ | MiMo-VL-7B | 3.95 | 3.32 | 2.20 | 3.75 | 2.46 | 3.82 | 4.88 | 2.52 | 3.93 | 3.43 |
118
+ | InternVL3.5-8B | 3.98 | 3.40 | 2.05 | 4.14 | 3.30 | 3.84 | 4.94 | 2.77 | 3.89 | 3.59 |
119
+ | GLM-4.1V-9B | 3.95 | 3.27 | 2.23 | 3.90 | 2.64 | 3.81 | 4.92 | 2.23 | 4.02 | 3.44 |
120
+ | GPT-4o<sup>†</sup> | 4.09 | 3.47 | 2.30 | 4.00 | 3.43 | 3.87 | 4.92 | 2.85 | 4.08 | **3.67** |
121
 
122
  </details>
123
 
124
  <details>
125
+ <summary><b>🖼️ Qualitative Visualization</b></summary>
126
 
127
+ > 🟢 **Green** and 🔵 **Blue** denote the edits of *Janus-4o* and *Step1X-Edit* respectively;
128
+ > 🔴 **Red** denotes the edits of our models trained on different data corpora.
 
 
129
 
130
  ![Overall](assets/vis_overall.png)
131
  ![Add](assets/vis_add.png)
 
136
 
137
  </details>
138
 
139
+ ## 📦 Dataset
 
 
 
 
140
 
141
  ### DIM-Edit
142
 
143
+ **Step 1.** Download [**DIM-Edit**](https://huggingface.co/datasets/stdKonjac/DIM-Edit) from our 🤗 HF repo using
144
+ the `hf` CLI:
145
 
146
+ ```bash
147
+ # 1. Install the huggingface_hub library (>= 0.32.0 for hf_xet support)
148
  pip install -U huggingface_hub
149
 
150
  # 2. Log in with your Hugging Face account token
151
+ hf auth login
152
 
153
  # 3. Download the dataset
154
+ hf download stdKonjac/DIM-Edit --repo-type dataset --local-dir ./DIM-Edit
155
  ```
156
 
157
+ **Step 2.** Merge and extract the split archives:
 
158
 
159
+ ```bash
160
  cd DIM-Edit
161
  cat images.tar.gz.part* > images.tar.gz
162
  tar -xvzf images.tar.gz
163
  ```
164
 
165
+ **Step 3.** Each line of `tos_dataset_edit.jsonl` corresponds to a single sample with four fields:
 
166
 
167
+ | Field | Description |
168
+ |:--------------------|:----------------------------------------------------------------------------------|
169
+ | `id` | Unique identifier for each sample. |
170
+ | `image_path` | Path to the **source** image, beginning with `image/`. |
171
+ | `image_path_target` | Path to the **target** image, beginning with `image/`. |
172
+ | `prompt` | The CoT-style instruction describing how to transform the source into the target. |
173
 
174
+ **Step 4.** Load the dataset with the 🤗 `datasets` library:
175
 
176
  ```python
177
  from datasets import load_dataset, Features, Value
 
193
  print(ds[0])
194
  ```
195
 
196
+ #### 📜 DIM-Edit License
197
 
198
+ The **DIM-Edit** dataset is released under the [CC-BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/) license.
199
 
200
+ ### DIM-T2I
201
 
202
+ Please refer to [`T2I_DATASET.md`](https://github.com/showlab/DIM/blob/main/data/T2I_DATASET.md) for download instructions and licensing details.
203
+
204
+ ## 🚀 Model
205
+
206
+ ### ⚙️ Environment Setup
207
+
208
+ ```bash
209
  pip install -r requirements.txt
210
  ```
211
 
212
  ### 🦙 Model Zoo
213
 
214
+ Create a `checkpoints` folder in the root directory, then download the models from our 🤗 HF repo and move them
215
+ into `checkpoints/`.
216
 
217
+ ```bash
218
  mkdir checkpoints
219
  ```
220
 
221
+ > 💡 To facilitate reproducibility, we release [**DIM-4.6B-Edit-Stage1
222
+ **](https://huggingface.co/stdKonjac/DIM-4.6B-Edit-Stage1),
223
+ > which is trained solely on the **UltraEdit** dataset. Fine-tuning this checkpoint on our proposed
224
+ > [**DIM-Edit**](https://huggingface.co/datasets/stdKonjac/DIM-Edit) dataset should reproduce
225
+ > [**DIM-4.6B-Edit**](https://huggingface.co/stdKonjac/DIM-4.6B-Edit).
226
 
227
  | Model | Task | Training Data | ImgEdit | Parameters |
228
  |:----------------------------------------------------------------------------------|:-------------:|:--------------------------:|:-------:|:---------------:|
 
230
  | [**DIM-4.6B-Edit-Stage1**](https://huggingface.co/stdKonjac/DIM-4.6B-Edit-Stage1) | Image Editing | UltraEdit | 2.76 | 3.0B❄️ + 1.6B🔥 |
231
  | [**DIM-4.6B-Edit**](https://huggingface.co/stdKonjac/DIM-4.6B-Edit) | Image Editing | UltraEdit → DIM-Edit | 3.67 | 3.0B❄️ + 1.6B🔥 |
232
 
233
+ Organize the checkpoints as follows:
234
 
235
  ```
236
  DIM/
 
246
  └── ...
247
  ```
248
 
249
+ ### 🔮 Inference
250
 
251
  <details>
252
+ <summary><b>🎨 T2I Generation</b></summary>
253
 
254
+ Demo T2I instructions are provided in `cache/demo/tos_dataset_demo.jsonl`. Each line is a JSON instruction, e.g.:
 
 
 
255
 
256
+ ```json
257
+ {
258
+ "id": "0000",
259
+ "image_path": "./cache/demo/edit_demo_0000.png",
260
+ "prompt": "A yummy cupcake floating in the air dark background"
261
+ }
262
  ```
263
 
264
+ > The `image_path` is a placeholder modify `prompt` to generate your own image.
265
 
266
+ Run:
267
 
268
+ ```bash
269
  bash scripts/demo_t2i.sh
270
  ```
271
 
272
+ Generated images will be saved to `cache/inference/demo/DIM-4.6B-T2I/{id}_gen.jpg`.
273
 
274
  </details>
275
 
276
  <details>
277
+ <summary><b>✂️ Image Editing</b></summary>
278
 
279
+ Demo edit instructions are provided in `cache/demo/tos_dataset_edit_demo.jsonl`. Each line looks like:
280
 
281
+ ```json
282
+ {
283
+ "id": "0",
284
+ "image_path": "./cache/demo/edit_demo_0000.png",
285
+ "prompt": "Remove the lemons on the table.",
286
+ "image_path_target": "./cache/demo/edit_demo_0000.png"
287
+ }
288
  ```
289
 
290
+ `image_path` is the source image and `prompt` is the edit instruction; `image_path_target` is a placeholder.
 
291
 
292
+ In `infer/demo_edit.py`, use the `set_designer_gpt` API with your own key to set GPT-4o as the external designer
293
+ for optimal performance:
294
 
295
  ```python
296
  # GPT-4o as external designer
297
+ model.set_designer_gpt(api_key=os.environ['OPENAI_API_KEY'])
298
  ```
299
 
300
+ Alternatively, use `set_designer_X` APIs for open-source VLMs (auto-downloaded to local disk):
 
301
 
302
  ```python
303
  # Qwen2.5-VL as external designer
 
314
  model.set_designer_glm(version='THUDM/GLM-4.1V-9B-Thinking')
315
  ```
316
 
317
+ Run:
318
 
319
+ ```bash
320
  bash scripts/demo_edit.sh
321
  ```
322
 
323
+ The model first generates a CoT-guided edit instruction for each prompt
324
+ (saved to `cache/inference/demo/DIM-4.6B-Edit/tos_dataset_edit_cot_demo_gen.jsonl`),
325
+ then produces edited images at `cache/inference/demo/DIM-4.6B-Edit/{id}_edited.jpg`.
326
 
327
+ A sample GPT-4o-generated CoT jsonl is provided at `cache/demo/tos_dataset_edit_cot_demo.jsonl` for reference.
328
 
329
  </details>
330
 
331
+ ### 📜 Model License
332
 
333
+ The models are developed based on
334
+ [Qwen2.5-VL-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-3B-Instruct)
335
+ (subject to the [Qwen RESEARCH LICENSE AGREEMENT](https://huggingface.co/Qwen/Qwen2.5-VL-3B-Instruct/blob/main/LICENSE))
336
+ and [SANA1.5_1.6B_1024px](https://huggingface.co/Efficient-Large-Model/SANA1.5_1.6B_1024px)
337
+ (subject to
338
+ the [NVIDIA License](https://huggingface.co/Efficient-Large-Model/SANA1.5_1.6B_1024px/blob/main/LICENSE.txt)).
339
+ We retain ownership of all intellectual property rights in and to any derivative works and modifications that we made.
340
 
341
+ ## 🧪 Evaluation
342
 
343
+ <details>
344
+ <summary><b>📐 GenEval</b></summary>
345
 
346
+ We provide two evaluation jsonl files in `cache/GenEval` based on prompt type:
 
347
 
348
+ 1. `tos_dataset.jsonl` Original prompts.
349
+ 2. `tos_dataset_rewritten.jsonl` LLM-rewritten prompts.
350
 
351
+ > The `image_path` field is a placeholder — please replace it with a pseudo image on your local disk first.
352
 
353
+ Run:
354
+
355
+ ```bash
356
  bash scripts/eval_geneval.sh
357
  ```
358
 
359
+ Generated images will be saved to `cache/inference/DIM-4.6B-T2I/GenEval(_rewritten)`.
360
+ Follow the [GenEval official repo](https://github.com/djghosh13/geneval) for metric calculation.
361
 
362
  </details>
363
 
364
  <details>
365
+ <summary><b>🖼️ MJHQ-30K</b></summary>
366
 
367
+ Download [MJHQ-30K](https://huggingface.co/datasets/playgroundai/MJHQ-30K) (only `mjhq30k_imgs.zip` is needed),
368
+ extract under `cache/` as:
 
 
 
369
 
370
  ```
371
  cache
372
  └── MJHQ-30K
373
  ├── animals
374
  │ ├── {id}.jpg
 
375
  │ └── ...
376
  ├── art
377
  ├── fashion
 
384
  └── vehicles
385
  ```
386
 
387
+ All MJHQ-30K prompts are in `cache/MJHQ-30K/tos_dataset.jsonl`. Run:
 
388
 
389
+ ```bash
390
  bash scripts/eval_mjhq30k.sh
391
  ```
392
 
393
+ Generated images will be saved to `cache/inference/DIM-4.6B-T2I/MJHQ-30K`.
394
+ We use [pytorch-fid](https://github.com/mseitzer/pytorch-fid) to compute FID.
395
 
396
  </details>
397
 
398
  <details>
399
+ <summary><b>✏️ ImgEdit</b></summary>
400
 
401
+ Download [ImgEdit](https://huggingface.co/datasets/sysuyy/ImgEdit/tree/main) and organize under `cache/`:
 
 
 
402
 
403
  ```
404
  cache
 
422
  └── singleturn.json
423
  ```
424
 
425
+ Four evaluation jsonl files are provided in `cache/ImgEdit`:
426
 
427
+ 1. `tos_dataset_edit.jsonl` Original prompts.
428
+ 2. `tos_dataset_edit_cot.jsonl` CoT-style prompts from GPT-4o.
429
+ 3. `tos_dataset_edit_cot_Qwen2.5-VL-3B-Instruct.jsonl` CoT-style prompts from Qwen2.5-VL-3B.
430
+ 4. `tos_dataset_edit_cot_Qwen2.5-VL-7B-Instruct.jsonl` CoT-style prompts from Qwen2.5-VL-7B.
431
 
432
+ Run:
433
 
434
+ ```bash
435
  bash scripts/eval_imgedit.sh
436
  ```
437
 
438
+ Generated images will be saved to `cache/inference/DIM-4.6B-Edit/ImgEdit`.
439
+ Follow the [ImgEdit official repo](https://github.com/PKU-YuanGroup/ImgEdit) for metric calculation.
440
 
441
  </details>
442
 
443
  <details>
444
+ <summary><b>📝 GEdit-Bench-EN</b></summary>
445
 
446
+ Download [GEdit-Bench](https://huggingface.co/datasets/stepfun-ai/GEdit-Bench), extract raw images, and organize under
447
+ `cache/`:
 
 
448
 
449
  ```
450
  cache
 
453
  ├── {id}.png
454
  ├── {id}.png
455
  ├── {id}.png
 
456
  └── ...
457
  ```
458
 
459
+ Four evaluation jsonl files are provided in `cache/GEdit-Bench`:
460
 
461
+ 1. `tos_dataset_edit_en.jsonl` Original prompts.
462
+ 2. `tos_dataset_edit_en_cot.jsonl` CoT-style prompts from GPT-4o.
463
+ 3. `tos_dataset_edit_en_cot_Qwen2.5-VL-3B-Instruct.jsonl` CoT-style prompts from Qwen2.5-VL-3B.
464
+ 4. `tos_dataset_edit_en_cot_Qwen2.5-VL-7B-Instruct.jsonl` CoT-style prompts from Qwen2.5-VL-7B.
465
 
466
+ Run:
467
 
468
+ ```bash
469
  bash scripts/eval_gedit_bench.sh
470
  ```
471
 
472
+ Generated images will be saved to `cache/inference/DIM-4.6B-Edit/GEdit-Bench`.
473
+ Follow the [GEdit-Bench official repo](https://github.com/stepfun-ai/Step1X-Edit) for metric calculation.
474
 
475
  </details>
476
 
477
+ ## 📖 Citation
 
 
478
 
479
+ If you find **DIM** useful for your research, please consider citing our paper:
480
 
481
+ ```bibtex
482
+ @misc{zeng2025draw,
483
+ title = {Draw-In-Mind: Rebalancing Designer-Painter Roles in Unified Multimodal Models Benefits Image Editing},
484
+ author = {Zeng, Ziyun and Zhang, David Junhao and Li, Wei and Shou, Mike Zheng},
485
+ year = {2025},
486
+ eprint = {2509.01986},
487
+ archivePrefix = {arXiv},
488
+ primaryClass = {cs.CV},
489
+ url = {https://arxiv.org/abs/2509.01986}
 
 
 
 
 
 
 
 
 
 
 
 
 
490
  }
491
  ```