File size: 4,337 Bytes
749d66f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: bsl-1.0
pretty_name: Widget2Code Bench Data v2
task_categories:
  - image-to-text
tags:
  - screenshot-to-code
  - react
  - jsx
  - multimodal
---

# Widget2Code Bench Data v2

Evaluation targets for Widget2Code, rebuilt so that the picture a person reviews is the picture a
model is trained on and scored against.

| directory | samples | contents |
| --- | ---: | --- |
| `train-v2/` | 1,822 | training screenshots and canonical metadata |
| `test-v2/` | 1,000 | evaluation screenshots and canonical metadata |

```text
train-v2/image_0004/
test-v2/image_0001/
├── image.png        # RGB, no alpha channel
└── metadata.json
```

## Why v2 exists

Every target in Widget2Code Data V4.1 is RGBA, and its readers disagreed about what that meant.
`PIL.Image.convert("RGB")` — used by the benchmark, by the training image loader, by the vLLM
inference path and by the conversation's own image pipeline — drops the alpha channel and keeps
whatever RGB is stored underneath. A browser composites instead. So a person reviewing a target
saw one picture while the model was trained and scored on another.

Usually the disagreement was a few antialiased corner pixels. In 61 targets the capture had left
a whole neighbouring widget under the mask, and the model was scored on reproducing content no
design contains. On those, the reference render — the best answer the source pool has — scored
SSIM `0.5532` against the stored target and `0.6990` against the flattened one, against a pool
mean of `0.7664`.

Every target here is RGB with no alpha, so the three readers now see the same pixels.

## What changed from V4.1 `train/` and `test/`

127 of 2,822 targets differ visibly; the rest differ only where antialiased edge pixels were
composited.

| change | targets |
| --- | ---: |
| hidden content covered by the flat background | 61 |
| cropped to the bounding box of non-transparent pixels | 108 |
| both | 42 |

The background is white because it was measured, not assumed: on the affected samples the
reference render scores `0.7163` against a white-flattened target, `0.6161` against the stored
one and `0.5557` against a black-flattened one.

A transparent margin is what the capture left around the widget, not part of the design, so it is
cropped away. An **opaque** white margin is kept — a pixel the capture recorded as opaque is part
of the design. 140 targets therefore still carry a white border.

## metadata.json

```jsonc
{
  "id": "image_2052",
  "split": "test-v2",
  "sha256": "...",              // of this image.png
  "category": "tools",          // null when not labelled
  "has_chart": null,
  "side_info": {                // prompt-ready, derived from these pixels
    "dims": [243, 293],
    "ocr": "- `\"Hello, Hayat\"` at (19.8%, 8.5%) of widget, font-height ≈ 12.3% ...",
    "palette": "Target widget palette (top-4, after AA-fringe consolidation): ..."
  },
  "flattened_from": {
    "split": "test",
    "original_sha256": "...",
    "stored_size": [434, 444],
    "crop_box": [95, 76, 338, 369],   // null when nothing was cropped
    "transparent_fraction": 0.651254,
    "hidden_colours": 1171,           // distinct RGB values under the mask
    "background": [255, 255, 255]
  }
}
```

`side_info` was regenerated from the new pixels with the benchmark 1.2.0 CPU container, the same
generator that produced the V4.1 metadata — verified by reproducing V4.1's own `side_info` byte
for byte on all 1,822 of its train targets. CPU output is canonical; GPU OCR follows a different
numeric path.

The `eval` ground-truth feature cache carried by V4.1 is **not** included: it describes pixels
that changed. A benchmark that misses it recomputes those features, which is correct and slower.

## Pairing with reference sources

The `sft-v4` reference pool in
[Widget2Code-Data-V4](https://huggingface.co/datasets/Djanghao/Widget2Code-Data-V4) hard-codes
each target's **stored** canvas in its root `width`/`height`, so 108 of those sources no longer
match these targets. Regenerate the references against `train-v2`/`test-v2` rather than pairing
the two directly.

## Download

```python
from huggingface_hub import snapshot_download

snapshot_download(
    repo_id="Djanghao/Widget2Code-Bench-Data",
    repo_type="dataset",
    local_dir="Widget2Code-Bench-Data",
)
```