Abstract
We investigate the problem of Language-Based Image Editing (LBIE), where a target image is generated by editing a source image based on a natural language description. We propose a generic modeling framework for two sub-tasks: language-based image segmentation and image colorization. The framework utilizes recurrent attentive models to fuse image and language features. A key innovation is the introduction of a termination gate for each image region, allowing the model to dynamically determine the necessary number of inference steps to extract information from the text. Our framework achieves state-of-the-art performance on the ReferIt segmentation dataset and presents the first language-based colorization results on the Oxford-102 Flowers dataset.
Introduction: The Challenge of Language-Based Editing
Traditional image editing is often a manual, pixel-level process. While text-to-image generation has seen significant progress, editing an existing image based on natural language presents unique challenges. The system must maintain the spatial structure of the source image while precisely mapping linguistic concepts—such as "the vamp of the shoe should be purple"—to specific visual regions.
Existing methods often struggle with complex instructions involving multiple sentences or relational logic (e.g., "color the shape to the left of the red square blue"). Previous models typically used a fixed-step approach to fuse text and image data, which is often inefficient for simple tasks and insufficient for complex reasoning.
Methodology: Recurrent Attentive-Fusion
The proposed framework consists of four main components designed to handle multi-modal reasoning:
- Image and Language Encoders: A CNN extracts spatial feature maps from the source image, while an LSTM encodes the natural language description into feature vectors.
- Recurrent Attentive-Fusion Module: This module uses an attention mechanism to align image regions with relevant text segments. It employs Convolutional Gated Recurrent Units (C-GRUs) to iteratively update image features.
- Termination Gates: Instead of a fixed number of iterations, the model features a "termination gate" for each region. This allows the model to stop processing once sufficient information is extracted. To ensure trainability, the Gumbel-Softmax reparameterization trick is used for these discrete decisions.
- Image Decoder: A deconvolutional network upsamples the fused features into the final target image, such as a colorized version of a grayscale source.
For colorization tasks, the framework incorporates a Conditional GAN (Generative Adversarial Network) loss to ensure the generated images are visually realistic and consistent with real-world priors.
Key Insights: Dynamic Reasoning
A significant insight of this work is that not all parts of an image require the same amount of "thought." By using termination gates, the model can spend more iterations on complex objects described across multiple sentences while quickly finishing simpler regions. The recurrent nature allows the model to "re-read" instructions, typically processing direct descriptions in early steps and relational descriptions in later steps.
Experimental Evaluation and Results
The framework was validated across three datasets:
- CoSaL: A synthetic dataset for evaluating end-to-end reasoning on grids of shapes.
- ReferIt: A benchmark for real-world image segmentation.
- Oxford-102 Flowers: Used for the language-based colorization task.
Key Performance Metrics
- 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%.
- Superior Colorization: Human evaluations on the Oxford-102 Flowers dataset showed a consistency score of 0.849 between output and captions, significantly higher than the 0.27 achieved by baseline image-to-image translation models.
Conclusion and Future Work
While the framework demonstrates strong results in segmentation and colorization, LBIE remains a broad field. Future work may expand the types of edits possible—such as modifying shapes, textures, or object positions—and move toward interactive dialogue systems where users can provide iterative feedback to refine the results.
Summary updated