Text as Neural Operator: Image Manipulation by Text Instruction

Tianhao Zhang, Hung-Yu Tseng, Lu Jiang, Honglak Lee, Irfan Essa, Weilong Yang · DOI

Abstract: In recent years, text-guided image manipulation has gained increasing attention in the multimedia and computer vision community. The input to conditional image generation has evolved from image-only to multimodality. In this paper, we study a setting that allows users to edit an image with multiple objects using complex text instructions to add, remove, or change the objects. The inputs of the task are multimodal including (1) a reference image and (2) an instruction in natural language that describes desired modifications to the image. We propose a GAN-based method to tackle this problem. The key idea is to treat text as neural operators to locally modify the image feature. We show that the proposed model performs favorably against recent strong baselines on three public datasets. Specifically, it generates images of greater fidelity and semantic relevance, and when used as a image query, leads to better retrieval performance.

Introduction

While text-to-image generation has seen massive leaps, manipulating existing images via natural language remains a significant challenge. Most existing methods are limited to simple attribute changes or global style transfers. This research addresses the problem of "complex instructions"—sentences that involve specific actions (add, remove, modify) combined with spatial reasoning (e.g., "add a small pine tree on the left side"). The core difficulty lies in multimodal fusion: the model must understand which part of the image the text refers to and then apply a transformation that is semantically consistent with the rest of the scene.

Methods: TIM-GAN

The researchers propose TIM-GAN (Text Instructed Manipulation GAN), which models text instructions as functional operators that act upon image feature maps. The architecture is built on two primary pillars:

  1. Disentangled "Where" and "How":
    • The Localizer (Where): Using BERT-encoded text, the model employs self-attention to identify locational keywords. It then generates a spatial mask that highlights the specific region of the image to be modified.
  2. The Operator (How): This component applies the actual change. Instead of a static network, they use a text-adaptive transformation whose parameters are dynamically generated based on the "operational" words in the instruction (like "add" or "remove").
  3. Routing-Neurons: To make the model scalable, the authors use a "routing" strategy. Instead of training a separate network for every possible instruction, the model uses a Gumbel-Softmax trick to dynamically select a path through a set of shared neural blocks. This allows the model to share knowledge between similar instructions while maintaining specialized paths for different operations.
Examples of text-instructed image manipulation across Clevr and CoDraw datasets, demonstrating the model's ability to add, remove, and modify objects based on spatial instructions.

Datasets and Evaluation

The model was evaluated on three distinct benchmarks:

  • Clevr (CSS): A dataset of 3D-rendered geometric shapes, perfect for testing precise spatial and attribute modifications.
  • Abstract Scene (CoDraw): A synthetic dataset of clip-art scenes focusing heavily on the "add" operation.
  • Cityscapes: A real-world driving dataset adapted by manipulating semantic segmentation masks, demonstrating the model's potential for complex label manipulation.

To evaluate performance, the authors emphasize Retrieval Recall over standard metrics like FID. By using the generated image as a query to find the intended target image in a database, they can verify if the model actually followed the instructions rather than simply copying the input image.

Key Results

TIM-GAN significantly outperformed baselines such as GeNeVA and TA-GAN across the board. On the Clevr dataset, TIM-GAN achieved a Recall@1 of 95.9%, nearly doubling the performance of the next best baseline (TIRG-GAN at 48.5%). In user preference studies, TIM-GAN's results were chosen as more realistic and more semantically relevant than competitors by a wide margin. Furthermore, the "Routing-Neurons" approach allowed the model to increase its parameter capacity by 3x with almost zero increase in computational cost (FLOPs) during inference.

Limitations and Future Work

The authors acknowledge that training currently requires "triplets" (input image, instruction, and target image), which are difficult to find for real-world photography. Additionally, the model struggles when instructions are underspecified. Future work aims to explore unsupervised training on unpaired data to bypass the need for ground-truth "after" images, potentially opening the door to editing high-resolution, real-world photos.

Summary updated

BibTeX
@inproceedings{zhang2021text,
  author = {Tianhao Zhang and Hung-Yu Tseng and Lu Jiang and Honglak Lee and Irfan Essa and Weilong Yang},
  title = {{Text as Neural Operator: Image Manipulation by Text Instruction}},
  booktitle = {ACM Multimedia},
  year = {2021},
  doi = {10.1145/3474085.3475343},
}
Figure