Establishment method and application of wheat seedling detection model
By establishing a wheat seedling detection model, using an efficient feature extractor DTV and feature fusion network, combined with local annotation strategy, the problems of accuracy and efficiency in traditional methods are solved, and efficient and accurate wheat seedling detection is achieved.
Patent Information
- Application Number
- CN202510343951.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-22
- Publication Date
- 2025-08-12
AI Technical Summary
The existing traditional wheat seedling detection methods have low accuracy and efficiency, especially in large-scale farmland applications, which are susceptible to artificial errors, and have poor detection results in complex field environments.
A wheat seedling detection model is established, and the feature extraction and prediction process is optimized through efficient local feature module ELFM, feature reshaping module FRM, multi-scale global feature aggregation module MSGAM, feature strengthening module FEM and EIoU loss function.
It improves the accuracy and efficiency of wheat seedling detection, enhances the model's characterization ability of local structure, spatial context and global characteristics, reduces the impact of calculation complexity and background interference, and improves detection accuracy and robustness.
Smart Images

Figure CN120472303A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of wheat seedling quantity evaluation, and in particular to a method for establishing a wheat seedling detection model and its application. Background Art
[0002] The seedling stage is the starting point for wheat planting and the beginning of plant population regulation, significantly impacting the entire wheat growth and development process. Accurately and efficiently counting wheat plants during the seedling stage is a key indicator for assessing seedling population size and sowing quality. This not only helps assess the rationality of sowing depth, density, and quality, but also influences grain structure and wheat yield to a certain extent.
[0003] Traditional seedling counting methods rely primarily on manual field surveys. While this method is relatively simple and direct, it is susceptible to human error, and particularly faces problems of low efficiency and high cost in large-scale farmland applications. With the application of traditional image processing technology in precision agriculture, the inventors have also learned of a wheat seedling detection method based on traditional image processing technology, which generally includes steps such as image preprocessing, region segmentation, feature extraction, and counting statistics. First, the seedling contrast is enhanced through color space conversion (such as RGB to HSV), filtering denoising, and histogram equalization. Then, the seedling region is extracted using threshold segmentation, edge detection (Sobel, Canny), or K-means clustering. Next, noise is removed through morphological processing (opening and closing operations), and the number of seedlings is counted using connected domain analysis or contour detection.
[0004] However, in the process of implementing the technical solutions in the embodiments of the present application, the inventors of the present application found that although the crop seedling detection method based on image processing has initially achieved automated detection and is suitable for resource-constrained environments, its degree of automation is low, and the detection results are affected by human subjective factors. The generalization ability is insufficient, and it is difficult to accurately and efficiently detect seedlings in complex field environments.
[0005] The information disclosed in this background technology section is only used to deepen the understanding of the background technology of the present disclosure and should not be regarded as an admission or any form of suggestion that the information constitutes the prior art known to those skilled in the art. Summary of the Invention
[0006] In view of at least one of the above technical problems, the present disclosure provides a wheat seedling detection model, which aims to solve the technical problems of low accuracy and efficiency of existing traditional wheat seedling detection methods.
[0007] According to one aspect of the present disclosure, a method for establishing a wheat seedling detection model is provided, comprising the following steps: (1) After wheat is sown, image data of wheat seedlings is collected from the seedling stage to the three-leaf stage; (2) cropping and data enhancement processing are performed on the collected image data to form a wheat seedling dataset, and after image annotation, the wheat seedling dataset is divided into a training set, a test set, and a validation set; (3) Using a local annotation strategy to annotate the wheat seedling dataset; (4) Establish a wheat seedling detection model including feature extraction network, feature fusion network and prediction network; (5) The wheat seedling detection model is obtained by training the wheat seedling detection model based on the wheat seedling dataset.
[0008] In some embodiments of the present disclosure, in step (1), different wheat varieties are sown in different years, different sowing spacings are set, and different data areas are divided according to the spacings; and the water and fertilizer treatments of each data area are controlled to be the same.
[0009] In some embodiments of the present disclosure, in step (2), the wheat seedling dataset is divided into different data subsets according to different data areas, and each of the data subsets is divided into the training set, test set, and validation set in the same division ratio.
[0010] In some embodiments of the present disclosure, in step (3), the local marking strategy is performed with the stem of the wheat seedling as the origin, the soil contact surface as the base, and the length covering 2.8 to 3.2 cm between the two leaves of the wheat seedling.
[0011] In some embodiments of the present disclosure, in step (4), the feature extraction network is an efficient feature extractor DTV, and the efficient feature extractor includes an efficient local feature module ELFM, a feature reshaping module FRM, and a multi-scale global feature aggregation module MSGAM.
[0012] In some embodiments of the present disclosure, in step (4), the feature fusion network adopts a bidirectional feature fusion mechanism and includes a feature coordination module Dc2 and a feature enhancement module FEM for performing weighted optimization processing on the output feature map of the efficient feature extractor DTV.
[0013] In some embodiments of the present disclosure, in step (4), the prediction network includes an efficient intersection-over-union loss function EIoU.
[0014] In some embodiments of the present disclosure, in step (5), any data subset is selected for model training, and an epoch after the loss and accuracy are stabilized is selected as the training weight of the wheat seedling detection model.
[0015] In some embodiments of the present disclosure, in step (5), for the set N epoch training cycles, the backbone network parameters are frozen in the first M training cycles and only the model classifier part is trained; the backbone network parameters are unfrozen in the next NM training cycles and participate in model training.
[0016] According to another aspect of the present disclosure, a wheat seedling detection method is provided, which performs quantitative detection on wheat seedlings based on the wheat seedling detection model established by the above method.
[0017] One or more technical solutions provided in the embodiments of the present application have at least any of the following technical effects or advantages: In the feature extraction stage, the wheat seedling detection model introduces an efficient feature extractor DTV, including an efficient local feature module ELFM, a feature reshaping module FRM, and a multi-scale global feature aggregation module MSGAM, which enhances the model's comprehensive characterization capability of the local structure, spatial context, and global features of the wheat seedlings, while effectively reducing the number of parameters and computational costs. Secondly, in the feature fusion stage, a feature enhancement module FEM based on the coordinate attention mechanism CA is introduced to optimize the spatial expression capability, effectively reduce background interference, and improve the feature fusion efficiency through the feature coordination module Dc2, thereby reducing the computational complexity. In the prediction stage, the EIoU loss function is used for bounding box optimization, thereby improving the positioning accuracy and overall detection performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 These are images of wheat seedlings under different planting densities and field environments in one embodiment of the present application.
[0019] Figure 2 This is a schematic diagram of partial marking of wheat seedlings under different planting density conditions in one embodiment of the present application.
[0020] Figure 3 This is a structural principle diagram of a wheat seedling detection model in one embodiment of the present application.
[0021] Figure 4 This is a structural principle diagram of the feature extraction network in one embodiment of the present application.
[0022] Figure 5 1 is a structural principle diagram of an efficient local feature module ELFM in one embodiment of the present application.
[0023] Figure 6 This is a structural principle diagram of the feature reshaping module FRM in one embodiment of the present application.
[0024] Figure 7 This is a structural principle diagram of the multi-scale global feature aggregation module MSFGA in one embodiment of the present application.
[0025] Figure 8 This is a structural principle diagram of a feature fusion network in one embodiment of the present application.
[0026] Figure 9 This is a schematic diagram of the structural principle of the coordinate attention mechanism CA in one embodiment of the present application.
[0027] Figure 10 2 is a structural principle diagram of the feature coordination module Dc2 in one embodiment of the present application.
[0028] Figure 11 This is a structural principle diagram of the prediction network in one embodiment of the present application.
[0029] Figure 12 This is a curve chart of the wheat seedling detection model training results in one embodiment of the present application.
[0030] Figure 13 This is a schematic diagram of the detection effects of different marking methods in one embodiment of the present application.
[0031] Figure 14 This is a schematic diagram of the detection effect of YOLOv8-n on wheat seedlings with different planting densities in one embodiment of the present application.
[0032] Figure 15 This is a schematic diagram of the detection effect of the wheat seedling detection model on wheat seedlings with different planting densities in one embodiment of the present application.
[0033] Figure 16 This is a schematic diagram of the visual comparison of the detection effect in a field environment in one embodiment of the present application. DETAILED DESCRIPTION
[0034] In order to better understand the technical solution of the present application, the above technical solution will be described in detail below with reference to the accompanying drawings and specific implementation methods.
[0035] To address the shortcomings of wheat seedling detection methods based on traditional image processing technology in terms of detection accuracy and efficiency, this example discloses a method for establishing a wheat seedling detection model, which specifically includes the following steps: (1) After wheat is sown, image data of wheat seedlings is collected from the seedling stage to the three-leaf stage.
[0036] In this embodiment, a field experiment carried out in a wheat experimental field in Xuchang City, Henan Province is taken as an example to carry out field experiments and corresponding data collection. Specifically, the first experiment was carried out on October 26, 2023, and the wheat variety sown was dwarf 58, and a plot experiment and a field experiment were set up. Among them, the plot experiment included 3 plots with an area of 10m², and artificial sowing was adopted, with plant spacings of 1cm, 3cm, and 5cm respectively; the field experiment area was 300m², and mechanical sowing was adopted with a plant spacing of 1cm. The second experiment started on November 5, 2024, and the wheat variety sown was new wheat 26. The setting of the experimental environment was the same as the first time, and to ensure the comparability of the experimental results, the water and fertilizer treatments of all experiments were kept consistent in this example. Thus, wheat data for two planting years, two main wheat varieties, three planting densities, and two types of field environments involving plot experiments and field experiments in each data area can be obtained.
[0037] After sowing is completed, data collection begins at intervals of two weeks. In this embodiment, data collection is specifically carried out during the wheat seedling stage to the three-leaf stage. Counting the wheat seedlings at this stage can efficiently and accurately calculate the emergence rate to provide important data for seedling monitoring. Specifically, this example uses a Canon EOS 1500D camera with auxiliary tools such as a tripod and a gimbal for image data collection. The shooting height of the camera is set to 1.5m from the ground, and the shooting angle is 45° downward from the horizontal plane. To ensure uniform lighting and image quality, data collection is carried out from 8:40 to 10:00 in the morning and from 14:00 to 16:00 in the afternoon every day. Finally, a total of 3,400 RGB images of different wheat varieties, planting densities and field environments were collected, and the image resolution was 5472×3648 pixels. For some wheat seedling images, see Figure 1 .
[0038] (2) The collected data are cropped and data enhanced to form a wheat seedling dataset, and the wheat seedling dataset is divided into a training set, a test set, and a validation set after image annotation.
[0039] In this example, when processing the collected data, all original images were first cropped and resized to 2400 × 1400 pixels. Furthermore, to enhance the model's adaptability to different scene changes, data augmentation processing was performed on the images, including rotation (90°, 180°, and 270°), flipping, and brightness adjustment. This expanded the data size from 3400 to 6000 images, forming the Wheat Seedling Dataset (WSD).
[0040] Among them, the wheat seedling dataset in this example specifically includes 4 data subsets with multiple scenes and multiple densities. The specific data distribution is shown in Table 1. In this example, the wheat seedling dataset has a total of 156,000 wheat seedlings annotated, of which the maximum number of seedlings annotated in a single image is 45, the minimum is 12, and the average number of seedlings annotated per image is 26, which can more fully reflect the characteristics of different planting densities and experimental environments. In addition, in this embodiment, the dataset is divided into training set, test set, and validation set in a ratio of 8:1:1. Among them, the data division ratio of each subset remains consistent to ensure that all types of scenes are fully covered and evaluated during the training, testing, and validation processes.
[0041] .
[0042] (3) A local labeling strategy is used to label the wheat seedling dataset.
[0043] The accuracy of wheat seedling detection depends largely on the quality of the dataset's annotation. Existing wheat seedling detection methods known to the inventors generally adopt a global annotation strategy, which involves annotating the wheat seedlings in the image as a whole. However, due to the small size and dense distribution of wheat seedlings, which are often accompanied by cross-occlusion, global annotation not only increases the complexity of the annotation work but also easily leads to a large proportion of background information such as soil in the annotated data. This redundant background information weakens the model's ability to extract fine-grained features of wheat seedlings, thereby affecting the improvement of detection accuracy.
[0044] To overcome the above problems, in this embodiment, see Figure 2 A local annotation strategy was used for the wheat seedling dataset to improve its annotation quality. Specifically, LabelImg software was used to annotate each wheat seedling image individually. The annotation method used the stem of the wheat seedling as the origin, covering a length of approximately 3 cm between the two leaves of the wheat seedling, and the soil contact surface as the base. Compared with global annotation, the local annotation used in this example significantly reduced the interference of soil background information, improved the focus of the annotated area, and helped enhance the model's ability to extract fine-grained features of the wheat seedlings. Furthermore, local annotation effectively simplified the annotation operation and reduced the difficulty of annotation caused by overlapping and occlusion of wheat seedlings.
[0045] (4) Establish a wheat seedling detection model including feature extraction network, feature fusion network and prediction network; In this embodiment, see Figure 3 , a TCE-YOLO wheat seedling detection model was established, which consists of a feature extraction network, a feature fusion network and a prediction network.
[0046] Through long-term practical research, the inventors discovered that spatial contextual information is crucial for the model to understand the relationship between seedlings and their surroundings, particularly in locating seedling positions, identifying relationships between seedlings, and distinguishing seedlings from the soil background. However, traditional models primarily rely on convolutional neural networks (CNNs) for feature extraction. Due to their limited receptive field, they struggle to capture long-range contextual dependencies between features. This limitation is particularly pronounced in densely planted wheat seedlings, easily leading to decreased detection accuracy and increased false detection rates. Therefore, in this embodiment, to achieve efficient collaborative modeling of local, spatial contextual, and global features, an efficient feature extractor (DTV) is incorporated into the feature extraction network of the wheat seedling detection model. Specifically, the feature reshaping module (RCM) is combined with Vision Transformer technology to address the CNN network's difficulty in capturing long-range contextual dependencies. The multi-scale global feature aggregation module (MSFGA) combines multi-scale spatial pooling to capture local details and global contextual information, alleviating the limited receptive field of CNN feature extraction and addressing the insufficient extraction capability when extracting wheat seedlings of different scales. The efficient local feature module (ELFM) optimizes feature extraction efficiency and reduces computational complexity. DTV integrates the above three modules to efficiently capture local, contextual and global features and model the relationship between them. Figure 4 .
[0047] Specifically, the efficient feature extractor DTV includes an efficient local feature module ELFM (Efficient Local Feature Module), a feature reshaping module FRM (Feature Reshaping Module), and a multi-scale global feature aggregation module MSGAM (Multi-Scale Global Aggregation Module).
[0048] Among them, the efficient local feature module ELFM uses depthwise separable convolution to efficiently complete the local feature extraction of wheat seedlings. Its structure is as follows Figure 5As shown in the figure, the depthwise separable convolution consists of point-by-point convolution PC and 3×3 depthwise convolution DC. For the input feature map, a 1×1 convolution kernel is first used to perform point-by-point convolution between image channels to integrate the feature information of different channels, thereby enhancing the representation ability of local features; then, the feature information is normalized and nonlinearly transformed through BN (BatchNormalization) and ReLU6 activation functions to maintain the stability and nonlinear characteristics of the feature information. After that, a 3×3 convolution kernel is used to perform a separate convolution operation on each input channel to generate feature maps for each channel. This structure can effectively reduce the number of convolution kernels, avoid weight sharing between channels, and reduce the amount of computation. Subsequently, BN and ReLU6 activation functions are used to maintain the stability and nonlinear characteristics of the feature information; finally, a 1×1 point-by-point convolution is used again to fuse the channel dimension in order to reintegrate the features and generate a new channel representation. In addition, see Figure 5 ,In this case, the efficient local feature module ELFM also introduces a residual structure to ensure ,effective information retention during feature extraction.
[0049] In this embodiment, the feature reshaping module FRM captures the contextual dependencies of local features through the Transformer encoder combined with the self-attention mechanism, mines spatial associations, and thus generates a fine-grained feature representation that integrates spatial context and local information. Its structure is as follows Figure 6 As shown, specifically, local feature encoding is performed first. The input of the FRM module is the feature from the efficient local feature module ELFM Figure X ∈R C×H×W , where C is the number of channels, H and W are the height and width of the feature map respectively. Features are extracted through a (n×n) size convolution Figure X Perform local encoding to capture local spatial information within a small range. Then perform context-related feature extraction (Transformer encoding). Use a 1×1 point-by-point convolution layer to project the local feature information into a high-dimensional space, denoted as X. L ∈R d×H×W (d is the spatial dimension, and d>C). X L ∈R d×H×W In high-dimensional space, the Unfold operation will transform it into P non-overlapping image blocks X L ∈R d×N×P , where P is the number of image blocks, P=w×h, and N=(H×W) / P, w and h are the height and width of the image block respectively. In this way, the mapping of local features to spatial block features is achieved. In order to extract the contextual association information between the local feature information in the image, the local feature X after the block is L ∈R d ×N×PInput to the Transformer module, the self-attention mechanism is used to extract contextual features within and between image blocks. Through the Fold operation, the X L ∈R d×N×P Reintegrate back to the original spatial resolution and encode it as X G ∈R d×H×W , while retaining the contextual features, this process reconstructs the block-level features into a complete feature map. G ∈R d×H×W The feature is projected back to the low-dimensional space through 1×1 point-by-point convolution. Finally, the reduced-dimensional feature is combined with the initial input feature through a cascade operation to obtain the output feature R that integrates local and global information. C×H×W .
[0050] Considering that wheat seedlings may appear at different scales in the image, it will affect the feature extraction of the model. Therefore, in order to enhance the model's ability to identify targets of different scales, in this embodiment, a multi-scale global feature aggregation module MSFGA is set. MSFGA uses multi-scale spatial pooling SPPF to perform multi-scale downsampling on the output F7 of the top layer of the network with the largest receptive field range. By aggregating information of different spatial scales, multi-scale global feature information is extracted. The structure of the multi-scale global feature aggregation module MSFGA in this example is as follows: Figure 7 As shown in the figure, it uses three small pooling kernels with sizes of 13*13, 9*9, and 5*5 to replace the pooling operation of a single large kernel. This reduces the computational complexity while maintaining the ability to aggregate multi-scale features. After the multi-scale pooling operation, the outputs of different pooling layers are concatenated to generate a feature map F8 that contains multi-scale global feature information.
[0051] The feature fusion network of the wheat seedling detection model improves the model's expressiveness and multi-scale adaptability by fusing feature maps at different levels. Figure 2As shown in the figure, wheat seedlings exhibit varying scales in an image. Therefore, the wheat seedling detection model TCE-YOLO employs a bidirectional feature fusion mechanism (PAFPN) consisting of a feature pyramid network (FPN) and a path aggregation network (PAN) to fuse feature maps of three different scales (F3, F5, and F8) to ensure the effective transfer and integration of multi-level features. Feature map F3 focuses on the local details of the wheat seedlings; F5 combines local features with contextual information to capture the relationships between seedlings and their distinction from the background; and F8 incorporates global semantic information, revealing the overall image context and large-scale relationships. By enabling bidirectional information transfer between these different layers of feature maps, the bidirectional feature fusion network transfers both local details from the shallow layers and global semantic information from the deep layers, thereby enhancing the expressive power of features and improving the model's ability to recognize wheat seedlings of varying scales and those that are partially occluded.
[0052] However, considering that the feature maps F3, F5 and F8 may still contain a large amount of redundant background information, the interference of complex backgrounds can easily have a negative impact on the detection accuracy of the model. In order to avoid the adverse effects of complex backgrounds on detection accuracy in field environments, in this embodiment, a feature enhancement module FEM based on the coordinate attention mechanism CA is introduced into the feature fusion network of the wheat seedling detection model TCE-YOLO. FEM performs weighted optimization on the feature maps extracted by DTV to optimize the weights of key information in the feature maps, enhance the significant feature expression of the seedlings, and thus achieve the purpose of suppressing background feature interference. At the same time, in order to cope with the problem of increased computational complexity caused by the attention mechanism and the multi-scale feature fusion process, this example uses deep separable convolution (DSC) to simplify the feature fusion process calculation. The traditional C2f is lightweighted through deep separable convolution to form a feature coordination module Dc2, which retains the function of C2f to coordinate the information transfer between multi-scale feature maps in the feature fusion process, while reducing computational overhead and enhancing fusion efficiency through module structure optimization. The structure of the feature fusion network is shown in the figure. Figure 8 shown.
[0053] Specifically, the feature enhancement module FEM uses the coordinate attention mechanism CA to apply the coordinate attention mechanism (CA) layer by layer to the three-layer feature map (F3, F5, F8) output by the feature extraction network to enhance the feature expression. Its structure is as follows: Figure 9As shown. First, the number of channels of the input feature map is compressed by 1×1 convolution to complete the nonlinear transformation, and ReLU activation is used after retaining important feature information. The feature map is then decomposed along the spatial dimension, and feature vectors in the horizontal and vertical directions are generated by global average pooling. This decomposition enables the model to focus on the key areas of the feature map in the horizontal and vertical directions respectively. Next, 1×1 convolution is performed on the horizontal and vertical feature vectors respectively to restore the original number of channels, and the Sigmoid function is used to generate horizontal and vertical attention weight tensors. Finally, these weights are element-wise multiplied with the original feature map and weighted fusion is performed to highlight the key information of the target area while suppressing the interference of irrelevant background. The above process is applied to F3, F5 and F8 layer by layer, and finally the enhanced feature maps F3*, F5* and F8* are generated for subsequent feature map fusion.
[0054] In the traditional YOLO8 network, the C2f module is a key component of the bidirectional feature fusion network. It is deployed after each feature map concatenation and is used to achieve feature fusion between two adjacent feature layers. However, in this embodiment, the introduction of the coordinate attention mechanism (CA) in the wheat seedling detection model enhances feature representation capabilities but also increases the model's computational complexity. Furthermore, because the C2f module uses traditional convolution operations to process feature maps, each convolution operation involves a large amount of computation, which significantly increases computational overhead, especially when processing high-resolution feature maps. Therefore, to optimize fusion efficiency, we introduce depthwise separable convolution to lightweight the C2f module into a Dc2 module. Depthwise separable convolution splits the standard convolution operation into depthwise convolution and pointwise convolution. This architecture reduces the number of parameters and computational overhead while more efficiently transferring gradients. Its structure is shown in Figure 10. The Dc2 module first transforms the input feature map through an initial depthwise separable convolution layer to generate an intermediate feature representation. This intermediate feature map is then split into two parts: one is directly passed to the final Concat module, and the other is passed through multiple Bottleneck blocks to further extract high-level features. In each Bottleneck block, the feature map undergoes two convolution operations to refine a more discriminative feature representation. The extracted features are not only passed to the next Bottleneck block but also mapped to the Concat module to be concatenated with features extracted from other Bottleneck blocks. Finally, the fused feature map is processed by a second depthwise separable convolution (DSC) layer to generate a final feature map that integrates multi-level feature information.
[0055] The Dc2 module achieves efficient feature fusion between adjacent feature layers while maintaining the model's lightweight design and enhancing the propagation of gradient flow. The feature maps generated by this module combine high resolution with rich semantic information, thereby improving the model's ability to represent objects. Using a bidirectional feature fusion strategy, multiple Dc2 modules work together to effectively fuse and transfer multi-scale information, enabling the model to accurately capture key features of small objects across feature maps of varying resolutions. This enhances multi-scale object recognition and improves overall object detection performance.
[0056] In addition, considering that wheat seedlings have different morphologies, the length and width of the annotation boxes are not consistent when annotating them. This may make it difficult for the model to accurately learn the position and size of the target object during the bounding box regression process, thereby affecting the prediction accuracy. In order to improve the bounding box regression accuracy of the prediction network, in this embodiment, the EIoU (Efficient Intersection over Union) loss function is introduced into the prediction network of the wheat seedling detection model to calculate the bounding box regression loss. Referring to formula (1), the EIoU loss function can more comprehensively evaluate the degree of match between the predicted box and the true box by introducing three key geometric factors, namely the overlapping area, the center point distance, and the side length difference, to guide the parameter optimization during the model training process, thereby improving the overall detection performance.
[0057] (1).
[0058] Where b is the center point of the pre-stored frame; b gt is the center point of the real frame; ρ represents the Euclidean distance of the center point of the corresponding calculation element; c is the shortest diagonal length of the minimum bounding box; w and h are the width and height of the pre-stored frame; w gt 、 h gt is the width and height of the real frame; C w 、 C h The width and height of the minimum bounding box.
[0059] See also Figure 11 In this example, the prediction network of the wheat seedling detection model adopts a decoupled head structure to separate the classification and detection heads. A total of three decoupled heads are used to complete image detection and classification tasks at different scales, and finally output the target category and detection box position information.
[0060] Overall, the processing flow of the TCE-YOLO wheat seedling detection model disclosed in this example is as follows: the feature extraction network DTV first uniformly adjusts the input image to 640×640, and after the initial standard convolution layer Conv processing, generates a feature map F1; then the efficient local feature module ELFM extracts the local feature information in the feature map and generates a feature map F2; then the feature reshaping module FRM processes the feature map F2, captures the contextual association between local feature information, constructs the spatial relationship of feature points, and extracts and integrates local and contextual features. After three consecutive FRM modules, feature maps F3 to F5; F3 to F7 are generated; and then the multi-scale global feature aggregation module MSGAM captures and aggregates multi-scale global features of F7 to generate a feature map F8. In the feature fusion network, the feature enhancement module (FEM) first optimizes the feature maps F3, F5, and F8 at different levels layer by layer, generating enhanced feature maps F3*, F5*, and F8*. Subsequently, the bidirectional feature fusion mechanism (PAFPN) fuses multi-scale features to generate the final fused feature maps F13, F16, and F19, which are then fed into the prediction network. Ultimately, the model predicts the specific location and confidence score of the wheat seedlings, completing the detection task.
[0061] (5) The wheat seedling detection model is trained based on the wheat seedling dataset to obtain the wheat seedling detection model.
[0062] In this example, model training was performed on an NVIDIA GeForce RTX 3060 Ti GPU (8GB of video memory), using CUDA 11.4 as the parallel computing framework. The software was run on Windows 10, using Python 3.8.8 as the programming language, PyTorch 1.2.0 as the deep learning framework, and PyCharm 2021 as the development tool.
[0063] To obtain the TCE-YOLO pre-training weights, this example first pre-trains the model on the data subset WSD-E1. Figure 12 shows the training loss (Loss) change trend and the evolution of detection accuracy (mAP@0.5) of the wheat seedling detection model on the WSD-E1 dataset. When the training reaches 100 epochs, the loss and accuracy tend to be stable. Therefore, 100 epochs are selected as the training weights. In order to improve training efficiency and prevent overfitting, in the training of this example, the model training cycle is set to 100 epochs, among which: the first 50 epochs: freeze the backbone network (backbone) parameters, and only train the classifier part. The initial learning rate is set to 1×10 -3, the batch size is 8, and the weight decay rate is set to 5×10 -4 After 50 epochs: Unfreeze the backbone network parameters to enable them to participate in training. The initial learning rate is adjusted to 1×10 -4 , the batch size remains 8, and the weight decay rate remains 5×10 -4 The Adam optimizer is used to update parameters during the training process. This strategy can improve the model's convergence speed and detection performance while ensuring training stability.
[0064] In addition, this example also discloses a wheat seedling detection method, which detects the number of wheat seedlings using a wheat seedling detection model established according to the above method.
[0065] To comprehensively and accurately evaluate the wheat seedling detection model disclosed herein, this example uses mean average precision (mAP) as the primary metric for evaluating the model's detection accuracy. To comprehensively measure the model's detection capability and generalization performance, this example analyzes the following two specific mAP metrics: mAP@0.5: The average precision calculated when the IoU (Intersection over Union) threshold is set to 0.5, which mainly reflects the detection ability of the model under lower overlap requirements.
[0066] mAP@0.5-0.95: The mean average precision (mAP) calculated over an IoU threshold range of 0.5 to 0.95 (in steps of 0.05). This metric is used to evaluate the detection performance of a model under different IoU requirements and more comprehensively reflects the robustness and generalization ability of the model.
[0067] Among them, IoU (Intersection over Union) is used to measure the degree of overlap between the predicted bounding box and the true bounding box. Its calculation formula is shown in Equation 2.
[0068] (2).
[0069] Where A1 is the area of the predicted bounding box, A2 is the area of the real bounding box, and A inter A is the intersection area of the predicted bounding box and the true bounding box. union is the area of the union of the two bounding boxes.
[0070] In addition, this example uses parameters (Params) and computation (FLOPs) to evaluate the computational complexity of the model. Params represents the total number of trainable parameters in the model, including weights and biases, and is used to measure the model's spatial complexity. GFLOPs represents the number of floating-point operations (GFLOPs) required by the model during a single forward propagation, measured in gigaflops.
[0071] Specifically, this example first uses the wheat seedling dataset (WSD) to conduct comparative experiments on detection accuracy and computational complexity using the object detection algorithms Faster-RCNN, CenterNet-Hourglass-104, YOLOv5-n, YOLOv6-n, YOLOv7-tiny, YOLOX-L, and YOLOv8-n. The experimental environment and parameter settings for each model remain consistent. Faster-RCNN is a two-stage object detection model that generates candidate regions followed by classification and bounding box regression. CenterNet is a single-stage object detection model that achieves object localization through keypoint detection. YOLOX-L is another single-stage model that uses an anchor-free and decoupled head design to achieve object detection by directly predicting the object center point and regressing information such as width and height. YOLOv5-n, YOLOv6-n, YOLOv7-tiny, and YOLOv8-n are lightweight single-stage models in the YOLO family. The experimental results are shown in Table 2.
[0072] .
[0073] The experimental results shown in Table 2 clearly demonstrate that the wheat seedling detection model, TCE-YOLO, demonstrated in this example outperforms other comparison models in detection accuracy across various planting densities and environments (WSD-E1, WSD-E3, WSD-E5, and WSD-F1). In terms of mAP@0.5, TCE-YOLO achieves improvements of 12.1 to 13.8 percentage points compared to lightweight models (YOLOv5-n, YOLOv6-n, YOLOv7-tiny, and YOLOv8-n), and 5.1 to 8.3 percentage points compared to larger models (Faster R-CNN, CenterNet, and YOLOX-L). Its superiority is equally evident under the more stringent mAP@0.5-0.95 metric, with improvements of 9.7 to 12.8 percentage points compared to lightweight models and 3 to 10.9 percentage points compared to larger models, demonstrating excellent detection capabilities.
[0074] Further analysis of the experimental results shows that in the comparison of the same environment with different planting densities (WSD-E1, WSD-E3 and WSD-E5), the mAP@0.5 and mAP@0.5-0.95 of TCE-YOLO vary little, with a difference of only about 3 percentage points, while the accuracy changes of other comparison models exceed 5 percentage points. This shows that TCE-YOLO can maintain more stable detection accuracy under changing planting density, showing stronger adaptability and robustness; in the comparison of the same planting density but different environment (WSD-E1 and WSD-F1), although the background of WSD-F1 is complex and the seedlings are unevenly distributed, the detection accuracy of TCE-YOLO only drops by about 1 percentage point, with mAP@0.5 dropping from 91.42% to 90.43%, and mAP@0.5-0.95 dropping from 51.2% to 50.3%. In comparison, the accuracy of other models drops more significantly, further demonstrating TCE-YOLO's adaptability to complex backgrounds and unevenly arranged wheat seedlings.
[0075] In terms of computational complexity, TCE-YOLO maintains low computational overhead while ensuring high precision. Its parameter count is 7.8M and its computational complexity FlOPs is 9.2G, which is at the same level as other lightweight models.
[0076] In summary, the wheat seedling detection model TCE-YOLO demonstrates optimal performance in the wheat seedling detection task, demonstrating enhanced adaptability and stability, particularly when dealing with varying planting densities and complex environments. TCE-YOLO leverages the efficient feature extractor DTV to enhance the collaborative modeling capabilities of local, spatial contextual, and global features, addressing the shortcomings of existing methods in capturing spatial contextual features and improving the model's robustness. Furthermore, the feature enhancement module FEM optimizes the model's performance in complex environments, further reducing the impact of background interference. Furthermore, the deep separable convolution and lightweight feature coordination module Dc2 effectively reduce computational complexity, balancing computational efficiency while ensuring detection accuracy.
[0077] In order to verify the effect of local annotation on the performance of the optimization model, this example uses the wheat seedling dataset WSD-E3 with global annotation and local annotation to train the wheat seedling detection model TCE-YOLO. The detection results are shown in Table 3. The specific detection effect examples are as follows: Figure 13 shown.
[0078] .
[0079] The experimental results in Table 3 show that compared with global annotation, using local annotation data for model training achieves significant improvements of 11.87% and 8.7% in mAP@0.5 and mAP@0.5-0.95 respectively. Figure 13 , it can be observed that the model trained using global annotated data failed to effectively identify the target within the blue bounding box during detection, and there was a significant phenomenon of missed detection. In contrast, the model trained using local annotated data significantly improved the missed detection problem during detection, especially when detecting occluded wheat seedlings, showing a significant improvement in ability. The reason for this difference is that local annotation reduces the impact of background interference, allowing the model to focus more on capturing the local structural features of the wheat seedlings. Even when faced with irregular shapes, size changes, and occlusions of wheat seedlings, it can still maintain sensitivity to key features, thereby achieving more accurate target detection in complex field environments.
[0080] To analyze the impact of different feature extraction networks on the accuracy and computational complexity of wheat seedling detection, this example compares the application effects of the FasterNet network, MoblieNe network, GhostNetv2 network, EfficientNet network, and the efficient feature extractor DTV in the TCE-YOLO model. Experiments are conducted based on the WSD-E3 dataset. The experimental results are shown in Table 4. TCE-YOLO* is the TCE-YOLO model that does not include a feature extraction network.
[0081] .
[0082] The experimental results in Table 4 demonstrate that the design of the feature extraction network has a significant impact on detection accuracy and computational complexity. TCE-YOLO, using the efficient feature extractor DTV as its feature extraction network, achieved the best performance in the experiment, achieving mAP@0.5 and mAP@0.5-0.95 of 92.4% and 55.3%, respectively. Its minimum number of parameters (7.8M) and computational overhead (9.2G FLOPs) were also minimal. This is due to DTV's efficient collaborative modeling of local, contextual, and global features. Specifically, it extracts local features through the depthwise separable convolution (ELFM) and combines it with the feature reshaping module (RCM) to capture the contextual associations between local features. This design also enables global feature modeling without introducing additional computational overhead. This design not only reduces computational complexity but also improves the model's adaptability to complex scenarios.
[0083] To verify the impact of different attention mechanisms on model performance, this example uses attention SE, CBAM, EMA, and CA to construct a feature enhancement module FEM, which is then added to TCE-YOLO**. Experiments are conducted on the WSD-E3 dataset, and the experimental results are shown in Table 5. Among them, TCE-YOLO** is a simplified TCE-YOLO without the integrated feature enhancement module FEM.
[0084] .
[0085] The experimental results in Table 5 show that different attention mechanisms significantly improve model performance, but there are also significant differences. Compared to TCE-YOLO**, CA improves mAP@0.5 by 7.3 percentage points and mAP@0.5-0.95 by 2.8 percentage points, while also having minimal impact on model computational complexity, outperforming SE, CBAM, and EAM. The superior performance of the feature enhancement module (FEM) built on CA lies not only in its own mechanism, but also in its ability to complement the feature extraction network and the bidirectional feature fusion mechanism (PAFPN), significantly improving the model's detection performance.
[0086] To further verify the impact of the embedding position of the feature enhancement module (FEM) on model performance, FEM is embedded in the feature extraction network, feature fusion network, and between the feature extraction network and feature fusion network of TCE-YOLO. Experimental comparisons are conducted on the WSD-E3 data subset. The results are shown in Table 6.
[0087] .
[0088] From the experimental results shown in Table 6, it can be seen that embedding FEM between the feature extraction network and the feature fusion network has the greatest improvement on the model detection performance.
[0089] To verify the impact of different loss functions on model performance, the loss functions GIoU, DIoU, and EIoU are used as the loss functions of the TCE-YOLO*** model, and comparative experiments are conducted on the WSD-E3 data subset. The results are shown in Table 7. Among them, the TCE-YOLO*** loss function uses CIoU.
[0090] .
[0091] The results shown in Table 7 show that different loss functions have a significant impact on model performance. The GIoU loss function, which considers the overlap between bounding boxes in addition to the standard IoU loss, slightly improves both mAP@0.5 and mAP@0.5-0.95 to 91.6% and 54.6%, respectively. However, this results in a significant increase in parameters (11.1M) and computational overhead (21.3GB). DIoU achieves 91.4% on the mAP@0.5 metric; however, its performance drops to 53.1% on the more stringent mAP@0.5-0.95 metric. This indicates that DIoU's global optimization capabilities are still insufficient in complex scenes, particularly for small object detection. Furthermore, the model's parameters and computational overhead are 12.2M and 19.7GB, respectively, indicating high computational complexity. TCE-YOLO, which uses EIoU, achieves mAP@0.5 and mAP@0.5-0.95 of 92.4% and 55.3%, respectively. Although the number of parameters (7.8M) and computational complexity (9.2G) have increased slightly compared to TCE-YOLO***, the detection performance has been significantly improved. This shows that the EIoU loss function is more capable of balancing the positioning accuracy and classification performance of the bounding box while maintaining a low computational cost.
[0092] To verify the impact of the efficient feature extractor DTV, feature enhancement module FEM, feature coordination module Dc2, and efficient intersection-over-union (EIoU) loss function in the TCE-YOLO model on the wheat seedling detection model, an ablation experiment was designed based on the WSD-E3 dataset. The experimental results are shown in Table 8.
[0093] .
[0094] The experimental results in Table 8 show that the introduction of each optimization module in TCE-YOLO contributes to varying degrees to model performance improvements. FEM provides the most significant improvement in detection accuracy and is the primary source of this improvement. Dc2 plays a key role in the fusion of features at different levels, improving feature coordination and second only to FEM in terms of accuracy improvement. EIoU optimizes the regression accuracy of the object bounding box, contributing relatively little to the final detection performance improvement. While DTV has a limited impact on accuracy improvement, it excels in lightweight design. Its core role lies in providing efficient feature representation, enabling the model to establish synergistic relationships between local, contextual, and global features at a low computational cost, thus providing a solid foundation for the optimization of modules such as FEM and Dc2. Furthermore, considering the impact of module combination, the synergy of different modules can significantly improve model performance. The combination of FEM and EIoU contributes the most to detection accuracy, while the combination of DTV and Dc2 excels in reducing computational complexity. By integrating all optimization modules, TCE-YOLO achieves an optimal balance between accuracy and efficiency. The experimental results verify the effectiveness of multi-module collaborative design and prove that TCE-YOLO has better computational efficiency while ensuring high detection accuracy, making it more applicable in complex field environments.
[0095] In addition, to determine the detection performance of TCE-YOLO for wheat seedlings under different planting densities, this example uses the baseline model YOLOv8-n and TCE-YOLO to conduct comparative detection experiments on three data subsets: WSD-E1, WSD-E3, and WSD-E5. Figure 14 As shown, the detection effect of TCE-YOLO is as follows Figure 15 shown.
[0096] contrast Figure 14 and Figure 15 The difference in detection performance between the two models can be intuitively observed. YOLOv8-n exhibits significant missed detections across different planting densities (1cm, 3cm, and 5cm spacing), with the problem being particularly severe in areas with higher planting densities (1cm and 3cm spacing). Furthermore, the model's detection bounding box confidence distribution is unstable, with some targets having confidence levels below 0.5, reflecting its weak ability to capture target features and difficulty reliably identifying wheat seedlings in complex scenarios. TCE-YOLO significantly outperforms YOLOv8-n in detection performance, as evidenced by a significant reduction in missed detections across all planting densities, demonstrating TCE-YOLO's improved target capture capabilities. Furthermore, the detection bounding box confidence levels are generally high, exceeding 0.7 for the vast majority of targets, indicating that TCE-YOLO is able to accurately identify wheat seedlings and ensure the stability and reliability of its detection results.
[0097] In addition, to intuitively demonstrate the detection performance of TCE-YOLO in wheat seedlings in the field environment, the baseline model YOLOv8-n and TCE-YOLO were used to conduct detection experiments on the WSD-F1 data subset. Figure 16 As shown in (a), the detection results of TCE-YOLO are as follows Figure 16 (b) shows the red box is the target box, and the blue box is the missed detection mark.
[0098] from Figure 16 It can be observed that the background conditions in the field environment are complex, with interference factors such as stones and plant debris, which will block the base of the wheat seedling neck, and the wheat seedlings are unevenly distributed. The YOLOv8-n model has many missed detections during the detection process, such as Figure 16 As shown in the blue box in (a). The TCE-YOLO model can maintain a high detection accuracy, especially when facing staggered wheat seedlings. The position and size of the detection result box of the TCE-YOLO model can accurately reflect the actual position of the wheat seedlings, as shown in the blue box in (a). Figure 16 (b) This shows that the TCE-YOLO model has enhanced its ability to adapt to complex backgrounds, enabling it to better cope with background interference in field environments.
[0099] Although some preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0100] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications of the present invention fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.
Claims
1. A method for establishing a wheat seedling detection model, characterized in that: The steps include: (1) After wheat is sown, image data of wheat seedlings is collected from the seedling stage to the three-leaf stage; (2) cropping and data enhancement processing are performed on the collected image data to form a wheat seedling dataset, and after image annotation, the wheat seedling dataset is divided into a training set, a test set, and a validation set; (3) Using a local annotation strategy to annotate the wheat seedling dataset; (4) Establish a wheat seedling detection model including feature extraction network, feature fusion network and prediction network; (5) After the wheat seedling detection model is trained based on the wheat seedling dataset, it is completed.
2. The establishment method according to claim 1, characterized in that In the step (1), different wheat varieties are sown in different years, different sowing spacings are set, and different data areas are divided according to the spacings; and the water and fertilizer treatments of each data area are controlled to be the same.
3. The establishment method according to claim 2, characterized in that: In step (2), the wheat seedling dataset is divided into different data subsets according to different data areas, and each data subset is divided into the training set, test set and validation set with the same division ratio.
4. The establishment method according to claim 1, characterized in that In step (3), the local marking strategy is to mark the wheat seedling stem as the origin, the soil contact surface as the base, and the length of 2.8 to 3.2 cm between the two leaves of the wheat seedling is covered.
5. The establishment method according to claim 1, characterized in that: In step (4), the feature extraction network is an efficient feature extractor DTV, and the efficient feature extractor includes an efficient local feature module ELFM, a feature reshaping module FRM, and a multi-scale global feature aggregation module MSGAM.
6. The establishment method according to claim 5, characterized in that: In the step (4), the feature fusion network adopts a bidirectional feature fusion mechanism and includes a feature coordination module Dc2 and a feature enhancement module FEM for performing weighted optimization processing on the output feature map of the efficient feature extractor DTV.
7. The establishment method according to claim 1 or 6, characterized in that: In the step (4), the prediction network includes an efficient intersection-over-union loss function EIoU.
8. The establishment method according to claim 3, characterized in that: In the step (5), any data subset is selected for model training, and the epoch after the loss and accuracy are stabilized is selected as the training weight of the wheat seedling detection model.
9. The establishment method according to claim 1, characterized in that: In the step (5), for the set N epoch training cycles, the backbone network parameters are frozen in the first M training cycles and only the model classifier part is trained; the backbone network parameters are unfrozen in the next NM training cycles and participate in model training.
10. A wheat seedling detection method, characterized in that: Image data of wheat seedlings in the test area are collected from the wheat seedling stage to the three-leaf stage, and after preprocessing, are input into the wheat seedling detection model described in claim 1 to perform wheat seedling quantity detection.