Performance Analysis of ResNet50 and Inception-V3 Image Classification for Defect Detection in 3D Food Printing

— In the future, 3D food printing may be a fruitful area for the food industry. The presence of this technology opens the public's eyes to a revolution in the food sector, where food processing is limited to the conventional. The existence of this technology will also make food production much more effective and efficient. However, there is a problem when the 3D Food Printing process is carried out; when object defects occur, there will be material waste. This research proposes deep learning-based defect detection for defect and non-defect objects. This model mainly uses CNN as a deep learning method. The dataset is taken from the image of the print process performed at the time of object creation to be trained and validated to check the effectiveness of the proposed model. The architecture used uses pre-trained CNN models namely Inception-V3 and ResNet50 with the hope of classifying images that have a higher viscosity of the material. Where the model has been tested with previous datasets and applied with 3D Food Printing datasets with a dataset division ratio of 85% which is training data and 15% is validation data. After testing the two proposed scenarios, the accuracy result obtained in the test model scenario 1, Inception-V3, is 84.62% and for the test model scenario 2, ResNet50, the accuracy is 93.83%. The outcomes also demonstrate that improved accuracy, loss, and classification time may be obtained by applying CNN in conjunction with data augmentation.


I. INTRODUCTION
Perfection in the form of food is essential for every industry in the food industry.Good service in terms of food perfection is a crucial factor in getting the primary response from customers.3D Food Printing is here to support food technology innovation in all elements.Experts have predicted that 3D food printing will become a part of culinary life, both in restaurants and at home [1].
The manufacturer also claims that, unlike mass-produced industrial food products, 3D Food Printing will truly improve human nutrition, allowing every human to print fresh and healthy food right in the kitchen and with maximum transparency with minimum time and effort [2].The shape characteristics of 3D Food Printing objects are also important for object recognition.Various deep learning algorithms can be used to recognize 3D Food Printing objects with shape, texture, and other features to have good detection capabilities and high accuracy.The remote monitoring system in the 3D printing process is also a problem in addition to the perfection of the shape of the food printed by the 3D Food Printer machine [3].When the automation process is executed, the tendency to avoid defect detection can be done.Although extrusion-based 3D food printing technology has advanced in the past decade, food layer interlayer imperfections such as delamination and warping are still dominant when printing complex parts.
A self-monitoring system was created to categorize various degrees of delamination in food printing using real-time camera images and deep learning algorithms.In addition, a new method incorporating strain measurement was established to measure and predict the onset of warping [4].Without human intervention, this self-monitoring system can also evaluate other production processes to achieve autonomous calibration and pre-diagnose defects.Materials are the focus when a monitoring system for defect detection is needed-early detection of food-printed objects, making the efficient provision of food goods.Several studies show that deep learning models can detect various levels of delamination [5] and successfully determine the level and trend of defects before they occur in food object prints.Many studies have been done on defect detection in conventional 3D printing, especially with the help of artificial intelligence technology that begins with computer vision methods [6].Baumann and Roller [6] conducted research with computer vision to detect fault diagnosis; Baumann divided the defect classification into 5 parts, of which 3 were successfully detected with false positives with a 60 to 80 percent detection rate.
Research conducted by Baumgartl et al. [7], observing the printing process with delamination features obtained an accuracy of 96.80%.Then in research conducted by Kadam et al [3], a machine learning model was used to detect faults with SVM, KNN, Random Forest, Decision Tree, and naïve Bayes algorithm models where the highest accuracy uses the SVM model with 99.70%.Research conducted by [8] improved print results were achieved by analyzing 3D printing fault detection using augmentation data on a Convolutional Neural network (CNN), which had an accuracy value of 95.45% using private datasets.
So, from this, various research studies were conducted on detecting new defects carried out with conventional 3D printing, and no one has used a 3D food printing machine.Also, because of the voids that occur in 3D Printing [9], voids can also be included in the types of defects in 3D Food Printing.In 3D Food Printing, defects obtained in the printing process are less than in ordinary 3D Printing.This is due to the different types of materials used.In 3D Printing, with the kind of Polylactic Acid (PLA) material, defect problems often occur, namely warping [10], under extrusion, and over extrusion.Etc.Research conducted by [11] conducted defect detection in 3D Food Printing, but in detail, the technology used to detect defects does not yet exist.The research undertook only mitigation strategies and characteristic properties of defects in 3D Food Printing.Therefore, our research will perform a defect detection process with deep learning to obtain classification results and accuracy values, which can help monitor the printing process in 3D food printing.

