0% found this document useful (0 votes)
37 views

Different Apple Varieties Classification Using KNN and MLP Algorithms

This document discusses different methods for classifying apple varieties using image processing and machine learning algorithms. It presents previous research on apple variety classification using techniques like visible/near-infrared spectroscopy, x-ray imaging and more. The document then describes an experiment where the authors use k-nearest neighbors and multi-layer perceptron algorithms on 7 morphological attributes extracted from images to classify 3 varieties of apples with over 98% accuracy.

Uploaded by

Abel Demelash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Different Apple Varieties Classification Using KNN and MLP Algorithms

This document discusses different methods for classifying apple varieties using image processing and machine learning algorithms. It presents previous research on apple variety classification using techniques like visible/near-infrared spectroscopy, x-ray imaging and more. The document then describes an experiment where the authors use k-nearest neighbors and multi-layer perceptron algorithms on 7 morphological attributes extracted from images to classify 3 varieties of apples with over 98% accuracy.

Uploaded by

Abel Demelash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

International Journal of

Intelligent Systems and


Applications in Engineering Advanced Technology and Science

ISSN:2147-67992147-6799www.atscience.org/IJISAE Original Research Paper

Different Apple Varieties Classification Using kNN and MLP


Algorithms
Kadir SABANCI*1, Muhammed Fahri ÜNLERŞEN2

Accepted 3rd September 2016

Abstract:In this study, three different apple varieties grown in Karaman province are classified using kNN and MLP algorithms. 90
apples in total, 30 Golden Delicious, 30 Granny Smith and 30 Starking Delicious have been used in the study. DFK 23U445 USB 3.0
(with Fujinon C Mount Lens) industrial camera has been used to capture apple images. 4 size properties (diameter, area, perimeter and
fullness) and 3 color properties (red, green, blue) have been decided using image processing techniques through analyzing each apple
image. A data set which contains 7 physical features for each apple has been obtained. Classification success rates and error rates have
been decided changing the neuron numbers in the hidden layers in the classification using MLP model and in different neighbor values in
the classification made using kNN algorithm. It is seen that the classification using MLP model is much higher. While the success rate of
classification made according to apple type is 98.8889%.

Keywords:Image processing, Apple classification, kNN, MLP


