A New Triple-Weighted K-Nearest Neighbor Algorithm for Tomato Maturity Classification

Authors

  • Lidya Ningsih Lidya Telkom University
  • Arif Mudi Priyatno Arif Universitas Pahlawan Tuanku Tambusai
  • Addini Yusmar dini Universitas Islam Negeri Mahmud Yunus Batusangkar

DOI:

https://doi.org/10.29207/resti.v9i4.6441

Keywords:

DW-KNN, HSV, KNN, Tomato, TW-KNN, W-KNN

Abstract

As climatic products, tomatoes are highly sensitive to harvesting and processing. The sorting of tomatoes can be significantly improved by utilizing Hue Saturation Value (HSV) color features that are classified using neighboring algorithms, such as K-Nearest Neighbor (KNN), Weighted K-Nearest Neighbor (W-KNN), and DW-KNN. However, the DW-KNN algorithm does not consider the relative relationship between the farthest, nearest, and surrounding neighbors, which may impact the classification accuracy, particularly in datasets with uneven distributions. This study proposes a Triple Weighted K-Nearest Neighbor (TW-KNN) algorithm for tomato image classification. This algorithm effectively handles the problem of sensitivity and outliers in the data distribution and considers the relationship between neighboring distances. The classification data consisted of 400 tomato images with five maturity levels divided into training and testing sets using k-fold cross-validation. Tests were conducted using several variations of parameter k, namely 4, 6, 9, and 15, to evaluate the classification performance. The results show that the proposed TW-KNN algorithm consistently outperforms other methods by producing better classification results. This is demonstrated by an accuracy rate of 95.52% across different values of k. The superior performance of the TW-KNN highlights its ability to provide robust and stable classification results compared to conventional KNN variants. This finding indicates that the TW-KNN is more effective in consistently classifying tomato fruits, making it a promising approach for automated fruit sorting applications.

Downloads

Download data is not yet available.

References

Y. P. Huang, T. H. Wang, and H. Basanta, “Using Fuzzy Mask R-CNN Model to Automatically Identify Tomato Ripeness,” IEEE Access, vol. 8, pp. 207672–207682, 2020, doi: 10.1109/ACCESS.2020.3038184.

R. G. de Luna, E. P. Dadios, A. A. Bandala, and R. R. P. Vicerra, “Tomato growth stage monitoring for smart farm using deep transfer learning with machine learning-based maturity grading,” Agrivita, vol. 42, no. 1, pp. 24–36, 2020, doi: 10.17503/agrivita.v42i1.2499.

W. Rahmatika, Wasito, B. S. Wibawa, T. Handayani, and N. Fitriyah, “Potensi Pupuk Kotoran Kelinci dan Pupuk Anorganik pada Tanaman Tomat (Lycopersicum esculentum Mill.),” Innofarm J. Inov. Pertan., vol. 26, no. 1, pp. 61–68, 2024.

H. S. Mputu, A. Abdel-Mawgood, A. Shimada, and M. S. Sayed, “Tomato Quality Classification Based on Transfer Learning Feature Extraction and Machine Learning Algorithm Classifiers,” IEEE Access, vol. 12, no. December 2023, pp. 8283–8295, 2024, doi: 10.1109/ACCESS.2024.3352745.

Ifmalinda, Andasuryani, and I. Rasinta, “Classification of tomato (Lycoersicon Esculentum Miil) ripeness levels based on HSV color using digital image processing,” IOP Conf. Ser. Earth Environ. Sci., vol. 1116, no. 1, 2022, doi: 10.1088/1755-1315/1116/1/012062.

H. Mubarok, S. Murni, and M. M. Santoni, “Penerapan Algoritma K-Nearest Neighbor untuk Klasifikasi Tingkat Kematangan Buah Tomat Berdasarkan Fitur Warna,” Semin. Nas. Mhs. Ilmu Komput. dan Apl. Jakarta-Indonesia, no. April, pp. 773–782, 2021.

