Pest Detection on Oil-Palm Leaves Using the K-Nearest Neighbor Algorithm and Image Analysis
DOI:
https://doi.org/10.56473/cicost2025pp117-123Keywords:
Image analysis; K-Nearest Neighbor (KNN); leaf pests; oil palm; texture features (GLCM).Abstract
Oil palm is a strategic commodity whose productivity is often threatened by leaf‐feeding pests such as bagworms and nettle caterpillars, underscoring the need for rapid, objective early detection. This study develops an image-based pest detection system using the K-Nearest Neighbor (KNN) algorithm with Gray Level Co-occurrence Matrix (GLCM) texture features—energy, contrast, homogeneity, and correlation—extracted from images of healthy and infested leaves. The workflow comprises preprocessing (resizing, grayscale conversion, thresholding), GLCM feature extraction, normalization, and KNN classification with Euclidean distance and an empirically selected k. Performance is assessed on three classes (healthy, bagworm, nettle caterpillar) using a confusion matrix alongside precision, recall, and F1-score, with cross-validation to gauge generalization. The model reliably distinguishes classes, with classwise metrics ranging from 0.71 to 0.83 evaluation on new samples yields predictions consistent with ground truth. These findings indicate that the GLCM–KNN combination is an effective and affordable approach for early pest detection in oil-palm leaves, supporting timely, data-informed decisions in the field. Future improvements include enlarging and diversifying the dataset, parameter optimization and feature selection, comparative baselines with SVM/CNN, and integration into IoT and UAV monitoring pipelines for plantation-scale surveillance.


