Grape Drying Process Using Machine Vision Based on Multilayer Perceptron Networks

This paper proposed a grape drying machine using computer vision and Multi-layer Perceptron (MLP) method. Computer vision is for taking grapes’ image on conveyor, whereas MLP is for controlling grape drying machine and classifying its output. To evaluate the proposed, a kind of grapes are put on conveyor of the machine and their images are taken every two min. Some parameters of MLP to control the drying machine includes dried grape, temperature, grape area, motor position, and motion speed. Those parameters are to adjust an appropriate MLP’s output, including motion control and heater control. Two different temperatures are employed on the machine, including 60 and 75C. The results showed that the grape could be dried with similar area 3800 pixel at the 770 min using temperature 60C and at the 410 min using temperature 75°C. Comparing between them, the similar ratio could also be achieved at 0.64 with different time 360 min. Indeed, the temperature setting at 75C resulted faster drying performance. © 2020 Tim Pengembang Jurnal UPI Article History: Received 14 Nov 2019 Revised 27 May 2020 Accepted 28 May 2020 Available online 30 May 2020 ____________________


INTRODUCTION
Grape is palatable fruit to be eaten or as material to make different foods or beverages, such as vinegar, juice, jelly, wine, jam, sauces, candies, and raisins. In addition to the flesh fruit, the grape seed can also be extracted becoming the grapeseed oil, and biofuel (Sanahuja-Parejo et al., 2019). Grape is good as nutrition of human health like vitamins, a large amount of iron, carbohydrates, antioxidants, and minerals (Doymaz, 2006). However, the quality of grape decreases during the harvest season due to highly susceptible to microbial deterioration (Hamdi et al., 2018). Due to its abundant harvesting, grape should be preserved to make healthier food. Old method to preserve the grape uses dryer, either using natural solar drying method (Hamdi et al., 2018) or machine using the hot air drying process (Khazaei et al., 2013). The product of the dried grape is popularly called as a raisin. The raisin is smaller size than the fresh grape, but it is rich in fiber with natural sweet, high in sugar, and calories. Therefore, the grape is dried using the drying machine controlled by computer as a mediated system may adequately expedite the process. In addition, it also may classify into uniform group and quality. To tackle this strategy, machine vision (MV) is employed on the computer to realize the drying system.
MV is the computer method to see an object, receive characteristic optically, and interpret its results (Jha, 2010). In recent year, detection, identification, and classification an object using MV method have been attention some researchers due to many application in various fields. These applications are farming (Zion, 2012), animal husbandry (Zhou et al., 2018), control system (Zhao et al., 2016), sport (Thomas et al., 2017), security (García et al., 2017), robotic (Zhao et al., 2016, inspection (Xu et al., 2016), drying processes (Khazaei et al., 2013), and others. Owing to those benefit, MV is the prospective method as an effective solution in future life comparing with the conventional method running manually. Some methods have been proposed by researchers for obtaining appropriate characteristic to identify or classify its images, particularly the raisin. These vision methods involve with either conventional or artificial intelligence (AI) method, including fuzzy logic system (Mao et al., 2016;Albusac et al., 2018), Artificial NN (Sabanci et al., 2017;Singh & Chaudhury, 2016;Kezhu et al., 2014), and heuristic algorithms, such as genetic algorithm (GA), particle swarm optimization (PSO), Grey wolf optimizer (GWO), and many others.
Neural network (NN) is one of the Artificial Intelligent (AI) method that involves learning processes to optimize in solving problems. Likewise the human being, learning process is an important role for the learners to provide direct experience (Sujarwo & Wibawa, 2018). NN method has several nodes that connected using direction links with associated weights. These weights determine the strength of the connections. Each weight on the connection can be used as the signal that can usually be updated by learning algorithm. The nodes of NN can be used as input and output that connected to the external world. Each node receives the signal from the incoming links, calculates the signal, and sends the signal into the outgoing links (Russell & Norvig, 2009). Generally, there are several NN structures in various engineering field, including single-layer feed-forward (SLF) networks, multilayer feed-forward networks (MLF), radial basis networks (RBF), and recurrent neural networks (Poznyak et al., 2001). This MLF NN method can also be called as Multi-layer perceptron (MLP) NNs. MLP is one of the most effective and simplest kind of NN structure to solve many engineering problems in the real world (Bui et al., 2015;Paranjay & Rajeshkumar, 2020).
Several NN methods for image's application has previously been studied in the literature. Sabanci et al. (2017) presented computer vision using MLP method to classify the wheat grain into bread. The proposed model employed four input data set, trained via 180 grains, and resulted effectively on classifying the agricultural grains. Singh and Chaudhury (2016) proposed a classification method using Backpropagation Neural Network (BPNN) for four types of bulk rice grain images. The classification resulted better performance on comparison with other algorithms, including k-nearest neighbors (KNN), naive Bayes (NB), and support vector machine (SVM). Kezhu et al. (2014) studied system identification diseases of soybean using machine vision incorporating with BPNN. The study performed better accuracy for heterogeneous soybean seeds. Taner et al. (2018) classified varieties of grain species using ANN method, and obtained a good alignment with the experimental data. De Oliveira et al. (2016) proposed computer vision to measure and classify green coffee bean using artificial neural networks (ANN) and Bayes classifier. The proposed system is effectively performed in classifying variation in the color of green coffee beans. Due to effective and better performance for image's classification, ANN becomes an interesting and prospective method to be applied on the drying grape classification.
This study proposed a drying grape process using machine vision combining with MLP Technique. This approach used camera vision for taking grape images on the conveyor of the drying machine. By taking some input parameters, the MLP method is employed to control the temperature resulted by heater and the motion control of conveyor. To optimize the MLP's performance, It has to employ the learning system either conventional or heuristic method. Several studies of NN have verified using back propagation (BP) learning systems and resulted efficient enough in dealing with the real problems may have complex constraints (Wu et al., 2015). Due to easy implementation process, Back propagation learning method is employed as a solution for obtaining better results.

METHOD 2.1. Designing Of Drying Machine
The proposed drying machine is composed into two parts, including the mechanic of the drying machine and the algorithm using MLP Method. Both of them are to control the machine and to catch the grape images using machine vision. The mechanic is designed using several components, including heater at the drying chamber, camera vision at the vision or capturing chamber, lamp, grape mover using conveyer, and computer. This adjustable air temperature resulted by the heater is sprayed to the grapes where is put on the conveyer moved by two motors. These two motors are controlled using MLP networks. The camera vision captures the image of grapes periodically every two min for each. The lamp installed on the image capturing chamber to give lighting. The movement of all parts is synchronized by the computer to control the system. The structure of the drying machine can be illustrated in Figure 1.
To control the drying machine, this study employs Proportional Integral Derivative (PID) control method incorporating with NNs. Mao et al. (2018) studied PID control and resulted better precision trajectory tracking performance in motion control system.
The PID method is to control the heater and the motor position to move of conveyer belt where the grapes are put and for adjusting the heat air temperature generated by ceramic heater. The image of grape is captured by camera vision after two min on the heating chamber for each. The captured images are as inputs of the MLP networks what the grape is still fresh or dried condition.
Combining with motor position and motor speed sensor as inputs, the output of MLP network is processed to control the heater and motion of the motor for obtaining a good drying grape conditions. The dried grapes from the heating chamber are moved into a container, whereas the still fresh grapes are re-dried using drying machine and re-capture using smart camera. The fresh grapes are re-drying processes until the drying condition is satisfied.

Capturing Image Strategy
To obtain the results, we used analysis steps for the captured images. The procedures can be illustrated as follows. Firstly, the captured image is analyzed using smoothing, segmentation, features extraction, and data analysis. Secondly, the images are captured in the red green blue (RGB) color space. Thirdly, the images are converted into R-B gray image. In this step, all background pixels become negative and the image pixels with negative values are changed to zero. Fourthly, R-B gray image is converted into binary [0, 1] image with a threshold "AND" 1 is assigned to the object and 0 is assigned to the background. Fifthly, Erosion or dilation is used for eliminating the stem. The final step, sixthly, is the calculation of the area of the binary image. Those processing steps above are for obtaining the area of the captured image of the grapes. By comparing the final step and the original images, there are different value for each step.
As shown in Figure 2, the proposed design employed several kinds of grapes with different sizes to investigate the capture image performance. The original size is the fresh grape when the image is taken first. The grapes are dried using the heater installed on the heating chamber of the drying machine. The hot air temperature uses around 60 and 75C for obtaining appropriate dried grapes. These conditions occur until the fresh grape become the drying one. The camera captures the grape images periodically. If the captured images have a different size with the original one, then it is kept to be compared with previously captured image and the next one. This condition is repeated until the captured dried images do not change the size anymore.

Structure of MLP Network
MLP is the feed-forward ANN model that is organized into three layers, including an input layer, an output layer, and the layer in between them, namely hidden layers (Farobie & Hasanah, 2016). This NN method is usually trained using back-propagation (BP) learning algorithm. BP is one of the learning method used to adjust the synaptic weights. This learning algorithm is an efficient method for MLP. In training mode, MLP networks are operated at the beginning by using random weight values, and it is preceded iteratively. Each iteration of the networks adjusts the weights in a direction to reducing errors. After several iterative completed, it continues to decrease the weights gradually, until the optimal value is convergent. Due to this reason, MLP is better to be considered to approximate nonlinear modelling and complex processes.
The structure of the MLP method is illustrated in Figure 3.
There are two stages of the MLP learning methods in the literature, including forward and back forward propagation algorithms (Bui et al., 2015). In this study, the MLP method is employed to control drying grape machine and its outputs. In control processes, MLP adjusts appropriate air temperature generated by the heater and controls motion speed of camera vision to capture the grape image every two min. The number of inputs, outputs, and hidden layers is adjusted depending on some desired parameters, the quantity of neurons on hidden layers, and the training algorithm used on this system. The inputs of the MLP are connected with some measurements, such as dried grape, temperature, grape area, motor position, and motion speed.  The structure of the system has several parts as the inputs of MLP networks, including the original grape size, the dried grape area, the previous dried grape area, air temperature, motor position, and motion speed. Those inputs are used to approximate of MLP networks for optimizing the performance of the system. The grape images and their color are captured using camera vision. To obtain best performance, Parameters are an important role in the MLP networks. These parameters are adjusted manually at the first time. The structure of MLP is adjusted using 5-6-6-2. This structure has five inputs, hidden networks, and two outputs. The inputs of MLP are seven inputs from dried grapes, temperature, Grape area, motor position and motor speed. Figure 4a illustrates the flesh grape capturing by smart camera at the vision chamber of the drying machine. This vision interfaces with personal computer to catch and process of grape figure every two min. By HALCON machine vision, the size of the flesh grape is measured by how many pixels of each grape has. These grapes are also measured to know their textures and their skin characteristics. Then, the figure of grape is reduced and scaled using similar rectangle size and converted from Red-bluegreen (RBG) image becoming gray image as shown in Figure 4b. Next, this gray image is segmented to separate between dark and background image shown in Figure 4c. In this condition, grape image is encircled by black color line including its stalk. In fact, the dark color encircling by black color line is not all flesh of fruit, so its region has to be bounded using image processing dilation or erosion, shown in Figure 4d. Finally, the image area is calculated using its pixel shown in Figure 4e. The procedure of above is a step for obtaining the area of image. This step is done every two min after drying process, so the grape putting on the conveyer is arbitrarily moved inside or outside of the drying chamber and vision chamber.

Drying Grape and Vision Processes
To obtain all sizes before and after the drying process, the grape is always moved inside or outside from two chambers. Two min on the drying chamber and a second on the vision chamber. In the moving process, Computer calculates and compares the grape size before and after drying process until appropriate size is obtained. The area of grape was different and decreased gradually with time. These different grapes are captured as an original image for measuring the area ratio after the drying processes finishes. These original images are mixed and located randomly. By this condition, machine vision identified by capturing all grapes and detected firstly. These capture images are for input the MLP networks. Combined with temperature, speed, and position sensors, MLP processed to control the grape motion speed and the temperature of heater. Figure 5 describes the final grapes after drying processed finished using air temperature 60°C. Comparing with the fresh grapes, the area of grape has smaller size than previously. The size of grapes decreases and has rough skin. Measuring by machine vision, this size is compared continually with the original fresh grape. The total time to achieve the dried grape is around 780 min.
Aforementioned, the drying machine uses temperature setting 60 and 75C. These temperatures are attempted at a different time and the size of fresh grape has slightly small different. Firstly, we set the drying machine using 60C, for total time 780 min. To dry the fresh grape, the machine moves from the vision chamber to drying chamber the grape to entry and out every two min. It means that the time of the grape at the drying chamber is two min and the time of the grape at vision chamber is a second.  This process occurred repeatedly until 780 min and the size of grape decreased gradually. In 780 min, this process has 400 captured image with different pixels. This pixel is converted becoming the grape area. Figure 6 exhibits different area of grape every 40 min. This area of grape is gradually decreased until desired area of drying grape is obtained. Figure 6a is the grape with drying time for 80 min, Figure 6b is for 160 min, Figure 6c is for 240 min, and the final capturing is for 780 min (Figure 6j). These different pixel sizes are due to reducing the moisture content of the grape. Figure 7 describes the area using how many pixels of the grape has due to changing the moisture content. On the drying process, the machine takes the grape images every two min using machine vision camera. Computer calculates to measure the pixel of the image. The result of the measured grape areas decrease from 6000 pixels to around 3800 pixels using temperature 60C and around 3500 pixels using temperature 75C at the 780 th min. Based on Figure 7, the area of dried grape using air temperature 60C decreases until the 580 th min. It happens due to the optimal drying process reaching saturated point. 580 th min after the saturated point, the size of grape is steady state. This saturated condition is almost fixed area until the 780 th min and decreases slowly. Air temperature settings bring impact to drying speed. Regardless of the output quality, the similar area of drying grape is achieved 3800 pixels at the 770 th min using air temperature 60C and at the 410 th min using 75C. The area of drying grape is illustrated in Figure 7.

Drying Image Ratio
To identify the drying level, we used the area ratio of the grape (Figure 8). The final ratio of grape is 0.65 using air temperature 60C and 0.58 using air temperature 75C. This ratio is obtained by the drying process using the machine as long as 780 min or 13 h with the average air temperature of 60 and 75C. The temperature is adjusted using MLP Networks to control the heater.
In the beginning, the air temperature is firstly reached around 80C. By BP learning networks, the heater is always adjusted depending on its learning condition. The final learning process, the air temperature also decreases slowly depending on the desired inputs. This drying machine also adjusts the grape mover and the lighting when the camera vision catches the grape image.
The quality of the dried grape depend on the desired setting, including grape area, time, air temperature, and grape quality. Regardless of the resulted dried quality, this proposed drying machine operated well by different temperature setting to dry fresh grape as the attempted material. Similar results of the dried grapes are achieved at the area ratio 0.64 for two different temperatures.

Comparison Drying Performance
The comparison performance between two temperature settings both using 60 and 75C achieved different drying time. To obtain a similar ratio 0.64, this study needs 400 min for 60C and 770 min for 75C. This ratio is resulted by comparing the grape areas before the and after drying processes. These areas are calculated after the erosion or the dilation operation using HALCON machine vision (Khazaei et al., 2013). After the dilation process, this study resulted in average of 5917 pixels for the fresh grape area. Passing time on the drying process, the moisture content of grape evaporates due to the air temperature propagated on the heater chamber. This shrinking area of grape at t time is compared with the fresh grape. The decreasing areas of grapes have related to the increasing drying temperature. This condition has also been reported in previous the study (Ramos et al., 2004).

Figure 8. Area Ratio at t time
The comparison results between temperatures of 60 and 75C achieved that temperature setting at 75C had shorter drying time for obtaining similar results than using 60C. Due to different air temperature, it indicated that the temperature setting had a direct effect on the grape moisture changing and the grape drying time. This condition makes the grape putting on the conveyer becoming smaller when the air temperature on the heating chamber increases. These statements have similar results with some previous studies (Doymaz & Pala, 2002;Khazaei et al., 2013). The desired area of the grape and drying time could be set by MLP for obtaining better results. The motion speed of conveyer controlling by MLP did not effect the ratio area. This motion speed only effected to the drying image capturing by camera vision.

CONCLUSION
The drying machine using computer vision and Multi-layer Perceptron (MLP) method is proposed overcome the shortcomings of the conventional drying method. The drying grape using the machine vision can be designed by employing MLP networks using BP learning method. This MLP performs well to control the temperature resulted by the heater and the grape mover on the conveyor belt. The result showed that the grape could be dried faster with better performance. It could be proven that the calculated area of grape using two different temperatures decreased gradually. The area ratio of grape decreased becoming 0.65 for 60C temperature setting at the 770 th min, and 0.60 for 75C temperature setting at a similar time. The similar ratio could be achieved at 0.64 with different time 360 min for temperature setting 60 and 75C.