Hyperparameter-Tuned K-Nearest Neighbor for Herbal Leaf Classification Using Shape, Color, and Texture Feature Fusion in Smart Agriculture
DOI:
https://doi.org/10.63158/journalisi.v8i5.1938Keywords:
Herbal Leaf Classification, K-Nearest Neighbor, Feature Extraction, Hyperparameter Tuning, Smart AgricultureAbstract
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.
Downloads
References
[1] A. Riska, Purnawansyah, H. Darwis, and W. Astuti, "Studi perbandingan kombinasi GMI, HSV, KNN, dan CNN pada klasifikasi daun herbal," The Indonesian Journal of Computer Science, vol. 12, no. 3, pp. 1201–1215, 2023, doi: 10.33022/ijcs.v12i3.3210.
[2] S. Ramadhani, J. Iskandar, and T. Husodo, "Studi etnobotani pemanfaatan tumbuhan obat di Desa Cintakarya, Kabupaten Pangandaran, Jawa Barat," in Prosiding Seminar Nasional Masyarakat Biodiversitas Indonesia, vol. 6, no. 1, pp. 518–524, 2020, doi: 10.13057/psnmbi/m060107.
[3] S. F. Fatonah et al., "Pemanfaatan tanaman pekarangan untuk pengobatan herbal," JPPM (Jurnal Pengabdian dan Pemberdayaan Masyarakat), vol. 4, no. 2, pp. 247–256, 2020, doi: 10.30595/jppm.v4i2.6030.
[4] L. P. R. Noviana and I. N. B. S. Nugraha, "Perbandingan klasifikasi citra daun herbal menggunakan metode logistic regression dan decision tree classifier berdasarkan fitur (warna, GLCM, bentuk)," JITU: Journal Informatic Technology and Communication, vol. 7, no. 2, pp. 126–133, 2023, doi: 10.36596/jitu.v7i2.1241.
[5] M. Meiriyama, S. Devella, and S. M. Adelfi, "Klasifikasi daun herbal berdasarkan fitur bentuk dan tekstur menggunakan KNN," JATISI (Jurnal Teknik Informatika dan Sistem Informasi), vol. 9, no. 3, pp. 2573–2584, 2022, doi: 10.35957/jatisi.v9i3.2974.
[6] K. Pushpanathan, M. Hanafi, S. Mashohor, and W. F. Fazlil Ilahi, "Machine learning in medicinal plants recognition: A review," Artificial Intelligence Review, vol. 54, no. 1, pp. 305–327, 2021, doi: 10.1007/s10462-020-09847-0.
[7] A. Z. Alfarizi and E. I. Sela, "Klasifikasi rimpang menggunakan metode k-nearest neighbor dan ekstraksi ciri gray level co-occurrence matrix," Jurnal Fasilkom, vol. 14, no. 1, pp. 88–94, 2024, doi: 10.37859/jf.v14i1.6832.
[8] F. M. Fathoni, C. A. Putra, and A. L. Nurlaili, "Klasifikasi penyakit daun anggur menggunakan metode k-nearest neighbor berdasarkan gray level co-occurrence matrix," Biner: Jurnal Ilmiah Informatika dan Komputer, vol. 3, no. 1, pp. 8–15, 2024, doi: 10.32699/biner.v3i1.6332.
[9] M. Vakili, M. Ghamsari, and M. Rezaei, "Performance analysis and comparison of machine and deep learning algorithms for IoT data classification," arXiv, arXiv:2001.09636, 2020, doi: 10.48550/arXiv.2001.09636.
[10] S. Naeem et al., "The classification of medicinal plant leaves based on multispectral and texture feature using machine learning approach," Agronomy, vol. 11, no. 2, Art. no. 263, 2021, doi: 10.3390/agronomy11020263.
[11] S. Patil and M. Sasikala, "Segmentation and identification of medicinal plant through weighted KNN," Multimedia Tools and Applications, vol. 82, no. 2, pp. 2805–2819, 2023, doi: 10.1007/s11042-022-13201-7.
[12] H. Basri, Purnawansyah, H. Darwis, and F. Umar, "Klasifikasi daun herbal menggunakan k-nearest neighbor dan convolutional neural network dengan ekstraksi Fourier descriptor," Jurnal Teknologi dan Manajemen Informatika, vol. 9, no. 2, pp. 79–90, 2023, doi: 10.26905/jtmi.v9i2.10350.
[13] D. Zahirah, Purnawansyah, N. Kurniati, and H. Darwis, "Digital image classification of herbal leaves using KNN and CNN with GLCM features," Jurnal Teknik Informatika (JUTIF), vol. 5, no. 1, pp. 61–67, 2024, doi: 10.52436/1.jutif.2024.5.1.1162.
[14] H. A. Abu Alfeilat et al., "Effects of distance measure choice on k-nearest neighbor classifier performance: A review," Big Data, vol. 7, no. 4, pp. 221–248, 2019, doi: 10.1089/big.2018.0175.
[15] M. Pintus, F. Colucci, and F. Maggio, "Emerging developments in real-time edge AIoT for agricultural image classification," IoT, vol. 6, no. 1, Art. no. 13, 2025, doi: 10.3390/iot6010013.
[16] A. T. Khan, S. M. Jensen, A. R. Khan, and S. Li, "Plant disease detection model for edge computing devices," Frontiers in Plant Science, vol. 14, Art. no. 1308528, 2023, doi: 10.3389/fpls.2023.1308528.
[17] F. Azzahra and A. D. Astuti, "Comparative study of the use of natural ingredient in ethnomedical study in Indonesia on the herbal formulary of the RI Ministry of Health," Stannum: Jurnal Sains dan Terapan Kimia, vol. 5, no. 2, pp. 58–74, 2023, doi: 10.33019/jstk.v5i2.3895.
[18] C. Schröer, F. Kruse, and J. M. Gómez, "A systematic literature review on applying CRISP-DM process model," Procedia Computer Science, vol. 181, pp. 526–534, 2021, doi: 10.1016/j.procs.2021.01.199.
[19] W. Vallejo, C. Diaz-Uribe, and C. Fajardo, "Google Colab and virtual simulations: Practical e-learning tools to support the teaching of thermodynamics and to introduce coding to students," ACS Omega, vol. 7, no. 8, pp. 7421–7429, 2022, doi: 10.1021/acsomega.2c00362.
[20] D. M. Belete and M. D. Huchaiah, "Grid search in hyperparameter optimization of machine learning models for prediction of HIV/AIDS test results," International Journal of Computers and Applications, vol. 44, no. 9, pp. 875–886, 2022, doi: 10.1080/1206212X.2021.1974663.
[21] P. R. Sihombing and I. F. Yuliati, "Penerapan metode machine learning dalam klasifikasi risiko kejadian berat badan lahir rendah di Indonesia," MATRIK: Jurnal Manajemen, Teknik Informatika dan Rekayasa Komputer, vol. 20, no. 2, pp. 417–426, 2021, doi: 10.30812/matrik.v20i2.1174.
[22] S. Latif, F. F. Dola, M. M. Afsar, I. J. Esha, and D. Nandi, "Investigation of machine learning algorithms for network intrusion detection," International Journal of Information Engineering and Electronic Business, vol. 14, no. 2, pp. 1–22, 2022, doi: 10.5815/ijieeb.2022.02.01.
[23] M. H. Ahmad, F. M. Hana, T. G. Pratama, and H. Aulida, "Klasifikasi empat jenis daun herbal menggunakan metode convolutional neural network," Jurnal Ilmu Komputer dan Matematika, vol. 4, no. 2, pp. 69–76, 2023.
[24] M. F. Kurnia, S. S. Solihat, G. Windarsih, and D. Usmadi, "Identifikasi otomatis lima jenis resak (Vatica spp.) berdasarkan beberapa karakter morfologi daun dan algoritma pembelajaran mesin," Buletin Kebun Raya, vol. 26, no. 1, pp. 26–37, 2023, doi: 10.55981/bkr.2023.740.
[25] R. Muliono, J. H. Lubis, and N. Khairina, "Analysis k-nearest neighbor algorithm for improving prediction student graduation time," SinkrOn, vol. 4, no. 2, pp. 42–46, 2020, doi: 10.33395/sinkron.v4i2.10480.
Downloads
Published
Issue
Section
License
Copyright (c) 2026 Journal of Information Systems and Informatics

This work is licensed under a Creative Commons Attribution 4.0 International License.
Author's Declaration
- The Authors certify that they have read, understood, and agreed to the Journal of Information Systems and Informatics (JournalISI) submission guidelines, policies, and submission declaration. The submission has been prepared using the provided template.
- The Authors certify that all authors have approved the publication of this manuscript and that there is no conflict of interest.
- The Authors confirm that the manuscript is their original work, has not received prior publication, is not under consideration for publication elsewhere, and has not been previously published.
- The Authors confirm that all authors listed on the title page have contributed significantly to the work, have read the manuscript, attest to the validity and legitimacy of the data and its interpretation, and agree to its submission.
- The Authors confirm that the manuscript is not copied from or plagiarized from any other published work.
- The Authors declare that the manuscript will not be submitted for publication in any other journal or magazine until a decision is made by the journal editors.
- If the manuscript is finally accepted for publication, the Authors confirm that they will either proceed with publication immediately or withdraw the manuscript in accordance with the journal’s withdrawal policies.
- The Authors agree that, upon publication of the manuscript in this journal, they transfer copyright or assign exclusive rights to the publisher, including commercial rights


