KG-GAN: Knowledge-Guided Generative Adversarial Networks

Che-Han Chang, Chun-Hsien Yu, Szu-Ying Chen, Edward Y. ChangarXiv 2019

Abstract

Can generative adversarial networks (GANs) generate roses of various colors given only roses of red petals as input? The answer is negative, since GANs' discriminator would reject all roses of unseen petal colors. In this study, we propose knowledge-guided GAN (KG-GAN) to fuse domain knowledge with the GAN framework. KG-GAN trains two generators; one learns from data whereas the other learns from knowledge with a constraint function. Experimental results demonstrate the effectiveness of KG-GAN in generating unseen flower categories from seen categories given textual descriptions of the unseen ones.

Introduction

Standard Generative Adversarial Networks (GANs) are highly effective at mimicking training data distributions but struggle to generalize beyond them. If a GAN is trained exclusively on red roses, its discriminator learns a narrow definition of the category. Consequently, any attempt by the generator to produce a yellow or blue rose is rejected as "fake." This limitation hinders applications in fields like medical imaging or rare species classification where data for every possible variation is unavailable. KG-GAN addresses this by leveraging external domain knowledge—textual descriptions converted into semantic embeddings—to guide the generator in producing "unseen" categories that a standard discriminator would otherwise stifle.

Methodology

The KG-GAN architecture, built upon the stable Spectral Normalization GAN (SN-GAN), introduces three primary innovations to enable zero-shot image generation:

  1. Dual Generators with Shared Weights: The framework employs two generators, $G_1$ and $G_2$. While $G_1$ learns from available "seen" training data, $G_2$ is dedicated to generating "unseen" categories. By sharing weights, $G_2$ inherits the structural and textural foundations learned by $G_1$, applying them to new semantic contexts.
  2. Semantic Embeddings: Instead of discrete one-hot labels, KG-GAN uses continuous semantic embedding vectors derived from textual descriptions (using fastText). This allows the model to mathematically understand relationships between categories—for instance, recognizing that a "pink" flower is closer to a "red" one than a "blue" one.
  3. Knowledge-Guided Constraint Function: An embedding regression network ($E$) acts as a "knowledge coach." It evaluates whether a generated image matches the characteristics described in its semantic embedding. A specialized Semantic Embedding Loss ($L_{se}$) is added to the objective function, encouraging the generator to adhere to domain knowledge even when the discriminator lacks a reference point.
The KG-GAN architecture featuring dual generators (G1, G2), a discriminator (D), and an embedding regression network (E) for knowledge guidance.

Experimental Results

The model was evaluated using the Oxford Flowers dataset (102 categories), with 82 categories used as "seen" data and 20 reserved as "unseen."

Quantitative Performance

KG-GAN achieved an Unseen Fréchet Inception Distance (FID) of 0.1386, significantly outperforming a baseline KG-GAN using one-hot labels (0.6286). This highlights the critical role of semantic embeddings in navigating the image manifold for zero-shot tasks. Ablation studies further showed that even without the explicit $L_{se}$ loss, the use of embeddings alone provided a strong signal for generation (FID 0.1408).

Qualitative Analysis

Qualitatively, the model successfully generated flowers with accurate colors for unseen categories, such as the Orange Dahlia. The shared weight mechanism allowed the model to transfer structural knowledge (how to build a "flower") while the semantic embeddings guided the specific color and textural shifts required for the new category.

Qualitative results showing generated flower images across various categories, demonstrating the model's ability to produce diverse and recognizable floral structures.

Discussion and Limitations

While KG-GAN excels at capturing color-based domain knowledge, it faces challenges with complex geometric structures. Textual descriptions often provide rich color vocabulary but lack the precision needed to describe intricate fractal petal geometries. Furthermore, the process of averaging hundreds of fastText vectors per category can "blur" structural details. Future research will focus on developing richer semantic representations that better encode spatial and structural information to improve the realism of generated unseen categories.

Summary updated

Abstract

Can generative adversarial networks (GANs) generate roses of various colors given only roses of red petals as input? The answer is negative, since GANs' discriminator would reject all roses of unseen petal colors. In this study, we propose knowledge-guided GAN (KG-GAN) to fuse domain knowledge with the GAN framework. KG-GAN trains two generators; one learns from data whereas the other learns from knowledge with a constraint function. Experimental results demonstrate the effectiveness of KG-GAN in generating unseen flower categories from seen categories given textual descriptions of the unseen ones.
BibTeX
@misc{chang2019kg,
  author = {Che-Han Chang and Chun-Hsien Yu and Szu-Ying Chen and Edward Y. Chang},
  title = {{KG-GAN: Knowledge-Guided Generative Adversarial Networks}},
  year = {2019},
  eprint = {1905.12261},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1905.12261},
}
Figure