have been done to gather the near infrared reflectance (NIR)
1. Introduction spectra. FDCM accuracy have achieved 97%. FDCM was better
than FCM, possibility c-means, and Gustafson–Kessel (GK)
Apple production is an important economic activity in Karaman.
during clustering operation [3].
The dominant apple varieties produced in Karaman, are Golden Shahin et al. (2013) have proposed to detect bruises in apples by
Delicious, Granny Smith and Starking Delicious. During using line–scan x–ray imaging method. Transform and spatial
marketing these apples, the product is wanted to be consisted of characteristics were investigated about their segregating
just one species of apples. The mixture rate of other apple
capability of classification of fruit by using bruise defects. In this
varieties in the product is wanted to be at minimum level. For this
study Golden delicious (GD) and Red delicious (RD) apples have
purpose many selection system have been proposed in the
been used. To distinguish one month old and a few hour old
literature. bruises, several artificial neural network (ANN) classifiers were
He Yong et al. (2007) have investigated the visible/near-infrared advanced. The ANN classifier accomplished the classification
(Vis/NIR) spectroscopy method for its capacity to non- success rate for RD apples as 90% and for GD apples as 83%
destructively distinguish apple varieties. The chemo metrics steps
when it was employed to classify the apples that have one month
employed to the Vis/NIR data were artificial neural network
old bruises. The accuracy of classifier was 60% for both RD and
(ANN), wavelet transform (WT) and principal component
GD apples when it was employed to classify the apples that have
analysis (PCA). The best result of classification success rate of a few hour old bruise [4].
the apple types have been found as 100% with WT-ANN model In this study, 90 apples grown in Karaman have been used. 7
[1]. morphological attributes have been obtained from their images by
Ronald et al. (2016) have proposed to investigate the applicability
using image processing techniques. The apples have been
and performance of Naive Bayes algorithm in the classification of
classified into 3 group (Golden Delicious, Granny Smith and
apple fruit varieties. Apple classification system prototype was
Starking Delicious) with kNN and MLP algorithms by using the
built using MATLAB R2015a development platform obtained attributes.
environment. The results showed that the averaged values of the
estimated accuracy, sensitivity, precision and specificity were
2. Materials and Methods
91%, 77%, 100% and 80% respectively [2].
Wu et al. (2016) introduced a fuzzy clustering method, termed An interface presented in Figure 1, have been designed by using
fuzzy discriminant c-means (FCM) clustering, to distinguish GUIDE (Graphical User Interface Design) in MATLAB. The
varieties of apples by using NIR spectroscopy. The dataset image of the apple under the camera is taken when the Take
consists of four types of apple with 200 samples. Experiments Button pressed on the GUI.
_______________________________________________________________________________________________________________________________________________________________
1 The mean of R (red), G (green) and B (blue) pixel values of the
KaramanogluMehmetbey University Electrical and Electronics
Engineering Engineering Department Karaman Turkey area where the apple is in the image have been calculated. These
2
Necmettin Erbakan University Electrical and Electronics values have been used for classification of the apples for their
Engineering Engineering Department Konya, Turkey colors. Then the colored images have been converted to grey
* Corresponding Author:Email: [email protected] level image by using image processing techniques.
Note: This paper has been presented at the 3rd International Conference
on Advanced Technology & Sciences (ICAT'16) held in Konya (Turkey),
Morphological operations have been applied onto bitwise images.
September 01-03, 2016. The image processing steps have been presented in Figure 2.

This journal is © Advanced Technology & Science 2013 IJISAE, 2016, 4(Special Issue), 166–169 |166
Figure 1. Graphical user interface designed in MATLAB GUIDE.

perceptron (MLP) is composed of multiple layers where each


layer is connected to the other one. Each node is a processing
element or a neuron that has a nonlinear activation function
exceptthe input nodes. It uses a supervised learning technique
named back propagation and it is used for training the network.
The alteration of the standard linear perceptron, MLP is capable
of distinguishing data which are not linearly separable [7].

2.3. K-Nearest Neighbour Algorithm


A supervised learning algorithm, k-NN solves classification
problems. Classification is the examination of the attributes of an
image and the designation of this image to a predefined class. The
critical point is the determination of the features of each category
previously [8]. Conforming to the used classifcation algorithm k-
NN based on the attributes drawn from the classification stage,
the distance of the new individual that is wanted to be classified
to all previous individuals is considered and the nearest k class is
used. As an outcome of this procedure, the belonging of the test
data is determined due to the k-nearest neighbour category which
contains more exactly determined classes.In k-NN, the
Figure 2. The image processing steps
determination of the algorithm used for distance calculation and
The physical properties of the apple like radius, perimeter, area, neighbour number are the critical optimization points.In the
volume, mass and eccentricity have been extracted. So that study, the optimum k number is appointed with experiments. In
creates 7 attributes by gathering 4 morphological and 3 colour. the calculation of distance, the Euclidean Distance is performed.
Euclidean calculation method [9]:
2.1. Software-WEKA
Developed by Waikato University in New Zealand, WEKA is an
open-source data mining software with a functional graphical
interface which incorporates machine learning algorithms [5]. xi and xj are two points that is wanted to be learnt the distance
WEKA includes various classification,data pre-processing, between them.
regression, association rules, clustering and visualization tools. In classification procedure, inputs are diameter, perimeter, area,
The algorithms can be applied on the data cluster either directly fullness, mean red, mean green and mean blue values. The
or by calling via Java code [6,7]. They are also suitable for outputs are Golden Delicious, Granny Smith and Starking
developing new machine learning algorithms. Delicious. The whole classification system have been presented
in Figure 3.
2.2. Multilayer Perceptron
It is a feed forward type artificial neural network model which
corresponds input sets onto propersets of output. A multilayer

This journal is © Advanced Technology & Science 2013 IJISAE, 2016, 4(Special Issue), 166–169 |167
Figure 4. Success rate versus number of neighbours.

The data in the same dataset were processed using the multilayer
perceptron model, and the classification accuracy, MAE and
RMSE values were obtained while the hidden layer neuron
number were changing from 1 to 20. In the MLP model, the
training was performed by taking the learning rate value as 0.3,
Figure 3.The block diagram of the classification process momentum value as 0.2 and iteration number as 500. The
classification accuracy, MAE and RMSE values were collectedby
using the MLP model have been presented in Table 2.The
3. Results and Discussion diagram demonstrating the changes in classification success rate
based on the number of neuron in the hidden layer is
demonstrated in Figure 5.
In the study, WEKA software was used in order to classify apples
by species (Golden Delicious, Granny Smith and Starking Table 2. The success rate and error values obtained by using MLP
Delicious). Using the kNN algorithm, the classification success classifier
rates, the mean absolute error (MAE) and the root mean squared
error (RMSE) were obtained for various k-neighbour values. The The number of
classification accuracieswere obtained with k-NN algorithm, and Classification
neurons in the MAE RMSE
accuracy (%)
MAE and RMSE values were presented in Table 1. The success hidden layer
rate change versus number of neighbours for kNN method is 1 94.4444 0.1975 0.2513
presented in Figure 4.
2 97.7778 0.033 0.0985
3 95.5556 0.0375 0.1350
Table 1.The success rate and error values obtained by using kNN
classifier 4 96.6667 0.0352 0.1152
5 98.8889 0.1698 0.2225
6 97.7778 0.0355 0.1089
Neighbourliness Classification
MAE RMSE
number (k) accuracy (%) 7 97.7778 0.0269 0.1049
8 97.7778 0.0223 0.1073
1 93.3333 0.0414 0.1886
9 96.6667 0.0479 0.1234
2 96.6667 0.2296 0.2854 10 96.6667 0.0441 0.1214
3 97.7778 0.0364 0.1283 20 95.5556 0.0746 0.1476

4 90.0000 0.0512 0.1537

5 94.4444 0.0543 0.1541

6 93.3333 0.0539 0.1500

7 95.5556 0.0546 0.1503

8 94.4444 0.0644 0.1573

9 94.4444 0.0728 0.1670

10 91.1111 0.0803 0.1735

168|IJISAE, 2016, 4(Special Issue), 166–169 This journal is © Advanced Technology & Science 2013
Acknowledgment

This study was supported by KaramanogluMehmetbey University


scientific research project coordination with 01-M-15 project
number.

References

[1] He, Y., Li, X., Shao, Y., (2007). Fast Discrimination of
Apple Varieties Using Vis/NIR Spectroscopy, Vol. 10(1).
Pages. 9-18.
[2] Ronald, M., Evans, M., (2016). Classification of Selected
Apple Fruit Varieties Using Naive Bayes, Indian Journal of
Computer Science and Engineering (IJCSE), Vol. 7(1)
Figure 5. Success rates versus number of neurons in the hidden layer Pages. 13-19.
[3] Wu, X., Wu, B., Yang, N.,(2016). Classification of Apple
The model of MLP whose hidden layer consists of 5 neurons Varieties Using Near Infrared Reflectance Spectroscopy
which creates the highest classification accuracy is shown in and Fuzzy Discriminant C-Means Clustering Model,
Figure 6. Journal of Food Process Engineering, doi:
10.1111/jfpe.12355.
[4] Shahin, M.A., Tollner, E.W., McClendon, R.W., Arabnia,
H.R.,(2013). Apple Classification Based on Surface Bruises
Using Image Processing and Neural Networks,
Transactions of the ASAE, Vol. 45(5). Pages. 1619–1627.
[5] Witten I.H., Frank E., Hall M.A., (2011). Data mining:
practical machine learning tools and techniques. Elsevier,
London.
[6] Patterson, D., Liu, F., Turner, D., Concepcion, A., Lynch,
R., (2008). Performance Comparison of the Data Reduction
System. Proceedings of the SPIE Symposium on Defense
and Security, Mart, Orlando, FL, pp. 27-34.
[7] Hall, M., Frank, E., Holmes, G., Pfahringer, B.,Reutemann,
P. & Witten, I. H., (2009). The WEKA Data Mining
Software: An Update, SIGKDD Explorations, Vol. 11(1).
Pages. 10-18.
Figure 6. The structure of Multilayer Perceptron [8] Wang, J., Neskovic, P., & Cooper, L. N., (2007). Improving
nearest neighbour rule with a simple adaptive distance
Figure 6. The structure of Multilayer Perceptron measure, Pattern Recognition Letters, Vol. 28(2). Pages.
207-213.
[9] Zhou, Y., Li, Y. & Xia, S., (2009). An improved KNN text
4. Conclusions classification algorithm based on clustering, Journal of
computers, Vol. 4(3). Pages. 230-237.

In this study, classification of apples as Golden Delicious,


Granny Smith and Starking Delicious have been proposed by
using machine learning algorithms. The classification success
rates and error values of data mining algorithms were calculated
for kNN and MLP. It was observed that the success rate was
higher for the classifications performed using the MLP algorithm.
The best classification result was achieved when the number of
neighbourhood was 3 and the success rate was 97.7778%. The
MAE and RMSE error value were 0.0364 and 0.1283
respectively. For the classification accuracy obtained using MLP
algorithm, the highest classification accuracy and minimum MAE
value was achieved for 5 neurons in the hidden layer and it was
98.8889%. For this MLP structure, the MAE and RMSE error
values were 0.1698 and 0.2225 respectively.

This journal is © Advanced Technology & Science 2013 IJISAE, 2016, 4(Special Issue), 166–169 |169

You might also like