[Paper Review] Improving Text-to-Image Synthesis Using Contrastive Learning
This paper proposes a contrastive learning framework to improve text-to-image synthesis by enhancing semantic consistency in both image-text matching and GAN training stages. By aligning textual representations of diverse captions for the same image and minimizing distributional variance in generated images, the method significantly boosts FID scores—by 29.60% on AttnGAN and 21.96% on DM-GAN over COCO—while improving IS and R-precision across datasets.
The goal of text-to-image synthesis is to generate a visually realistic image that matches a given text description. In practice, the captions annotated by humans for the same image have large variance in terms of contents and the choice of words. The linguistic discrepancy between the captions of the identical image leads to the synthetic images deviating from the ground truth. To address this issue, we propose a contrastive learning approach to improve the quality and enhance the semantic consistency of synthetic images. In the pretraining stage, we utilize the contrastive learning approach to learn the consistent textual representations for the captions corresponding to the same image. Furthermore, in the following stage of GAN training, we employ the contrastive learning method to enhance the consistency between the generated images from the captions related to the same image. We evaluate our approach over two popular text-to-image synthesis models, AttnGAN and DM-GAN, on datasets CUB and COCO, respectively. Experimental results have shown that our approach can effectively improve the quality of synthetic images in terms of three metrics: IS, FID and R-precision. Especially, on the challenging COCO dataset, our approach boosts the FID signifcantly by 29.60% over AttnGAN and by 21.96% over DM-GAN.
Motivation & Objective
- Address the challenge of linguistic variance in human-annotated captions for the same image, which degrades image generation quality.
- Improve semantic consistency in text-to-image synthesis by learning robust, invariant representations across diverse captions.
- Enhance the fidelity and diversity of generated images by applying contrastive learning during GAN training.
- Generalize the approach to be compatible with existing GAN-based text-to-image models like AttnGAN and DM-GAN.
- Demonstrate consistent performance gains across multiple metrics (IS, FID, R-precision) on CUB and COCO datasets.
Proposed method
- Pre-train image and text encoders using contrastive loss to align embeddings of multiple captions describing the same image.
- Apply contrastive learning to push together representations of fake images generated from semantically related captions of the same real image.
- Integrate the contrastive loss into the GAN training pipeline to minimize inter-sample variance for the same image while maximizing it across different images.
- Use a temperature-scaled contrastive loss with learnable hyperparameters λc and τ to stabilize training and improve representation quality.
- Leverage pre-trained image and text encoders to extract consistent features during GAN training, enhancing alignment between text and generated image features.
- Generalize the method to be plug-and-play with existing models like AttnGAN and DM-GAN without architectural changes.
Experimental results
Research questions
- RQ1Can contrastive learning reduce the impact of linguistic variance in captions on text-to-image generation quality?
- RQ2How does joint contrastive learning on image-text pairs and generated image pairs improve semantic consistency in synthesis?
- RQ3To what extent does the proposed method improve FID, IS, and R-precision compared to strong baselines like AttnGAN and DM-GAN?
- RQ4How sensitive is the performance to hyperparameters like λc and τ in the contrastive loss?
- RQ5Can the proposed contrastive learning framework be effectively generalized and integrated into existing GAN-based text-to-image models?
Key findings
- On the COCO dataset, the proposed method reduces FID by 29.60% compared to AttnGAN and by 21.96% compared to DM-GAN, demonstrating significant performance gains.
- The method improves R-precision by 2.25 points on CUB and 1.58 points on COCO when using both contrastive learning stages.
- FID scores on CUB improve from 15.55 (baseline DM-GAN) to 14.38 with the full contrastive approach, showing consistent improvement across metrics.
- The hyperparameter λc has a minor impact on FID, with the best performance at λc = 0.2 (FID = 16.34), while τ has a small but measurable effect, with τ = 0.5 yielding the lowest FID.
- The method maintains or slightly improves IS on most settings, with only a 0.55-point drop in IS on COCO with DM-GAN, indicating minimal trade-off in diversity.
- Ablation studies confirm that both contrastive learning stages—on image-text matching and GAN training—are necessary for optimal performance, with incremental gains at each stage.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.