II. MATERIALS AND METHOD
The research method in this study is shown in Figure 1.This study has seven main stages, starting with making the formation setup and then performing the printing process on 3D food printing with chocolate material.Next, we take the image dataset during printing with defect labeling detection from the Obico plugin on the camera captured at one side of the corner.After that, the image is preprocessed by resizing the dataset and dividing the process data by the training and validation data.In the next stage, the image will be trained using Inception-V3 and ResNet50 models to get maximum results, and in the final stage, the model evaluation will be carried out.

A. 3D Food Printing Material
By adding fruits, vegetables, and other vitamin sources in between the layers created, 3D printing can also encourage the general public to consume these foods.This way, the food products will be strengthened with nutrients without the consumer noticing them [12]Though 3D food printing has progressed significantly recently, many obstacles remain in the areas of printable ingredients (the printing technique limits the types of food that can be printed), process (the process is prolonged for mass production), and consumer perception (very few people know about food printing and tend to reject it) [13].The search for suitable food materials and the adjustment of their printing parameters are the main topics of many of the published studies on 3D food printing [14], [15] The experiment was conducted using a 3D Printer machine the Ender 3, plus a food extruder tool that can remove printed objects, namely the luckybot extruder.A camera is used to monitor defect detection that occurs in the printing process [16].

B. Setup Formation
Fused Deposition Modeling (FDM) is the 3D printing technology employed in this research, and the food 3D printer used is the 3D Printer Ender 3. The Luckybot food extruder, an additional food printing device, is combined with the 3D printer.The printer head, nozzle replacement, and motor cable transfer on the Ender 3D Printer machine's motherboard are among the components disassembled throughout the machine construction process.It should be noted that our suggested approach is currently limited to the printer and printing procedure described above.Using cameras to take photographs at certain checkpoints, the pieces that are 3D printed are monitored [17], [18].Raspberry Pi also helps the connection between monitoring devices to detect PCs with LAN/Wi-Fi networks, from camera capture directly controlled through octoprint software.The Internet of Things is integrated with the camera setup procedure, as depicted in Figure 3, and brown printing material was employed for this investigation.Chocolate is an excellent substance for the 3D food printing machine's extrusion concept [19].The differences significantly influence the quality of the product printed with both materials in their mechanical qualities [20].Code to automate real-time printing process monitoring has been developed using the Obico and Octoprint applications [21]Throughout this investigation, we kept the same setup for 3D food printing.Some tests were carried out first by taking images of the 3D printing process, taking into account the impacts of lighting conditions.

C. Printing Process
The images taken for analysis underwent a molding process with a nozzle temperature of 200°C, sufficient to extract the required chocolate ingredients, and a food extruder temperature of 35°C.For the bed temperature, a temperature of 50°C is required so that the attachment process between the chocolate material and the bed is strong.So that the printing can have a good shape according to the design.Human resources and operators have a significant impact on the printing process since different operator skills will result in higher-quality prints [22].As shown in Table 1 using the XYZ direction pattern, 3D Food printing follows the direction of the Gcode command during the printing process, so alignment between the design command and the Gcode command is needed.In this printing process, defects occur that can cause material waste.The accuracy level of these defects will be analyzed.
This research takes the dataset from scratch by capturing data from the ongoing printing process.With the Obico plugin tool and eye observation, the dataset is captured by video recording.Then, the image is broken into frames and analyzed by deep learning.Therefore, transfer learning techniques are used in the classification process.Transfer learning is one of the solutions to overcome data limitations when classifying images using deep learning [23].One transfer learning process is using a pre-trained model to build a new CNN architecture.In this research, two pre-trained models were used, namely Inception-V3 and ResNet50.The two pretrained models were chosen because they can build CNN models on devices with limited resources [24].
This study compares the performances of the Inception-V3 and ResNet 50 models.To increase its accuracy, the architecture of the pre-trained model was altered.The neural network layer's hyperparameter tuning was used to make changes.The research's difficult task is choosing the correct parameter values to create a reliable model for mobile device picture categorization.
2085 data is taken to perform the defect detection process on 3D Food Printing.15% of the dataset is used for testing, while 85% is used for training.This percentage indicates 1773 images in the training set and 312 in the testing set.Datasets are grouped into defects and no defects.The skin disease dataset is displayed.The defective 3D Food Printing dataset can be seen in Figure 3.The dataset is taken while the print process runs and detected by the Obico plugin if a defective object occurs.For every image recording that arises with a defect label, the researcher takes the data from the frames of the recording to be used as a dataset.The 2085 data taken are heterogeneous data from the chocolate printing process in 3D Food Printing.In this research, the dataset consists of several variables formed from materials and is grouped into several classes.The surface shape and object shape, as in Table 2, are very influential on image detection because they can affect the precision and accuracy of results when optimized.

