Fruit Image Classification Based on SVM, Decision Tree and KNN
Xiang Han
Faculty of Information Science and Engineering, Ocean University of China, Qingdao, China
Keywords: Fruit Image Classification, SVM, Decision Tree, KNN.
Abstract: Image classification is becoming more and more popular in today’s daily life. Image classification is widely
used in many fields. For example, the market demand for face recognition technology has increased
significantly in recent years. The foundation of these new technologies is still image classification. In order
to explore the efficiency of different image classification algorithms and help guide the use of different image
classification algorithms in the market, this paper uses a variety of algorithms to classify images in the fruit360
dataset. Fruit360 dataset is a dataset with 90483 images of 131 kinds of fruits and vegetables. Images in this
dataset have a size of 100×100 pixels. As a result, the Support Vector Machine algorithm is 89% accurate,
the decision tree algorithm is 94% accurate, and the K-nearest Neighbors algorithm is nearly 100% accurate.
Apart from the accuracy of these algorithms, this paper also analyzes the difference in classification accuracy
among different classes. For the Support Vector Machine algorithm, the classification accuracy of class 1 and
class 2 is low, which is caused by the algorithm itself. For the decision tree algorithm, the accuracy of each
classification group is similar. For the K-nearest Neighbors algorithm, the overall accuracy is very high. In
addition, this paper also compares the characteristics of these three algorithms, analyzes the performance
difference between the Support Vector Machine algorithm and the decision tree algorithm, and discusses the
relationship between the Support Vector Machine algorithm efficiency and the number of classes.
1 INTRODUCTION
Nowadays, image classification is widely used in
people’s daily life. Taking the campus as an example,
schools need to use a face recognition system at the
entrance of the library to help determine whether
there is access permission. But the author sometimes
sees such cases: some people outside the school can
also successfully pass the face recognition system.
This means that the current image classification still
has the problem of low accuracy. In this paper, SVM,
decision tree and KNN, three different algorithms are
used, and based on fruit360 dataset, various
classification algorithms are compared and analyzed,
so as to give a reasonable method selection for image
classification problems.
There have been many scientific studies based on
these algorithms. Boumedine Ahmed Yassine et al.
used KNN for 3D face recognition. They used KNN
for feature extraction (Yassine et al 2023). In other
research, they did glass component classification
based on decision tree (Guo et al 2023). However,
most of the existing research lack the comparison
between algorithms.
In addition, there are many research on image
classification using neural networks (Zhang et al
2014). However, a neural network is an end-to-end
model, which remains a “black box” for users, and
people cannot intuitively see the operation process of
its internal algorithms (Wang et al 2020)0. Also, the
training time of neural network algorithm is long, and
the interpretation is not strong enough. So this paper
focuses on the SVM, decision tree and KNN
algorithm.
Support Vector Machine is a supervised machine
learning algorithm, and it is widely used for
regression and classification tasks (Chandra and Bedi
2018 & Nie et al 2023). In addition to image
classification, SVM can be applied to text
classification, such as sentiment analysis, topic
classification, etc. SVM can extract text features and
make decisions for classification. SVM can also be
used for financial forecasting. In the financial field,
SVM can be used to predict stock prices and calculate
the risk of investments.
The decision tree algorithm is used in the financial
field and medical field. In the financial field, banks
can use a decision tree model to predict a customer’s
Han, X.