Learning from Adversity: Semantic-Aware Mask Refinement through Adversarial Perturbation

Beomyoung Kim, Sung Ju Hwang · Submission to ICLR 2026 · Rejected

TL;DR

The Phoenix framework introduces a new paradigm for mask refinement by training models on "smart" noise. By using adversarial attacks to generate realistic, semantically-aware errors and a tri-directional contrastive loss to guide the learning process, Phoenix significantly improves the boundary precision and structural integrity of segmentation masks across diverse tasks, from medical imaging to fine-grained object detection.

What Problem Does This Paper Address?

Image segmentation—the task of delineating the exact pixels belonging to an object—is a cornerstone of computer vision. However, even state-of-the-art (SOTA) models like SAM (Segment Anything Model) often produce "noisy" results: jagged boundaries, missing parts (false negatives), or extra blobs (false positives).

To fix this, researchers use mask refinement models as a post-processing step. The challenge lies in training these refiners. Traditionally, researchers create training data by taking a perfect ground-truth mask and adding "synthetic noise" using simple geometric operations like dilation or erosion. The problem? Real-world model errors aren't just random geometric shifts; they are semantically driven, occurring where the model is most uncertain or confused by similar-looking objects. Phoenix addresses this "reality gap" in training data.

Methods

The authors propose the Phoenix framework, which is built upon the Segment Anything Model (SAM) architecture (specifically the ViT-H encoder and a lightweight decoder). It introduces two primary innovations:

  1. Adversarial Mask Perturbation (AMP): Instead of using simple geometric noise, Phoenix uses adversarial learning to generate training examples. By adapting the Fast Gradient Sign Method (FGSM) to operate in the embedding space rather than the pixel space, the system generates noise that specifically targets the model's weaknesses. They use "Guidance Masks" to control the type of noise:
  2. Expansion: Pushes boundaries outward (simulating false positives).
  3. Contraction: Shrinks masks (simulating false negatives).
  4. Inversion: A balanced mix of both.
  5. Contrastive Mask Refinement Learning (CMRL): Most refiners use a simple pixel-wise loss (is this pixel right or wrong?). Phoenix uses a tri-directional contrastive framework. It categorizes pixels into six regions based on the relationship between the Ground Truth, the Noisy Input, and the Refined Output (e.g., "Success" regions where the model fixed an error vs. "Failure" regions where it didn't). This allows the model to learn rich feature representations that ensure consistency within an object while maintaining a sharp separation from the background.

Datasets

The model was trained on the LVIS dataset and evaluated across a wide variety of benchmarks to test its versatility:

  • General Instance Segmentation: COCO (using LVIS annotations).
  • Fine-grained Segmentation: DIS5K and ThinObject-5K (focusing on complex structures like feathers and bicycle spokes).
  • Semantic Segmentation: PASCAL VOC2012.
  • Zero-shot Generalization: Cityscapes (urban scenes) and ISIC2018 (medical skin lesion segmentation).

Key Insights and Ideas

  • Adversity as a Teacher: The core philosophy is that a model learns better by facing realistic challenges. By repurposing adversarial attacks—usually seen as a threat to model robustness—as a constructive data augmentation tool, the authors bridge the gap between synthetic training noise and real-world deployment errors.
  • Embedding Space Efficiency: Perturbing the latent embeddings rather than the raw image pixels is not only computationally faster (taking only ~6ms per update) but also results in "smarter" noise that respects the semantic context of the image.
  • The "Phoenix" Curriculum: The CMRL loss creates a natural curriculum. By contrasting its own successful refinements against its failures within the same image, the model essentially "bootstraps" its way to better performance.

Key Results

Phoenix consistently outperformed existing SOTA refiners like SegRefiner and SAMRefiner:

  • Quantitative Gains: On weakly-supervised tasks (where initial masks are very poor), Phoenix achieved absolute gains of up to +16.1% in APmask and +17.3% in APboundary.
  • Fine-Grained Superiority: In tasks involving thin structures (like the DIS task), it improved Intersection over Union (IoU) by 11% to 21% over baseline models.
  • Zero-Shot Robustness: Despite being trained only on natural images (LVIS), it provided a +4.6% IoU boost on medical skin lesion images without any additional fine-tuning.
  • Qualitative Quality: Visual results show Phoenix is significantly better at preserving delicate details, such as the spokes of a bicycle or the intricate branching of a dinosaur skeleton, where other models often "hallucinate" or blur the structure.

Limitations and Future Work

  • Class-Agnosticism: Phoenix is designed to fix shapes, not labels. If a base model incorrectly identifies a "sail" as a "person," Phoenix will refine the boundary of the sail perfectly but will still consider it a "person." The authors suggest integrating open-vocabulary models or text embeddings to address this.
  • Mislocalization: If the initial noisy mask is completely displaced from the actual object (zero overlap), Phoenix struggles to "find" the object. The authors note that providing additional visual cues (like a bounding box or a point prompt) can mitigate this.
  • Future Directions: The authors see potential in self-supervised refinement (learning without ground-truth masks) and multimodal guidance, where text or other sensors help guide the refinement process.

Summary updated

Abstract

Despite significant advances in image segmentation, even state-of-the-art models produce masks with imperfect boundaries, semantic inconsistencies, and structural errors. Mask refinement addresses these limitations, yet current approaches rely on simplistic synthetic noise that fails to capture the complex error patterns of real segmentation models. We introduce Phoenix, a novel framework that leverages adversarial learning to generate semantically meaningful noise patterns and contrastive learning to model refinement relationships. Our approach consists of two key innovations: (1) Adversarial Mask Perturbation, which employs embedding attacks to create semantic-aware noise that mimics real segmentation errors, and (2) Contrastive Mask Refinement Learning, which establishes a tri-directional framework that ensures feature consistency within semantic regions while maintaining separation between classes. Experiments demonstrate that Phoenix significantly outperforms existing methods across diverse tasks, while consistently enhancing state-of-the-art segmentation models with substantial improvements.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
COCO/LVIS instance-segmentation refinementPhoenixAP^mask48.1Refinement of coarse masks from semi-supervised and weakly semi-supervised models.
Source quote
L263: +Phoenix (ours) │ 48.1 {{\textcolor{green!50!black}{(+6.5)}}} │ 39.8 {{\textcolor{green!50!black}{(+10.8)}}}
COCO/LVIS instance-segmentation refinementPhoenixAP^boundary39.8Refinement of coarse masks from semi-supervised and weakly semi-supervised models.
Source quote
L263: +Phoenix (ours) │ 48.1 {{\textcolor{green!50!black}{(+6.5)}}} │ 39.8 {{\textcolor{green!50!black}{(+10.8)}}}
Cityscapes · instance segmentation validation setPhoenixAP37.2split: val · 0-shot · backbone=Mask R-CNN R50
Source quote
L582: +Phoenix (ours) │ 37.2 {{\textcolor{green!70!black}{(+1.1)}}} │ 61.9 {{\textcolor{green!70!black}{(+1.0)}}}
ISIC2018 · skin lesion segmentationPhoenixIoU59.20-shot · backbone=UNet
Source quote
L594: +Phoenix (ours) │ 59.2 {{\textcolor{green!70!black}{(+4.6)}}} │ 77.2 {{\textcolor{green!70!black}{(+6.0)}}}
BibTeX
@misc{kim2026learning,
  author = {Beomyoung Kim and Sung Ju Hwang},
  title = {{Learning from Adversity: Semantic-Aware Mask Refinement through Adversarial Perturbation}},
  year = {2026},
  eprint = {2607.29059},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2607.29059},
}
Figure