Abstract
Modern diffusion models excel at generating images from scratch but struggle with precise editing of existing content. We introduce "Editable Image Elements," a representation that decomposes images into disjoint, semantically meaningful patches. By decoupling appearance from spatial properties (size and location) and utilizing a specialized diffusion decoder, our framework allows for intuitive "drag-and-drop" editing. Experimental results demonstrate that this approach maintains high fidelity to original textures while providing superior spatial control compared to existing inversion and conditioning-based methods.
Introduction
While models like Stable Diffusion have revolutionized image generation, editing real-world photographs remains a challenge. Current techniques typically rely on inversion—finding the latent noise that reconstructs an image—or conditioning, such as using edge maps or text prompts. Inversion often suffers from a trade-off between editability and reconstruction fidelity, while conditioning frequently loses the fine-grained details of the source object.
The core issue is the lack of a representation that is both spatially flexible and content-rich. We propose a solution that treats images as a collection of "elements" rather than a rigid pixel grid, enabling users to manipulate objects as independent entities.
Methodology: From Pixels to Elements
Our framework operates in two primary stages: tokenization and decoding.
Tokenization and Encoding
Instead of a standard grid, we employ a modified SLIC clustering algorithm guided by features from the Segment Anything Model (SAM). This process partitions the image into "superpixels" that align with natural object boundaries.
Each patch is then resized and processed through a convolutional encoder to generate an appearance embedding. By resizing the patches before encoding, we effectively decouple the object's visual identity from its original scale and position in the frame.
Diffusion-Based Decoding
The synthesis is handled by a modified Stable Diffusion UNet. We introduce additional cross-attention layers that ingest the image elements (appearance embeddings, centroids, and bounding boxes). To ensure the model can handle missing information—such as the background behind a moved object—we utilize "Image Element Dropout" and random partitioning during training. This forces the model to learn robust inpainting and scene harmonization.
Results and Evaluation
The model was trained on 3 million images from the LAION dataset. Evaluation focused on both reconstruction accuracy and the quality of spatial edits.
Spatial Control and Fidelity
Unlike text-based editing (e.g., InstructPix2Pix), our method allows for direct manipulation of object geometry. Users can "drag" elements to new locations or resize them without inducing global artifacts or warping the surrounding scene. In a Two-Alternative Forced Choice (2AFC) perceptual study, human participants preferred our results over baselines like Paint-by-Example by over 85%.
Computational Efficiency
Because the encoding process is a direct feed-forward pass, the system avoids the expensive optimization loops required by inversion-based methods. This enables near-interactive speeds for complex editing workflows.
Conclusion and Future Work
Editable Image Elements provide a powerful bridge between the flexibility of generative models and the precision required for image editing. While the current system excels at spatial manipulation, future work will focus on improving reconstruction fidelity for high-frequency details and developing intuitive methods for editing the appearance embeddings themselves (e.g., changing colors or textures via latent space manipulation).
Summary updated