Abstract
Direct contour regression for instance segmentation is a challenging task. Previous works usually achieve it by learning to progressively refine the contour prediction or adopting a shape representation with limited expressiveness. In this work, we argue that the difficulty in regressing the contour points in one pass is mainly due to the ambiguity when discretizing a smooth contour into a polygon. To address the ambiguity, we propose a novel differentiable rendering-based approach named ContourRender. During training, it first predicts a contour generated by an invertible shape signature, and then optimizes the contour with the more stable silhouette by converting it to a contour mesh and rendering the mesh to a 2D map. This method significantly improves the quality of contour without iterations or cascaded refinements. Moreover, as optimization is not needed during inference, the inference speed will not be influenced. Experiments show the proposed ContourRender outperforms all the contour-based instance segmentation approaches on COCO, while stays competitive with the iteration-based state-of-the-art on Cityscapes. In addition, we specifically select a subset from COCO val2017 named COCO ContourHard-val to further demonstrate the contour quality improvements.
Introduction: The Challenge of Contour Regression
Instance segmentation—the task of detecting and outlining every individual object in an image—is typically handled using either pixel-wise masks or polygonal contours. While masks are common, contours are often preferred for applications like medical imaging and autonomous driving because they provide explicit control over shape and are easier for humans to edit.
However, regressing contour points directly is notoriously difficult. The authors identify a core issue: discretization ambiguity. As shown in the figure below, a single smooth shape (like a circle) can be represented by many different sets of discrete points, leading to training instability.
Furthermore, previous works often restricted shapes to simple polar coordinate systems, which fail on complex, concave objects like the letter 'S'.
Methodology: ContourRender
ContourRender is a novel one-pass instance segmentation framework that overcomes the instability of polygon discretization by leveraging differentiable rendering during training. The core "aha moment" is that optimizing the inner content (the silhouette) of a shape is more stable than regressing the boundary coordinates.
1. Compact Shape Signature (DCT)
Instead of predicting raw $(x, y)$ coordinates, the model predicts coefficients for a Discrete Cosine Transform (DCT). This signature is compact, robust to noise, and invertible. Using DCT coefficients naturally encourages the model to learn smoother, more realistic shapes compared to raw Cartesian coordinates, which are prone to "zig-zag" artifacts.
2. Differentiable Rendering Pipeline
To bridge the gap between discrete points and a 2D image, the predicted points are converted into a 2D mesh using an "External Linking-Shrink" strategy. This mesh is passed through a differentiable renderer to produce a 2D silhouette (mask). Because the renderer is differentiable, gradients from mask-based losses flow back to the predicted contour points.
3. Efficient One-Pass Inference
Crucially, the renderer and mesh construction are only used during training. During inference, the model simply predicts the DCT coefficients and performs an inverse DCT to get the final polygon. This achieves the accuracy of mask-based supervision with the speed and flexibility of a contour-based output. The team integrated this branch into both one-stage (FCOS) and two-stage (Mask R-CNN) detectors.
Experimental Results
The model was evaluated on several benchmarks:
- COCO: ContourRender outperformed all existing contour-based methods.
- Cityscapes: It remains competitive with iterative methods like DeepSnake while being significantly faster due to its single-pass nature.
- COCO ContourHard-val: On this specialized subset of complex, non-round shapes, ContourRender showed a significant performance gap over methods like PolarMask, proving its ability to handle highly concave geometries.
Ablation studies showed that using the DCT signature improved performance by 3.6 AP over raw Cartesian coordinates.
Conclusion and Limitations
ContourRender demonstrates that training-inference asymmetry—putting computational heavy lifting into the training phase—allows for high-quality, one-pass contour detection. However, the current method cannot handle objects with holes (topology constraints) and remains dependent on the accuracy of the initial bounding box detection.
Summary updated