Blue2Giant's picture
Improve cref_sref dataset usage README
230ca1b verified
|
Raw
History Blame
2.45 kB
# `cref_sref` Payload Guide
This folder contains the content-reference/style-reference LoRA triplet payload for the FreeStyle dataset.
Start from the root [`README.md`](../README.md) for full usage examples. This file summarizes the payload layout.
## Sources
| 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 |
## Layout
Each source directory has the same structure:
```text
<source>/
README.md
summary.json
triplets.csv
content_images.csv
style_images.csv
target_images.csv
images/
content/...
style/...
target/...
```
`_state/` and `logs/` are intentionally not included in the public upload.
## How to Use
For a source such as `qwen`:
1. Read `qwen/triplets.csv`; it is the sequence-level index.
2. For each row, use:
- `content_image_path`
- `style_image_path`
- `target_image_path`
3. Resolve those paths relative to `cref_sref/qwen/`.
4. Use `content_images.csv`, `style_images.csv`, and `target_images.csv` only when you need image-level metadata, reuse counts, original-path provenance, or prompt recovery details.
Minimal Python example:
```python
from huggingface_hub import hf_hub_download
from PIL import Image
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"))
row = triplets.iloc[0]
content_path = hf_hub_download(repo_id=repo_id, repo_type="dataset", filename=f"cref_sref/{source}/{row['content_image_path']}")
style_path = hf_hub_download(repo_id=repo_id, repo_type="dataset", filename=f"cref_sref/{source}/{row['style_image_path']}")
target_path = hf_hub_download(repo_id=repo_id, repo_type="dataset", filename=f"cref_sref/{source}/{row['target_image_path']}")
content = Image.open(content_path).convert("RGB")
style = Image.open(style_path).convert("RGB")
target = Image.open(target_path).convert("RGB")
```
## Notes
- `triplets.csv` is sequence-level.
- `*_images.csv` files are deduplicated image-level metadata.
- The same image can be reused by many triplets; check `sequence_count` in the image metadata tables.
- Prompt/provenance fields are best effort. Rows with unresolved provenance are intentionally preserved.