Structure-Aware Generation Network for Recipe Generation from Images

Hao Wang, Guosheng Lin, Steven C. H. Hoi, Chunyan Miao

Abstract

The Structure-Aware Generation Network (SGN) improves automatic recipe generation by first predicting the "skeleton" or tree structure of a cooking procedure before writing the actual text. By using unsupervised learning to discover these structures, the model generates longer, more coherent, and more human-like recipes from food images and ingredient lists.

Introduction

Generating a recipe from an image is significantly more complex than standard image captioning. While a typical caption is a single short sentence, a recipe is a long-form paragraph requiring a specific logical flow. Traditional encoder-decoder models often struggle with this length, leading to repetitive or incomplete instructions. Furthermore, recipe datasets lack the structural annotations (like bounding boxes in object detection) necessary to help models understand the relationships between cooking steps.

Comparison between conventional encoder-decoder architectures and the proposed SGN framework.

Methodology

The SGN framework addresses these challenges by decomposing the generation process into three specialized modules that explicitly model the latent structure of recipes.

Detailed architecture of the SGN, illustrating the flow from images and ingredients to the final recipe via tree structure inference.
  • Recipe2tree (The Teacher): To overcome the lack of manual tree labels, this module uses an unsupervised approach. It extends Ordered Neurons LSTM (ON-LSTM) to perform sentence-level parsing, capturing the logical flow of a recipe by learning to identify correct sentence sequences.
  • Img2tree (The Planner): During inference, this module predicts the tree structure (represented as an adjacency matrix) directly from food image features using a Recurrent Neural Network (RNN).
  • Tree2recipe (The Writer): This module utilizes Graph Attention Networks (GATs) to embed the predicted tree structure. These embeddings are then integrated into a Transformer decoder along with image and ingredient features to generate the final instructional text.

Experimental Results

The model was evaluated on the Recipe1M dataset, the largest of its kind. SGN achieved state-of-the-art performance across several metrics:

  • Quality Improvement: When integrated with a BERT-based baseline, SGN increased the BLEU score from 9.29 to 12.75.
  • Recipe Length: Human-written recipes average 116 words. While standard models produced short, clipped recipes (avg. 66.9 words), SGN produced recipes averaging 112.5 words, demonstrating significantly better coverage of the cooking process.
  • Coherence: Qualitative results showed that SGN-generated recipes included more specific details and correctly identified ingredients visible in the images that non-structural models often ignored.

Discussion and Conclusion

A primary finding of this work is that unsupervised structure discovery is a powerful tool for long-form text generation. By forcing the model to learn latent hierarchies, it naturally captures the distinct phases of cooking. Additionally, the use of Graph Attention Networks (GATs) ensures that structural information is preserved by restricting attention to neighboring nodes in the tree.

Despite these gains, challenges such as redundancy and the "hallucination" of ingredients not present in the input list remain. Future research will focus on tighter integration of ingredient lists to ensure higher fidelity to the provided inputs and eliminate the generation of phantom ingredients.

Summary updated

BibTeX
@inproceedings{wang2020structure,
  author = {Hao Wang and Guosheng Lin and Steven C. H. Hoi and Chunyan Miao},
  title = {{Structure-Aware Generation Network for Recipe Generation from Images}},
  booktitle = {European Conference on Computer Vision},
  year = {2020},
  doi = {10.1007/978-3-030-58583-9\_22},
}
Figure