Automatic Grading of Emperor Apples Based on Image Processing

0 downloads 0 Views 2MB Size Report
The highest coefficient of determination (R2) between the measured and estimated fruit mass was 0.945 and the root mean square error was 116.1 kg. Zheng et.
Tarım Bilimleri Dergisi

Journal of Agricultural Sciences

Dergi web sayfası: www.agri.ankara.edu.tr/dergi

Journal homepage: www.agri.ankara.edu.tr/journal

TARIM BİLİMLERİ DERGİSİ — JOURNAL OF AGRICULTURAL SCIENCES 21 (2015) 326-336

Tar. Bil. Der.

Automatic Grading of Emperor Apples Based on Image Processing and ANFIS Sajad SABZIa, Yousef ABBASPOUR-GILANDEHa, Hossein JAVADIKIAb, Hadis HAVASKHANb

a

University of Mohaghegh Ardabili, Faculty of Agricultural Technology and Natural Resources, Department of Agricultural Machinery, Ardabil, IRAN

b

Razi University of Kermanshah, Faculty of Agriculture, Department of Agricultural Machinery Engineering, Kermanshah, IRAN

ARTICLE INFO Research Article Corresponding Author: Yousef ABBASPOUR-GILANDEH, E-mail: [email protected], Tel: +98 (45) 335 230 08 Received: 13 July 2013, Received in Revised Form: 04 September 2014, Accepted: 11 September 2014 ABSTRACT Mass-based fruit classification is important in terms of improving packaging and marketing. Mass sizing can be accomplished by direct or indirect methods. In this study, 100 samples of Emperor Apples were randomly selected from an orchard in Kermanshah, Iran (longitude: 7.03 °E; latitude: 4.22 °N). All tests were carried out in Physical Laboratory, Faculty of Agriculture Engineering, Razi University, and Kermanshah, Iran. Fourteen parameters were obtained by image processing for each apple. Several mass modeling were made using ANFIS and linear regression methods. In the best model for ANFIS, linear and nonlinear regression, R2, SSE, and MSE were 0.990, 276.58, 13.17, 0.856, 15980.96, 166.47 and 0.791, 24512.16, 255.35, respectively. So, a mass-based sorting system was proposed with machine vision system and using ANFIS method that could obtain apple mass without contact with the fruit. Benefits of this system over mechanical and electrical systems were: 1- Easier recalibration of the machine to the groups with different sizes, and 2- Reaching more accurate mass measurement and higher operating speed using indirect grading. Keywords: SPSS; Packaging; Marketing; Machine vision; Fuzzy inference system; Sorting

Görüntü İşleme ve ANFIS ile Emperor Elmasının Otomatik Sınıflandırılması ESER BİLGİSİ Araştırma Makalesi Sorumlu Yazar: Yousef ABBASPOUR-GILANDEH, E-posta: [email protected], Tel: +98 (45) 335 230 08 Geliş Tarihi: 13 Temmuz 2013, Düzeltmelerin Gelişi: 04 Eylül 2014, Kabul: 11 Eylül 2014 ÖZET Ağırlık tabanlı meyve sınıflandırma, paketleme ve pazarlanmanın iyileştirilmesi açısından önemli bir terimdir. Ağırlıklarına göre sınıflandırma doğrudan veya dolaylı yöntemlerle gerçekleştirilebilir. Bu çalışma için, Kirmanşah, İran’da (Boylam: 7.03 °E; Enlem: 4.22 °N). bir meyve bahçesinden rastgele 100 Emperor Elma örneği seçilmiştir. Tüm testler Ziraat Mühendisliği Fakültesi, Razi Üniversitesi, Kirmanşah, İran Fizik Laboratuarında yapılmıştır. Her elma için

Automatic Grading of Emperor Apples Based on Image Processing and ANFIS, Sabzi et al

görüntü işleme ile ondört parametre elde edilmiştir. ANFIS ve doğrusal regresyon yöntemleri kullanılarak çeşitli ağırlık modelleri geliştirilmiştir. En iyi model sırasıyla ANFIS, doğrusal ve doğrusal olmayan regresyon için, R2, SSE, ve MSE için 0.990, 276.58, 13.17, 0.856, 15980.96, 166.47 ve 0.791, 24512.16, 255.35 şeklindedir. Yani, makine görme sistemi ile meyve ile temas etmeden ağırlık tabanlı elma sınıflandırması sağlanabilir. Mekanik ve elektrik sistemleri üzerinden bu sistemin faydaları şunlardır: 1- Farklı boyutlarda gruplar için makinenin tekrar kalibrasyon kolaylığı, 2- Dolaylı sınıflandırma kullanılarak daha doğru ağırlık ölçümü ve yüksek çalışma hızına ulaşma. Anahtar Kelimeler: SPSS; Paketleme; Pazarlama; Yapay görme; Bulanık çıkarım sistemi; Ayırma © Ankara Üniversitesi Ziraat Fakültesi

