Schnowflake commited on
Commit
ec627db
·
verified ·
1 Parent(s): 0acf789

situate_diffuse subset: 472 scenes, 9 models

Browse files
.ipynb_checkpoints/README-checkpoint.md ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pretty_name: SITUATE-Diffuse
3
+ task_categories:
4
+ - text-to-image
5
+ configs:
6
+ - config_name: situate_diffuse
7
+ data_files:
8
+ - split: test
9
+ path: situate_diffuse/*.parquet
10
+ ---
11
+
12
+ # SITUATE-Diffuse
13
+
14
+ Pictures and results of the SITUATE-Diffuse paper. The code that made them: [situate-diffuse-paper](https://gitlab.iisys.de/systemintegration/situate-diffuse-paper).
15
+
16
+ ## situate_diffuse
17
+
18
+ One row per scene (472): the prompt, what should be in the picture, and for each of the 9 image models its picture, what SAM 3.1
19
+ found and the scene's points. Every model drew the scene with a rewritten prompt: the 4 `*_reprompt` models with their own rewriter
20
+ (`<model>_rewrite`), the other 5 with HiDream-O1's (`hidream_o1_image_reprompt_rewrite`).
21
+
22
+ | Column | |
23
+ |---|---|
24
+ | `scene_id` | `<category>_<objects>_<copy>`, e.g. `billiard_06_a` |
25
+ | `category` | billiard, checkers, chess, cupcake_candles, fruitcake, nuts, shelf, table |
26
+ | `objects` | objects in the scene, 2-16 |
27
+ | `seed` | the seed every model drew it with (copy a-d: 1-4) |
28
+ | `prompt` | the dataset prompt |
29
+ | `expected` | JSON, check -> the expected number (or true/false for yes/no checks) |
30
+ | `possible_points` | the points a perfect picture gets (chess pawns not counted) |
31
+ | `<model>` | the picture, 1024x1024 (models with a larger card size drew at it and were scaled down) |
32
+ | `<model>_rewrite` | the rewrite the model drew (only the 4 with their own rewriter) |
33
+ | `<model>_found` | JSON, check -> what SAM 3.1 found |
34
+ | `<model>_points` | right checks minus wrong ones (something there that should not be, a wrong yes/no check), never below 0 |
35
+ | `<model>_uncapped` | the same, can go below 0 |
36
+ | `<model>_hits` | right checks only |
37
+
38
+ Models: `ideogram_4_reprompt`, `fibo_2_edit_turbo`, `flux_3_klein_reprompt`, `hidream_o1_image_reprompt`, `krea_2_turbo`,
39
+ `ming_image_0_1_design`, `moss_image_sft`, `qwen_image_2_1_turbo_reprompt`, `qwen_image_2512_lightning`.
40
+
41
+ A model's score in the paper is per category the sum of its points over the sum of `possible_points`, then the mean of the 8 categories.
42
+
43
+ ```python
44
+ from datasets import load_dataset
45
+
46
+ scenes = load_dataset("<this dataset>", "situate_diffuse", split="test")
47
+ scene = scenes[0]
48
+ scene["moss_image_sft"] # PIL image
49
+ scene["moss_image_sft_found"] # '{"all balls": 2, "solid": 0, ...}'
50
+ ```
51
+
52
+ `make_situate_diffuse.py` builds the subset from a finished run of the code.
README.md ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pretty_name: SITUATE-Diffuse
3
+ task_categories:
4
+ - text-to-image
5
+ configs:
6
+ - config_name: situate_diffuse
7
+ data_files:
8
+ - split: test
9
+ path: situate_diffuse/*.parquet
10
+ ---
11
+
12
+ # SITUATE-Diffuse
13
+
14
+ Pictures and results of the SITUATE-Diffuse paper. The code that made them: [situate-diffuse-paper](https://gitlab.iisys.de/systemintegration/situate-diffuse-paper).
15
+
16
+ ## situate_diffuse
17
+
18
+ One row per scene (472): the prompt, what should be in the picture, and for each of the 9 image models its picture, what SAM 3.1
19
+ found and the scene's points. Every model drew the scene with a rewritten prompt: the 4 `*_reprompt` models with their own rewriter
20
+ (`<model>_rewrite`), the other 5 with HiDream-O1's (`hidream_o1_image_reprompt_rewrite`).
21
+
22
+ | Column | |
23
+ |---|---|
24
+ | `scene_id` | `<category>_<objects>_<copy>`, e.g. `billiard_06_a` |
25
+ | `category` | billiard, checkers, chess, cupcake_candles, fruitcake, nuts, shelf, table |
26
+ | `objects` | objects in the scene, 2-16 |
27
+ | `seed` | the seed every model drew it with (copy a-d: 1-4) |
28
+ | `prompt` | the dataset prompt |
29
+ | `expected` | JSON, check -> the expected number (or true/false for yes/no checks) |
30
+ | `possible_points` | the points a perfect picture gets (chess pawns not counted) |
31
+ | `<model>` | the picture, 1024x1024 (models with a larger card size drew at it and were scaled down) |
32
+ | `<model>_rewrite` | the rewrite the model drew (only the 4 with their own rewriter) |
33
+ | `<model>_found` | JSON, check -> what SAM 3.1 found |
34
+ | `<model>_points` | right checks minus wrong ones (something there that should not be, a wrong yes/no check), never below 0 |
35
+ | `<model>_uncapped` | the same, can go below 0 |
36
+ | `<model>_hits` | right checks only |
37
+
38
+ Models: `ideogram_4_reprompt`, `fibo_2_edit_turbo`, `flux_3_klein_reprompt`, `hidream_o1_image_reprompt`, `krea_2_turbo`,
39
+ `ming_image_0_1_design`, `moss_image_sft`, `qwen_image_2_1_turbo_reprompt`, `qwen_image_2512_lightning`.
40
+
41
+ A model's score in the paper is per category the sum of its points over the sum of `possible_points`, then the mean of the 8 categories.
42
+
43
+ ```python
44
+ from datasets import load_dataset
45
+
46
+ scenes = load_dataset("iisys-hof/situate-diffuse", "situate_diffuse", split="test")
47
+ scene = scenes[0]
48
+ scene["moss_image_sft"] # PIL image
49
+ scene["moss_image_sft_found"] # '{"all balls": 2, "solid": 0, ...}'
50
+ ```
51
+
52
+ `make_situate_diffuse.py` builds the subset from a finished run of the code.
make_situate_diffuse.py ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Writes the situate_diffuse subset from a finished 3_situate_diffuse run: one row per scene, one picture column per model,
2
+ with what Sam 3.1 found and the scene's points next to each picture. The scoring is 3_situate_diffuse's own (scoring.py).
3
+
4
+ python make_situate_diffuse.py ../SITUATE-DIFFUSER26/3_situate_diffuse/results/v6_reprompts_hues
5
+ """
6
+ import json
7
+ import sys
8
+ from pathlib import Path
9
+
10
+ from datasets import Dataset, Features, Image, Value
11
+
12
+ HERE = Path(__file__).resolve().parent
13
+ CODE = HERE.parent / "situate-diffuse-clean/3_situate_diffuse"
14
+ sys.path.append(str(CODE))
15
+
16
+ from scoring import scene_hits, scene_points # noqa: E402
17
+ from settings import MODELS # noqa: E402
18
+
19
+ RUN = Path(sys.argv[1])
20
+ OUT = HERE / "situate_diffuse"
21
+ JUDGE = "sam3.1"
22
+ UNSCORED = {("chess", "pawns")} # as in 3_score.py: left out of the points, still in found
23
+ SHARDS = 5 # parquet files of about 250 MB
24
+
25
+
26
+ def column(model): # "qwen-image-2.1-turbo-reprompt" -> "qwen_image_2_1_turbo_reprompt", so SQL needs no quotes
27
+
28
+ return model.replace("-", "_").replace(".", "_")
29
+
30
+
31
+ def read_rows(path): # scene_id -> its row of a jsonl file
32
+
33
+ rows = {}
34
+
35
+ for line in path.read_text().splitlines():
36
+ row = json.loads(line)
37
+ rows[row["scene_id"]] = row
38
+
39
+ return rows
40
+
41
+
42
+ def features():
43
+
44
+ fields = {"scene_id": Value("string"),
45
+ "category": Value("string"),
46
+ "objects": Value("int32"),
47
+ "seed": Value("int32"),
48
+ "prompt": Value("string"),
49
+ "expected": Value("string"),
50
+ "possible_points": Value("int32")}
51
+
52
+ for model in MODELS:
53
+ name = column(model)
54
+ fields[name] = Image()
55
+
56
+ if model.endswith("-reprompt"):
57
+ fields[f"{name}_rewrite"] = Value("string")
58
+
59
+ fields[f"{name}_found"] = Value("string")
60
+ fields[f"{name}_points"] = Value("int32")
61
+ fields[f"{name}_uncapped"] = Value("int32")
62
+ fields[f"{name}_hits"] = Value("int32")
63
+
64
+ return Features(fields)
65
+
66
+
67
+ def rows():
68
+
69
+ scenes = [json.loads(line) for line in (RUN / "scenes.jsonl").read_text().splitlines()]
70
+ answers = {model: read_rows(RUN / model / JUDGE / "answers.jsonl") for model in MODELS}
71
+ rewrites = {model: read_rows(RUN / model / "reprompts.jsonl") for model in MODELS if model.endswith("-reprompt")}
72
+
73
+ for scene in scenes:
74
+ scene_id = scene["scene_id"]
75
+ checks = answers[MODELS[0]][scene_id]["checks"]
76
+ expected = {check["check"]: check["expected"] for check in checks}
77
+ scored = [check for check in checks if (scene["category"], check["check"]) not in UNSCORED]
78
+ _, possible = scene_points(scored)
79
+ row = {"scene_id": scene_id,
80
+ "category": scene["category"],
81
+ "objects": int(scene_id.split("_")[-2]),
82
+ "seed": scene["seed"],
83
+ "prompt": scene["prompt"],
84
+ "expected": json.dumps(expected),
85
+ "possible_points": possible}
86
+
87
+ for model in MODELS:
88
+ name = column(model)
89
+ checks = answers[model][scene_id]["checks"]
90
+ scored = [check for check in checks if (scene["category"], check["check"]) not in UNSCORED]
91
+ points, _ = scene_points(scored)
92
+ picture = RUN / model / f"{scene_id}.jpg"
93
+ row[name] = {"bytes": picture.read_bytes(), "path": f"{model}/{scene_id}.jpg"}
94
+
95
+ if model in rewrites:
96
+ row[f"{name}_rewrite"] = rewrites[model][scene_id]["reprompt"]
97
+
98
+ row[f"{name}_found"] = json.dumps({check["check"]: check["found"] for check in checks})
99
+ row[f"{name}_points"] = max(0, points)
100
+ row[f"{name}_uncapped"] = points
101
+ row[f"{name}_hits"] = scene_hits(scored)
102
+
103
+ yield row
104
+
105
+
106
+ data = Dataset.from_generator(rows, features=features())
107
+ OUT.mkdir(exist_ok=True)
108
+
109
+ for index in range(SHARDS):
110
+ shard = data.shard(SHARDS, index, contiguous=True)
111
+ shard.to_parquet(OUT / f"test-{index:05d}-of-{SHARDS:05d}.parquet")
112
+
113
+ print(f"{len(data)} scenes, {len(data.column_names)} columns -> {OUT}")
situate_diffuse/test-00000-of-00005.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a072ae072e8692bdf2db9c6f31eab39f88926896bf8cfd8a1c332da6b9858c3
3
+ size 265186067
situate_diffuse/test-00001-of-00005.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:83e49e738714d76e919144dd8b7af8d8e59e964407bc6acd3daa7b8c8a04189e
3
+ size 265633976
situate_diffuse/test-00002-of-00005.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5799e72c205b189ec7587cb0d44132b5239032f059e830368aa14d02a50b4a9d
3
+ size 196058767
situate_diffuse/test-00003-of-00005.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:83b38ce6935fd53d57809538d1beadffce6924c03f28d770b6138caaf44e4060
3
+ size 225904788
situate_diffuse/test-00004-of-00005.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c36805dd93e30a3120b9a7b7bf88a17b750d504a14e2ed69ef8d2843eafc5454
3
+ size 187094006