---
title: X2Edit-Dataset
canonical_url: "https://www.modelscope.cn/datasets/AIGCer-OPPO/X2Edit-Dataset"
md_url: "https://www.modelscope.cn/datasets/AIGCer-OPPO/X2Edit-Dataset.md"
repository: AIGCer-OPPO/X2Edit-Dataset
last_updated: 2025-09-01
license: "Apache License 2.0"
storage_size: "4.5 TB"
downloads: 1547
stars: 2
---

# X2Edit-Dataset

> X2Edit-Dataset - AIGCer-OPPO 在 ModelScope 开源的数据集。X2Edit Dataset is a comprehensive image editing dataset that covers 14 diverse editing tasks and exhibits substantial advantages over existing open-source datasets including AnyEdit, HQ-Edit, UltraEdit,…

AIGCer-OPPO/X2Edit-Dataset 是 ModelScope 魔搭社区上的数据集，存储大小 4.5 TB，采用 Apache License 2.0 许可。

- **Repository**: AIGCer-OPPO/X2Edit-Dataset
- **License**: Apache License 2.0
- **Storage size**: 4.5 TB
- **Downloads**: 1547
- **Stars**: 2
- **Last updated**: 2025-09-01

Source: https://www.modelscope.cn/datasets/AIGCer-OPPO/X2Edit-Dataset

---

<div align="center">
  <h1>X2Edit</h1>
<a href='https://github.com/OPPO-Mente-Lab/X2Edit'><img src="https://img.shields.io/badge/GitHub-OPPOer/X2Edit-blue.svg?logo=github" alt="GitHub"></a>
<a href='https://arxiv.org/abs/2508.07607'><img src='https://img.shields.io/badge/arXiv-2508.07607-b31b1b.svg'></a> &nbsp;
<a href='https://huggingface.co/datasets/OPPOer/X2Edit-Dataset'><img src='https://img.shields.io/badge/🤗%20HuggingFace-X2Edit Dataset-ffd21f.svg'></a>
<a href='https://huggingface.co/OPPOer/X2Edit'><img src='https://img.shields.io/badge/🤗%20HuggingFace-X2Edit-ffd21f.svg'></a>
</div>

## Introduction

**X2Edit Dataset** is a comprehensive image editing dataset that covers 14 diverse editing tasks and exhibits substantial advantages over existing open-source datasets including AnyEdit, HQ-Edit, UltraEdit, SEED-Data-Edit, ImgEdit and OmniEdit.

