Hyperparameter-Tuned K-Nearest Neighbor for Herbal Leaf Classification Using Shape, Color, and Texture Feature Fusion in Smart Agriculture
Abstract
This study develops a lightweight K-Nearest Neighbor (K-NN) classifier to identify five Indonesian herbal leaf species—betel, bay, guava, soursop, and moringa—for potential smart-agriculture applications. The initial dataset contained 1,000 leaf images and was expanded to 6,000 images through offline augmentation. After data cleaning, 5,884 images were retained for analysis. Each image was resized to 256 × 256 pixels, converted into grayscale and HSV color spaces, and segmented using Otsu thresholding. A total of 21 features representing shape, color, and Gray-Level Co-occurrence Matrix (GLCM)-based texture characteristics were extracted. K-NN hyperparameters were optimized through Grid Search with Stratified 5-Fold Cross-Validation using 80:20, 70:30, and 60:40 training–testing splits. Under image-level evaluation, the best configuration used Manhattan distance, k = 1, and distance weighting, achieving 92.18% accuracy and a 92.29% macro F1-score on the 80:20 split. The 70:30 and 60:40 splits achieved accuracies of 91.79% and 91.21%, respectively. Misclassifications primarily occurred between soursop and guava leaves. Although the framework is compact and interpretable, augmentation before splitting may have produced optimistic results. Future work should apply source-grouped validation and assess real on-device performance.
Related
- The nearest neighbor interchange proximity measure for the tree-basedness of rooted binary phylogenetic networks
- A greedy nearest-neighbor approach to quantify site revisitation: comparing two sympatric raven species
- Enhancement of gut-microbiome-based classification of prodromal Parkinson's Disease cases by hyperparameter tuning, integration of multimodal data, and meta-analysis.
- Fuzzy-guided hyperparameter optimization for efficient CNN-based plant disease classification
- A Computer Vision-Based Framework for Multilevel Egg Fertility Classification Using L*a*b* Color Segmentation, Wavelet Texture Features, and Support Vector Machine
BibTeX
@article{kurniawan2026hyperparametertuned,
title = {{Hyperparameter-Tuned K-Nearest Neighbor for Herbal Leaf Classification Using Shape, Color, and Texture Feature Fusion in Smart Agriculture}},
author = {Avip Kurniawan and Agustinus Eko Setiawan and Vevi Maritha and Muhammad Abrar Argianata},
journal = {Journal of Information Systems and Informatics},
year = {2026},
month = oct,
doi = {10.63158/journalisi.v8i5.1938},
url = {https://doi.org/10.63158/journalisi.v8i5.1938},
note = {CC BY},
}
RIS
TY - JOUR
TI - Hyperparameter-Tuned K-Nearest Neighbor for Herbal Leaf Classification Using Shape, Color, and Texture Feature Fusion in Smart Agriculture
AU - Avip Kurniawan
AU - Agustinus Eko Setiawan
AU - Vevi Maritha
AU - Muhammad Abrar Argianata
PY - 2026
DA - 2026/10/24
JO - Journal of Information Systems and Informatics
DO - 10.63158/journalisi.v8i5.1938
UR - https://doi.org/10.63158/journalisi.v8i5.1938
AB - This study develops a lightweight K-Nearest Neighbor (K-NN) classifier to identify five Indonesian herbal leaf species—betel, bay, guava, soursop, and moringa—for potential smart-agriculture applications. The initial dataset contained 1,000 leaf images and was expanded to 6,000 images through offline augmentation. After data cleaning, 5,884 images were retained for analysis. Each image was resized to 256 × 256 pixels, converted into grayscale and HSV color spaces, and segmented using Otsu thresholding. A total of 21 features representing shape, color, and Gray-Level Co-occurrence Matrix (GLCM)-based texture characteristics were extracted. K-NN hyperparameters were optimized through Grid Search with Stratified 5-Fold Cross-Validation using 80:20, 70:30, and 60:40 training–testing splits. Under image-level evaluation, the best configuration used Manhattan distance, k = 1, and distance weighting, achieving 92.18% accuracy and a 92.29% macro F1-score on the 80:20 split. The 70:30 and 60:40 splits achieved accuracies of 91.79% and 91.21%, respectively. Misclassifications primarily occurred between soursop and guava leaves. Although the framework is compact and interpretable, augmentation before splitting may have produced optimistic results. Future work should apply source-grouped validation and assess real on-device performance.
SN - 2656-5935
SN - 2656-4882
ER -