Introduction
Generating classical Chinese poetry is a sophisticated task that requires not only linguistic creativity but also strict adherence to structural and rhythmic constraints. While AI has made strides in text-to-poetry generation, translating visual "inspiration" from an image into a coherent poem remains a significant challenge. This paper introduces the Memory-based Image to Poem Generator (MIPG), a framework designed to bridge the gap between visual features and poetic expression while maintaining thematic consistency.
The Challenge of Classical Poetry
A standard classical quatrain (jueju) is a high-stakes "constrained optimization" problem. It requires exactly four lines of five or seven characters, specific rhyming schemes, and strict tonal patterns known as Ping (level) and Ze (oblique).
Beyond structural rules, image-to-poem generation faces the hurdle of "topic drift." Previous models often failed to maintain a consistent theme across all four lines, starting with one visual element (e.g., a mountain) and ending with an unrelated concept. Furthermore, images contain nuanced "artistic conceptions" (yijing) that simple keyword prompts cannot fully capture.
The MIPG Architecture
The proposed MIPG framework utilizes an Encoder-Decoder architecture augmented by a specialized memory component to ensure thematic coherence and visual relevance.
1. Image-based Encoder (I-Enc)
The encoder extracts two types of information:
- Visual Features: A pre-trained VGG-19 network identifies local visual features, capturing the "vibe" and artistic conception of the image.
- Semantic Features: A bi-directional Gated Recurrent Unit (Bi-GRU) encodes previously generated lines, allowing the model to maintain context across the poem.
2. Topic Memory Network
The core innovation is the Topic Memory Network. Instead of relying on a static keyword, the model uses the Clarifai API to extract a large pool of keywords from the image. These are stored in a memory network, allowing the decoder to dynamically query relevant concepts for every character generated.
3. Memory-based Decoder (M-Dec)
The decoder uses an attention mechanism to select the most relevant keywords from the memory network at each step. By adding a "topic bias" to the output probability, the model is encouraged to choose characters semantically linked to the image, effectively preventing topic drift.
Data and Training
To train such a complex model, the researchers compiled a massive dataset of image-poem pairs. By automatically matching 68,715 images with 65,559 quatrains based on shared keywords, they generated a training set of approximately 2.3 million samples. This scale allows the model to learn the intricate relationships between visual elements and poetic vocabulary.
Experimental Results
The MIPG model was evaluated against several baselines (SMT, RNNPG, PPG) using both automatic metrics and human expertise.
- Human Evaluation: 18 experts rated poems on a 1-10 scale. MIPG achieved superior scores in Poeticness (8.30), Fluency (7.69), and Coherence (7.07).
- Thematic Consistency: MIPG showed the most significant improvement in matching the image's theme, scoring 6.70 compared to the next best model's 5.41.
- Keyword Recall: The model successfully incorporated key concepts from the images at a rate of 58.8%, nearly doubling the performance of previous keyword-based methods.
Conclusion and Future Work
The MIPG framework demonstrates that combining deep visual features with a dynamic Topic Memory Network significantly improves the quality and consistency of image-inspired poetry. While the model excels at structural and thematic tasks, future research will focus on capturing deeper "human" philosophical insights and expanding to other poetic genres like Song iambics.
Summary updated