Implementation of the K-Nearest Neighbor (KNN) Algorithm in Handwritten Digit Pattern Recognition Using the Zoning Method

Authors

  • afilda maharani asmaraloka Universitas Muria Kudus, Jawa Tengah, Indonesia
  • Kharisatun Nisa Universitas Muria Kudus
  • Muhammad Ardi Hermansyah Universitas Muria Kudus
  • Fikri Hamdhan Dwi Saputra Universitas Muria Kudus
  • Arif Setiawan Universitas Muria Kudus https://orcid.org/0000-0001-8525-2984

DOI:

https://doi.org/10.51903/kf6s5f56

Keywords:

Digit Recognition, Handwriting, K-Nearest Neighbors, Digital Image Processing, Google Colab

Abstract

Handwritten digit recognition is one of the key challenges in the field of digital image processing and artificial intelligence, with significant potential in various applications such as automatic form input systems, handwritten data correction, and attendance systems based on handwriting. This study aims to develop a web-based information system capable of automatically recognizing handwritten digits using the K-Nearest Neighbors (KNN) classification method. The system is designed through several main stages, including image preprocessing (conversion to grayscale, thresholding, and image size normalization), feature extraction using the zoning technique, and classification using the KNN algorithm. This research utilizes the MNIST dataset, which contains thousands of handwritten digit images ranging from 0 to 9. The system is developed using the Google Colab platform, supported by Python libraries such as OpenCV, NumPy, and Scikit-learn. Test results show that the system can achieve an accuracy of over 90% at certain K values, indicating that the KNN method is quite effective and efficient in recognizing handwritten digit patterns. This system is expected to be applicable for various digitization needs of handwritten numbers in education, administration, and information technology sectors.

References

H. Syahputra, R. Givent, and A. Simanjorang, “Penerapan Algoritma K-Nearest Neighbor (KNN) dalam Pengenalan Pola Tulisan Tangan Angka 0-9,” vol. 28, no. 2, p. 2023.

V. Oktavia and N. Wijaya, “Pengenalan Tulisan Tangan Huruf Latin Bersambung Menggunakan Local Binary Pattern dan K-Nearest Neighbor,” 2022.

M. I. Mubarok, C. Informatika, S. Karawang, J. H. Ronggo Waluyo, T. Timur, and I. Karawang, “PENERAPAN ALGORITMA K-NEAREST NEIGHBOR (KNN) DALAM KLASIFIKASI PENILAIAN JAWABAN UJISAN ESAI,” 2023.

C. Ramadhona Hassolthine, R. Sahara, F. Asy, S. N. Haq, and S. Abdullah, “Hlm 358-363 1,2,4 PJJ Informatika,” JOISIE Journal Of Information System And Informatics Engineering, vol. 7, no. 2, pp. 2780–6189, 2023.

Z. A. Muhammad, G. Budiman, and S. Saidah, “PENGGUNAAN COMPRESSIVE SENSING PADA PENGENALAN HURUF DENGAN TULISAN TANGAN MENGGUNAKAN METODE K-NEAREST NEIGHBOR”, doi: 10.25126/jtiik.202295612.

M. Suyal and P. Goyal, “A Review on Analysis of K-Nearest Neighbor Classification Machine Learning Algorithms based on Supervised Learning,” Jul. 01, 2022, Seventh Sense Research Group. doi: 10.14445/22315381/IJETT-V70I7P205.

Published

2025-05-31