1. Introduction Product grading is done with the aim of providing products with high quality and the same shape, volume, and weight. To carry out each of these objectives, there are several methods such as mechanical methods and electrical methods that are classified as direct and indirect methods, respectively. If a suitable method is used for data analysis, indirect method is better than other methods. Sabszi et al (2013) developed seven mass models for Blood orange based on ANFIS and linear regression. Results showed that ANFIS has better performance than linear regression method. In the best model, the coefficient of determination (R2), sum square error (SSE) and mean square error (MSE) for ANFIS and linear regression were 0.983, 65.86 and 2.9 and 0.927, 936.26 and 9.65, respectively. Mizushima & Lu (2013) proposed an image segmentation method for apple sorting and grading using support vector machine and Otsu’s method. This method automatically adjusted the classification hyperplane that was calculated using linear SVM and required minimum training and time. The segmentation error varied from 3% to 25% for the fixed SVM, while the adjustable SVM achieved consistent and accurate results for each training set with the segmentation error of less than 2%. Tong et al (2013) used machine vision for the estimate quality of seeds of tomato, cucumber, aubergine, and pepper based on leaf area. In this work, a decision method and a methodology were developed for the watershed segmentation of overlapping leaf (OL) images. Relative identification accuracy of seedling quality was 98.6%, 96.4%, 98.6%, and 95.2% for tomato,

cucumber, aubergine, and pepper, respectively. Sabzi et al (2013) studied mass modeling of Bam orange with ANFIS and linear regression methods for using in machine vision. ANFIS and linear regression models were employed to predict the mass based on perimeter and width/length value as inputs. The coefficient of determination (R2), sum square error (SSE) and mean square error (MSE) for ANFIS and linear regression were 0.948, 405.7 and 13.99 and 0.919, 2246.43 and 23.159, respectively. Shin et al (2012) studied citrus mass and size estimation during postharvest processing using a logistic classification model and a watershed algorithm. In this study, a mass calibration process was conducted and fruit mass was estimated, which turned out to be reasonably good. The highest coefficient of determination (R2) between the measured and estimated fruit mass was 0.945 and the root mean square error was 116.1 kg. Zheng et al (2010) conducted a study on developing an online method for quality evaluation and classification of some chlorophyll containing fruits in packing lines. Khojastehnazhand et al (2009) conducted a study on axi-symmetrical agricultural products to compute surface area and volume using machine vision and image processing. Rashidi et al (2009) investigated cantaloupe fruits and determined their volume using water displacement and image processing methods. Koc (2007) used image processing to determine the volume of watermelons. Xing et al (2005) detected bruises on Golden Delicious apples using hyper spectral imaging with multiple wavebands. Leemans et al (2004) presented a real time grading method of apples based on features extracted from defects. Also, Lu (2003) presented a method for detecting bruises on apples using near-infrared hyperspectral imaging.

Ta r ı m B i l i m l e r i D e r g i s i – J o u r n a l o f A g r i c u l t u r a l S c i e n c e s

21 (2015) 326-336

327

Görüntü İşleme ve ANFIS ile Emperor Elmasının Otomatik Sınıflandırılması, Sabzi et al

Sabliov et al (2002) applied an image processing algorithm to determine surface area and volume of axi-symmetric agricultural products. No report on the application of adaptive neuro-fuzzy inference system for mass modeling apple fruits has been documented. Nowadays, using such computerized grading systems necessities the research in this regard. Therefore, the aim of the present study is to offer a full automatic grading system for Emperor Apple with low error percentage using ANFIS coupled with machine vision technique.

2. Material and Methods 2.1. Samples The Emperor Apple (Figure 1), a variety planted in Iran, was obtained from Kermanshah, Iran (longitude: 7.03 °E; latitude: 4.22 °N) and 100 samples were randomly selected. These apples were transported to Physical Laboratory, Faculty of Agriculture Engineering, Razi University, Kermanshah, Iran. All the tests were carried out on two days. The fruit mass was determined by an electronic balance with the accuracy of 0.01 g.

of the best condition for imaging, 3- development of a program in MATLAB to extract several features from apple, and 4- development of mass prediction model of apple based on ANFIS, linear and nonlinear regression models. 2.2.1. Image acquisition system Machine vision system (Figure 2) is a combination of a 100 cm × 100 cm × 100 cm chamber, an illumination system installed around the chamber, a color video camera, a color grabber, and a personal computer (PC) equipped with MATLAB (ver. R20011a) and Microsoft Excel (ver. 2013) programs. The illumination system consisted of three type lamps: Fluorescent, Tungsten, and LED. There was a Dimmer to adjust the light intensity. The best image acquisition conditions and background were selected using the algorithm developed in MATLAB software.

2.2. Work algorithm This study performed based on off line method. There are several stages in this method, 1- design and development of imaging chamber 2- determination

Figure 1- Image sample of Emperor Apples Şekil 1- Örnek Emperor Elma görüntüsü