P. Das and J. P. S. Yadav, “Automated Tomato Maturity Grading System using CNN,” Proc. - Int. Conf. Smart Electron. Commun. ICOSEC 2020, no. Icosec, pp. 136–142, 2020, doi: 10.1109/ICOSEC49089.2020.9215451.

S. A. Mutha, A. M. Shah, and M. Z. Ahmed, “Maturity Detection of Tomatoes Using Deep Learning,” SN Comput. Sci., vol. 2, no. 6, pp. 1–7, 2021, doi: 10.1007/s42979-021-00837-9.

N. Astrianda, “Klasifikasi Kematangan Buah Tomat Dengan Variasi Model Warna Menggunakan Support Vector Machine,” VOCATECH Vocat. Educ. Technol. J., vol. 1, no. 2, pp. 45–52, 2020, doi: 10.38038/vocatech.v1i2.27.

L. Ningsih and P. Cholidhazia, “Classification Of Tomato Maturity Levels Based on RGB And HSV Colors Using KNN Algorithm,” RIGGS J. Artif. Intell. Digit. Bus., vol. 1, no. 1, pp. 25–30, 2022, doi: 10.31004/riggs.v1i1.10.

A. M. Priyatno, “Spammer Detection Based on Account, Tweet, and Community Activity on Twitter,” J. Ilmu Komput. dan Inf., vol. 13, no. 2, pp. 97–107, 2020, doi: 10.21609/jiki.v13i2.871.

S. Uddin, I. Haque, H. Lu, M. A. Moni, and E. Gide, “Comparative performance analysis of K-nearest neighbour (KNN) algorithm and its different variants for disease prediction,” Sci. Rep., vol. 12, no. 1, pp. 1–11, 2022, doi: 10.1038/s41598-022-10358-x.

P. Tamrakar and S. P. Syed Ibrahim, “Lazy Learning Associative Classification with WkNN and DWkNN Algorithm,” ITM Web Conf., vol. 37, p. 01023, 2021, doi: 10.1051/itmconf/20213701023.

G. Chen, X. Guo, K. Liu, X. Li, and J. Yang, “RWKNN: A Modified WKNN Algorithm Specific for the Indoor Localization Problem,” IEEE Sens. J., vol. 22, no. 7, pp. 7258–7266, 2022, doi: 10.1109/JSEN.2022.3155902.

F. Tarakci and A. Ozkan, “Comparison of classification performance of kNN and WKNN algorithms,” Selcuk Univ. J. Eng. Sci., vol. 20, no. 02, pp. 32–37, 2021, [Online]. Available: http://sujes.selcuk.edu.tr/sujes.

S. Ji, R. Li, S. Shen, B. Li, B. Zhou, and Z. Wang, “Heartbeat Classification Based on Multifeature Combination and Stacking-DWKNN Algorithm,” J. Healthc. Eng., vol. 2021, 2021, doi: 10.1155/2021/8811837.

E. K. Hassan and J. H. Saud, “HSV Color Model and Logical Filter for Human Skin Detection,” AIP Conf. Proc., vol. 2457, no. February, 2023, doi: 10.1063/5.0120025.

L. Xiong and Y. Yao, “Study on an adaptive thermal comfort model with K-nearest-neighbors (KNN) algorithm,” Build. Environ., vol. 202, no. June, p. 108026, 2021, doi: 10.1016/j.buildenv.2021.108026.

A. Almomany, W. R. Ayyad, and A. Jarrah, “Optimized implementation of an improved KNN classification algorithm using Intel FPGA platform: Covid-19 case study,” J. King Saud Univ. - Comput. Inf. Sci., vol. 34, no. 6, pp. 3815–3827, 2022, doi: 10.1016/j.jksuci.2022.04.006.

Downloads

Published

2025-08-28

Issue

Section

Artificial Intelligence

How to Cite

Lidya, L. N., Arif, A. M. P., & dini, A. Y. (2025). A New Triple-Weighted K-Nearest Neighbor Algorithm for Tomato Maturity Classification. Jurnal RESTI (Rekayasa Sistem Dan Teknologi Informasi), 9(4), 955-962. https://doi.org/10.29207/resti.v9i4.6441