NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

DynaMask: Dynamic Mask Selection for Instance Segmentation

Ruihuang Li, Chenhang He, Shuai Li, Yabin Zhang, Lei Zhang

Abstract

In the field of computer vision, instance segmentation represents the pinnacle of object recognition, requiring the identification of every pixel belonging to an object. Despite its importance, traditional models have long relied on a "one-size-fits-all" approach to mask resolution, typically employing a fixed $28 \times 28$ grid regardless of object complexity. This paper introduces DynaMask, a dynamic framework that adaptively selects optimal mask resolutions for individual objects. By utilizing a dual-level Feature Pyramid Network and a lightweight Mask Switch Module, DynaMask provides high-detail masks for complex shapes while maintaining efficiency for simpler ones. Experimental results demonstrate that DynaMask outperforms standard models like Mask R-CNN by nearly 3% AP on the COCO dataset with minimal computational overhead.

Introduction

Most modern instance segmentation frameworks, such as the widely used Mask R-CNN, predict masks at a fixed, low resolution. While a $28 \times 28$ grid is computationally efficient, it often fails to capture the fine details of object boundaries, leading to jagged edges on complex structures like human fingers or thin furniture legs. Simply increasing the resolution across the board is not a viable solution due to two primary hurdles: quadratic scaling of computational costs and feature dilution, where high-level features become too coarse to provide meaningful detail at higher resolutions.

DynaMask addresses these challenges by questioning the necessity of high-resolution masks for every object. While a large, smooth object like a suitcase can be segmented effectively at low resolution, a small, irregular object like a potted plant requires significantly more detail. DynaMask introduces a mechanism to assign computational resources where they are most needed.

Methodology

The DynaMask architecture incorporates three primary innovations to enable dynamic mask selection:

1. Dual-Level Feature Pyramid Network (FPN)

Standard models utilize an image-level FPN (i-FPN). DynaMask augments this with a region-level FPN (r-FPN). As the model focuses on a specific object, the r-FPN gradually increases feature resolution by pulling fine-grained details from the lower layers of the main network—layers that are typically ignored in standard mask prediction heads.

2. Mask Switch Module (MSM)

The Mask Switch Module is a lightweight, CNN-based decision-maker. It analyzes an object's features and selects one of four possible mask resolutions: $14 \times 14, 28 \times 28, 56 \times 56,$ or $112 \times 112$. This allows the model to bypass expensive computations for simple objects.

3. Differentiable Training Strategy

To train a module to make discrete choices, the researchers employed the Gumbel-Softmax trick, making the selection process differentiable. Additionally, the framework incorporates an Edge Loss to improve boundary precision and a Budget Constraint to prevent the model from defaulting to the highest resolution for all objects, ensuring a balance between accuracy and speed.

Experimental Setup

The researchers evaluated DynaMask across three major benchmarks:

  • COCO (Common Objects in Context): The standard for general object detection and segmentation.
  • Cityscapes: Focused on urban street scenes, where boundary precision for pedestrians and vehicles is critical.
  • LVIS: A dataset featuring a "long tail" of categories and high-quality mask annotations, ideal for testing high-resolution predictions.

To ensure spatial alignment during feature upsampling, the authors also utilized a Feature Aggregation Module (FAM) with deformable convolutions, which re-aligns features to produce sharper boundaries.

Results and Discussion

DynaMask demonstrates significant improvements in both accuracy and efficiency over baseline models:

  • Accuracy Gains: On the COCO dataset using a ResNet-50 backbone, DynaMask achieved 37.6% AP, a 2.9% improvement over the Mask R-CNN baseline.
  • Efficiency Benchmarks: Compared to refinement methods like PointRend, DynaMask achieved higher accuracy (36.8% vs 35.6% AP) while maintaining a higher frame rate (11.2 FPS vs 9.4 FPS) and using fewer FLOPs.
  • Qualitative Improvements: Visual analysis shows that DynaMask produces significantly cleaner edges on complex objects like bicycles and giraffes, where standard models often produce over-smoothed or "blobby" masks.

A key insight from the study is that object "hardness" is determined by complexity rather than just size. For instance, a large bus might be assigned a lower resolution than a small, complex human hand. By tuning the budget parameter ($C_t$), users can customize the trade-off between speed and precision.

Conclusion and Future Work

DynaMask proves that dynamic resolution selection is a powerful tool for improving instance segmentation. While the current implementation is capped at $112 \times 112$ and built on the two-stage Mask R-CNN framework, future research could extend this logic to even higher resolutions for specialized data (such as satellite imagery) or integrate dynamic selection into single-stage and Transformer-based architectures like Mask2Former. Furthermore, the concept of dynamic resource allocation could be extended to the backbone layers themselves, adaptively activating layers based on the complexity of the input image.

Summary updated

BibTeX
@inproceedings{li2023dynamask,
  author = {Ruihuang Li and Chenhang He and Shuai Li and Yabin Zhang and Lei Zhang},
  title = {{DynaMask: Dynamic Mask Selection for Instance Segmentation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2023},
  doi = {10.1109/cvpr52729.2023.01085},
}
Figure