Figure 2- Special image acquisition of the chamber Şekil 2- Özel görüntü odası

328

Ta r ı m B i l i m l e r i D e r g i s i – J o u r n a l o f A g r i c u l t u r a l S c i e n c e s

21 (2015) 326-336

Automatic Grading of Emperor Apples Based on Image Processing and ANFIS, Sabzi et al

Figure 3- Image segmentation Şekil 3- Görüntü ayırma

2.2.2. Determination of the best condition for imaging At first stage, the stored images were recalled to get the best condition of photography. These images were converted into blue, red, and green values to draw the histogram. The best background and separation threshold were selected using the drawn histogram (Figure 3). Figure 3 shows the separated RGB image in green, blue, and red images. Peaks from left to right were the maximum frequency count of the color pixels of apple and background, respectively. Based on the distance between the apple and background pixel values, the red image was selected. At the second stage, diameter, area, center of mass, roughness, RGB and fruit entropy were determined. Edges were detected using canny and laplacian filters. Also, canny and laplacian filters were used for noise removal. Canny filter: By this method, edges are diagnosed with local maximum gradient f(x, y). Gradient is calculated using a derivative of Gaussian filter. In this method, two thresholds are used to identify strong and weak edges. Laplacian filter: In this method, edges are diagnosed after filtering f(x, y) using a Gaussian filter (Gonzalez et al 2004). The camera resolution was set at 352 × 288. Fluorescent lamp with the light intensity of 289.7l was selected. The distance between surface of the measurement table and the

camera was 10 cm. At the third stage, the images were taken from 100 samples and the algorithms developed in MATLAB were used to measure 14 parameters including area, eccentricity, perimeter, length/area, blue value, green value, red value, width, contrast, entropy, wide/area, wide/length, roughness and length, which were then transferred to Excel. 2.3. Adaptive fuzzy neural network ANFIS is a fuzzy inference system implemented in the framework of an adaptive fuzzy neural network. Sivasankaran et al (2011) argued that ANFIS can construct input–output data pairs using a hybrid learning procedure. This combination merges the advantages of fuzzy systems and neural networks. The main target of ANFIS is to find a model which can accurately simulate the inputs with the outputs. Rezaei et al (2012) argued that an ANFIS is used to map input characteristics to input membership functions, input membership function to a set of TSK type fuzzy if-then rules, rules to a set of output characteristics, output characteristics to output membership functions, and output membership function to a single-valued output or a decision associated with the output.

Ta r ı m B i l i m l e r i D e r g i s i – J o u r n a l o f A g r i c u l t u r a l S c i e n c e s

21 (2015) 326-336

329

