Text-to-image model explained

A text-to-image model is a machine learning model which takes an input natural language description and produces an image matching that description.

Text-to-image models began to be developed in the mid-2010s during the beginnings of the AI boom, as a result of advances in deep neural networks. In 2022, the output of state-of-the-art text-to-image models—such as OpenAI's DALL-E 2, Google Brain's Imagen, Stability AI's Stable Diffusion, and Midjourney—began to be considered to approach the quality of real photographs and human-drawn art.

Text-to-image models generally combine a language model, which transforms the input text into a latent representation, and a generative image model, which produces an image conditioned on that representation. The most effective models have generally been trained on massive amounts of image and text data scraped from the web.

History

Before the rise of deep learning, attempts to build text-to-image models were limited to collages by arranging existing component images, such as from a database of clip art.

The inverse task, image captioning, was more tractable, and a number of image captioning deep learning models came prior to the first text-to-image models.

The first modern text-to-image model, alignDRAW, was introduced in 2015 by researchers from the University of Toronto. alignDRAW extended the previously-introduced DRAW architecture (which used a recurrent variational autoencoder with an attention mechanism) to be conditioned on text sequences. Images generated by alignDRAW were in small resolution (32×32 pixels, attained from resizing) and were considered to be 'low in diversity'. The model was able to generalize to objects not represented in the training data (such as a red school bus) and appropriately handled novel prompts such as "a stop sign is flying in blue skies", exhibiting output that it was not merely "memorizing" data from the training set.

In 2016, Reed, Akata, Yan et al. became the first to use generative adversarial networks for the text-to-image task. With models trained on narrow, domain-specific datasets, they were able to generate "visually plausible" images of birds and flowers from text captions like "an all black bird with a distinct thick, rounded bill". A model trained on the more diverse COCO (Common Objects in Context) dataset produced images which were "from a distance... encouraging", but which lacked coherence in their details. Later systems include VQGAN-CLIP,[1] XMC-GAN, and GauGAN2.[2]

One of the first text-to-image models to capture widespread public attention was OpenAI's DALL-E, a transformer system announced in January 2021. A successor capable of generating more complex and realistic images, DALL-E 2, was unveiled in April 2022, followed by Stable Diffusion that was publicly released in August 2022.[3] In August 2022, text-to-image personalization allows to teach the model a new concept using a small set of images of a new object that was not included in the training set of the text-to-image foundation model. This is achieved by textual inversion, namely, finding a new text term that correspond to these images.

Following other text-to-image models, language model-powered text-to-video platforms such as Runway, Make-A-Video,[4] Imagen Video,[5] Midjourney,[6] and Phenaki[7] can generate video from text and/or text/image prompts.[8]

Architecture and training

Text-to-image models have been built using a variety of architectures. The text encoding step may be performed with a recurrent neural network such as a long short-term memory (LSTM) network, though transformer models have since become a more popular option. For the image generation step, conditional generative adversarial networks (GANs) have been commonly used, with diffusion models also becoming a popular option in recent years. Rather than directly training a model to output a high-resolution image conditioned on a text embedding, a popular technique is to train a model to generate low-resolution images, and use one or more auxiliary deep learning models to upscale it, filling in finer details.

Text-to-image models are trained on large datasets of (text, image) pairs, often scraped from the web. With their 2022 Imagen model, Google Brain reported positive results from using a large language model trained separately on a text-only corpus (with its weights subsequently frozen), a departure from the theretofore standard approach.

Datasets

Training a text-to-image model requires a dataset of images paired with text captions. One dataset commonly used for this purpose is the COCO dataset. Released by Microsoft in 2014, COCO consists of around 123,000 images depicting a diversity of objects with five captions per image, generated by human annotators. Oxford-120 Flowers and CUB-200 Birds are smaller datasets of around 10,000 images each, restricted to flowers and birds, respectively. It is considered less difficult to train a high-quality text-to-image model with these datasets because of their narrow range of subject matter.

Quality evaluation

Evaluating and comparing the quality of text-to-image models is a problem involving assessing multiple desirable properties. A desideratum specific to text-to-image models is that generated images semantically align with the text captions used to generate them. A number of schemes have been devised for assessing these qualities, some automated and others based on human judgement.

A common algorithmic metric for assessing image quality and diversity is the Inception Score (IS), which is based on the distribution of labels predicted by a pretrained Inceptionv3 image classification model when applied to a sample of images generated by the text-to-image model. The score is increased when the image classification model predicts a single label with high probability, a scheme intended to favour "distinct" generated images. Another popular metric is the related Fréchet inception distance, which compares the distribution of generated images and real training images according to features extracted by one of the final layers of a pretrained image classification model.

List of notable text-to-image models

! Name! Release date! Developer! License
January 2021OpenAIProprietary
DALL-E 2April 2022
DALL-E 3September 2023
ImagenGoogle
Imagen 2December 2023[9]
PartiUnreleased
FireflyJune 2023Adobe Inc.
MidjourneyJuly 2022Midjourney, Inc.
Stable DiffusionAugust 2022Stability AICreativeML Open RAIL-M
RunwayML2018Runway AI, Inc.Proprietary

See also

Notes and References

  1. Web site: Rodriguez . Jesus . Edge#229: VQGAN + CLIP . 2022-10-10 . thesequence.substack.com . 27 September 2022 . en.
  2. Web site: Rodriguez . Jesus . Edge#231: Text-to-Image Synthesis with GANs . 2022-10-10 . thesequence.substack.com . 4 October 2022 . en.
  3. Web site: Stable Diffusion Public Release . 2022-10-27 . Stability.Ai . en-GB.
  4. Web site: Kumar . Ashish . 2022-10-03 . Meta AI Introduces 'Make-A-Video': An Artificial Intelligence System That Generates Videos From Text . 2022-10-03 . MarkTechPost . en-US.
  5. Web site: Edwards . Benj . 2022-10-05 . Google's newest AI generator creates HD video from text prompts . 2022-10-25 . Ars Technica . en-us.
  6. Web site: Rodriguez . Jesus . Edge#237: What is Midjourney? . 2022-10-26 . thesequence.substack.com . 25 October 2022 . en.
  7. Web site: Phenaki . 2022-10-03 . phenaki.video.
  8. News: Edwards . Benj . 9 September 2022 . Runway teases AI-powered text-to-video editing using written prompts . 12 September 2022 . Ars Technica.
  9. Web site: Imagen 2 on Vertex AI is now generally available . 2024-01-02 . Google Cloud Blog . en-US.