Blue2Giant commited on
Commit
11d1116
·
verified ·
1 Parent(s): b5892bd

Add benchmark README

Browse files
Files changed (1) hide show
  1. README.md +119 -0
README.md ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pretty_name: FreeStyle Bench
3
+ task_categories:
4
+ - image-to-image
5
+ - text-to-image
6
+ language:
7
+ - en
8
+ tags:
9
+ - benchmark
10
+ - style-transfer
11
+ - image-editing
12
+ - cref
13
+ - sref
14
+ ---
15
+
16
+ # FreeStyle Bench
17
+
18
+ This repository contains benchmark inputs for evaluating FreeStyle reference-based image editing.
19
+
20
+ It includes two benchmark subsets:
21
+
22
+ - `sref_bench/`: a style-transfer benchmark.
23
+ - `cref_sref_bench/`: a content-and-style dual-reference benchmark.
24
+
25
+ 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.
26
+
27
+ ## Repository Layout
28
+
29
+ ```text
30
+ <repo-root>/
31
+ README.md
32
+ sref_bench/
33
+ cref/
34
+ ... content reference images ...
35
+ sref/
36
+ ... style reference images ...
37
+ prompts.json
38
+ cref_sref_bench/
39
+ cref/
40
+ ... content reference images ...
41
+ sref/
42
+ ... style reference images ...
43
+ prompts.json
44
+ ```
45
+
46
+ ## `sref_bench`
47
+
48
+ `sref_bench` is the style-transfer benchmark.
49
+
50
+ For each benchmark pair:
51
+
52
+ - `sref_bench/cref/` contains the content reference image.
53
+ - `sref_bench/sref/` contains the style reference image.
54
+ - `sref_bench/prompts.json` contains the text prompt or instruction for the pair.
55
+
56
+ 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.
57
+
58
+ For example, if `prompts.json` contains a key:
59
+
60
+ ```text
61
+ example_pair
62
+ ```
63
+
64
+ then the corresponding files should be found by matching the same basename under:
65
+
66
+ ```text
67
+ sref_bench/cref/example_pair.*
68
+ sref_bench/sref/example_pair.*
69
+ ```
70
+
71
+ where the image extension may depend on the actual uploaded files.
72
+
73
+ ## `cref_sref_bench`
74
+
75
+ `cref_sref_bench` is the content-and-style dual-reference benchmark.
76
+
77
+ It has the same structure as `sref_bench`:
78
+
79
+ - `cref_sref_bench/cref/` contains the content reference image.
80
+ - `cref_sref_bench/sref/` contains the style reference image.
81
+ - `cref_sref_bench/prompts.json` contains the text prompt or instruction for the pair.
82
+
83
+ 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/`.
84
+
85
+ ## How To Read A Pair
86
+
87
+ ```python
88
+ import json
89
+ from pathlib import Path
90
+ from PIL import Image
91
+
92
+ bench_dir = Path("/path/to/FreeStyle_Bench/sref_bench") # or cref_sref_bench
93
+
94
+ with open(bench_dir / "prompts.json", "r", encoding="utf-8") as f:
95
+ prompts = json.load(f)
96
+
97
+ pair_name, prompt = next(iter(prompts.items()))
98
+
99
+ # Find images by matching the pair basename. The actual extension may vary.
100
+ cref_path = next((bench_dir / "cref").glob(pair_name + ".*"))
101
+ sref_path = next((bench_dir / "sref").glob(pair_name + ".*"))
102
+
103
+ content_ref = Image.open(cref_path).convert("RGB")
104
+ style_ref = Image.open(sref_path).convert("RGB")
105
+
106
+ print("pair:", pair_name)
107
+ print("prompt:", prompt)
108
+ print("content reference:", cref_path)
109
+ print("style reference:", sref_path)
110
+ ```
111
+
112
+ ## Notes
113
+
114
+ - `cref` means content reference.
115
+ - `sref` means style reference.
116
+ - `prompts.json` is the index file for each subset.
117
+ - The key of each `prompts.json` entry is the pair basename used to match images in `cref/` and `sref/`.
118
+ - Use `sref_bench` for style-transfer evaluation.
119
+ - Use `cref_sref_bench` for dual-reference content-and-style evaluation.