ANFIS 166 a fuzzy inference system implemented in the framework of an adaptive fuzzy neural 165is ANFIS 166 is aa fuzzy inference system implemented in the framework an adaptive fuzzy neural stem implemented inet the framework of that an adaptive fuzzy neural of ANFIS 166 is system implemented in the framework of fuzzy neural etwork.Sivasankaran 167 al (2011) argued ANFIS data pairs ANFIS 166 is a fuzzy fuzzy inference inference system implemented in can the construct frameworkinput–output of an an adaptive adaptive fuzzy using neuralaa etwork.Sivasankaran 167 et al (2011) argued that ANFIS can construct input–output data pairs using ) argued that ANFIS can construct input–output data pairs using a etwork.Sivasankaran 167 et al (2011) argued that ANFIS can construct input–output data pairs using ybrid 168 learning procedure. This combination merges the advantages of fuzzy systems and using neuralaa etwork.Sivasankaran 167 et al (2011) argued that ANFIS can construct input–output data pairs ybrid 168 learning procedure. This combination merges the advantages of fuzzy systems and neural combination merges theof advantages fuzzy systems and ybrid 168 learning procedure. This combination the of fuzzy and neural etworks. 169 The main target ANFIS is tooffind a merges model which canneural accurately the inputs the ybrid 168 learning procedure. This combination merges the advantages advantages of simulate fuzzy systems systems andwith neural etworks. 169 The main target of ANFIS is to find a model which can accurately simulate the inputs with the IS is to Rezaei find amain model which can accurately simulate thewhich inputs with the etworks. 169 The target of ANFIS is to find a model can accurately simulate the inputs with the utputs. 170 et al (2012) argued that an ANFIS is used to map input characteristics to input etworks. 169 The main target of ANFIS is to find a model which can accurately simulate the inputs with the utputs. 170 Rezaei et al (2012) argued that an ANFIS is used to map input characteristics to input gued that an ANFIS is used to mapthat input characteristics to toinput utputs. 170 Rezaei et al (2012) argued an ANFIS is used map input characteristics to input membership 171 functions, input membership function to a set of TSK type fuzzy if-then rules, rules to a set utputs. 170 Rezaei et al (2012) argued that an ANFIS is used to map input characteristics to input membership 171 functions, input membership function to aa set of TSK fuzzy if-then rules, rules to aa set bership function to a set of TSK type fuzzy if-then rules, rules to type a set membership 171 functions, input membership function to set of TSK type fuzzy if-then rules, rules to f output 172 characteristics, output characteristics to output membership functions, and output membership membership 171 characteristics, functions, input membership function to Otomatik a setmembership ofSınıflandırılması, TSK typefunctions, fuzzy if-then rules, rules to a set set ff output 172 output characteristics to output membership ve ANFIS ilefunctions, Emperor Elmasının Sabzi et aland output haracteristics to Görüntü outputİşleme membership and output membership output 172 characteristics, output characteristics to output membership functions, and output membership unction 173 to a single-valued output or a decision associated with the output. f output 172 tocharacteristics, output characteristics to output membership functions, and output membership unction 173 a single-valued output or a decision associated with the output. or a173 decision associated with the output. unction to 174 unction 173 to aa single-valued single-valued output output or or aa decision decision associated associated with with the the output. output. 174 174 .4. Statistical 175 analyses or rather than one input are used, prediction of 2.4. Statistical analyses 174 .4. Statistical 175 analyses .4. 175 analyses 176 .4. Statistical Statistical 175 analyses 176 Model performance was examined using some output relative to combination of inputs. So, 176 Model 177 performance was examined using some statistic parameters such as mean squared (MSE), when one of theerror inputs was noisy, the model with 176 Model 177 performance was examined using parameters such as mean squared error (MSE), statistic parameters such as statistic mean squared error 2(MSE), using someerror statistic parameters such as some mean squared error Model 177 performance was examined using some statistic parameters such as mean squared error (MSE), um 178 squared (SSE), and coefficient of determination (R below: 2), as shown several inputs had less error than the model with Model 177 performance was examined using some statistic parameters such as mean squared error (MSE), 2 coefficient 2), as shown um 178 squared error (SSE), and of determination (R below: (MSE), sum squared (SSE), and coefficient of ficient of determination (R ),coefficient as shownerror below: 2), as shown um squared error (SSE), and of determination (R below: 179 um 178 178 squared error (SSE), and coefficient of determination (R ), as shown below: one input. Since ANFIS used nonlinear model and 179 determinationn (R(X2),−X as0shown below: 179 )22 n =1 k 2 k 179 linear regression used linear −X 0 )2 180 R2 = 1 − nkn =1(X (1) model for modeling, 2 X k −X (Xkkk−X −Xm )2 0) n=1 180 R (1) 2 = 1− =1(X nk k (X k−X −X 00 )))22 (1) 180 R = 1 − (1) data than linear (X ANFIS could cover more 2 k =1 k −X m )2 2 (1) R = 1 − knkn =1 (1) X k −X180 m) m k 181 2 =1(X k =1(X k −X m ) 181 regression method and thus provide better results. 1 181 181 𝑋𝑋𝑘𝑘 182 𝑋𝑋𝑚𝑚 = 11 𝑛𝑛𝑘𝑘=1 (2) 𝑛𝑛 In table 3 seven nonlinear equations of inputs and 𝑛𝑛 𝑋𝑋 182 𝑋𝑋 (2) 𝑛𝑛 𝑚𝑚 = 𝑘𝑘 (2) 1 𝑘𝑘=1 (2) 𝑋𝑋 182 𝑋𝑋 = (2) 𝑛𝑛 𝑘𝑘 𝑋𝑋 182 𝑋𝑋𝑚𝑚 = 𝑛𝑛𝑛𝑛 𝑘𝑘=1 (2) 183 output had given. Nonlinear equations in SPSS 𝑚𝑚 𝑘𝑘 𝑛𝑛 1 𝑘𝑘=1 183 183 n 2 have some limitation. In SPSS program, we must 1 183 184 MSE = 1 k=1 (3) n (Xk − X0 )2 n 184 MSE = (3) n (Xk − X0 )2 (3) 1 k=1 X0 )2 (3) (X MSE = − X ) (3) n n 2 k −184 propose nonlinear equation, then parameters are k 0 (X − X0 ) 184 MSE = n k=1 (3) 185 nn k=1 k 185 2 initialized. So, achieving nonlinear equations in 185 186 SSE = nk=1(Xk − X0 )2 (4) (4) 185 SSE = (4) 2 n (Xk − X0 )2 k=1 SPSS program is done based on trial and error. − X186 ) (4) 186 SSE = (X − X ) (4) n 0 187 k 0 2 186 SSE = k=1 (4) k=1 (Xk − X0 ) 187 Where; Xs is the actual values; Xo is the0 forecast For this reason, this method has worse results than 187 Where;Xs 188 is the actual values; Xo is forecast values;X is the average of experimental values; X mis 187 is the actual values; Xo is the Where;Xs 188 the forecast values;X is the average of experimental values; X mis 0values; values; is the average of experimental values; X oheismean the forecast values;X the average of experimental X is the other two methods. Figure 4 and 5 depicts the Where;Xs 188 is the actual values; Xo is the forecast values;X is the average of experimental values; X is mparameters evaluate the agreement 0 189 of values; n isisthe forecasts. 0 is These Where;Xs 188 is the the actual values; Xo thenumber forecastof values;X the maverage of experimental values; Xm mis 0 he mean 189 of actual values; nn is the number of forecasts. These parameters evaluate the agreement is the number of forecasts. These parameters evaluate the agreement is the mean of the actual values; n is the number of he mean 189 of the actual values; is the number of forecasts. These parameters evaluate the agreement result of the regression analysis etween 190 and forecast (Naderloo 2012). These parameters evaluate the agreement for ANFIS and he mean 189 the of actual the actual values; values n is the number et ofal forecasts. etween the actual and forecast values (Naderloo et al 2012). ues190 (Naderloo et al 2012). etween 190 the actual and forecast values (Naderloo et al forecasts. These parameters evaluate the agreement linear regression. Tables 1, 2 and 3 show that 191 etween 190 the actual and forecast values (Naderloo et al 2012). 2012). 191 191 between the actual and forecast values (Naderloo et ANFIS model was more accurate than the linear .. Results 192 and Discussion 191 192 and Discussion al 2012). .. Results Results 192 and Discussion regression model and could precisely predict the 193 Results 192 and Discussion 193 193 mass of the apples. So, image processing along .1. Mass 194 modeling of Emperor Apples 193 .1. Mass 194 modeling of Emperor Apples with ANFIS model can be used to launch an pples .1. 194 Emperor Apples 195 3. of Results and Discussion .1. Mass Mass 194 modeling modeling of Emperor Apples 195 automatic grading 195 Afterextracting 196 the 14 feature from apple, several models obtained using different mass-based inputs that among the system with low 195 Afterextracting 196 the 14 feature from apple, several models obtained using different inputs that among the m apple, several models obtained using different inputs that among the Afterextracting 196 the 14 feature from apple, several models obtained using different inputs that among the error percentage. 3.1. Mass modeling of Emperor Apples models, 197 seven models Table1,2 3 were the best models.Specifications of ANFIS, linear and Afterextracting 196 the 14 shown featurein from apple,and several models obtained using different inputs that among the models, 197 seven models shown in Table1,2 and 3 were the best models.Specifications of ANFIS, linear and able1,2 and 3 were the best models.Specifications of ANFIS, linear and models, 197 seven models shown in Table1,2 and 3 were the best models.Specifications of ANFIS, linear and onlinear 198 regression models are presented in 3Tables 1, 2 and 3.The models were of compared with three models, 197 seven models shown in Table1,2 and were the best models.Specifications ANFIS, linear and After extracting the 14 feature from apple, several onlinear 198 regression models are presented inwere Tables 1, 22 and 3.The models were compared with three resented in 1, 2 and 3.The models compared with three onlinear 198 regression models are Tables 1, models were arameters 199 of Tables 𝑅𝑅22 ,models SSE, and MSE. In the bestin model linear and nonlinear regression,with R22, three SSE, onlinear 198 regression models are presented presented indifferent Tablesfor 1,ANFIS, 2 and and 3.The 3.The models were compared compared with obtained using inputs that 2 2, three arameters 199 of 𝑅𝑅 , SSE, and MSE. In the best model for ANFIS, linear and nonlinear regression, R SSE, 2 In MSE the best model for 276.58, ANFIS, linear andbest nonlinear regression, Rlinear , SSE, 2, SSE, arameters 199 of 𝑅𝑅 and MSE. In the model for ANFIS, and nonlinear regression, R 2 , SSE, nd 200 were 0.990, 13.17, 0.856, 15980.96, 166.47 and 0.791, 24512.16, 255.35 respectively. arameters 199 of 𝑅𝑅 , SSE, and MSE. In the best model for ANFIS, linear and nonlinear regression, R , SSE, among the models, seven models shown in Table nd MSE 200 were 0.990, 276.58, 13.17, 0.856, 15980.96, 166.47 and 0.791, 24512.16, 255.35 respectively. 0.856,were 15980.96, 166.47 and 24512.16, 255.35 respectively. nd MSE 200 0.990, 276.58, 13.17, 0.856, 15980.96, 166.47 0.791, 24512.16, n17, ANFIS 201 method, to construct the0.791, models, five adjustments ofand membership function255.35 input, respectively. membership nd MSE 200 were 0.990, 276.58, 13.17, 0.856, 15980.96, 166.47 and 0.791, 24512.16, 255.35 respectively. 1, 2 and 3 were the best models. Specifications nne ANFIS 201 method, to construct the models, five adjustments of membership function input, membership models, five adjustments of membership function input, of membership 201 method, construct the models, five of membership function input, unction 202 ofto input, membership function number optimization and epoch n ANFIS ANFIS 201 number method, to construct theand models, five adjustments adjustments ofoutput, membership functionmethod, input, membership membership of ANFIS, linear nonlinear regression models unction 202 number of input, membership function number of output, optimization method, and epoch ership function number of output, optimization method, and epoch unction 202 number of input, membership function number of output, optimization method, unction 202 number are of presented input, membership output, optimization method, and and epoch epoch in Tablesfunction 1, 2 andnumber 3. Theofmodels were compared with three parameters of , SSE, and MSE. In the best model for4 ANFIS, linear 4 4 4 and nonlinear regression, R2, SSE,4and MSE were 0.990, 276.58, 13.17, 0.856, 15980.96, 166.47 and 0.791, 24512.16, 255.35 respectively. In ANFIS method, to construct the models, five adjustments of membership function input, membership function number of input, membership function number of output, optimization method, and epoch number performed. The model gives acceptable results if all adjustments do accurately. Table1 Figure 4- The comparison of experimental and shows that the models with two or three inputs ANFIS predicted values had better results than one input model. When Şekil 4- Deneysel ve ANFIS tahmin değerlerinin one input is used for model, prediction of output karşılaştırılması is relative to this input absolutely, but when two

