Abstract
We investigate the problem of Language-Based Image Editing (LBIE). Given a source image and a natural language description, we want to generate a target image by editing the source image based on the description. We propose a generic modeling framework for two sub-tasks of LBIE: language-based image segmentation and image colorization. The framework uses recurrent attentive models to fuse image and language features. Instead of using a fixed step size, we introduce for each region of the image a termination gate to dynamically determine after each inference step whether to continue extrapolating additional information from the textual description. The effectiveness of the framework is validated on three datasets. First, we introduce a synthetic dataset, called CoSaL, to evaluate the end-to-end performance of our LBIE system. Second, we show that the framework leads to state-of-the-art performance on image segmentation on the ReferIt dataset. Third, we present the first language-based colorization result on the Oxford-102 Flowers dataset.
Introduction
Language-Based Image Editing (LBIE) allows users to modify images—such as colorizing a sketch or segmenting a photo—using complex, multi-sentence natural language instructions. While significant progress has been made in generating images from text, editing an existing image based on natural language remains a difficult hurdle. Most current systems rely on simple, single-phrase commands. However, real-world instructions are often complex and multi-faceted (e.g., "The insole should be brown, while the vamp and heel should be purple and shining").
The core challenge is spatial-textual alignment: the model must determine which part of a long description refers to which specific region of the image. Furthermore, different regions might require different amounts of "reasoning" steps to process. For instance, a direct instruction ("the circle is red") is easier to process than a relational one ("the shape to the left of the red circle is blue").
Methodology: Recurrent Attentive-Fusion
The proposed framework consists of four main components designed to handle iterative reasoning:
- Image Encoder: A CNN that extracts spatial feature maps from the source image (sketch, grayscale, or natural image).
- Language Encoder: An LSTM that encodes the natural language description into feature vectors.
- Recurrent Attentive-Fusion Module: Instead of a single pass, this module iteratively "reads" the text and "looks" at the image. At each step, it calculates which words in the description are most relevant to each region of the image.
- Dynamic Termination Gate: Not every pixel needs the same amount of processing. The authors introduce a termination gate for each region that decides, step-by-step, whether the model has gathered enough information to stop or if it needs to continue "thinking" by looking at the text again. To make this discrete decision differentiable, the Gumbel-Softmax reparameterization trick is employed.
- Decoder: A deconvolutional network upsamples the fused features to generate the final edited image. For colorization tasks, a Conditional GAN is used to ensure realistic results.
Experimental Evaluation
The model was evaluated on three distinct datasets to test different aspects of the framework:
- CoSaL (Colorizing Shapes with Artificial Language): A synthetic dataset featuring grids of shapes with descriptions involving coreference and logical reasoning.
- ReferIt: A standard benchmark for language-based image segmentation containing over 130,000 descriptions of objects in real-world photos.
- Oxford-102 Flowers: Used to test language-based colorization, where the model must colorize grayscale flower images based on textual descriptions of their petals and stigmas.
Key Results and Insights
Iterative reasoning proved essential for complex instructions. On the CoSaL dataset, the model naturally learned a logical order: attending to "direct" descriptions in early steps and "relational" descriptions in later steps. By allowing different regions to terminate at different steps, the model avoids over-processing simple areas while spending more computational effort on complex ones.
- State-of-the-Art Segmentation: On the ReferIt dataset, the model achieved an Intersection-over-Union (IoU) of 50.09%, surpassing the previous state-of-the-art of 48.03%.
- Human-Validated Colorization: On the Oxford-102 Flowers dataset, human evaluators rated the model’s consistency with the text at 0.849 (on a 0-1 scale), compared to just 0.27 for a baseline that didn't use the text input.
Conclusion
This research demonstrates that recurrent attentive models with dynamic termination gates are highly effective for complex language-based image editing tasks. While the current work focuses on segmentation and colorization, future work aims to extend this approach to more complex geometric transformations, such as changing shapes and positions, eventually building a fully interactive, dialogue-based image editing system.
Summary updated