Machine Learning in Agriculture: KNN-Based Classification of Fruits and Vegetables

Authors

  • Siyang Yao Author

DOI:

https://doi.org/10.61173/tszzmw78

Keywords:

K Nearest Neighbor (KNN), machine learning, image recognition

Abstract

In modern agriculture and the food industry, it is essential to classify fruits and vegetables accurately and efficiently to meet growing consumer demand and reduce post-harvest losses. Traditional manual methods are often labor-intensive and error prone, highlighting the need for automated solutions. This paper discusses the application of the k Nearest Neighbor (KNN) algorithm to fruit and vegetable recognition using image processing technology. In this study, image data sets are used for feature extraction using Directional Gradient Histogram (HOG) and dimensionality reduction using Principal Component Analysis (PCA). The accuracy of KNN model on verification set and test set reaches 97%, which proves its validity. Confusion matrix analysis and F1 score evaluation further revealed the strengths and areas of improvement of the model, particularly in distinguishing visually similar categories. The results show that the integration of artificial intelligence (especially KNN) offers great potential for the automation of agricultural classification tasks. Future studies could combine more advanced models, such as CNNS, with larger datasets to improve accuracy and robustness.

Downloads

Published

2024-10-29

Issue

Section

Articles