330

Ta r ı m B i l i m l e r i D e r g i s i – J o u r n a l o f A g r i c u l t u r a l S c i e n c e s

21 (2015) 326-336

Automatic Grading of Emperor Apples Based on Image Processing and ANFIS, Sabzi et al

Table 1- Summary of properties from some ANFIS models for Emperor Apple different types of inputs Çizelge 1- Farklı Emperor Elması girdileri için ANFIS modelinde bazı özellikler No

MF input

MF number

Epoch number

MF output

input 1

Input2

Input3

R2

SSE

MSE

1

Gauss2mf

333

1500

constant

Width

Length

Perimeter

0.990

276.58

13.17

2

trimf

333

30

constant roughness Eccentricit

Perimeter

0.976

484.02

20.17

3

trimf

333

20

constant

entropy

Area

Width

0.964

820.41

31.55

4

gbellmf

555

50

linear

Length

Perimeter

entropy

0.875

4001.46

133.38

5

trimf

555

3

constant

Area

Length

Width

0.875

3893.24

129.77

6

pimf

333

150

linear

entropy

Contrast

roughness

0.852

3684.61

122.82

7

dsigmf

555

250

constant

Perimeter

entropy

R

0.50

9650.06

321.47

Table 2- Summary of properties from some linear regression models for Emperor Apple different types of inputs Çizelge- Farklı Emperor Elması girdileri için doğrusal regresyon modelinde bazı özellikler No

