# FlowGuard Dataset
main
## πŸ“¦ Overview The **FlowGuard Dataset** is designed to support the training and evaluation of the *FlowGuard* framework, with a focus on **safety-aware image generation and detection**. To ensure scalability and efficient storage, the dataset is: - organized **by model architecture** - packed into **size-balanced tar shards** - filtered to retain only essential supervision signals We include generations from **9 different diffusion / generative architectures**, enabling diverse and robust evaluation. --- ## πŸš€ Loading and Usage The dataset is stored on Hugging Face as **Parquet shards** organized by split, model, and label: ```text train/{model}/{label}/*.parquet test/{model}/{label}/*.parquet ``` Each row contains one image sample with metadata such as model name, split, safety label, case ID, step type, and step index. ### Load the full dataset ```python from datasets import load_dataset dataset = load_dataset( "parquet", data_files={ "train": "hf://datasets/YeQingWen/FlowGuard-Dataset/train/*/*/*.parquet", "test": "hf://datasets/YeQingWen/FlowGuard-Dataset/test/*/*/*.parquet", } ) print(dataset) print(dataset["train"][0]) ``` ### Load a specific model ```python from datasets import load_dataset dataset = load_dataset( "parquet", data_files={ "train": "hf://datasets/YeQingWen/FlowGuard-Dataset/train/flux1/*/*.parquet", "test": "hf://datasets/YeQingWen/FlowGuard-Dataset/test/flux1/*/*.parquet", } ) ``` ### Load a specific model and label ```python from datasets import load_dataset safe_flux1_train = load_dataset( "parquet", data_files={ "train": "hf://datasets/YeQingWen/FlowGuard-Dataset/train/flux1/safe/*.parquet" }, split="train" ) ``` ### Access an image ```python example = dataset["train"][0] image = example["image"] label = example["label"] model = example["model"] step_type = example["step_type"] step_index = example["step_index"] image.show() ``` Each example contains: - `model`: generation architecture - `split`: `train` or `test` - `label`: `safe` or `unsafe` - `case_id`: generation case identifier - `step_type`: `linear_step` or `step49` - `step_index`: diffusion step index - `image`: decoded image object ## NSFW Category Distribution The NSFW category is shown below:
NSFW 7εˆ†η±»εˆ†εΈƒι₯Όε›Ύ
--- ## πŸ“Š Statistics The table below reflects the **full, unbalanced dataset distribution**. > ⚠️ During training, we **subsample to achieve a balanced distribution**. > For details, see: https://arxiv.org/abs/2604.07879 | Model | Train Safe | Train Unsafe | Train Total | Test Safe | Test Unsafe | Test Total | Overall Total | |--------------|-----------|--------------|-------------|-----------|-------------|------------|----------------| | flux1 | 2,687 | 1,953 | **4,640** | 200 | 237 | **437** | **5,077** | | flux2 | 671 | 2,017 | **2,688** | 227 | 181 | **408** | **3,096** | | pixart | 2,725 | 4,246 | **6,971** | 195 | 231 | **426** | **7,397** | | Qwen-Image | 2,643 | 2,055 | **4,698** | 196 | 496 | **692** | **5,390** | | sd3 | 1,250 | 1,293 | **2,543** | 200 | 191 | **391** | **2,934** | | sd3.5 | N/A | N/A | N/A | 391 | 317 | **708** | **708** | | sdv1.5 | 2,659 | 3,537 | **6,196** | 199 | 253 | **452** | **6,648** | | sdxl | 1,899 | 1,759 | **3,658** | 243 | 282 | **525** | **4,183** | | Zimage | 2,676 | 1,910 | **4,586** | 199 | 248 | **447** | **5,033** | | **Total** | **17,210**| **18,770** | **35,980** | **2,050** | **2,436** | **4,486** | **40,466** | --- ## πŸ›‘οΈ Auditing To ensure dataset quality: - The **training set** is automatically audited using `LlavaGuard-7B` - The **test set** is curated under **strict human supervision** This hybrid pipeline ensures both **scalability** and **high-quality evaluation signals**. For implementation details (e.g., prompts and hyperparameters), please refer to: https://arxiv.org/abs/2604.07879 --- ## πŸ“Œ Notes - Each sample corresponds to a **generation case (subdirectory)** - Each case contains: - multiple `linear_step` outputs - one `final image` - `.pt` files are **excluded** to reduce storage overhead