---
title: EliGenTrainSet
canonical_url: "https://www.modelscope.cn/datasets/DiffSynth-Studio/EliGenTrainSet"
md_url: "https://www.modelscope.cn/datasets/DiffSynth-Studio/EliGenTrainSet.md"
repository: DiffSynth-Studio/EliGenTrainSet
last_updated: 2025-09-28
license: "Apache License 2.0"
storage_size: "863 GB"
downloads: 30899
stars: 3
---

# EliGenTrainSet

> EliGenTrainSet - DiffSynth-Studio 在 ModelScope 开源的数据集。Train Dataset of EliGen Paper: EliGen: Entity-Level Controlled Image Generation with Regional Attention Github: DiffSynth-Studio Model: ModelScope Online Demo: ModelScope EliGen Studio

DiffSynth-Studio/EliGenTrainSet 是 ModelScope 魔搭社区上的数据集，存储大小 863 GB，采用 Apache License 2.0 许可。

- **Repository**: DiffSynth-Studio/EliGenTrainSet
- **License**: Apache License 2.0
- **Storage size**: 863 GB
- **Downloads**: 30899
- **Stars**: 3
- **Last updated**: 2025-09-28

Source: https://www.modelscope.cn/datasets/DiffSynth-Studio/EliGenTrainSet

---

## Train Dataset of EliGen
* Paper: [EliGen: Entity-Level Controlled Image Generation with Regional Attention](https://arxiv.org/abs/2501.01097)
* Github: [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio)
* Model: [ModelScope](https://www.modelscope.cn/models/DiffSynth-Studio/Eligen)
* Online Demo: [ModelScope EliGen Studio](https://www.modelscope.cn/studios/DiffSynth-Studio/EliGen)

## Dataset Description
All image data is stored in parquet format. Each sample contains the following fields:
* image_id: unique id for each image, `000009`
* caption: global prompt, eg. `A cartoon chicken dressed in a suit and tie.`
* entities: entity descriptions and their bounding boxes, eg. `[{"entity": "cartoon chicken", "bbox": [0.145, 0.06, 0.854, 0.94]}]`
* image: base64 encoded image data.

For better usage, we provide a python script to read the parquet files and extract the source image and annotations. It is recommended to decode and restore the images first. 

The annotations is also stored in json format in `caption-bboxbyqwen-dataset.jsonl`, you may use it for lightweight loading of the annotations.
## Example Usage
download dataset using
```bash
git lfs install
git clone https://www.modelscope.cn/datasets/DiffSynth-Studio/EliGenTrainSet.git
```
or 
```bash
modelscope download --dataset DiffSynth-Studio/EliGenTrainSet
```
Then you can use the following python code to read the parquet files to extract the source image and annotations.

```python
import pandas as pd
import base64
from PIL import Image
import io
import os

parquet_file_template = 'output_parquet_files/part-{}.parquet'
out_image_folder = 'output_images'
os.makedirs(out_image_folder, exist_ok=True)

for file_num in range(100):
    file_name = f"{file_num:05d}"
    parquet_file = parquet_file_template.format(file_name)
    if not os.path.exists(parquet_file):
        print(f"File {parquet_file} does not exist, skipping.")
        continue
    df = pd.read_parquet(parquet_file)
    for i, row in df.iterrows():
        try:
            # global prompt
            caption = row['caption']
            # entity descriptions and their bounding boxes: [x1, y1, x2, y2]
            all_entities = row.get("entities", [])
            # image id
            image_id = row['image_id']
            # image data
            image_data = base64.b64decode(row['image'])
            image = Image.open(io.BytesIO(image_data))
            image.save(os.path.join(out_image_folder, f"{image_id}.png"))
        except:
            continue
    print(f"File {parquet_file} processed.")
```

## Citation
If you find our work helpful, feel free to give us a cite.
```
@article{zhang2025eligen,
  title={Eligen: Entity-level controlled image generation with regional attention},
  author={Zhang, Hong and Duan, Zhongjie and Wang, Xingjun and Chen, Yingda and Zhang, Yu},
  journal={arXiv preprint arXiv:2501.01097},
  year={2025}
}
```