Input1

1 Width

Input2 Length

Input3 Perimeter

Regression equation

SSE

M= 0.029 W + 0.629 L + 0.705 P -123.95

MSE

0.746 30758.6 320.402

2 Roughness

Eccentricit

Perimeter

M= 0.059 r-7.003 E + 339.38 P- 174.37

0.856 15980.96 166.47

3 Entropy

Area

Width

M= 0.15 e + 0.003 A + 0.004 W-27.87

0.736 30549.16 318.22

4 Length

Perimeter

Entropy

M= 0.007 L + 0.036 P + 0.943 e-145.62

0.846 16987.4

176.95 171.98

5 Area

Length

Width

M= 0.725 A + 0.824 L + .000 W-136.48

0.844 16510.4

6 Entropy

Contrast

Roughness

M= 352.8 e + 209.6 C + 0.004 r-210.71

0.803 22806.95 237.57

7 Perimeter

Entropy

R

M= -0.051 P + 0.021 e + 0.035 R-124.96

0.799 20547.17 214.04

A, area; L, length; W, width; P, perimeter; e, entropy; C, contrast; r, roughness; E, eccentricity; R, red value

Table 3- Summary of properties from some nonlinear regression models for Emperor Apple different types of inputs Çizelge 3- Farklı Emperor Elması girdileri için doğrusal olmayan regresyon modelinde bazı özellikler No

Input 1

Input 2

Input 3

Regression equation

SSE

MSE

0.169

88628.3

923.192

1

Width

Length

Perimeter

M= 5×10-18ln(L) + 16.505ln(P) + ln(1×10-8)

2

Roughness

Eccentricity

Perimeter

M= 31.036ln(r) + 293.28 ln(P) + ln(0.004)

0.791

24512.16

255.35

3

Entropy

Area

Width

M= 16.42ln(A) + ln(1.25×10-8)

0.151

101726.3

1059.65

0.165

92426.35

962.77

4

Length

Perimeter

Entropy

M= 7.47ln(P) + 22.74ln(e) + ln(1.08×10-8)

5

Area

Length

Width

M= 16.52ln(W) + ln(9.94×10-8)

0.169

88617.2

923.11

6

Entropy

Contrast

Roughness

M= 307.2ln(e) + 12.7ln(C) + 26.5ln(r) + ln(002)

0.678

40601.3

422.92

A, area; L, length; W, width; P, perimeter; T, entropy; C, contrast; r, roughness; E, eccentricity; R, red value

