Keywords

1 Introduction

The existence of food and dietary-related content on the Internet has become notable in recent days. In addition to the massive amount of images on social networking sites, the usage of online mediums as a source for eating habits and diet intakes is enlarging rapidly. With the enormous number of existing information, finding the proper intake for the diet becomes a hectic task. The nutritional food recommender systems, a subclass of food recommender systems, have been designed to give assistance in providing users with nutritional facts and dietary plans for targeted diet intakes and also disease-specific diet plans that helps the users to accommodate their preferences and also identifies the problems present in the existing food recommender systems [1]. Recently the food intakes and dietary plans are suggested mostly by online recommender systems that help to filter the data based upon user-given input or their concerned dietary requirements [2].

A food recommendation system can simply be defined as a software tool that takes a very large and complex amount of data such as images and user input data, analyzes it, and gives the output based on the selected choice by the user [3]. Recommender methodology is extensively used in various online platforms especially e-commerce websites.

In this paper it is implemented within the platform of health and nutrition. In the year 2016 the World Health Organization (WHO) evaluated that worldwide there were 39% of adults suffering with obesity and 13% were overweight [4]. Obesity will lead to many diseases including heart diseases, lung diseases, blood pressure, and gastric trouble and also many other cardiac problems. A nutritious and balanced dietary habit plays a crucial role in balancing and maintaining the overall well-being of a person [5].

Many studies have been carried out on the effectiveness of the dietary intake systems. It has been improvising by experimenting with various object detection, pattern detection, and image processing methodologies to spontaneously identify the food varieties. In this technique comprehensive food images dataset help to regular meal consumption report for each person depending on the detection and recognition of food images. The examination of food images is considered as a difficult work due to the various parameter.

2 Literature Survey

Food detection and recommendation system have implemented and advanced through various technology and diverse methodologies [6]. In this paper they utilize AHP Sort as multiple-criteria result investigation means for refining out meal, meat, and snack among these foodstuffs which are unhealthy for the user to intake, and it also covers an optimization-based level for creating an everyday diet forum whose ultimate aim is to recommend the foodstuff which is likely selected by user. This work presents a normal structure for every day diet strategy suggestions, absorbing as important aspect the parallel maintenance of nutritional aware and preference aware data, in variation of the previous effort which neglects this international angle.

But this work requires a heavy processor for processing data and requires more memory to save different datasets. The similar work has implemented using neural networks. This analysis groundwork is concentrated on developing machine and deep learning algorithms as logistic regression, naive Bayes, recurrent neural network (RNN), multilayer perceptron (MLP), gated recurrent units (GRU), and long short-term memory (LSTM). This journal offers a deep learning quick fix for health infrastructure medicinal dataset that naturally find whatever food to be given to respective patients based on their illness and remaining lineaments like elderliness, gender-specific, weight, calories, etc., but if a person is not having any health problems or diseases, this system cannot give any recommendations for him/her [7].

Further implemented research mainly focuses on the detection process which implements the same kind of methodology as this research. In this paper, deep learning has been widely used as an efficient image recognition method, and CNN is the contemporary approach for deep learning to be implemented. It will just recognize the food image based on the datasets that they trained before, but it cannot tell you the nutritional values, and also, we cannot give our health issues/conditions in this system.

3 Neural Network Model

A neural network model consists of hidden layers, input layer of neurons, and also output neurons [8]. This research uses multilayered architecture that helps to give more accurate and efficient results.

Multilayered neural networks are suitable for real-world applications and complex situations. Implementation of multilayered architecture takes lot of efforts in real-world scenario [9]. The multilayered and artificial neural networks together demonstrated for the functionality of deep learning [10].

Deep learning follows unsupervised learning that has the capability to take unstructured and unlabeled data [11]. Initially it makes a decision by itself and sends the node information forward based on the previous node information. Figure 1 shows the neural network model [12].

Fig. 1
figure 1

Architecture of neural network

The data in the network must be trained by providing a set of input images. These researches acquired images resources from Kaggle datasets and analyze the data using a model to get the output. Neural networks are showed with respect of layers used for implementing the input and outputs [13]. The convolution neural network (CNN) is expressed as a prominent methodology used for any kind deep learning and classification techniques. It comprises of many hidden layers, termed as convolution layers. This model uses the following layers such as conv_2d, maxpooling, dropout, and flatten.

