Pix2Struct: Screenshot Parsing as Pretraining for Visual Language Understanding

Kenton Lee, Mandar Joshi, Iulia Turc, Hexiang Hu, Fangyu Liu +5 more
10/7/2022
cs.CLcs.CV

Official code: google-research/pix2struct (693 stars, Apache-2.0, last commit 2026-10-05).

Abstract

Visually-situated language is ubiquitous -- sources range from textbooks with diagrams to web pages with images and tables, to mobile apps with buttons and forms. Perhaps due to this diversity, previous work has typically relied on domain-specific recipes with limited sharing of the underlying data, model architectures, and objectives. We present Pix2Struct, a pretrained image-to-text model for purely visual language understanding, which can be finetuned on tasks containing visually-situated language. Pix2Struct is pretrained by learning to parse masked screenshots of web pages into simplified HTML. The web, with its richness of visual elements cleanly reflected in the HTML structure, provides a large source of pretraining data well suited to the diversity of downstream tasks. Intuitively, this objective subsumes common pretraining signals such as OCR, language modeling, image captioning. In addition to the novel pretraining strategy, we introduce a variable-resolution input representation and a more flexible integration of language and vision inputs, where language prompts such as questions are rendered directly on top of the input image. For the first time, we show that a single pretrained model can achieve state-of-the-art results in six out of nine tasks across four domains: documents, illustrations, user interfaces, and natural images.

View on arXivView PDF

Code Implementations(1)

Apache-2.0
69362CSS, HTMLOct 11, 20222 weeks agoApache-2.0

Similar Papers

Cite this paper

@article{lee2022pixstruct,
  title  = {Pix2Struct: Screenshot Parsing as Pretraining for Visual Language Understanding},
  author = {Kenton Lee and Mandar Joshi and Iulia Turc and Hexiang Hu and Fangyu Liu and Julian Eisenschlos and Urvashi Khandelwal and Peter Shaw and Ming-Wei Chang and Kristina Toutanova},
  year   = {2022},
  eprint = {2210.03347},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2210.03347}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2210.03347.svg)](https://codeofpaper.com/paper/2210.03347)

Discussion