Abstract
Effective weed detection for precise management remains a pertinent issue in modern agriculture. In this study, hyperspectral imaging (HSI) was combined with machine learning (ML) to differentiate between peanut plants and four common weeds found in peanut fields. Several spectral preprocessing methods-Moving Window Averaging (MWA), Median Filtering (MF), Gaussian Filtering (GF), and Savitzky-Golay smoothing (SGS)-were applied. Feature selection algorithms, including Correlation-based feature selection (CFS), Principal Components Analysis (PCA), and Wrapper Feature Selection (WFS), were then used to extract the most informative wavelengths. Among the various classifiers evaluated, the combination of MF preprocessing, WFS algorithm, and LDA classifier (MF-WFS-LDA) achieved the best performance, while the WFS method selected 12 optimal wavelengths from a total of 465. The accuracy, precision, recall, and RMSE values of this model in the training stage were 99.71%, 0.997, 0.997, and 0.054, respectively. These statistics were 96.67%, 0.967, 0.968, and 0.088, respectively, in the test stage. Furthermore, it successfully differentiated peanuts from each weed species using a minimal number of optimal wavelengths. These findings highlight the potential of integrating HSI with ML for precise weed detection in peanut cultivation. However, further validation under diverse environmental and field conditions is recommended.