D. Pre-processing Process
The most challenging step in the procedure is preprocessing because the data must be normalized.Uniform image resolution is how the normalizing process is completed.The steps completed in mage Resizing, localization, augmentation, and labeling are examples of pre-processing [25].An image prepared for vector processing is the end product of pre-processing.

1) Resize Image:
The dataset consists of various-sized images.As a result, the image size must be equalized to facilitate robot object recognition.This study resizes the image so that all processed images have the same 224x224 size.
2) Image Augmentation: Five augmentation strategies have been used to expand the quantity of datasets.Some augmentation techniques include rescaled, rotation, zoom, horizontal flipping, and random shift.Through augmentation, a new image with the same features as the original is created [26].
3) Image Splitting: Following the pre-processing phase, the image has a consistent size and shape format, ready for further processing throughout the feature extraction procedure.Photos must be divided into training and validation sets to speed up the model validation procedure and begin feature extraction.The training and validation sets are compared at 85% versus 15%.
Strong normalization is needed to overcome imbalanced data in the pre-processing stages above.In this research, every data captured from the camera, the camera capture process indeed uses good angle capture techniques to get high-quality image data.The 3 points above, namely resizing the image, image augmentation image, and splitting, are enough to overcome the slightly imbalanced data.

E. Model Architecture
This research uses the pre-trained learning CNN model, using model because the pre-trained model can detect previous models that at least have knowledge that can be utilized to detect other objects [27].For example, the model already knows which objects are background which are trees, and which are not.We transfer that knowledge to new needs.Therefore, we still need to train again (although most training processes are much faster because the model is already a bit smarter).
Transfer learning is a deep learning technique that reuses a previously prepared model to train a new model for a related problem [28]A convolutional neural network with 50 layers of depth is called ResNet-50.The three picture blocks that makeup RestNet-50 are the architecture: a convolution block (in the middle) that modifies the input dimensions and an identity block (on the right) that does not.[29] CNN is a kind of selective deep architecture made up of a pooling layer and a convolution layer on top of each other to create a deep model [30].Including a crucial element known as an inception module sets the Inception-v3 apart from networks like LeNet and VGG [31].This module makes use of receptive kernels in various sizes.Zero padding maintains consistency in the convolution operation's output size.By using filter concatenation, the final feature maps are produced.Richer features are extracted from the input image with the aid of the inception technique.An inception network's structure is displayed in Table 3. Deeper networks can be trained with the residual network pretty effectively.As Table 4 illustrates, the concept of "identity shortcut connection" was established by ResNet [32].
Consequently, we can create a residual form of a deep network by injecting shortcuts.Eq. ( 1) can be used to introduce identity shortcuts when the input and output have the same dimension where F(x,{ }) represents the residual mapping and x, y represents the input and output vectors.Gradients in ResNet can backpropagate to the prior layers via skip connections.The numbers of the building blocks for each of these structures are layered and displayed in brackets.ResNet50 is a residual network that consists of 50 layers.

F. Model Evaluation
Accuracy, precision, recall, and F1 scores are computed using the confusion matrix in this study to assess model performance.Confusion matrix normalization offers more details on the relationships between classes and kinds of classification mistakes [33].
,-. / 01 2 3-.455 ,-./ 01 2 3-.455 (5) Furthermore, all experiments were recorded.The experimental results were analyzed to determine the most accurate (highest accuracy), lightest (fastest training and testing time), and most efficient (best combination of all metrics) model, as well as the image augmentation that most significantly improved the model's performance.

