Djanghao commited on
Commit
749d66f
·
verified ·
1 Parent(s): 2303e21

docs: describe v2 targets and why they differ from V4.1

Browse files
Files changed (2) hide show
  1. README.md +117 -0
  2. VERSION +1 -0
README.md ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: bsl-1.0
3
+ pretty_name: Widget2Code Bench Data v2
4
+ task_categories:
5
+ - image-to-text
6
+ tags:
7
+ - screenshot-to-code
8
+ - react
9
+ - jsx
10
+ - multimodal
11
+ ---
12
+
13
+ # Widget2Code Bench Data v2
14
+
15
+ Evaluation targets for Widget2Code, rebuilt so that the picture a person reviews is the picture a
16
+ model is trained on and scored against.
17
+
18
+ | directory | samples | contents |
19
+ | --- | ---: | --- |
20
+ | `train-v2/` | 1,822 | training screenshots and canonical metadata |
21
+ | `test-v2/` | 1,000 | evaluation screenshots and canonical metadata |
22
+
23
+ ```text
24
+ train-v2/image_0004/
25
+ test-v2/image_0001/
26
+ ├── image.png # RGB, no alpha channel
27
+ └── metadata.json
28
+ ```
29
+
30
+ ## Why v2 exists
31
+
32
+ Every target in Widget2Code Data V4.1 is RGBA, and its readers disagreed about what that meant.
33
+ `PIL.Image.convert("RGB")` — used by the benchmark, by the training image loader, by the vLLM
34
+ inference path and by the conversation's own image pipeline — drops the alpha channel and keeps
35
+ whatever RGB is stored underneath. A browser composites instead. So a person reviewing a target
36
+ saw one picture while the model was trained and scored on another.
37
+
38
+ Usually the disagreement was a few antialiased corner pixels. In 61 targets the capture had left
39
+ a whole neighbouring widget under the mask, and the model was scored on reproducing content no
40
+ design contains. On those, the reference render — the best answer the source pool has — scored
41
+ SSIM `0.5532` against the stored target and `0.6990` against the flattened one, against a pool
42
+ mean of `0.7664`.
43
+
44
+ Every target here is RGB with no alpha, so the three readers now see the same pixels.
45
+
46
+ ## What changed from V4.1 `train/` and `test/`
47
+
48
+ 127 of 2,822 targets differ visibly; the rest differ only where antialiased edge pixels were
49
+ composited.
50
+
51
+ | change | targets |
52
+ | --- | ---: |
53
+ | hidden content covered by the flat background | 61 |
54
+ | cropped to the bounding box of non-transparent pixels | 108 |
55
+ | both | 42 |
56
+
57
+ The background is white because it was measured, not assumed: on the affected samples the
58
+ reference render scores `0.7163` against a white-flattened target, `0.6161` against the stored
59
+ one and `0.5557` against a black-flattened one.
60
+
61
+ A transparent margin is what the capture left around the widget, not part of the design, so it is
62
+ cropped away. An **opaque** white margin is kept — a pixel the capture recorded as opaque is part
63
+ of the design. 140 targets therefore still carry a white border.
64
+
65
+ ## metadata.json
66
+
67
+ ```jsonc
68
+ {
69
+ "id": "image_2052",
70
+ "split": "test-v2",
71
+ "sha256": "...", // of this image.png
72
+ "category": "tools", // null when not labelled
73
+ "has_chart": null,
74
+ "side_info": { // prompt-ready, derived from these pixels
75
+ "dims": [243, 293],
76
+ "ocr": "- `\"Hello, Hayat\"` at (19.8%, 8.5%) of widget, font-height ≈ 12.3% ...",
77
+ "palette": "Target widget palette (top-4, after AA-fringe consolidation): ..."
78
+ },
79
+ "flattened_from": {
80
+ "split": "test",
81
+ "original_sha256": "...",
82
+ "stored_size": [434, 444],
83
+ "crop_box": [95, 76, 338, 369], // null when nothing was cropped
84
+ "transparent_fraction": 0.651254,
85
+ "hidden_colours": 1171, // distinct RGB values under the mask
86
+ "background": [255, 255, 255]
87
+ }
88
+ }
89
+ ```
90
+
91
+ `side_info` was regenerated from the new pixels with the benchmark 1.2.0 CPU container, the same
92
+ generator that produced the V4.1 metadata — verified by reproducing V4.1's own `side_info` byte
93
+ for byte on all 1,822 of its train targets. CPU output is canonical; GPU OCR follows a different
94
+ numeric path.
95
+
96
+ The `eval` ground-truth feature cache carried by V4.1 is **not** included: it describes pixels
97
+ that changed. A benchmark that misses it recomputes those features, which is correct and slower.
98
+
99
+ ## Pairing with reference sources
100
+
101
+ The `sft-v4` reference pool in
102
+ [Widget2Code-Data-V4](https://huggingface.co/datasets/Djanghao/Widget2Code-Data-V4) hard-codes
103
+ each target's **stored** canvas in its root `width`/`height`, so 108 of those sources no longer
104
+ match these targets. Regenerate the references against `train-v2`/`test-v2` rather than pairing
105
+ the two directly.
106
+
107
+ ## Download
108
+
109
+ ```python
110
+ from huggingface_hub import snapshot_download
111
+
112
+ snapshot_download(
113
+ repo_id="Djanghao/Widget2Code-Bench-Data",
114
+ repo_type="dataset",
115
+ local_dir="Widget2Code-Bench-Data",
116
+ )
117
+ ```
VERSION ADDED
@@ -0,0 +1 @@
 
 
1
+ 2.0.0