To address this issue, we propose a novel contrastive learning approach to improve the quality
and enhance the semantic consistency of synthetic images. In the image-text matching task, we pre-train an image encoder and a text encoder to learn the semantically consistent visual and textual representations of the image-text pair. Meanwhile,
we learn the consistent textual representations by pushing together the captions of the same image and pushing way the captions of different images via the contrastive loss.
The pre-trained image encoder and text encoder are leveraged to extract consistent visual and textual features in the following stage of GAN training. Then we also utilize the contrastive loss to minimize the distance of the fake images generated from text descriptions related to the same ground truth image while maximizing those related to different ground truth images. We generalize the existing text-to-image models to a unified framework so that our approach can be integrated into them to improve their performance. We evaluate our approach over two popular base models, AttnGAN [1]} and DM-GAN [2]} on datasets CUB [3]} and COCO [4]}. The experimental results have shown that our approach can effectively improve the quality of the synthetic images in terms of Inception Score (IS)  [5]}, Fréchet Inception Distance (FID) [6]}, and R-precisions [1]}.