A. Testing The Use of Learning Rate
The learning rate is one of the training parameters to calculate the weight correction value during the training process [34].This learning rate value ranges from zero (0) to (1).The training process will proceed more quickly the higher the learning rate value.The network will be less accurate the higher the learning rate, and vice versa; if the learning rate is lower, the network's accuracy will be higher or rise, which will lengthen the training process.Tables 5 and 6 are the results of comparing models generated from 4 different learning rates.Based on Table 6 above, the learning rate value is not too small to get good accuracy.The dataset is very influential based on the test results, from image preprocessing and algorithm analysis.

B. Training and Validation Results using Inception V3
Inception-V3 architecture was used in the model's development for the training and validation phases.The data is divided into training and validation sets with a learning rate of 0.0005, with a total of 2085 training sets comprising both defect and non-defect images.There are 1773 images utilized for training in the training and validation stage, where the ratio of training data to validation data is 85:15.To validate the relationship between epochs and the accuracy and loss that resulted from the training stage, a total of 312 pictures were employed.The curves displayed in Figures 4 and 5 display the corresponding validations.

D. Comparison of Accuracy Results
Based on the results of accuracy, Precision, Recall, and F-1 Score, the ResNet50 Model has the highest accuracy of 93.83% compared to Inception-V3, which only has 84.62%.In Table 7, ResNet50 also achieves the highest Precision with 96.84%.Another influencing factor is the shape of objects, which is difficult to analyze by Inception-V3 and very easy to analyze by ResNet50, especially with datasets sourced from printed materials with high viscosity.Table 8 shows the results of this study compared to previous research with a higher accuracy value than last research, with a value of 96.80% [7].This is because the materials and methods used are very different.Suppose Hermann Baumgartl's research uses conventional 3D printing with laser powder bed fusion.This research uses 3D food printing with a distinct chocolate material and a higher viscosity than PLA or ABS 3D printing materials.
Also, in the concept research of [8], with an accuracy value of 95.45%, the printout was perfected by analyzing 3D printing fault detection using data augmentation on Convolutional Neural network (CNN) using private datasets.However, it also uses ordinary filament material, which is materially quite good with a level of difficulty, unlike 3D Food Printing.

IV. CONCLUSION
Based on the results, the first test model, ResNet50, obtained an accuracy of 93.83%, higher than the test model scenario of test model 2, Inception-V3, which is 84.62%.The shape of 3D food printing between defects and non-defects looks identical.Still, in this study, they can be distinguished with the help of a trained system using the Convolution Neural Network (CNN) algorithm, even though the dataset image material has a high viscosity.Numerous factors affect the outcome, such as the distribution of the splitting ratio, the number of layers, the number of inputs, and the balance of the datasets used.The same study topic and dataset should be used in future research, and the CNN algorithm should be modified by attempting to combine the CNN model with transformers to achieve the best possible outcomes.Another research opportunity is the application of this pre-trained learning algorithm to other 3D printing objects, such as 3D buildings, which also need optimization techniques for defect detection in the future.

Fig. 1
Fig. 1 Flowchart of the research method

Fig. 4
Fig. 4 The Validation Accuracy using Inception-V3 Inception-V3 accuracy results on training data are shown on the blue line, while validation uses red.These results show that the best learning rate gets an accuracy value of 84.62% with 26 epochs.

Fig. 5
Fig. 5 The Validation Loss using Inception-V3 C. Training and Validation Results Using ResNet 50 The model further uses the ResNet50 architecture in the training and validation stages.With a learning rate 0.0001, the data is also grouped into training and validation data, each totaling 2085 training data consisting of defect and non-defect images.Like the Inception-V3 model, the training and validation data ratio is 85:15, and 1773 images were used for training.As demonstrated in Figures 6 and 7, 312 images were used for validation to examine the link between epochs and the accuracy and loss that resulted from the training and validation stages.

Fig. 6
Fig. 6 The Validation Accuracy using ResNet50 ResNet50 accuracy results on training data are shown on the blue line, while validation uses red.These results show the

Table 5
shows data indicating that the Inception-V3 model's learning rate value of 0.0005 when employing the Adam optimizer yields the best results, with an accuracy value of 83.97%.The learning rate in the ResNet50 model yields the most remarkable results; however, it likewise employs a learning rate value of 0.0001 and achieves an accuracy value of 89.73%.The outcomes of the ResNet50 learning rate comparison are displayed in Table6.

TABLE VIII PERFORMANCE
COMPARISON OF SEVERAL METHOD OF 3D PRINTING