Recipe Generator Using Deep Learning
Recipe Generator Using Deep Learning
Recipe Generator Using Deep Learning
https://doi.org/10.22214/ijraset.2022.42321
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue V May 2022- Available at www.ijraset.com
Abstract: Finding new recipes daily with the ingredients in hand is a difficult task that leads to people looking at different recipe
websites and cookbooks.
But it is often not possible to find the recipe one is looking for with the constraint of ingredients. The objective of this paper is
to build a web application so as to cater to this specific problem faced by people. The proposed system takes ingredients as an
input and gives machine generatedrecipes with the help of deep learning to the user.
The recipe generated model will consist of title, ingredients and instruction reflecting the dataset used to prepare the model for
deep learning. The system also consists of interactive features in the user interface enabling the user to save and access the
generated recipe later on.
Index Terms: Recipe generator system, web application, cook- ing, deep learning , recipes, ingredients
I. INTRODUCTION
Everyone enjoys new, delicious, healthy food and prefers homemade meals over food brought from outside. But when it comes to
cooking we don’t want elaborate, long complex recipes instead we want quick, easy and efficient options. Even in terms of
obtaining ingredients, sometimes getting ingredients can be tough as we experienced recently in pan- demic. Hence, it is often
preferable to have recipes that use limited ingredients or to have recipes that match with personalavailability.
With the ever growing popularity of various cooking sites, blogs and books it is evident that people are always on a lookout
for innovative and interesting recipes.
It is alsoobserved that the use of online media and digital medium makes cooking more accessible.This gives us more reason to find
solutions to simple problems such as recipe generation using deep learning.
Cooking is considered no less than art, it is a creative process, procuring recipes consisting of the right combination of flavors. By
creating a recipe generator we can allow the creation of unique dishes with unique combinations, it is a system that combines deep
learning along with knowledge contributing to computational creativity. The system should be able to learn how to imitate human
creativity, to be able to generate a recipe.
In this paper, we propose a cooking recipe generator which will produce a recipe as output when the user inputs ingredi- ents. A
deep learning model is created and trained to generate the recipe. Our project focuses on creation of a number of unique and
creative recipes based on the ingredients enteredby the user, thus providing recipes as per the user’s ingredient availability.
1) Natural Language Generation: Natural Language gen- eration is a concept of producing text from data. In Recipe Generation it
can take some data and generate a recipe out of it. [13]OpenAI is a non-profit AI research company, and has built this model to
generate a para of text for industry usage. This model learns how to generate text by scraping each and every webpage. It is the
most popular NLG text generation model that is used to generate human-written like text.
2) LSTM: LSTM is short for Long Short Term Memory. It is an updated version of RNN which solves the problem of lowmemory.
While generating text, LSTM remembers the data for a longer period of time and has the ability to “remember” or “forget” the
information according to the importance. This is possible because of its architecture thus it is ideal for text generation.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 846
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue V May 2022- Available at www.ijraset.com
B. Project flow
Finding and gathering the most favorable dataset for the project in terms of content and size. Preparing the data to ensure it is ready
to feed into the model and developing the model using deep learning.
The project flow from the user end can be perceived as the following: The user interface consists of a text box to input a number
of ingredients, the input is processed into the back- end by the model and 3 different recipes will be displayed as output to the user.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 847
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue V May 2022- Available at www.ijraset.com
C. Use Case
The user inputs ingredients and receives system generated recipes. The signup and login feature enables the user to save the
generated recipes and retrieve them later from the favoritessection.
IV. IMPLEMENTATION
A. Dataset
For deep learning algorithms a large amount of data is required to train the model to perform well. Hence, a dataset that consists of
data from Epicurious and recipe box which were freely available online is used in this project. The dataset has a combination of
20k recipes along with ratingand nutrition from Epicurious and 125k recipes along with ingredients with proportions from Recipe
box. The dataset wasreduced to 3 attributes as title, ingredients and instructions (as in the procedure of the recipe).
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 848
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue V May 2022- Available at www.ijraset.com
5) Add padding to the sequence: [12]adding a stop word to the end of each recipe with the use of utility function and to make
them have the same length overall.
6) Split examples on ‘input‘ and ‘target‘ texts: creating a copy and forming the input and target texts.
C. Model Developement
Creating a text generation model using LSTM in keras tensorflow, making use of character based LSTM which essen- tially
generates the entire text by predicting the next character. Use of different hyperparameters helps find the best suited to approach for
next character prediction thus text generation. The number of layers used in the model development as well as the number of
training epochs set were found to be defining factors in model performance. The project also made use of different optimizer and
loss functions in order to improve the model performance.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 849
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue V May 2022- Available at www.ijraset.com
D. Result
For the minimization of loss a number of changes were made in terms of layers, epochs, learning rate, optimizers and loss functions.
We made use of different optimizer namely Adam optimizer and RMSProp that were trained and tested against different epochs, no
of steps, learning rate to gauge the respective loss and accuracy so as to develop the most accurate model. Use of Adam optimizer
with 500 epochs and learning rate 0.0005 resulted in the least loss.
Once ideal parameters were set and valid output was gen- erated by the model, it was deployed into a web application.
V. CONCLUSION
We were able to develop and deploy a recipe generator that is able to generate a logically sound, valid with semantic mean- ing
recipes. The project enabled understanding the changes in output affected by the change made in hyperparameters. After
successful creation of the model generating seemingly precise model we can move ahead to the next step of adding features to
enhance user interactions.
In future the model can make use of pre-trained transformers for definite and cohesive text generation thus correcting the model
prediction and accuracy. Furthermore to make the project ideal and efficient other filters for searching along with search by
ingredients can be added, such as search by image, search by cuisine type, health monitoring of recipes generated. Adding another
approach to recipe generation such as recipe generation from title rather than ingredients, can be an innovative direction to
recipe generation using deeplearning.
VI. ACKNOWLEDGEMENT
We would like to express gratitude towards our guide Prof.Sonali Bodekar-Kale of Usha Mittal Institute of Tech- nology for their
support and mentorship in completion of our project on Recipe Generation using Deep Learning. Our sincere appreciation to our
examiners from Computer Science and Technology Department for their valuable encouragementand insightful inputs.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 850
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue V May 2022- Available at www.ijraset.com
REFERENCES
[1] Florian Pecune,Lucile Callebert,Stacy Marsella, ”A Recommender Sys- tem for Healthy and Personalized Recipe Recommendations”,University of Glasgow,
Scotland:UK,September 2020.
[2] Keiji Yanai, Takuma Maruyama and Yoshiyuki Kawano,”A Cooking Recipe Recommendation System with Visual Recognition of Food In- gredients”, The
University of Electro- Communications,Tokyo:Japan,in 2014.
[3] Lu´ıs Rita ,”Building a Food Recommendation System”, Imperial College London ,in March 2020.
[4] Neha Setia,”Generate recipes using multi-ingredient aware LSTM”,July 12, 2019.
[5] Michał Bien´, Michał Gilski, Martyna Maciejewska, Wojciech Tais- ner,”Cooking recipes generator utilizing a deep learning-based language
model”,February 2020.
[6] Mikael Davidsson,”Using machine learning to generate recipes that actu- ally work Cooking with data science”, Apr 26.
[7] Amaia Salvador, Michal Drozdzal, Xavier Giro-i-Nieto, Adriana Romero,”Inverse Cooking: Recipe Generation from Food Images”,June 16, 2016.
[8] Laura Ana Maria Bostan,“Ingredient-driven Recipe Generation Using Neural and Distributional Models”,17 July 2017.
[9] Rebecca Coulson ,”Generating a Dessert Ingredients List Using NLP”,February 14, 2021.
[10] Chloe Kiddon, Luke Zettlemoyer,Yejin Choi,”Globally Coherent Text Generation with Neural Checklist Models”,[nd].
[11] https://www.tensorflow.org/api docs/python/tf/keras/preprocessing/text/ Tokenizer
[12] https://www.tensorflow.org/api docs/python/tf/keras/preprocessing/sequence/ pad sequences
[13] Mike Kaput,Natural Language Generation (NLG): Everything You Need to Know,April 20th,2022.
©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 851