TD-GEM: Text-Driven Garment Editing Mapper

Reza Dadfar, Sanaz Sabzevari, Mårten Björkman, Danica KragicBMVC 2023

Abstract

Language-based fashion image editing allows users to try out variations of desired garments through provided text prompts. Inspired by research on manipulating latent representations in StyleCLIP and HairCLIP, we focus on these latent spaces for editing fashion items of full-body human datasets. Currently, there is a gap in handling fashion image editing due to the complexity of garment shapes and textures and the diversity of human poses. In this paper, we propose an editing optimizer scheme method called Text-Driven Garment Editing Mapper (TD-GEM), aiming to edit fashion items in a disentangled way. To this end, we initially obtain a latent representation of an image through generative adversarial network inversions such as Encoder for Editing (e4e) or Pivotal Tuning Inversion (PTI) for more accurate results. An optimization-based Contrastive Language-Image Pre-training (CLIP) is then utilized to guide the latent representation of a fashion image in the direction of a target attribute expressed in terms of a text prompt. Our TD-GEM manipulates the image accurately according to the target attribute, while other parts of the image are kept untouched. In the experiments, we evaluate TD-GEM on two different attributes (i.e., "color" and "sleeve length"), which effectively generates realistic images compared to the recent manipulation schemes.

Introduction

Editing fashion images presents unique challenges compared to facial editing. While human faces follow a relatively consistent structural template, fashion involves a vast array of garment shapes, intricate textures, and diverse body poses. Existing approaches often struggle with two primary issues: slow optimization speeds and "entanglement." Optimization-based methods like the Latent Optimizer require significant computation for every individual image, while many feed-forward models suffer from leakage, where changing a garment attribute inadvertently alters the subject's facial features, pose, or the background.

TD-GEM (Text-Driven Garment Editing Mapper) addresses these gaps by providing a fast, feed-forward framework capable of performing realistic, disentangled edits on full-body human images using simple text prompts such as "long sleeves" or "blue color."

Methodology

The TD-GEM pipeline consists of two main stages: GAN inversion and latent space manipulation via a specialized mapper.

GAN Inversion

To edit a real-world photograph, it must first be mapped to a latent code within the StyleGAN2 network. TD-GEM utilizes Pivotal Tuning Inversion (PTI), which involves slightly adjusting the generator's weights to ensure the reconstructed image is a high-fidelity match of the original. This provides a more accurate starting point for editing compared to standard encoders.

The TD-GEM Mapper Architecture

The core of the system is a mapper network featuring three sub-modules: Coarse ($M_c$), Medium ($M_m$), and Fine ($M_f$). Textual descriptions are converted into embeddings using a CLIP ViT-B/32 model and injected into these modules. A key design choice is the targeted injection of semantic information: shape-related prompts are fed into all three modules, while color-related prompts are directed specifically at the fine-grained module to preserve structural integrity.

The TD-GEM architecture, showing the CLIP-guided mapper network and modulation modules for disentangled garment editing.

Disentangled Loss Functions

To ensure that edits remain localized to the garment, TD-GEM employs a suite of targeted loss functions:

  • Background Loss: Uses a pre-trained parsing network to mask the person and ensure the background remains unchanged.
  • Color Loss: Specifically targets the garment area for color modifications.
  • Identity Loss: Utilizes a ConvNeXt-based vision network to compare original and edited images, ensuring the subject's physical identity (face, hands, posture) is preserved.

Experimental Setup

The model was evaluated using the Stylish-Humans-HQ (SHHQ) dataset, which contains 230,000 high-quality full-body fashion images. For the experiments, a subset of 2,200 samples was selected, focusing on short-sleeved or sleeveless outfits to test "sleeve lengthening" and "color change" capabilities.

Results and Discussion

TD-GEM demonstrates significant improvements in both quantitative metrics and qualitative visual quality.

Quantitative Performance

In background preservation tests, TD-GEM achieved an FID score of 0.030, substantially outperforming the Latent Optimizer (0.126). Furthermore, the use of PTI inversion improved the Peak Signal-to-Noise Ratio (PSNR) from 19.1 (with e4e) to 32.0, indicating a much more faithful reconstruction of the source image.

Qualitative Analysis

Qualitatively, the model successfully performs complex edits like lengthening sleeves to the wrist while maintaining the natural appearance of fabric wrinkles and textures. Unlike previous methods such as InterFaceGAN or SeFa, which often distort patterns, TD-GEM preserves the original garment's intricate details.

Qualitative results of TD-GEM showing successful garment edits across various source images while maintaining identity and background.

A notable finding was the "Vertical Straw" effect: without injecting semantic information into the fine module, sleeve lengthening often produced artificial vertical artifacts. The multi-level injection strategy effectively resolved this, ensuring realistic fabric behavior.

Conclusion and Future Work

TD-GEM provides a robust framework for text-driven fashion editing, achieving high-fidelity results with minimal entanglement. However, some limitations remain, such as occasional color leakage where secondary garments (like trousers) may take on a slight tint of the target color. Future research will focus on expanding the range of editable attributes to include complex patterns (e.g., stripes, floral, plaid) and more diverse structural changes like shortening sleeves or adding specific garment features.

Summary updated

BibTeX
@inproceedings{dadfar2023td,
  author = {Reza Dadfar and Sanaz Sabzevari and Mårten Björkman and Danica Kragic},
  title = {{TD-GEM: Text-Driven Garment Editing Mapper}},
  booktitle = {BMVC},
  year = {2023},
  url = {https://openreview.net/forum?id=Bw5zN9cWD1},
}
Figure