Analysis of the Combination of K-Nearest Neighbor (KNN) and K-Means for the Classification of Rice Leaf Diseases Using Image Segmentation Method

rice leaf diseases image segmentation k-means clustering k-nearest neighbor machine learning

Authors

  • Rizal Afandi
    19081010146@student.upnjatim.ac.id
    Universitas Pembangunan Nasional, Indonesia
  • Kartini Universitas Pembangunan Nasional, Indonesia
  • Retno Mumpuni Universitas Pembangunan Nasional, Indonesia
May 21, 2026

Downloads

Rice is a staple food crop in many Asian countries, including Indonesia, and plays a crucial role in ensuring food security and economic stability. However, rice production is significantly threatened by various leaf diseases, which can lead to substantial yield losses if not detected early. Traditional disease identification methods rely heavily on manual observation, making them inefficient and prone to errors, particularly in early stages when symptoms are less visible. This study aims to develop an automatic classification system for rice leaf diseases by combining K-Means clustering and K-Nearest Neighbor (KNN) algorithms using image segmentation techniques. The research utilized a dataset of 5,932 rice leaf images obtained from Kaggle, consisting of four disease categories: Bacterial Blight, Blast, Brown Spot, and Tungro. The methodology involved preprocessing steps including grayscale conversion, image resizing, and feature extraction, followed by segmentation using K-Means and classification using KNN with various K values. The results indicate that the combination method provides effective classification performance, with the highest accuracy achieved at 88% under a 90:10 training-testing data ratio. Additionally, smaller K values tend to yield better accuracy compared to larger ones. Despite some misclassification between visually similar diseases, the proposed model demonstrates strong potential for practical application. This system can assist farmers in early disease detection, reduce crop losses, and contribute to improving agricultural productivity through data-driven approaches.