| --- |
| pretty_name: "FreeStyle Dataset: cref/sref LoRA Triplets" |
| task_categories: |
| - image-to-image |
| tags: |
| - image-to-image |
| - style-reference |
| - content-reference |
| - lora |
| - triplet |
| - prompt-provenance |
| size_categories: |
| - 100K<n<1M |
| --- |
| |
| # FreeStyle Dataset: cref/sref LoRA Triplets |
|
|
| This repository contains a file-based image triplet dataset for content-reference (`cref`) and style-reference (`sref`) training/evaluation. The exported payload is under [`cref_sref/`](./cref_sref/). |
|
|
| Each row in a `triplets.csv` file represents one training sequence with three images: |
|
|
| - **content**: image used as the content reference (`cref_0`) |
| - **style**: image used as the style reference (`sref_0`) |
| - **target**: image for the combined content+style result |
|
|
| The images are deduplicated within each source/role. A single image file can be reused by multiple triplet rows. |
|
|
| ## Quick Start |
|
|
| Install lightweight dependencies: |
|
|
| ```bash |
| pip install huggingface_hub pandas pillow |
| ``` |
|
|
| Download and inspect the metadata for one source without downloading all images: |
|
|
| ```python |
| from huggingface_hub import hf_hub_download |
| import pandas as pd |
| |
| repo_id = "Blue2Giant/FreeStyle_Dataset" |
| source = "qwen" # one of: qwen, flux, illustrious |
| |
| triplets_csv = hf_hub_download( |
| repo_id=repo_id, |
| repo_type="dataset", |
| filename=f"cref_sref/{source}/triplets.csv", |
| ) |
| triplets = pd.read_csv(triplets_csv) |
| |
| print(len(triplets)) |
| print(triplets[[ |
| "sequence_id", |
| "content_image_path", |
| "style_image_path", |
| "target_image_path", |
| "content_generation_prompt", |
| "style_generation_prompt", |
| "target_generation_prompt", |
| ]].head()) |
| ``` |
|
|
| Download the three images for one triplet: |
|
|
| ```python |
| from huggingface_hub import hf_hub_download |
| from PIL import Image |
| import pandas as pd |
| |
| repo_id = "Blue2Giant/FreeStyle_Dataset" |
| source = "qwen" |
| |
| triplets_csv = hf_hub_download(repo_id=repo_id, repo_type="dataset", filename=f"cref_sref/{source}/triplets.csv") |
| triplets = pd.read_csv(triplets_csv) |
| row = triplets.iloc[0] |
| |
| paths = {} |
| for role in ["content", "style", "target"]: |
| rel = row[f"{role}_image_path"] # relative to cref_sref/<source>/ |
| paths[role] = hf_hub_download( |
| repo_id=repo_id, |
| repo_type="dataset", |
| filename=f"cref_sref/{source}/{rel}", |
| ) |
| |
| images = {role: Image.open(path).convert("RGB") for role, path in paths.items()} |
| print(row["sequence_id"], images["content"].size, images["style"].size, images["target"].size) |
| ``` |
|
|
| ## Recommended Download Patterns |
|
|
| This is a large file-tree dataset. Prefer selective downloads rather than cloning/downloading the entire repository at once. |
|
|
| Download all CSV/JSON/README metadata, but no images: |
|
|
| ```python |
| from huggingface_hub import snapshot_download |
| |
| snapshot_dir = snapshot_download( |
| repo_id="Blue2Giant/FreeStyle_Dataset", |
| repo_type="dataset", |
| allow_patterns=[ |
| "README.md", |
| "cref_sref/README.md", |
| "cref_sref/*/README.md", |
| "cref_sref/*/summary.json", |
| "cref_sref/*/*.csv", |
| ], |
| ) |
| print(snapshot_dir) |
| ``` |
|
|
| Download one complete source, including images: |
|
|
| ```python |
| from huggingface_hub import snapshot_download |
| |
| source = "qwen" # qwen is the smallest; flux and illustrious are much larger |
| snapshot_dir = snapshot_download( |
| repo_id="Blue2Giant/FreeStyle_Dataset", |
| repo_type="dataset", |
| allow_patterns=["README.md", "cref_sref/README.md", f"cref_sref/{source}/**"], |
| ) |
| print(snapshot_dir) |
| ``` |
|
|
| If you need the full dataset, use `snapshot_download(repo_type="dataset")`, but expect many files. |
|
|
| ## Repository Layout |
|
|
| ```text |
| <repo-root>/ |
| README.md # this guide |
| cref_sref/ |
| README.md # payload-level guide |
| HF_UPLOAD_CHECKLIST.md |
| qwen/ |
| README.md |
| summary.json |
| triplets.csv |
| content_images.csv |
| style_images.csv |
| target_images.csv |
| images/ |
| content/... |
| style/... |
| target/... |
| flux/ |
| ... same layout ... |
| illustrious/ |
| ... same layout ... |
| ``` |
|
|
| Public upload notes: |
|
|
| - `_state/` export-resume folders are omitted. |
| - `logs/` are omitted. |
| - Paths stored in `triplets.csv` are relative to the source directory, e.g. relative to `cref_sref/qwen/`. |
|
|
| ## Sources and Counts |
|
|
| | Source | Triplet rows | Unique content images | Unique style images | Unique target images | |
| |---|---:|---:|---:|---:| |
| | `qwen` | 33,582 | 90 | 424 | 5,162 | |
| | `flux` | 273,682 | 482 | 13,037 | 129,237 | |
| | `illustrious` | 172,589 | 8,045 | 1,581 | 65,952 | |
| | **Total** | **479,853** | **8,617** | **15,042** | **200,351** | |
|
|
| Total exported image files across source/role directories: **224,010**. |
|
|
| ## File Semantics |
|
|
| ### `triplets.csv` |
|
|
| Use `triplets.csv` as the main training/evaluation index. Important columns include: |
|
|
| - `sequence_id`: unique sequence id |
| - `base_model`: one of `qwen`, `flux`, `illustrious` |
| - `pair_key`: pair identifier |
| - `content_model_id`, `style_model_id` |
| - `content_image_path`, `style_image_path`, `target_image_path` |
| - `content_original_path`, `style_original_path`, `target_original_path` |
| - `content_match_status`, `style_match_status`, `target_match_status` |
| - `content_prompt_status`, `style_prompt_status`, `target_prompt_status` |
| - `content_generation_prompt`, `style_generation_prompt`, `target_generation_prompt` |
| - `vault_texts_json` |
|
|
| For model training, the most common fields are the three `*_image_path` columns and, when available, the three `*_generation_prompt` columns. |
|
|
| ### `content_images.csv`, `style_images.csv`, `target_images.csv` |
| |
| These files are deduplicated image-level metadata tables. Important columns include: |
| |
| - `exported_image_path`: image path relative to the source directory |
| - `original_path`: best-effort recovered original generation image path |
| - `match_status`: original-path matching status |
| - `prompt_status`: prompt recovery status |
| - `generation_prompt` |
| - `base_prompt` |
| - `sequence_count`: number of triplet rows that reuse this image |
| - `sequence_ids_json`: triplet ids that reuse this image |
|
|
| Join keys: |
|
|
| - `triplets.csv.content_image_path` -> `content_images.csv.exported_image_path` |
| - `triplets.csv.style_image_path` -> `style_images.csv.exported_image_path` |
| - `triplets.csv.target_image_path` -> `target_images.csv.exported_image_path` |
|
|
| Example join: |
|
|
| ```python |
| from huggingface_hub import hf_hub_download |
| import pandas as pd |
| |
| repo_id = "Blue2Giant/FreeStyle_Dataset" |
| source = "qwen" |
| |
| triplets = pd.read_csv(hf_hub_download(repo_id=repo_id, repo_type="dataset", filename=f"cref_sref/{source}/triplets.csv")) |
| content_meta = pd.read_csv(hf_hub_download(repo_id=repo_id, repo_type="dataset", filename=f"cref_sref/{source}/content_images.csv")) |
| content_meta = content_meta.set_index("exported_image_path") |
| |
| row = triplets.iloc[0] |
| print(content_meta.loc[row["content_image_path"]]) |
| ``` |
|
|
| ## Match and Prompt Status Values |
|
|
| `match_status` describes whether the exporter could map an exported vault image back to an original candidate image: |
|
|
| - `matched`: exact visual-key match found in the candidate pool |
| - `unmatched`: candidate pool existed, but no exact unique match was found |
| - `ambiguous`: more than one candidate matched the same visual key |
| - `no_candidates`: no candidate pool was available for that lookup |
|
|
| `prompt_status` describes whether generation prompt metadata was recovered: |
|
|
| - `resolved`: prompt metadata was recovered |
| - `unmatched_original`: original image path was not matched |
| - `missing_prompt_payload`: prompt sidecar JSON was missing |
| - `missing_prompt_entry`: prompt file existed, but the specific image entry was missing |
| - `missing_prompt_index`: image filename could not be mapped to a prompt index |
|
|
| ## Important Notes |
|
|
| - Exported images are vault training images, not guaranteed to be raw copies of the original one-LoRA or dual-LoRA generation files. |
| - `original_path` and prompt recovery fields are best-effort provenance fields. Do not assume every row has a resolved prompt. |
| - Rows with unresolved provenance are intentionally kept rather than forcing incorrect prompt assignments. |
| - The repository is organized as ordinary files. Use `huggingface_hub`, `pandas`, and `Pillow` for flexible access. |
|
|
| ## Where to Start |
|
|
| 1. Choose a source: start with `qwen` for a smaller first pass. |
| 2. Read `cref_sref/<source>/README.md` and `summary.json`. |
| 3. Load `cref_sref/<source>/triplets.csv`. |
| 4. For each row, resolve image paths relative to `cref_sref/<source>/`. |
| 5. Optionally join to the deduplicated `*_images.csv` metadata tables for provenance and reuse statistics. |
|
|
|
|