Ta r ı m B i l i m l e r i D e r g i s i – J o u r n a l o f A g r i c u l t u r a l S c i e n c e s

21 (2015) 326-336

331

Görüntü İşleme ve ANFIS ile Emperor Elmasının Otomatik Sınıflandırılması, Sabzi et al

mass. Figure11 represent the change in the mass of Emperor Apples based on (a): length-perimeter, and (b): perimeter-width. It can be clearly seen in Figure 11(a) and (b) that impacts of length and width were larger than perimeter. Figure 12 shows the Mosaic mapping of width and length for mass modeling of Emperor Apples; the impact of width was more than length. 3.3. Grading system proposal

Figure 5- The comparison of experimental and linear regression predicted values Şekil 5- Deneysel ve doğrusal regresyon tahmin değerlerinin karşılaştırılması

3.2. Adaptive fuzzy neural network analyses The number of inputs and type inference system are shown in Figure 6. The model had three inputs (width, length, and perimeter) and one output (mass). Sugeno-type fuzzy inference system was used in the mass modeling of Emperor Apples. The relationship between training error and number of epochs in ANFIS model is shown in Figure 7. According to this figure, error decreased as epochs raised and finally it was leveled off (Naderloo et al 2012). Figure 6 presents the architecture of adaptive neuro-fuzzy inference system to predict the mass of Emperor Apples. Figure 8 demonstrates that the model had3 inputs, 1 output, and 27 rules. Figure 9 shows the initial Gaussian membership functions of the three appearance parameters. Membership function is a curve that maps each point of the input space into a membership value between 0 and 1. Figure 10 shows the reasoning procedure for the first order Sugeno fuzzy model. Since each rule has a crisp output, the overall output is obtained via a weighted average, thus avoiding the time consuming process (Taylan & Karagozoglu 2009). Input parameters of the considered ANFIS were width, length, and perimeter and the output was

332

A grading system was shown in Figure 13. Emperor Apples with different sizes were placed on the conveyor belt and the camera took images from them. The images were then transferred to the computer to be analyzed by an algorithm written in MATLAB. After the analysis, the fruits are divided into three groups of small, medium, and large (Table 4). Three lines were built to transmit apples with different sizes (small, medium and large) to different parts of the package. This grading layout can be designed and fabricated for the packaging apple in relevant industries. Table 4- Mean and standard deviation of groups Çizelge 4- Grupların ortalama ve standart sapmaları Statistical parameters

Group 1

2

3

Mean

113.38

145.82

198.84

Standard deviation

12.02

12.93

15.07

4. Conclusions There are several methods for mass-based sorting such as indirect, mechanical, and electrical methods. If analysis of the data that are extracted using image processing from the fruit is done using ANFIS, mass model has a low error percentage; so, an indirect sorting system can be designed. In this research, the potential of ANFIS model for estimating Emperor Apple was investigated and compared with the well-known statistical method of linear regression technique in SPSS software. 1- For developing ANFIS models, 70% experimental data (randomly selected) were

Ta r ı m B i l i m l e r i D e r g i s i – J o u r n a l o f A g r i c u l t u r a l S c i e n c e s

21 (2015) 326-336

Automatic Grading of Emperor Apples Based on Image Processing and ANFIS, Sabzi et al

Figure 6- Structure of fuzzy inference system (FIS) Şekil 6- Bulanık mantık arayüz sisteminin yapısı

Figure 7- Relationship between training error and the number of epochs in ANFIS Şekil 7- Eğitim hataları ve ANFIS evreleri arasındaki ilişki

Figure 8- Structure of the proposed ANFIS model to predict the mass of Emperor Apples Şekil 8- Emperor elmalarında ağırlık tahminleri için önerilen ANFIS modelinin yapısı Ta r ı m B i l i m l e r i D e r g i s i – J o u r n a l o f A g r i c u l t u r a l S c i e n c e s

21 (2015) 326-336

333

Görüntü İşleme ve ANFIS ile Emperor Elmasının Otomatik Sınıflandırılması, Sabzi et al

Figure 9- Membership functions of inputs (a), width; (b), length and (c), perimeter Şekil 9- Girişlerin üyelik fonksiyonları (a), genişlik; (b), uzunluk ve (c), çevre

Figure 10- Fuzzy reasoning procedure for Sugeno model for mass assessment of Emperor Apples Şekil 10- Emperor Elması ağırlık değerlendirmesi çin Sugeno modelinin bulanık sonuç prosedürü

334

Ta r ı m B i l i m l e r i D e r g i s i – J o u r n a l o f A g r i c u l t u r a l S c i e n c e s

21 (2015) 326-336

Automatic Grading of Emperor Apples Based on Image Processing and ANFIS, Sabzi et al

Figure 11- Mosaic mapping of (a) length, perimeter (b) width, perimeter for mass modeling of Emperor Apples Figure 11- Emperor Elması çevre modeli için (a), uzunluk; çevre genişliği (b) mozaik haritası

