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:
- 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.
- 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.
- 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.
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.
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