DEAL-300K / README.md
FlyHorseJ's picture
Upload folder using huggingface_hub
b0244c3 verified
metadata
tags:
  - image-segmentation
  - image-classification
  - forgery-detection
  - diffusion
  - image-manipulation-localization
  - deal-300k

DEAL-300K Dataset

DEAL-300K: Diffusion-based Editing Area Localization with a 300K-Scale Dataset and Frequency-Prompted Baseline

Paper Dataset

Overview

DEAL-300K is a large-scale dataset for Diffusion-based Image Manipulation Localization (DIML) containing over 300,000 annotated images. The dataset is specifically designed to address the challenges of localizing regions edited by diffusion models, which often blend seamlessly with original content.

Key Features

  • Scale: 330,979 training images, 3,989 validation images, and 5,500 test images
  • Annotation: Pixel-level segmentation masks for edited regions
  • Diversity: Covers a broad range of manipulations involving humans, animals, and objects
  • Quality: Automated annotation pipeline using SAM-CD (Segment Anything Model with Change Detection)

Dataset Structure

The dataset is stored in Parquet format for efficient loading and compatibility with Hugging Face Datasets:

train-00000-of-00067.parquet  # Training set (67 files)
train-00001-of-00067.parquet
...
val-00000-of-00001.parquet    # Validation set (1 file)
test-00000-of-00002.parquet   # Test set (2 files)
test-00001-of-00002.parquet

Data Fields

Field Type Description
image PIL.Image RGB image (512×384 or similar resolution)
mask PIL.Image Grayscale binary mask (L mode)
label ClassLabel 0=real, 1=fake
image_name string Original filename

Mask Details:

  • For real images: all-black mask (pixel value 0)
  • For fake images: segmentation mask of edited regions (white=255=edited, black=0=original)

Dataset Statistics

Split Real Images Fake Images Total Parquet Files
Train 115,814 215,165 330,979 67
Val 1,656 2,333 3,989 1
Test 1,901 3,599 5,500 2
Total 119,371 221,097 340,468 70

Usage

Loading from Hugging Face Hub (Recommended)

from datasets import load_dataset

# Load the full dataset
dataset = load_dataset("FlyHorseJ/DEAL-300K")

# Or load specific splits
train_dataset = dataset["train"]
val_dataset = dataset["val"]
test_dataset = dataset["test"]

# Access a sample
sample = train_dataset[0]
image = sample["image"]   # PIL Image (RGB)
mask = sample["mask"]     # PIL Image (grayscale mask)
label = sample["label"]   # 0 (real) or 1 (fake)
name = sample["image_name"]  # Original filename

PyTorch DataLoader Example

from torch.utils.data import DataLoader
from torchvision import transforms
import torch

def collate_fn(batch):
    transform = transforms.Compose([
        transforms.ToTensor(),
        transforms.Resize((512, 512))
    ])
    
    images = []
    masks = []
    labels = []
    
    for item in batch:
        images.append(transform(item["image"]))
        masks.append(transform(item["mask"]))
        labels.append(item["label"])
    
    return {
        "images": torch.stack(images),
        "masks": torch.stack(masks),
        "labels": torch.tensor(labels)
    }

# Load dataset from Hugging Face Hub
dataset = load_dataset("FlyHorseJ/DEAL-300K")

# Create DataLoader
train_loader = DataLoader(
    dataset["train"], 
    batch_size=32, 
    shuffle=True,
    collate_fn=collate_fn,
    num_workers=4
)

Visualization Example

import matplotlib.pyplot as plt
import numpy as np
from datasets import load_dataset

# Load from Hugging Face Hub
dataset = load_dataset("FlyHorseJ/DEAL-300K")

sample = dataset["train"][0]
fig, axes = plt.subplots(1, 3, figsize=(15, 5))

# Original image
axes[0].imshow(sample["image"])
axes[0].set_title(f"Image ({'Real' if sample['label'] == 0 else 'Fake'})")
axes[0].axis('off')

# Mask
axes[1].imshow(sample["mask"], cmap='gray')
axes[1].set_title("Mask")
axes[1].axis('off')

# Overlay
img_array = np.array(sample["image"])
mask_array = np.array(sample["mask"].convert('RGB'))
overlay = (img_array * 0.7 + mask_array * 0.3).astype(np.uint8)

axes[2].imshow(overlay)
axes[2].set_title("Overlay")
axes[2].axis('off')

plt.tight_layout()
plt.show()

Dataset Generation Pipeline

  1. Instruction Generation: Fine-tuned Qwen-VL generates editing instructions for MS COCO images
  2. Image Editing: InstructPix2Pix performs mask-free editing based on instructions
  3. Annotation: SAM-CD (Segment Anything Model with Change Detection) generates pixel-level masks

Comparison with Existing Datasets

Dataset Year Source Images Edited Images Image Size Scenario Generative Model
CoCoGlide 2023 512 512 256×256 General GLIDE (Mask-Required)
AutoSplice 2023 2,273 3,621 256×256–4232×4232 General DALL-E2 (Mask-Required)
MagicBrush 2023 5,313 10,388 1024×1024 General DALL-E2 (Mask-Required)
Repaint-P2/CelebA-HQ 2024 10,800 41,472 256×256 Face Repaint (Mask-Required)
DEAL-300K 2025 119,371 221,097 128×512–512×576 General InstructPix2Pix (Mask-Free)

Citation

If you use this dataset in your research, please cite:

@article{zhang2025deal300k,
  title={DEAL-300K: Diffusion-based Editing Area Localization with a 300K-Scale Dataset and Frequency-Prompted Baseline},
  author={Zhang, Rui and Wang, Hongxia and Liu, Hangqing and Zhou, Yang and Zeng, Qiang},
  journal={arXiv preprint arXiv:2511.23377},
  year={2025}
}

Contact

For questions or issues about the dataset, please:

License

This dataset is released for academic research purposes. Please refer to the original MS COCO and MagicBrush licenses for usage restrictions.

Related Links