使用无需渲染的视觉评判器学习 UI 到代码的逆向生成器
Learning UI-to-Code Reverse Generator Using Visual Critic Without Rendering
AI总结:
针对 UI 截图逆向生成 HTML/CSS 时渲染反馈不可微且成本高的问题,提出 ViCT 与无需渲染的视觉评判器 ViCR,以更低计算成本显著提升视觉与代码匹配性能。
摘要:
从 UI 截图自动逆向工程 HTML/CSS 代码是一个重要且具有挑战性的问题,在网站开发和设计中具有广泛应用。本文提出了一种新颖的 vision-code transformer(ViCT,视觉-代码 Transformer),它由处理截图的视觉编码器和用于生成代码的语言解码器组成。二者使用 ViT/DiT 和 GPT-2/LLaMA 等预训练模型进行初始化,但对齐两种模态需要端到端微调,其目标是最小化代码渲染网页与原始截图之间的视觉差异。然而,渲染过程不可微,并会带来高昂开销。我们通过 actor-critic(演员-评判器)微调解决这一问题,其中开发了无需渲染的视觉评判器 ViCR,用于根据原始代码和生成代码预测视觉差异。为训练和评估模型,我们创建了两个复杂度不同的合成数据集,包含超过 75,000 个唯一的(代码,截图)对。我们结合 MSE、BLEU、IoU 以及一种新的 htmlBLEU 分数等自动化指标评估 UI-to-Code 性能。ViCT 优于强基线模型 DiT-GPT2,将 IoU 从 0.64 提升到 0.79,并将 MSE 从 12.25 降低到 9.02。在计算成本低得多的情况下,它能够达到与使用 LLaMA 等更大解码器时相当的性能。
英文摘要:
Automated reverse engineering of HTML/CSS code from UI screenshots is an important yet challenging problem with broad applications in website development and design. In this paper, we propose a novel vision-code transformer (ViCT) composed of a vision encoder processing the screenshots and a language decoder to generate the code. They are initialized by pre-trained models such as ViT/DiT and GPT-2/LLaMA but aligning the two modalities requires end-to-end finetuning, which aims to minimize the visual discrepancy between the code-rendered webpage and the original screenshot. However, the rendering is non-differentiable and causes costly overhead. We address this problem by actor-critic fine-tuning where a visual critic without rendering (ViCR) is developed to predict visual discrepancy given the original and generated code. To train and evaluate our models, we created two synthetic datasets of varying complexity, with over 75,000 unique (code, screenshot) pairs. We evaluate the UI-to-Code performance using a combination of automated metrics such as MSE, BLEU, IoU, and a novel htmlBLEU score. ViCT outperforms a strong baseline model DiT-GPT2, improving IoU from 0.64 to 0.79 and lowering MSE from 12.25 to 9.02. With much lower computational cost, it can achieve comparable performance as when using a larger decoder such as LLaMA.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。