File size: 3,275 Bytes
11d1116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
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
<repo-root>/
  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.