--- 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", ) ```