ManiTrans: Entity-Level Text-Guided Image Manipulation via Token-wise Semantic Alignment and Generation

Jianan Wang, Guansong Lu, Hang Xu, Zhenguo Li, Chunjing Xu, Yanwei Fu

Introduction

Text-Guided Image Manipulation (TGIM) aims to modify specific image regions based on natural language descriptions. However, existing methods often struggle with a "global vs. local" trade-off. They frequently apply unintended changes to the background (hallucination) or fail to accurately reflect the text prompt on the target object. ManiTrans addresses these challenges by introducing a transformer-based framework designed for precise, entity-level editing.

The ManiTrans Framework

ManiTrans utilizes a two-stage architecture that decouples image synthesis from semantic manipulation, leveraging the strengths of discrete tokenization and cross-modal alignment.

1. The "Trans" Component (Image Synthesis)

The model employs a VQGAN-style approach, quantizing images into a sequence of discrete visual tokens. By treating an image as a sequence of tokens rather than a grid of pixels, the framework can utilize Transformer architectures to capture long-range dependencies and complex reasoning required for high-quality generation.

2. The "Mani" Component (Semantic Alignment)

This module acts as the guidance system for editing:

  • Semantic Alignment Module: During inference, the model identifies specific visual tokens corresponding to the text description using entity segmentation and FILIP-based similarity checks. This ensures that only the relevant "entity" tokens are modified.
  • Vision Guidance: To preserve the structural integrity of an object while changing its appearance (e.g., color or texture), the model can utilize a grayscale version of the original object as a structural template.
  • Semantic Loss: A CLIP-based loss function is used during training to ensure the generated output aligns with the high-level semantics of the text prompt.

Experimental Results

The researchers evaluated ManiTrans on the CUB-200-2011 (birds), Oxford-102 (flowers), and COCO (complex real-world scenes) datasets.

Qualitative comparison of ManiTrans against ManiGAN and Lightweight-GAN on the CUB dataset. ManiTrans demonstrates superior adherence to complex multi-entity text prompts while preserving background details.

Quantitative Performance

On the CUB dataset, ManiTrans significantly outperformed baseline models such as ManiGAN and Lightweight-GAN:

  • Inception Score (IS): Achieved 5.02, indicating higher image quality and diversity.
  • CLIP-score: Achieved 23.56, demonstrating superior alignment between the edited image and the text description.
  • Background Preservation: ManiTrans maintained a lower $L_2$ reconstruction error in non-target regions, proving its effectiveness at "surgical" entity-level editing.

Qualitative Performance

ManiTrans successfully performs complex "cross-category" manipulations, such as altering the species of a bird or changing objects in a COCO scene (e.g., turning a cat into sandwiches), while keeping the surrounding environment stable and natural.

Discussion and Limitations

While ManiTrans represents a significant step forward in entity-level manipulation, certain challenges remain:

  • Overlapping Entities: The semantic alignment module can occasionally struggle to distinguish between multiple similar objects (e.g., two birds of the same species), leading to unintended edits on the wrong entity.
  • Large Object Bias: In datasets where the object dominates the frame (like Oxford Flowers), the model may fail to distinguish foreground from background, leading to artifacts in the peripheral regions.
  • Complex Occlusions: Manipulating entities that are heavily obscured by other objects remains a difficult task for the current segmentation-based approach.

Summary updated

BibTeX
@inproceedings{wang2022manitrans,
  author = {Jianan Wang and Guansong Lu and Hang Xu and Zhenguo Li and Chunjing Xu and Yanwei Fu},
  title = {{ManiTrans: Entity-Level Text-Guided Image Manipulation via Token-wise Semantic Alignment and Generation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2022},
}
Figure