Soybean, as a summer sowing crop, has the characteristics of small seeds, weak seedling roots, and slow growth. On the other hand, high temperature and high humidity promote the rapid and diversified growth of weeds in the summer. This seriously hinders the growth of soybean because the weeds will compete for resources, such as sunlight, water, inorganic salts, and living space. As a result, the quality and yield of soybean are adversely affected, and the growth and development of soybean are hindered [
1].
Currently, there are three main conventional methods for weeding: artificial weeding, mechanized weeding, and chemical weeding. Artificial weeding in soybean fields is resource-intensive, especially due to the hot summer weather and the low operational efficiency of the process. This makes it unsuitable for large-scale weeding operations. Mechanical weeding can significantly improve the efficiency of the weeding program. In addition, it reduces the physical consumption of agricultural workers to the greatest extent and avoids the use of herbicides. Therefore, it lightens the ecological consequences of agricultural output [
2]. Chemical weeding has brought the benefits of economy, rapidity, and simplicity. Nevertheless, when large-scale chemical weeding is carried out under high-temperature and high-humidity conditions in summer, it may cause phytotoxicity to soybean seedlings. By applying herbicides, rainy conditions can increase the environmental risks. Target application of pesticides is an innovative method of chemical weeding that can accurately apply herbicide to crops and weeds. This method reduces the use of herbicide in non-target areas and the negative impact on the environment [
3]. Automatic mechanical weeding and the targeted application of pesticides depend on the accurate detection and identification of crops and weeds, so the identification of crops and weeds plays a vital role in ensuring the success of these operations.
Traditional crop and weed classification methods mainly include spectral feature recognition, conventional machine vision recognition, and deep learning-based machine vision recognition. In terms of spectral feature recognition, Su et al. [
4] used a drone, multispectral images, and machine learning techniques to spectrally analyse blackgrass in a wheat field, combined with a random forest classifier and Bayesian hyperparameter optimization, to achieve accurate weed classification and localization. Nik et al. [
5] utilized high-resolution multispectral data collected by a UAV to extract sensitive bands for distinguishing weeds from crops through significance analysis and then accomplished the distinction and localization of weeds in sorghum fields. Li et al. [
6] utilized hyperspectral imaging data and a multilayer perceptron classification model to achieve the recognition of four weeds in the pasture with an overall accuracy of 89.1%. Different crops and weeds have different spectral reflectance characteristics, and spectral analysis can effectively classify different kinds of crops. However, spectral instruments are expensive, and the data collected are affected by soil type, humidity, and light conditions, which increases the difficulty of classifying weed and crop. In machine vision recognition, the traditional recognition methods are mainly based on the differences in colour, edge texture, and shape characteristics between crops and weeds, combined with machine learning algorithms to achieve classification. Commonly used algorithms mainly include Support Vector Machines (SVM), random forest, decision tree algorithms, etc. [
6,
7,
8]. The recognition results are easily affected by factors such as changes in illumination, crop blockage, and data imbalance, etc., and the robustness of the recognition effect needs to be improved. At the same time, traditional methods need to design features manually, which is complicated in operation and has some defects, such as slow detection speed and insufficient identification accuracy. The integration of machine vision and deep learning algorithms leads to the application of the Convolutional Neural Network (CNN) in precision agriculture. This vision algorithm has stronger generalisation ability and higher accuracy than traditional methods, effectively enhancing the accuracy and adaptability of recognising target crops. Wang et al. [
9] extracted multi-scale hierarchical features from images by CNN to realize the recognition of corn and weeds with an average target recognition accuracy of 98.92%. Kong et al. [
10] proposed an improved YOLOv5 algorithm for fast and accurate identification of seedling crops and weeds in complex environments. Zhang et al. [
11] built a weed recognition system for peanut fields based on the improved YOLOv4 algorithm, and its maximum average accuracy for weed recognition was 94.54%. Zhang et al. [
12] used an optimized Faster R-CNN algorithm for weed identification in the seedling soybeans and achieved an average recognition rate of 92.69% in a natural environment. J. Prabavadhi et al. [
13] established a YOLOv5-based method for detecting plant weeds, and medicinal plants; this method utilized a diverse Kaggle dataset for precise annotations and achieved high performance in precision, recall, and F1 score. Sneha N et al. [
14] used the Region-Based Convolutional Neural Network (R-CNN), YOLOv3, and Centernet object recognition algorithms to identify weeds in images, and they pointed out that people need to begin by gathering a sizable collection of photos of various weed species to construct a deep learning model for weed identification. Oscar L G et al. [
15] established an artificial vision system based on the YOLOv5s model to differentiate corn from four types of weeds, and the recognition accuracy of corn was much higher than that of weeds. Although the deep learning algorithm can solve the problem of manual feature design in traditional image processing methods, its overall recognition rate is affected by the size of the dataset, and the dataset in a single environment restricts the versatility of the recognition model, resulting in a lack of robustness and generalization ability of the model. Compared to crops, there are many kinds of weeds in farmland, and the distribution of weeds is greatly influenced by geographical factors [
16], which makes it very difficult to establish comprehensive weed datasets.
Intelligent weeding robots have recently become a prominent field of agricultural research [
17,
18,
19]. Bawden et al. [
20] developed a modular weeding robot called AgBotII, which used machine vision for colour classification to differentiate crops from weeds. AgBotII can identify both broadleaf plants and grasses, achieving 96% overall accuracy. Trygve et al. [
21] developed a target application intelligent weeding robot, Adigo, to achieve accurate weeding of carrot fields by differentiating and localizing carrots and weeds. However, these devices cannot be widely implemented due to the high costs, and the computational costs required by weed detection and recognition algorithms are also too large [
22,
23]. Therefore, it is imperative to study the weed identification model on embedded devices, with the emphasis on reducing the calculation cost and improving the accuracy.
In this study we collected images of soybean seedlings and weeds from different regions aims to solve the problem of weed recognition at the soybean seedling stage under natural conditions. In this paper, the recognition of weeds is divided into two steps; firstly, the lightweight YOLOv8nGP algorithm is used to identify soybean seedlings. Secondly, after soybean seedlings are separated, weeds and soil parts are kept in the image, and then weeds are extracted and segmented from the background using the NExG index. Finally, an algorithm for recognising weeds at the soybean seedling stage is developed. Applying this algorithm to intelligent field weeding machinery can accurately identify different kinds of weeds in the field and then guide the weeding machinery to carry out targeted weeding operations. This way of combining deep learning with traditional machine vision algorithms can reduce the dependence of the recognition model on datasets and improve the robustness of the model.