docs: describe v2 targets and why they differ from V4.1
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117---license: bsl-1.0pretty_name: Widget2Code Bench Data v2task_categories: - image-to-texttags: - 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 amodel 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 |
```texttrain-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 vLLMinference path and by the conversation's own image pipeline — drops the alpha channel and keepswhatever RGB is stored underneath. A browser composites instead. So a person reviewing a targetsaw 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 lefta whole neighbouring widget under the mask, and the model was scored on reproducing content nodesign contains. On those, the reference render — the best answer the source pool has — scoredSSIM `0.5532` against the stored target and `0.6990` against the flattened one, against a poolmean 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 werecomposited.
| 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 thereference render scores `0.7163` against a white-flattened target, `0.6161` against the storedone 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 iscropped away. An **opaque** white margin is kept — a pixel the capture recorded as opaque is partof 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 samegenerator that produced the V4.1 metadata — verified by reproducing V4.1's own `side_info` bytefor byte on all 1,822 of its train targets. CPU output is canonical; GPU OCR follows a differentnumeric path.
The `eval` ground-truth feature cache carried by V4.1 is **not** included: it describes pixelsthat 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-codeseach target's **stored** canvas in its root `width`/`height`, so 108 of those sources no longermatch these targets. Regenerate the references against `train-v2`/`test-v2` rather than pairingthe two directly.
## Download
```pythonfrom huggingface_hub import snapshot_download
snapshot_download( repo_id="Djanghao/Widget2Code-Bench-Data", repo_type="dataset", local_dir="Widget2Code-Bench-Data",)```12.0.0README.mdAdded+117
VERSIONAdded+1