PolyFormer: Referring Image Segmentation as Sequential Polygon Generation

Jiang Liu, Hui Ding, Zhaowei Cai, Yuting Zhang, Vijay Mahadevan, Ravi Kumar Satzoda, R. Manmatha · OpenReview

Abstract

In this work, instead of directly predicting the pixel-level segmentation masks, the problem of referring image segmentation is formulated as sequential polygon generation, and the predicted polygons can be later converted into segmentation masks. This is enabled by a new sequence-to-sequence framework, Polygon Transformer (PolyFormer), which takes a sequence of image patches and text query tokens as input, and outputs a sequence of polygon vertices autoregressively. For more accurate geometric localization, we propose a regression-based decoder, which predicts the precise floating-point coordinates directly, without any coordinate quantization error. In the experiments, PolyFormer outperforms the prior art by a clear margin, e.g., 5.40% and 4.52% absolute improvements on the challenging RefCOCO+ and RefCOCOg datasets. It also shows strong generalization ability when evaluated on the referring video segmentation task without fine-tuning, e.g., achieving competitive 61.5% J&F on the Ref-DAVIS17 dataset.

Introduction

Referring Image Segmentation (RIS) is the task of identifying and segmenting an object in an image based on a natural language query, such as "the dog sitting under the red umbrella." Traditionally, RIS is treated as a dense, pixel-by-pixel classification problem. While effective, this approach often ignores the inherent geometric structure of an object's boundary and is computationally expensive due to the storage and processing requirements of dense masks.

Figure 1: Overview of the PolyFormer framework, converting a text query and image into a sequence of polygon vertices that form a segmentation mask.

PolyFormer reimagines RIS by moving away from traditional pixel-level masking in favor of sequential polygon generation. By treating the object contour as a series of coordinates and utilizing a regression-based transformer decoder, the model achieves state-of-the-art results while providing a more structured and efficient representation of objects.

Methodology

The core of PolyFormer is a sequence-to-sequence (seq2seq) framework that unifies Referring Expression Comprehension (bounding boxes) and Referring Image Segmentation (polygons). Unlike previous attempts that relied on "coordinate quantization"—which introduces rounding errors by dividing the image into discrete bins—PolyFormer predicts precise, floating-point coordinates directly.

Architecture Overview

The architecture consists of several key components designed to fuse multi-modal information and output high-precision geometric data:

  • Encoder-Decoder Architecture: The model employs a Swin Transformer for extracting visual features and BERT for processing text features. These features are fused within a multi-modal transformer encoder to capture the relationship between the image and the query.
  • Regression-based Decoder: This is the primary innovation. Instead of classifying coordinates into discrete bins, the decoder predicts continuous 2D coordinates $(x, y)$ directly.
  • 2D Coordinate Embedding: To process continuous coordinates autoregressively, the authors utilize a 2D coordinate codebook. High-precision embeddings for any floating-point coordinate are created via bilinear interpolation between the four nearest grid points.
  • Unified Sequence Output: The model outputs a single sequence containing bounding box corner points followed by polygon vertices. A special <SEP> token is used to handle objects with multiple disconnected parts, such as an object partially occluded by foreground elements.
Figure 2: Detailed architecture of PolyFormer, showing the visual and text encoders, the multi-modal transformer, and the regression-based decoder generating the vertex sequence.

Experimental Results

PolyFormer was evaluated on standard benchmarks including RefCOCO, RefCOCO+, RefCOCOg, and ReferIt. The model set new performance records across the board:

  • State-of-the-Art Performance: PolyFormer outperformed the previous state-of-the-art (LAVT) by 5.40% on RefCOCO+ and 4.52% on RefCOCOg. The move to a regression-based head alone accounted for nearly a 2% gain in mIoU (mean Intersection-over-Union).
  • Zero-Shot Video Transfer: Without any fine-tuning on video data, PolyFormer-L achieved 61.5% J&F on the Ref-DAVIS17 dataset, outperforming several models specifically designed for video tasks.
  • Efficiency and Coherence: Because each vertex prediction is conditioned on all previous vertices, the model "remembers" the path it is drawing. This leads to smoother and more coherent object boundaries compared to pixel-based methods.

Conclusion

By formulating referring image segmentation as a polygon generation task, PolyFormer demonstrates that regression-based localization is superior to traditional classification-based quantization for geometric tasks. While the model currently relies on high-quality polygon annotations, its ability to handle complex, multi-part objects and generalize to video data marks a significant step forward in multi-modal understanding. Future work may explore utilizing weakly-supervised data and optimizing the speed of autoregressive decoding for extremely complex objects.

Summary updated

BibTeX
@misc{liu2023polyformer,
  author = {Jiang Liu and Hui Ding and Zhaowei Cai and Yuting Zhang and Vijay Mahadevan and Ravi Kumar Satzoda and R. Manmatha},
  title = {{PolyFormer: Referring Image Segmentation as Sequential Polygon Generation}},
  year = {2023},
  eprint = {2302.07387},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2302.07387},
}
Figure