Instance Segmentation with Mask-supervised Polygonal Boundary Transformers

Justin Lazarow, Weijian Xu, Zhuowen TuCVPR 2022

Abstract

In this paper, we present an end-to-end instance segmentation method that regresses a polygonal boundary for each object instance. This sparse, vectorized boundary representation for objects, while attractive in many downstream computer vision tasks, quickly runs into issues of parity that need to be addressed: parity in supervision and parity in performance when compared to existing pixel-based methods. This is due in part to object instances being annotated with ground-truth in the form of polygonal boundaries or segmentation masks, yet being evaluated in a convenient manner using only segmentation masks. Our method, BoundaryFormer, is a Transformer based architecture that directly predicts polygons yet uses instance mask segmentations as the ground-truth supervision for computing the loss. We achieve this by developing an end-to-end differentiable model that solely relies on supervision within the mask space through differentiable rasterization. BoundaryFormer matches or surpasses the Mask R-CNN method in terms of instance segmentation quality on both COCO and Cityscapes while exhibiting significantly better transferability across datasets.

Introduction

Instance segmentation has historically been dominated by "mask-centric" approaches. Models like Mask R-CNN output a grid of pixels for every object, which, while effective, lacks explicit topology. This makes them difficult to use in downstream tasks like 3D reconstruction, tracking, or vector-based editing, where "boundary-centric" representations like polygons are preferred.

Historically, polygon-based models have faced two major "parity" issues. First, supervision parity: they often require ground-truth polygons for training, which are harder to obtain and more inconsistent than masks. Second, performance parity: they typically underperform compared to pixel-based counterparts on standard benchmarks like COCO. BoundaryFormer addresses both by predicting polygons directly while training solely on standard pixel-wise masks.

Methodology

BoundaryFormer is a Transformer-based architecture designed to regress vertex coordinates as a "drop-in" replacement for a standard mask head. The model employs a Transformer decoder where each query represents a vertex of the polygon.

The BoundaryFormer architecture utilizes a Transformer decoder for iterative polygon refinement and a differentiable rasterizer for mask-based supervision.

Iterative Refinement and Upsampling

The model initializes with a simple elliptical polygon inscribed within a predicted bounding box. Through successive layers, it uses Deformable Attention to sample image features and Self-Attention to coordinate between vertices, iteratively refining the shape. To maintain computational efficiency, BoundaryFormer uses a coarse-to-fine strategy, starting with a few vertices (e.g., 8) and progressively upsampling them (e.g., to 64 or 128) in deeper refinement layers.

The Differentiable Rasterizer

The core innovation is a CUDA-based differentiable rasterizer. To train a polygon-predicting model using mask-based loss, the polygon must be converted into a mask that allows gradients to flow back to the vertex coordinates. The rasterizer computes a "soft" mask based on a pixel's distance to the nearest polygon segment and its location (inside or outside the boundary). This allows the model to be trained using standard Dice Loss against ground-truth segmentation masks.

Experiments and Results

The model was evaluated on MS-COCO and Cityscapes, focusing on both standard performance and cross-dataset transferability.

  • Performance Parity: On MS-COCO, BoundaryFormer achieved 36.1 Mask AP, matching or slightly exceeding Mask R-CNN (35.2 - 35.8 AP) using the same backbone.
  • Superior Transferability: When trained on COCO and tested on Cityscapes without fine-tuning, BoundaryFormer achieved 38.3 AP, significantly outperforming the Mask R-CNN transfer baseline of 36.5 AP. This suggests that vector-based representations capture the essence of object shapes more effectively than pixel grids.
  • Supervision Insights: Interestingly, training on masks led to better results than training on "verbatim" ground-truth polygons, likely because mask annotations are more consistent than the often arbitrary vertex placements in manual polygon annotations.

Limitations and Discussion

While BoundaryFormer bridges the gap between mask and polygon methods, some challenges remain. The current approach predicts a single closed polygon per object. This causes issues with fragmented objects (e.g., a person partially occluded by a pole), where the model may "stretch" the polygon to cover disconnected parts. Additionally, the model does not currently support complex topologies, such as objects with holes (e.g., a donut), which would require multiple nested polygons.

Visualizing the iterative refinement process and common failure cases like fragmented objects.

Future work may explore even sparser forms of supervision and methods to handle more complex object topologies while maintaining the benefits of boundary-centric representations.

Summary updated

BibTeX
@inproceedings{lazarow2022instance,
  author = {Justin Lazarow and Weijian Xu and Zhuowen Tu},
  title = {{Instance Segmentation with Mask-supervised Polygonal Boundary Transformers}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2022},
  url = {https://openreview.net/forum?id=i-Gm_4fkqe7},
}
Figure