Introduction
Generating high-fidelity segmentation masks for high-resolution images remains a significant hurdle in computer vision. Due to memory constraints, state-of-the-art models often downsample images, resulting in "blurry" boundaries and the loss of fine-grained textures. While refinement modules have been developed to address these issues, they are frequently tied to specific architectures or struggle with complex structural errors, such as large false positives or failing to capture thin structures like cables or chair legs.
SegRefiner introduces a model-agnostic framework that treats mask refinement as an iterative data generation task. By leveraging a novel discrete diffusion process, it transforms coarse, low-quality masks into high-fidelity results, effectively capturing intricate details and correcting semantic errors across semantic, instance, and dichotomous segmentation tasks.
Methodology: Discrete Diffusion for Mask Refinement
The fundamental innovation of SegRefiner is the shift from standard continuous diffusion—which typically utilizes Gaussian noise—to a Discrete Diffusion Process.
Discrete State Transitions
Unlike traditional diffusion models that add "static" to an image, SegRefiner defines two discrete states for every pixel: Fine (ground truth) and Coarse (the degraded version).
- Forward Process: The model systematically degrades a perfect mask into a coarse version using a unidirectional state transition. This ensures that pixels only move from "fine" to "coarse," providing a predictable convergence path that mimics the types of errors (like dilation or erosion) found in real-world coarse predictions.
- Reverse Process (Refinement): Starting with a coarse mask from any off-the-shelf model, SegRefiner employs a conditional denoising U-Net to iteratively predict the "fine" state. The model takes both the current mask and the original image as inputs to guide the reconstruction.
Global-to-Local Strategy
To process ultra-high-resolution images (e.g., 2K and beyond) without exceeding GPU memory, the authors introduced HR-SegRefiner. This variant employs a two-stage approach:
- Global Refinement: The model performs refinement on a resized version of the image to correct large-scale semantic errors.
- Local Refinement: It identifies "uncertain" regions—pixels with low state-transition probabilities—and performs high-resolution refinement on specific patches.
Experimental Evaluation
SegRefiner was evaluated against demanding benchmarks including the BIG Dataset (high-resolution semantic segmentation), LVIS (detailed instance segmentation), and DIS5K (dichotomous segmentation of complex objects like lace and nets).
Performance Metrics
The framework consistently outperformed existing state-of-the-art refinement methods such as CRM and CascadePSP:
- Semantic Segmentation: On the BIG dataset, SegRefiner improved mean Boundary Accuracy (mBA) by 17.33% and IoU by 7.43% across various base models (e.g., FCN, DeepLab).
- Instance Segmentation: It enhanced Mask R-CNN performance by +0.9 Mask AP and +2.2 Boundary AP.
- Visual Fidelity: The model demonstrates a remarkable ability to reconstruct thin structures, such as the fine mesh of a chair or the thin wires of a bridge, from coarse "blobs" that initially missed these details.
Key Insights
- Refinement as Generation: By viewing a coarse mask as a "noisy" version of the truth rather than a failed prediction, SegRefiner leverages the iterative strengths of diffusion models, which are better suited for fitting complex distributions than single-pass networks.
- Mathematical Honesty: Moving away from Gaussian assumptions allows the model to respect the binary nature of segmentation masks, leading to more stable training and superior boundary adherence.
- Model-Agnosticism: Because it operates on the output masks of other models, SegRefiner can be integrated into any existing pipeline to improve quality without retraining the base model.
Conclusion and Future Work
SegRefiner represents a significant step forward in high-quality mask generation. While the iterative nature of diffusion introduces a bottleneck in inference speed—requiring approximately 6 steps per refinement—the gains in boundary accuracy and structural fidelity are substantial. Future research focusing on efficient diffusion sampling or distillation techniques may further reduce latency, making this high-fidelity refinement viable for real-time applications.
Summary updated