Figure 12- Mosaic mapping of width and length for mass modeling of Emperor Apples Şekil 12- Emperor Elması modeli için uzunluk ve genişlik mozaik haritası

Figure 13- Layout of computer mediated fruit sorting system Şekil 13- Bilgisayar ortamlı meyve sınıflandırma sistemi Ta r ı m B i l i m l e r i D e r g i s i – J o u r n a l o f A g r i c u l t u r a l S c i e n c e s

21 (2015) 326-336

335

Görüntü İşleme ve ANFIS ile Emperor Elmasının Otomatik Sınıflandırılması, Sabzi et al

used for training and 30% (the residual data) were applied for testing the models. 2- For developing ANFIS model, different learning algorithms with different epochs were experimented to define the model which had the best potential of ability estimation to predict the experimental results. 3- The best correlation was found through three inputs (length, perimeter, and weitgh). 4- After finding the best ANFIS model, results of ANFIS and SPSS were compared. 5- For comparing ANFIS and SPSS, determination coefficient (R2), SSE, and MSE statistics were used as the evaluation criteria. 6- In the best model for ANFIS and SPSS, R2, SSE, and MSE were 0.990, 276.58, 13.17 and 0.746, 30758.6, 320.402, respectively.

References Gonzalez R C, Woods R E & Eddins S L (2004). Digital Image Processing Using MATLAB. Prentice Hall Khojastehnazhand M, Omid M & Tabatabaeefar A (2009). Determination of orange volume and surface area using image processing technique. International Agrophysics 23: 237-224 Koc A B (2007). Determination of watermelon volume using ellipsoid approximation and image processing. Journal of Postharvest Biology and Technology 45: 366-371 Leemans V, Magein H & Destain M F (2004). On-line fruit grading according to their external quality using machine vision. Biosystems Engineering 83: 397-404 Lu R (2003). Detection of bruises on apples using nearinfrared hyperspectral imaging. Transactions of ASAE 46(2): 523-530 Mizushima A & Lu R (2013). An image segmentation method for apple sorting and grading using support vector machine and Otsu’s method. Computers and Electronics in Agriculture 94: 29-37 Naderloo L, Alimardani R, Omid M, Sarmadian F, Javadikia P, Torabi M Y & Alimardani F (2012). Application of ANFIS to predict crop yield based on different energy inputs. Measurement 45: 1406-1413 Rashidi M, Gholami M & Abbassi S (2009). Cantaloupe volume determination through Image Processing.

336

Journal of Agricultural Science and Technology 11: 623-631 Rezaei E, Karami A,Yousefi T & Mahmoudinezhad S (2012). Modeling the free convection heat transfer in a partitioned cavity using ANFIS. International Communications in Heat and Mass Transfer 39: 470475 Sabliov C M, Boldor D, Keener K M & Farkas B E (2002). Image processing method to determine surface area and volume of axisymmetric agricultural products. International Journal of Food Properties 5: 641-653 Shin J S, Lee W S & Ehsani R (2012). Postharvest citrus mass and size estimation using a logistic classification model and a watershed algorithm. Biosystems Engineering 113: 42-53 Sabzi S, Javadikia P, Rabani H & Adelkhani A (2013). Mass modeling of Bam orange with ANFIS and SPSS methods for using in machine vision. Measurement 46: 3333-3341 Sabzi S, Javadikia P, Rabani H, Adelkhani A & Naderloo L (2013). Exploring the best model for sorting Blood orange using ANFIS method. Agricultural Engineering International: CIGR Journal 15(4): 213219 Sivasankaran S, Sivaprasad K, Narayanasamy R & Iyer V K (2011). Evaluation of compaction equations and prediction using adaptive neuro-fuzzy inference system on compressibility behavior of AA 6061100−x–x wt. % TiO 2 nanocomposites prepared by mechanical alloying. Powder Technology 209: 124-137 Taylan O & Karagozoglu B (2009). An adaptive neurofuzzy model for prediction of student’s academic performance. Computers & Industrial Engineering 57: 732-741 Tong J H, Li J B & Jiang H Y (2013). Machine vision techniques for the evaluation of seedling quality based on leaf area. Biosystems Engineering 115: 369-379 Xing J, Bravo C, Jancso K P T, Ramon H & Baerdemaeker J D (2005). Detecting bruises on ‘Golden Delicious’ apples using hyperspectral imaging with multiple wavebands. Biosystems Engineering 90(1): 27–36 Zheng H, Lu H, Zheng YLou H & Chen C (2010). Automatic sorting of Chinese jujube (Zizyphus jujuba Mill. cv. ‘hongxing’) using chlorophyll fluorescence and support vector machine. Journal of Food Engineering 101: 402-408

Ta r ı m B i l i m l e r i D e r g i s i – J o u r n a l o f A g r i c u l t u r a l S c i e n c e s

21 (2015) 326-336

Suggest Documents