File size: 8,482 Bytes
230ca1b
 
 
 
 
 
 
 
 
 
 
 
 
 
761f47d
230ca1b
761f47d
230ca1b
761f47d
230ca1b
761f47d
230ca1b
 
 
761f47d
230ca1b
761f47d
230ca1b
761f47d
230ca1b
 
 
 
761f47d
 
230ca1b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
761f47d
230ca1b
761f47d
230ca1b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
761f47d
 
230ca1b
761f47d
230ca1b
761f47d
230ca1b
761f47d
230ca1b
 
761f47d
230ca1b
 
 
 
 
 
 
 
 
 
 
 
 
761f47d
230ca1b
761f47d
230ca1b
 
761f47d
230ca1b
 
 
 
 
 
 
 
761f47d
230ca1b
761f47d
230ca1b
761f47d
230ca1b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
761f47d
230ca1b
761f47d
230ca1b
 
 
761f47d
230ca1b
761f47d
230ca1b
 
 
 
 
 
761f47d
230ca1b
761f47d
230ca1b
761f47d
230ca1b
761f47d
230ca1b
761f47d
230ca1b
 
 
 
 
 
 
 
 
 
 
 
 
 
761f47d
230ca1b
 
 
 
 
 
 
 
 
 
761f47d
230ca1b
761f47d
 
 
 
 
230ca1b
761f47d
230ca1b
 
 
761f47d
230ca1b
 
761f47d
230ca1b
 
 
761f47d
230ca1b
 
 
 
 
 
 
 
 
 
761f47d
 
 
230ca1b
761f47d
230ca1b
761f47d
230ca1b
761f47d
 
 
230ca1b
761f47d
230ca1b
 
 
 
761f47d
230ca1b
761f47d
230ca1b
 
 
 
 
761f47d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
---
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.