Different Apple Varieties Classification Using KNN and MLP Algorithms
Different Apple Varieties Classification Using KNN and MLP Algorithms
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%.
This journal is © Advanced Technology & Science 2013 IJISAE, 2016, 4(Special Issue), 166–169 |166
Figure 1. Graphical user interface designed in MATLAB GUIDE.
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
168|IJISAE, 2016, 4(Special Issue), 166–169 This journal is © Advanced Technology & Science 2013
Acknowledgment
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.
This journal is © Advanced Technology & Science 2013 IJISAE, 2016, 4(Special Issue), 166–169 |169