--- license: cc-by-4.0 size_categories: - n>1T task_categories: - image-to-text pretty_name: vision2ui configs: - config_name: default data_files: - split: train path: data/*.parquet tags: - code --- Vision2UI: A Real-World Dataset for Code Generation from UI Designs with Layouts > Automatically generating webpage code from User Interface (UI) design images can significantly reduce the workload of front-end developers, and Multimodal Large Language Models (MLLMs) have demonstrated promising potential in this area. However, our investigation reveals that existing MLLMs are limited by the lack of authentic, high-quality, and large-scale datasets, leading to suboptimal performance in automated UI code generation. To mitigate this gap, we introduce a novel dataset, Vision2UI, derived from real-world scenarios and enriched with comprehensive layout information, specifically designed to finetune MLLMs for UI code generation. This dataset is created through a meticulous process involving the collection, cleaning, and refining of the open-source Common Crawl dataset. To ensure high quality, a neural scorer trained on manually annotated samples is employed to refine the data, retaining only the highest-quality instances. As a result, we obtain a high-quality dataset comprising over three million parallel samples that include UI design images, webpage code, and layout information. To validate the effectiveness of our proposed dataset, we establish a benchmark and introduce a baseline model based on the Vision Transformer (ViT), named UICoder. Additionally, we introduce a new metric, TreeBLEU, designed to evaluate the structural similarity between generated webpages and their corresponding ground truth in source code. Experimental results demonstrate that our dataset significantly improves the capability of MLLMs in learning code generation from UI design images. The code and dataset are publicly available at our project homepage: https://vision2ui.github.io. The paper can be accessed at: https://arxiv.org/abs/2404.06369 Features: - `image`: the screenshot of the webpage. - `bbox`: the layout information, i.e., the bounding boxes (Bbox) of all the elements in the webpage, which contains the size, position, and hierarchy information. - `text`: the webpage code text including HTML/CSS code. - `scale`: the scale of the screenshot, in the format [width, height]. - `lang`: the main language of the text content displayed on the rendered page (excluding HTML/CSS code). It is generated by a widely-applied [model](https://huggingface.co/papluca/xlm-roberta-base-language-detection) on HuggingFace, which achieved very high accuracy on its evaluation set. Currently, it supports the following 20 languages: arabic (ar), bulgarian (bg), german (de), modern greek (el), english (en), spanish (es), french (fr), hindi (hi), italian (it), japanese (ja), dutch (nl), polish (pl), portuguese (pt), russian (ru), swahili (sw), thai (th), turkish (tr), urdu (ur), vietnamese (vi), and chinese (zh). - `tokens`: the count of tokens of HTML and CSS code, in the format of [CSS length, HTML length]. The tokens are generated by [GPT-2 tokenizer](https://huggingface.co/openai-community/gpt2). - `score`: the score is obtained by the neural scorer proposed in the paper. - `hash`: the hash code of the image object.