For the relevant data construction scripts, model training and inference scripts, please refer to [**X2Edit**](https://github.com/OPPO-Mente-Lab/X2Edit).

## Dataset Statistics

<!-- ### Dataset Overview and Comparison

| Dataset | Size | Types | Resolution | Complex Tasks |
|:----------------|:---------------:|:-------------:|:-------------:|:-------------:|
| **AnyEdit** | 2.5M | 25 | 512 | $\checkmark$
| **HQ-Edit** | 197K | 6 | $\geq$ 768 | $\times$
| **UltraEdit** | 4M | 9 | 512 | $\times$
| **SEED-Data-Edit** | 3.7M | 6 | 768 | $\times$
| **ImgEdit** | 1.2M | 13 | $\geq$ 1280 | $\times$
| **OmniEdit** | 5.2M/1.2M | 7 | $\geq$ 512 | $\times$
| **X2Edit(512)** | **2M** | 14 | 512 | $\checkmark$
| **X2Edit(1024)** | **1.7M** | 14 | $\sim$ 1024 | $\checkmark$ -->

### Data Distribution Constructed by Each Model

| Model | Size |
|:------|:---------:|
| Bagel | 502K |
| GPT-4o | 232K |
| Kontext | 2.2M |
| Step1X-Edit | 900K |
| LaMa | 200K |
| OmniConsistency | 250K | 
| TextFlux | 280K |
<!-- | Total | 3.7M | -->

<!-- ### Data Volume Distribution for Each Task

| Task | Size |
|:------|:---------:|
| Style Change | 319K |
| Tone Transform | 334K |
| Reasoning | 342K |
| Background Change | 157K |
| Color Change | 183K |
| Subject Addition | 209K |
| Subject Deletion | 153K |
| Subject Replacement | 193K |
| Material Change | 180K |
| Action Change | 125K |
| Portrait Editing | 98K |
| Camera Movement | 94K |
| Text Change | 100K |
| Subject-Driven Generation | 460K |
| Style Change(Expert) | 250K |
| Text Change(Expert) | 280K |
| Subject Deletion(Expert) | 200K | -->
<!-- | Total | 3.7M | -->

## Unified Directory Structure

```
X2Edit-data/
├── bagel/
│   ├── 0/
│       ├── 00000.tar
│           ├── 000000.1.0.jpg         # Original image
│           ├── 000000.2.0.jpg         # Editing image
│           ├── 000000.json            # information image
│           ├── 000000.txt             # Editing instruction
│           └── ......
│       ├── 00001.tar
│       ├── 00002.tar
│       ├── 00003.tar
│       ├── 00004.tar             
│       └── ......
│   ├── 1/
│   ├── 2/
│   ├── 3/
│   ├── 4/
│   ├── 5/
│   ├── 6/
│   └── 7/
├── gpt4o/
├── kontext/
├── kontext_subject/
├── lama/
├── ominiconsistencey/
├── step1x-edit/
└── textflux/
    ├── 0/
        ├── 00000.tar
            ├── 000000.1.0.jpg         # Original image
            ├── 000000.1.1.jpg         # mask image of text foregroud
            ├── 000000.2.0.jpg         # Editing image
            ├── 000000.json            # information image
            ├── 000000.txt             # Editing instruction    
            └── ......                
        ├── 00001.tar
        ├── 00002.tar
        ├── 00003.tar
        ├── 00004.tar             
        └── ......

```

Each subfolder is named after the model used to construct the data, and each tar file contains about 5,000 sets of data.

## Json Format

### Common Fields

```python
{
    "caption_en": "string", # English description of the image.
    "caption_zh": "string", # Chinese description of the image.
    "instruction": "string", # Editing instruction, it could be Chinese or English.
    "instruction_zh": "string", # Chinese Editing instruction.
    "task": "string", # Editing task type. (e.g., "reasoning", "subject deletion")
    "model": "string", # Model for constructing the data.  (e.g., "Kontext", "step1x-edit")
    "score_7b": "string", # Score of Qwen2.5-7B evaluation.  (e.g., "[5, 5]")
    "liqe_score": "float", # liqe score of original image.
    "liqe_score_edit": "float", # liqe score of editing image.
    "liqe_score_clip": "float", # liqe clip score of original image.
    "liqe_score_clip_edit": "float", # liqe clip score of editing image.
    "aesthetic_score_v2_5": "float", # aesthetic score of original image.
    "aesthetic_score_v2_5_edit": "float" , # aesthetic score of editing image.
}
```

### Dataset-Specific Fields

#### step1x-edit

```python
{
    "score": "string", # Score of Qwen2.5-72B evaluation.
}
```

#### kontext_subject

```python
{
    "dino": "float", # DINOv2 score between original image and editing image.
    "clipI": "float", # CLIP score between original image and editing image.
    "clipT": "float", # CLIP score between editing instruction and editing image.
}
```

#### textflux
```python
{
    "font": [
        [
            "SHEIN",
            "(43,41) (225,41) (225,79) (43,79)"
        ]
    ] # Text box coordinates
}
```

## Usage Guide

### Download data

```bash
git lfs install
git clone https://www.modelscope.cn/datasets/majian/X2Edit-Dataset.git
```

### load data
```python
from torchdata.datapipes.iter import FileOpener
from torchdata.dataloader2 import MultiProcessingReadingService, DataLoader2

def decode(item):
    key, value = item
    if key.endswith(".txt"):
        return key, value.read().decode("utf-8")
    if key.endswith(".jpg"):
        return key, Image.open(value).convert("RGB")
    if key.endswith(".json"):
        return key, json.load(value)

def collate_fn(examples):
    key = [example["__key__"].split("/")[-1] for example in examples]
    jpg1 = [example["1.0.jpg"] for example in examples]
    jpg2 = [example["2.jpg"] for example in examples]
    json = [example["txt"] for example in examples]
    txt = [example["json"] for example in examples]
    jpg3 = [example["1.1.jpg"] for example in examples if "1.1.jpg" in example]
    return {"jpg1": jpg1,"jpg2": jpg2,"txt": txt, "key": key, "json": json, "jpg3": jpg3}

tar_path = 'X2Edit-data/bagel/0/00000.tar'
rs = MultiProcessingReadingService(num_workers=1)
dataset = FileOpener([tar_name], mode="b").load_from_tar().map(decode).webdataset(). \
        batch(1).collate(collate_fn=collate_fn)
dl = DataLoader2(dataset, reading_service=rs)
for obj in tqdm(dl):
    for i in range(len(obj["json"])):
        json = obj["json"][i]
        jpg1 = obj["jpg1"][i]
        jpg2 = obj["jpg2"][i]
        txt = obj["txt"][i]
        if "jpg3" in obj:
            jpg3 = obj["jpg3"][i]
```

## Acknowledgement
[FLUX.1-Kontext-dev](https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev), [Step1X-Edit](https://github.com/stepfun-ai/Step1X-Edit), [Bagel](https://github.com/stepfun-ai/Step1X-Edit), [GPT-4o](), [LaMa](https://github.com/stepfun-ai/Step1X-Edit), [TextFlux](https://github.com/stepfun-ai/Step1X-Edit), [OmniConsistency](https://github.com/stepfun-ai/Step1X-Edit).

## Citation

🌟 If you find our work helpful, please consider citing our paper and leaving valuable stars

```
@misc{ma2025x2editrevisitingarbitraryinstructionimage,
      title={X2Edit: Revisiting Arbitrary-Instruction Image Editing through Self-Constructed Data and Task-Aware Representation Learning}, 
      author={Jian Ma and Xujie Zhu and Zihao Pan and Qirong Peng and Xu Guo and Chen Chen and Haonan Lu},
      year={2025},
      eprint={2508.07607},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2508.07607}, 
}
```
