GarmentSegAgent: Autonomous Garment Segmentation for Web Fashion Images via Textual Self-Refinement

Jia Chen, Chao Huang, Xinrong Hu, Mingdi Huang, Ruyang Zhao, Jun BaiarXiv 2026 · arXiv

TL;DR

GarmentSegAgent is an autonomous framework that performs high-precision garment segmentation on complex web images without requiring human-provided spatial prompts. By using a novel iterative process called CAST (Constrained Attribution-guided Selective TextGrad), the agent diagnoses its own visual errors and surgically refines specific parts of its textual instructions to produce increasingly accurate masks.

What Problem Does This Paper Address?

Segmenting clothing in "wild" web images is notoriously difficult. Unlike clean catalog shots, these images feature cluttered backgrounds, overlapping garments, and tricky occlusions. While foundation models like the Segment Anything Model (SAM) are powerful, they usually require precise human-provided boxes or points to work well.

Existing autonomous methods often struggle with fine-grained details. When they try to self-correct, they typically rewrite their entire text prompt. This "naive" approach is risky: fixing a missing sleeve might accidentally cause the model to start segmenting the background or a different piece of clothing entirely. The challenge is creating an agent that can identify exactly what went wrong and fix it without breaking what was already working.

Methods

GarmentSegAgent operates as a closed-loop system involving four key components:

  1. Planner (Qwen2.5-VL): Generates a "semantic plan" based on an initial instruction (e.g., "segment the jacket"). It breaks this down into four structured fields: Target, Localization, Coverage, and Exclusion.
  2. Actor (SAM 2.1): Translates the plan into spatial prompts (bounding boxes and points) to generate candidate masks.
  3. Evaluator (Qwen3-VL): Inspects the masks for errors like "missing regions" or "background leakage."
  4. CAST Refinement Engine: This is the core innovation. Instead of a total rewrite, CAST uses Error Attribution to map visual errors to specific textual fields. For example, a missing sleeve is attributed to the "Coverage" field. It then applies Selective TextGrad—a language-based backpropagation technique—to update only those relevant fields while keeping the rest of the prompt under a "Garment Contract" (a set of constraints to ensure the target remains consistent).
Figure 2: Overview of GarmentSegAgent. The Planner generates a garment-aware semantic plan, the Actor produces candidate masks, and the Evaluator selects predictions and provides visual feedback. CAST performs selective, garment-constrained textual refinement to guide subsequent segmentation iterations.

Datasets

The authors evaluated the agent on three major fashion benchmarks, each offering different challenges:

  • DeepFashion2: Features diverse consumer and commercial images with various viewpoints.
  • ModaNet: Focuses on street-fashion imagery with highly cluttered backgrounds.
  • Fashionpedia: Provides fine-grained annotations for complex garment attributes.
  • COCO: Used for cross-domain testing to see if the framework generalizes to general person segmentation.

Key Insights and Ideas

  • Surgical vs. Global Refinement: The paper demonstrates that "naive" whole-prompt refinement often leads to performance degradation. By isolating updates to specific instruction fields (e.g., only updating the "Exclusion" text to fix background leakage), the agent is much more stable.
  • Visual-to-Textual Mapping: The ability to translate a visual error (a red blob on a sleeve) into a semantic instruction update ("include the cuffs and lower hem") allows the system to leverage the reasoning power of Large Vision-Language Models (LVLMs) for low-level vision tasks.
  • The "Garment Contract": Implementing a set of logical constraints prevents the agent from "hallucinating" its way into a different task during the iterative loop, ensuring that a request for a "jacket" doesn't turn into a "shirt" after three iterations.
Comparison showing how naive refinement can introduce new errors, while CAST's selective refinement maintains valid instructions.

Key Results

GarmentSegAgent consistently outperformed state-of-the-art baselines (like SegZero+SAM 2 and LISA) across all metrics:

  • Accuracy: Achieved an mIoU of 0.8124 on DeepFashion2, surpassing the strongest baseline by 1.65 percentage points.
  • Boundary Precision: Showed significant gains in Boundary IoU (BIoU), indicating much cleaner edges around complex structures like collars and sleeves.
  • Reliability: In refinement analysis, CAST showed a much higher Improvement Rate (88.7%) and a significantly lower Degradation Rate (6.4%) compared to vanilla TextGrad methods.
  • Generalization: Even on the general COCO person segmentation task, it outperformed specialized models, proving the framework isn't just for clothes.

Limitations and Future Work

While powerful, GarmentSegAgent has a few hurdles:

  • Inference Cost: The iterative nature requires multiple calls to large models (Qwen, SAM), which increases execution time (roughly 10-12 seconds per image).
  • Single Target Focus: The current evaluation focuses primarily on single-target upper-garment segmentation. Extending this to multi-instance scenarios (e.g., segmenting every item in an outfit simultaneously) remains a challenge.
  • Pixel-Level Guarantees: While the textual refinement is smart, the final mask quality is still capped by the underlying foundation model's (SAM 2.1) ability to follow the generated spatial prompts.

Future work will likely focus on making the refinement process more efficient and expanding the agent's "vocabulary" to handle more complex multi-garment interactions.

Summary updated

Abstract

Web fashion images support applications such as visual product search and consumer-to-shop matching, yet their visual heterogeneity makes reliable garment segmentation challenging. Despite advances in promptable segmentation, autonomously identifying and correcting garment-specific errors without human-provided spatial prompts remains difficult. We propose GarmentSegAgent, an autonomous framework that integrates semantic planning, spatial execution, and visual evaluation through iterative textual self-refinement. At its core, we introduce CAST (Constrained Attribution-guided Selective TextGrad), which connects visual error attribution with targeted textual optimization. CAST identifies instruction components responsible for segmentation errors, selectively updates them through textual gradients, and validates the resulting instructions against garment-specific constraints. This enables image-specific error correction at inference time while keeping the underlying foundation models frozen. Experiments on DeepFashion2, ModaNet, and Fashionpedia demonstrate consistent improvements in region overlap and boundary accuracy, alongside more reliable refinement than conventional TextGrad. By enabling visual feedback to guide controlled instruction updates, GarmentSegAgent offers a promising direction for autonomous garment understanding, with potential applications in scalable fashion content analysis, visual retrieval, and consumer-to-shop matching on the Web.
BibTeX
@misc{chen2026garmentsegagent,
  author = {Jia Chen and Chao Huang and Xinrong Hu and Mingdi Huang and Ruyang Zhao and Jun Bai},
  title = {{GarmentSegAgent: Autonomous Garment Segmentation for Web Fashion Images via Textual Self-Refinement}},
  year = {2026},
  eprint = {2610.36506},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.36506},
}
Figure