--- pretty_name: FreeStyle Bench task_categories: - image-to-image - text-to-image language: - en tags: - benchmark - style-transfer - image-editing - cref - sref --- # FreeStyle Bench This repository contains benchmark inputs for evaluating FreeStyle reference-based image editing. It includes two benchmark subsets: - `sref_bench/`: a style-transfer benchmark. - `cref_sref_bench/`: a content-and-style dual-reference benchmark. Both subsets use the same basic layout: a content-reference folder, a style-reference folder, and a `prompts.json` file that links each pair to its text prompt. ## Repository Layout ```text / README.md sref_bench/ cref/ ... content reference images ... sref/ ... style reference images ... prompts.json cref_sref_bench/ cref/ ... content reference images ... sref/ ... style reference images ... prompts.json ``` ## `sref_bench` `sref_bench` is the style-transfer benchmark. For each benchmark pair: - `sref_bench/cref/` contains the content reference image. - `sref_bench/sref/` contains the style reference image. - `sref_bench/prompts.json` contains the text prompt or instruction for the pair. The keys in `prompts.json` are pair basenames. A key can be used to match the corresponding content and style reference images across the two folders. For example, if `prompts.json` contains a key: ```text example_pair ``` then the corresponding files should be found by matching the same basename under: ```text sref_bench/cref/example_pair.* sref_bench/sref/example_pair.* ``` where the image extension may depend on the actual uploaded files. ## `cref_sref_bench` `cref_sref_bench` is the content-and-style dual-reference benchmark. It has the same structure as `sref_bench`: - `cref_sref_bench/cref/` contains the content reference image. - `cref_sref_bench/sref/` contains the style reference image. - `cref_sref_bench/prompts.json` contains the text prompt or instruction for the pair. Again, each key in `prompts.json` is a pair basename and can be used to align the content reference image in `cref/` with the style reference image in `sref/`. ## How To Read A Pair ```python import json from pathlib import Path from PIL import Image bench_dir = Path("/path/to/FreeStyle_Bench/sref_bench") # or cref_sref_bench with open(bench_dir / "prompts.json", "r", encoding="utf-8") as f: prompts = json.load(f) pair_name, prompt = next(iter(prompts.items())) # Find images by matching the pair basename. The actual extension may vary. cref_path = next((bench_dir / "cref").glob(pair_name + ".*")) sref_path = next((bench_dir / "sref").glob(pair_name + ".*")) content_ref = Image.open(cref_path).convert("RGB") style_ref = Image.open(sref_path).convert("RGB") print("pair:", pair_name) print("prompt:", prompt) print("content reference:", cref_path) print("style reference:", sref_path) ``` ## Notes - `cref` means content reference. - `sref` means style reference. - `prompts.json` is the index file for each subset. - The key of each `prompts.json` entry is the pair basename used to match images in `cref/` and `sref/`. - Use `sref_bench` for style-transfer evaluation. - Use `cref_sref_bench` for dual-reference content-and-style evaluation.