Conv2d layers generate a convolution kernel that is convolute along with layer input to build a tensor of outputs. The layer1 conv2d_4 takes 416 parameters, and the output volume is 49 × 49 × 32. The max pooling layer is essential to subsample the recognition of characteristics in maps. Layer 2 max_pooling2d_4(MaxPooling2) takes no parameters, and output volume is 24 × 24 × 32. The third layer conv2d_5 takes 8256 parameters and the output shape.

Volume contains 23 × 23 × 64. Layer4 maxpooling_2d_5 takes zero parameters; it has output volume as 11 × 11 × 64. The fifth layer conv2d_6 accepts 32896 parameters and gives output volume as 10 × 10 × 128. Sixth layer max_pooling_2d_6 takes 0 parameters that has output volume as 5 × 5 × 128. Drop out is an important regulation method when we are providing large amounts of data that helps to minimize training of huge numbers of neural networks with various constructions in lateral form. It also gives support to the approximation of analyzing the image datasets. Flatten function helps to change the pooled feature map to a single column that moves to the wholly attached layer.

The seven layer takes zero parameters which has output volume as 5 × 5 × 128. Layer8 takes 0 parameters and has output volume as 3200. Dense layer is a common fully connected neural network layer. It is the most frequent and routinely used neural network layer [14]. It follows a set of input and returns the output. Layer 9 has dense_4 that takes 204864 arguments and gives output shape as 64. Dense_5 is the tenth layer that takes 1040 parameters and gives output as 16. The last and final layer dense_6 has 68 parameters and gives output shape as 4. There are 247,540 total trainable parameters involved in this model. The images are collected from Kaggle datasets. 20 epochs are used to train images in the datasets. The following figure represents the flow of the model which mainly consists of six phases.

Data preparation can also be termed as data preparation in terms of neural networks. Data cannot be utilized directly. The initial data taken from the web is termed as raw data which is unusable for model preparation. Neural network model accepts only numbers that are stored in the form of matrices. The raw data converted into gray level in two dimensional and raw data converted into RGB levels in three dimensional. The movement of the neural network is described as follows

$$ Q\left(\omega \right)=\sum \limits_{i=1}^n Qi\left(\omega \right)=\sum \limits_{i=1}^n{\left({\hat{y}}_i-{y}_i\right)}^2=\sum \limits_{i=1}^n{\left({w}_1+{w}_2{x}_i-{y}_i\right)}^2. $$

The proposed methodology selects convolution neural network models which have both 1d and 2d neural networks. This neural network model is created using stochastic gradient descent (SGD) algorithm. SGD irregularly collects data point through the entire set of data et at every cycle to minimize the computations immensely. Model training was carried out using Kaggle. There are almost 8000 images present in the dataset out of which 80% images are used for training and 20% of images are used for testing. Model validation has carried out through a set of tested images on a webpage. Finally the model has deployed through a dedicated website implemented mainly using web technologies such as html, CSS, java script, and also nodes in Fig. 2.

Fig. 2
figure 2

Proposed model creation

4 Experimental Results

The experiments are performed on core-I3 system using anaconda-Spyder idea with 8 gb ram of computer 1.6 GHz processor is used for experimental setup. Data used in this experiment has taken from Kaggle community open source datasets. The dataset used in this project is named as fruit image for object detection. Figure 3 represents a graph that shows testing and training accuracy performance graph. The blue color represents the training accuracy, and orange color represents the value of accuracy. Figure 4 represents the accuracy loss of trained data. The blue line represents the training loss, and orange line represents the value loss. Figure 5 represents the detected model through neural network model. Here we detected apple as an object in Fig. 6; Figure 7 represents the model deployment in the website to get user preferences diet system.

Fig. 3
figure 3

Accuracy performance (test/train)

Fig. 4
figure 4

Detected fruit through model

Fig. 5
figure 5

Web interface for food selection

Fig. 6
figure 6

Selection of food varieties

Fig. 7
figure 7

Nutritional chart

5 Conclusion

In this paper, we implemented a CNN model using artificial neural networks and deep learning. Detection of images has converted into binary image using an 11-layered neural network model. Neural network model implemented through a set of images collected from Kaggle almost 8000 images were collected to test and train the data. The network mainly used 1d feed forward neural network and 2d neural networks.

The model takes SGD algorithm which gives accuracy rate as 83%. All the detection and nutritional facts displaying process have been implemented through a dedicated website.

To conclude this paper is a unique recommendation system that targets nutritional values of users. They can create their own diet plans according to their requirements. For further work, this model can be implemented with mixed food items.