EdiBERT, a generative model for image editing

Thibaut Issenhuth, Ugo Tanielian, Jérémie Mary, David Picard

Introduction

In the field of computer vision, specialized models are typically required for distinct tasks such as inpainting, denoising, or image composition. While effective, these "specialist" architectures lack the versatility found in large language models. Researchers from Criteo AI Lab and LIGM propose EdiBERT, a unified generative model that leverages the bidirectional capabilities of BERT for the visual domain. By operating over discrete latent tokens, EdiBERT serves as a generalist tool capable of performing a wide array of image manipulation tasks without task-specific training.

Methodology

EdiBERT combines Vector Quantization (VQ) with Bidirectional Transformers to achieve precise local editing.

Latent Space Representation

The model utilizes a VQGAN to compress images into a grid of discrete tokens. Unlike global latent vectors used in GAN inversion (e.g., StyleGAN), each token in EdiBERT corresponds to a specific local patch. This spatial locality is fundamental for localized editing, ensuring that modifications in one area do not inadvertently affect distant parts of the image.

Architecture and Training

EdiBERT employs a BERT-style bidirectional transformer rather than an autoregressive (left-to-right) model. During training, the model is tasked with recovering original tokens from a grid where some patches have been randomly perturbed. This bidirectional approach allows the model to utilize context from all surrounding pixels, which is more intuitive for editing tasks than sequential processing.

Inference and Sampling

The researchers introduced specific algorithms for different editing scenarios:

  • Localized Denoising: The model identifies "unlikely" tokens based on calculated likelihoods and replaces them with more probable alternatives.
  • Inpainting and Compositing: For masked areas, EdiBERT employs a spiral sampling strategy, filling the gap from the edges toward the center to maintain boundary consistency. A "periodic collage" technique and latent space optimization are used to ensure seamless blending and high-frequency detail recovery.

Applications and Results

EdiBERT's versatility is demonstrated across several tasks, including denoising, completion (inpainting), compositing, scribble-based editing, and "crossovers" where tokens are swapped between images.

EdiBERT demonstrates versatility across various image editing tasks, including denoising, completion, compositing, scribble-editing, and crossover.

Quantitative evaluations on the FFHQ and LSUN Bedroom datasets highlight the model's performance:

  • Inpainting Quality: On the FFHQ dataset, EdiBERT achieved an FID score of 13.8, outperforming ImageStyleGAN2++ (FID 22.1).
  • Fidelity: The model maintains significantly higher fidelity to unedited regions compared to GAN-based inversion methods.
  • User Preference: In a study of 30 participants, EdiBERT’s outputs were preferred 61.25% of the time, far exceeding competitors like ID-GAN (15.75%).

Conclusion

EdiBERT represents a significant step toward universal image manipulation. By treating image editing as a token-prediction task within a bidirectional framework, it matches or exceeds the performance of specialized models. While currently limited in handling global transformations (like rotation or zooming) due to its strict spatial locality, it provides a robust foundation for future generalist generative models in computer vision.

Summary updated

BibTeX
@article{issenhuth2023edibert,
  author = {Thibaut Issenhuth and Ugo Tanielian and Jérémie Mary and David Picard},
  title = {{EdiBERT, a generative model for image editing}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2023},
  url = {https://openreview.net/forum?id=qGRP_3_6-7},
}
Figure