Method and system for weed seed identification based on DEIMv2 and identification special model architecture

By introducing a multi-scale spatial adapter and a feature upsampling mechanism, combined with a large kernel separable attention mechanism, the problem of low efficiency in weed seed identification in existing technologies is solved, achieving high-precision and low-cost weed seed identification.

CN122392034APending Publication Date: 2026-07-14COMPREHENSIVE TECH CENT FOR INSPECTION & QUARANTINE OF ZHANGJIAGANG ENTRY EXIT INSPECTION & QUARANTINE BUREAU +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
COMPREHENSIVE TECH CENT FOR INSPECTION & QUARANTINE OF ZHANGJIAGANG ENTRY EXIT INSPECTION & QUARANTINE BUREAU
Filing Date
2026-06-10
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing machine vision technology struggles to effectively identify subtle textures and edge structures in weed seed identification, especially the minute differences between closely related species. This results in low identification efficiency and high costs, making it difficult to meet the fast-paced quarantine needs at ports of entry.

Method used

The DEIMv2-based weed seed identification method enhances the modeling ability of weed seed detail texture and overall structure by introducing a multi-scale spatial adapter, a visual base model, a hybrid encoder, a DEIM Transformer decoder, and a detection head, combined with feature upsampling, content-aware feature reorganization mechanism, and a large kernel separable attention mechanism.

Benefits of technology

It significantly improves the accuracy and efficiency of weed seed identification, enabling rapid and accurate identification of slender, irregularly shaped weed seeds and reducing identification costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122392034A_ABST
    Figure CN122392034A_ABST
Patent Text Reader

Abstract

The application discloses a weed seed identification method and system based on DEIMv2 and a special model architecture for identification, wherein the model architecture comprises: a multi-scale space adapter which extracts spatial features and performs multi-scale down-sampling on a target image to output three spatial feature tensors with descending resolutions; a visual basic model pre-trained in a self-supervised manner which encodes deep semantic features of the target image and outputs multi-scale deep semantic feature tensors; a hybrid encoder which aggregates the spatial feature tensors and the deep semantic feature tensors at the same scale to obtain first, second and third aggregation feature tensors with descending scales; a feature enhancement path is that the first aggregation feature tensor is fused with the second aggregation feature tensor after spatial channel down-sampling, and then is fused with the third aggregation feature tensor after spatial channel down-sampling to output an enhanced feature tensor; and a DEIM decoder and a detection head, wherein the decoder receives the enhanced feature tensor and decodes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of machine vision AI technology, and in particular to a method, system and dedicated model architecture for weed seed identification based on DEIMv2, which is especially suitable for automated and high-precision identification of weed seeds with slender and irregular shapes. Background Technology

[0002] Invasive weed seeds are a significant group of harmful alien organisms that pose a potential threat to the ecological environment. With the deepening of globalization and foreign trade, the risk of invasive weed seeds spreading through food and agricultural product trade channels is increasingly intensifying. Accurate identification of weed seeds is necessary to control them.

[0003] Traditional weed seed identification primarily relies on morphological assessment, judging by observing external morphological characteristics such as seed shape, color, and luster, as well as microscopic structures such as the seed coat and ornamentation. Some tiny seeds require microscopic observation to further identify their species. Due to the vast variety of weed seeds, their minute size, and subtle morphological differences between closely related species, coupled with a shortage of specialists and authoritative identification institutions proficient in weed seed classification, samples must be sent to specialized laboratories for identification. This process is not only time-consuming and labor-intensive but also costly, making it difficult to meet the high-frequency, fast-paced quarantine requirements at ports of entry.

[0004] Currently, machine vision technology is being applied to weed seed identification. It utilizes the end-to-end learning mechanism of deep learning to automatically extract multi-level discriminative features. Based on the task format, it can be divided into image classification models and object detection models. Image classification models extract global image features and are typically suitable for scenes where the target occupies a large portion of the image and the background is relatively simple, outputting the category label for the entire image. However, current detection models such as YOLOv5 and YOLOv8 still have room for improvement in their ability to represent subtle textures, delineate edge structures, and identify minute differences between closely related species.

[0005] The disclosure of the above background technical content is only for the purpose of assisting in understanding the concept and technical solution of this application, and does not necessarily provide technical instruction. Summary of the Invention

[0006] The purpose of this invention is to provide a weed seed identification scheme based on DEIMv2. By introducing targeted improvement modules into the hybrid encoder of DEIMv2, the ability to model the detailed texture and overall structure of weed seeds is significantly enhanced, and the multi-scale feature fusion process is optimized, thereby comprehensively improving the identification accuracy.

[0007] To achieve the above objectives, the technical solution adopted by the present invention is as follows: A method for identifying weed seeds based on DEIMv2 includes the following steps: Acquire target images of the seeds to be identified; The target image is input into a pre-trained weed seed identification model; The dedicated model for weed seed identification is configured to analyze the target image and output a prediction result for the type of weed seed. The dedicated model for weed seed identification is equipped with the following modules: A multi-scale spatial adapter is configured to perform spatial feature extraction and multi-scale downsampling on a target image to output at least a first spatial feature tensor, a second spatial feature tensor, and a third spatial feature tensor with resolutions ranging from high to low. The visual base model, which is a visual feature encoding network pre-trained in a self-supervised manner, is configured to receive the same target image as input to the multi-scale spatial adapter, and output deep semantic feature tensors corresponding to spatial feature tensors at each scale. A hybrid encoder is configured to aggregate the spatial feature tensor and its corresponding deep semantic feature tensor at the same scale to obtain at least a first aggregated feature tensor, a second aggregated feature tensor, and a third aggregated feature tensor in descending order of scale. The feature enhancement path of the hybrid encoder is as follows: the first aggregated feature tensor is downsampled through a first-level spatial channel and then fused with the second aggregated feature tensor; the fused feature tensor is downsampled through a second-level spatial channel and then fused with the third aggregated feature tensor to output a multi-scale enhanced feature tensor after hybrid encoding. The DEIM Transformer decoder is configured to receive and decode the multi-scale augmented feature tensor output by the hybrid encoder; and The detection head is configured to output the category of weed seeds based on the decoding results of the DEIM Transformer decoder.

[0008] Furthermore, in accordance with any or a combination of the aforementioned technical solutions, the hybrid encoder is also equipped with a feature upsampling module, which uses a content-aware feature reorganization mechanism to reconstruct the third aggregated feature tensor at high resolution to obtain the first reconstructed feature tensor. The second aggregated feature tensor is fused with the first reconstructed feature tensor to obtain the first fused feature tensor; The feature upsampling module also employs a content-aware feature recombination mechanism to reconstruct the first fused feature tensor at high resolution to enhance the feature representation of weed seed edges and textures, thereby obtaining a second reconstructed feature tensor. The second reconstructed feature tensor is fused with the first aggregated feature tensor to obtain the second fused feature tensor; The feature enhancement path of the hybrid encoder is replaced as follows: the second fused feature tensor is downsampled through the first-level spatial channel and then fused with the first fused feature tensor. The fused feature tensor is downsampled through the second-level spatial channel and then fused with the third aggregated feature tensor to output the multi-scale enhanced feature tensor after hybrid encoding.

[0009] Furthermore, following any or a combination of the aforementioned technical solutions, the hybrid encoder is further configured with a fusion enhancement module, which is configured to extract high-frequency detail features from the first aggregated feature tensor using the Detail Branch module, and send the extracted high-frequency detail features to the DEIM Transformer decoder through a first branch to enhance the explicit modeling of weed seed edges and textures, and send them through a second branch to a module for first-level spatial channel downsampling to connect the feature enhancement path.

[0010] Furthermore, following any one or a combination of the aforementioned technical solutions, the Detail Branch module includes a depthwise separable convolutional unit, a cross-channel information recombination unit, a batch normalized activation unit, and an SE calibration unit, wherein the depthwise separable convolutional unit, the cross-channel information recombination unit, and the batch normalized activation unit are sequentially connected, and the SE calibration unit is configured to perform SE attention mechanism processing on the intermediate feature tensor output by the batch normalized activation unit to obtain the detail feature tensor; The high-frequency detail features are obtained by adding the detail feature tensor element-wise to the feature tensor input to the depthwise separable convolutional unit.

[0011] Furthermore, following any one or a combination of the aforementioned technical solutions, the depthwise separable convolutional unit extracts the local spatial texture response using the following formula: Where DWConv(·) represents the depthwise convolution operation, F This represents the feature tensor input to the DetailBranch module; The cross-channel information reconstruction unit uses the following formula to reconstruct cross-channel information from the extracted local spatial texture response: Where PWConv(·) represents a 1×1 pointwise convolution operation; The batch normalization activation unit performs batch normalization and activation operations on the feature tensor of cross-channel information reorganization using the following formula: Where BN(·) represents the batch normalization function and δ(·) represents the nonlinear activation function; The SE calibration unit uses the following formula to perform SE attention mechanism processing: ,in, Fd Represents the detail feature tensor. SE (·) represents the function representation of the compression and stimulation mechanisms of attention; The high-frequency detail features F’ It is calculated using the following expression: F’ = F + F d .

[0012] Furthermore, following any or a combination of the aforementioned technical solutions, the hybrid encoder is also equipped with a structure-aware module, which is configured to use a large-kernel separable attention mechanism to model the overall structure of weed seeds and their long-range spatial dependencies. The input of the structure-aware module is connected to the input of the secondary spatial channel downsampling, and the output of the structure-aware module is connected to the DEIM Transformer decoder.

[0013] Furthermore, following any one or a combination of the aforementioned technical solutions, the target large kernel size of the large kernel separable attention mechanism is set to 11, and the decomposition factor is set to 2. This decomposes the 11×11 large kernel convolution into a series of separable one-dimensional convolutions with a kernel size of 3. ,in, Z This represents the feature tensor received at the input of the structure-aware module. A 1 represents the feature tensor obtained from one-dimensional convolution, DWConv 1×3 (·) indicates a depthwise convolution operation using a 1×3 kernel, DWConv 3×1 (·) indicates a depthwise convolution operation using a 3×1 kernel; Then, a one-dimensional convolution with a kernel size of 5 is used to apply the feature tensor. A 1. Expanding the spatial range: Among them, DWConv 1×5 (·) indicates a depthwise convolution operation using a 1×5 kernel, DWConv 5×1 (·) represents a depthwise convolution operation using a 5×1 kernel, and σ(∙) represents the Sigmoid activation function; The output of the structure-aware module obtains an enhanced feature tensor after spatial attention recalibration through attention weighting. Z’ : Z’ = Z ⊙ A 2, where ⊙ represents element-wise multiplication.

[0014] Furthermore, following any one or a combination of the aforementioned technical solutions, the performance of the dedicated weed seed identification model is evaluated in the following manner: Calculate the accuracy using the following formula ,in, TP This indicates the number of target weed seeds that were correctly identified. FP This indicates the number of non-target weed seeds that were mistakenly identified as target weed seeds; Calculate recall using the following formula ,in, FN This indicates the number of target weed seeds that were identified as non-target weed seed categories or were not identified. Calculate the F1 score using the following formula: ; Calculate the mean precision using the following formula. Among them, average accuracy , N This indicates the total number of weed seed species.

[0015] Furthermore, following any or a combination of the aforementioned technical solutions, the multi-scale spatial adapter includes a 3×3 convolutional layer, a max pooling layer, and three cascaded 3×3 convolutional layers connected in sequence. The three cascaded 3×3 convolutional layers output feature maps of different sizes, which are 1 / 8, 1 / 16, and 1 / 32 of the target image, respectively. The visual foundation model is the DINOv3 backbone network, which includes a Patch Embed layer and multiple attention blocks.

[0016] Furthermore, following any one or a combination of the aforementioned technical solutions, each fused feature vector undergoes deep feature extraction via stacked reparameterized convolutional blocks.

[0017] Furthermore, based on any one or a combination of the aforementioned technical solutions, the weed seed identification model outputs one or more prediction results for weed seed types; The method for identifying weed seeds also includes: Receive user feedback on the prediction results, wherein the feedback is either confirming one of the prediction results or denying all prediction results; The dedicated model for weed seed identification is configured to be optimized and updated based on the feedback information.

[0018] According to another aspect of the present invention, a weed seed identification system based on DEIMv2 is provided, comprising a user layer, an interaction and business logic layer, and an intelligent core layer, wherein the user layer is configured to collect target images of the seeds to be identified and upload them to the interaction and business logic layer. The interaction and business logic layer is configured to call the weed seed identification-specific model of the intelligent core layer to analyze the target image; The dedicated model for weed seed identification is configured to output prediction results for weed seed types, and the dedicated model for weed seed identification includes the following modules: A multi-scale spatial adapter is configured to perform spatial feature extraction and multi-scale downsampling on a target image to output at least a first spatial feature tensor, a second spatial feature tensor, and a third spatial feature tensor with resolutions ranging from high to low. The visual base model, which is a visual feature encoding network pre-trained in a self-supervised manner, is configured to receive the same target image as input to the multi-scale spatial adapter, and output deep semantic feature tensors corresponding to spatial feature tensors at each scale. A hybrid encoder is configured to aggregate the spatial feature tensor and its corresponding deep semantic feature tensor at the same scale to obtain at least a first aggregated feature tensor, a second aggregated feature tensor, and a third aggregated feature tensor in descending order of scale. The feature enhancement path of the hybrid encoder is as follows: the first aggregated feature tensor is downsampled through a first-level spatial channel and then fused with the second aggregated feature tensor; the fused feature tensor is downsampled through a second-level spatial channel and then fused with the third aggregated feature tensor to output a multi-scale enhanced feature tensor after hybrid encoding. The DEIM Transformer decoder is configured to receive and decode the multi-scale augmented feature tensor output by the hybrid encoder; and The detection head is configured to output the category of weed seeds based on the decoding results of the DEIM Transformer decoder.

[0019] Furthermore, following any one or a combination of the aforementioned technical solutions, the user layer is an application program carried by a smart terminal, which includes the following units: The target image uploading unit is configured to upload the target image of the seed to be identified to the interaction and business logic layer; The prediction result display unit is configured to display the prediction results of the weed seed type output by the dedicated weed seed identification model; The prediction result details unit is configured to display knowledge information about the corresponding weed seeds in response to a query operation on the prediction result.

[0020] Furthermore, following any one or a combination of the aforementioned technical solutions, the user layer is an application program carried by a smart terminal, which further includes one or more of the following units: The message board is configured to post questions and receive and display replies. The expert connection unit is configured to display a list of experts and send messages, voice call requests, or video call requests to the experts in the list. The knowledge dictionary unit is configured to retrieve and display knowledge information about weed seeds that match a query request in response to the query request.

[0021] According to another aspect of the present invention, a dedicated model architecture for weed seed identification is provided, comprising the following modules: A multi-scale spatial adapter is configured to perform spatial feature extraction and multi-scale downsampling on a target image to output at least a first spatial feature tensor, a second spatial feature tensor, and a third spatial feature tensor with resolutions ranging from high to low. The visual base model, which is a visual feature encoding network pre-trained in a self-supervised manner, is configured to receive the same target image as input to the multi-scale spatial adapter, and output deep semantic feature tensors corresponding to spatial feature tensors at each scale. A hybrid encoder is configured to aggregate the spatial feature tensor and its corresponding deep semantic feature tensor at the same scale to obtain at least a first aggregated feature tensor, a second aggregated feature tensor, and a third aggregated feature tensor in descending order of scale. The feature enhancement path of the hybrid encoder is as follows: the first aggregated feature tensor is downsampled through a first-level spatial channel and then fused with the second aggregated feature tensor; the fused feature tensor is downsampled through a second-level spatial channel and then fused with the third aggregated feature tensor to output a multi-scale enhanced feature tensor after hybrid encoding. The DEIM Transformer decoder is configured to receive and decode the multi-scale augmented feature tensor output by the hybrid encoder; and The detection head is configured to output the category of weed seeds based on the decoding results of the DEIM Transformer decoder.

[0022] The beneficial effects of the technical solution provided by this invention are as follows: a. Based on the DEIM object detection model, high-level semantic features of the self-supervised pre-trained model DINOv3 are introduced to enhance the representation ability of the real-time object detection model; b. In view of the statistical distribution characteristics of multi-scale targets in natural scenes, for the fine-grained texture differences and local structural changes presented by single weed seed targets, a spatial detail information enhancement scheme is proposed in the feature upsampling and multi-scale fusion process to suppress the decay of discriminative texture features. c. In the feature upsampling stage, a content-aware feature reconstructing mechanism CARAFE is introduced to adaptively reconstruct high-resolution features, which alleviates the problem of detail blurring caused by downsampling and enhances the ability to express the edge and texture information of weed seed targets. d. Introduce a lightweight detail branch in the hybrid encoder to explicitly model high-frequency detail information and use it as a compensation term in feature fusion, thereby enhancing the model's ability to discriminate the surface texture structure of weed seeds; e. In the detection output stage, the Large Kernel Separable Attention (LSKA) mechanism is introduced, which effectively expands the model's receptive field at a lower cost while maintaining computational efficiency. This enhances the model's ability to model the overall structure and long-range spatial dependencies of slender, irregular weed seed targets, thereby improving the robustness of recognition for complex-shaped targets. Attached Figure Description

[0023] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0024] Figure 1 A flowchart illustrating a DEIMv2-based weed seed identification method provided as an exemplary embodiment of the present invention; Figure 2 A structural block diagram of a dedicated model for weed seed identification provided as an exemplary embodiment of the present invention; Figure 3 A schematic block diagram of a Detail Branch module provided for an exemplary embodiment of the present invention; Figure 4 A schematic block diagram of an LSKA module provided for an exemplary embodiment of the present invention; Figure 5 A schematic diagram of a DEIMv2-based weed seed identification system provided as an exemplary embodiment of the present invention; Figure 6 Images of 171 kinds of weed seeds provided as an exemplary embodiment of the present invention; Figure 7 A comparison diagram of heat maps before and after model improvement is provided as an exemplary embodiment of the present invention; Figure 8 A schematic diagram illustrating the predictive performance of the DEIMv2-Seed model for multiple groups of weed seed categories with similar and easily confused appearance features, provided as an exemplary embodiment of the present invention. Figure 9 An entry interface diagram of a weed seed identification client provided as an exemplary embodiment of the present invention; Figure 10 for Figure 9 The image shows the interface for selecting a target image after clicking the electrode album mode. Figure 11 To confirm Figure 10 The screenshot shows the upload status after selecting the target image; Figure 12 This is an interface diagram showing the identification results obtained by the DEIMv2-based weed seed identification method of the present invention; Figure 13 For click to query Figure 12 A screenshot showing the details of a specific type of identification result; Figure 14 for Figure 13 The subsequent details screen images are shown after scrolling down from the details screen image; Figure 15 A screenshot of the interface for leaving a message in the "Online Support" module of a weed seed identification client provided as an exemplary embodiment of the present invention; Figure 16 This is a screenshot of the expert connection interface in the "Online Support" module. Figure 17 The "knowledge dictionary" module of the weed seed identification client provided as an exemplary embodiment of the present invention is shown in the weed graphic interface diagram. Detailed Implementation

[0025] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0026] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, apparatus, product, or device that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.

[0027] DEIMv2 is based on the object detection model DEIM (DETR with Improved Matching) and incorporates high-level semantic features from the self-supervised pre-trained model DINOv3, enhancing the representational capabilities of real-time object detection models. Its models at different scales have achieved leading or competitive detection performance on general datasets such as COCO. However, the original design of this framework primarily targets the statistical distribution characteristics of multi-scale objects in natural scenes. Its feature representation is still insufficient for the fine-grained texture differences and local structural changes exhibited by single weed seeds. During existing feature upsampling and multi-scale fusion processes, spatial detail information is attenuated during scale alignment and semantic fusion, making it difficult to fully preserve some discriminative texture features. Furthermore, for weed seeds with elongated or irregular shapes, their structural representation is more dependent on the receptive field of the context. Under the constraints of receptive field modeling and computational complexity, DEIMv2 struggles to simultaneously address both the sufficiency of structural representation and real-time performance requirements.

[0028] This invention aims to improve three key aspects—feature upsampling, fusion enhancement, and structure perception—based on the DEIMv2 multi-scale feature fusion framework, in order to establish a DEIMv2-Seed model applicable to weed seed identification.

[0029] In one embodiment of the present invention, a method for identifying weed seeds based on DEIMv2 is provided, such as... Figure 1 As shown, the identification method includes the following steps: Acquire target images of the seeds to be identified; The target image is input into a pre-trained weed seed identification model; The dedicated model for weed seed identification is configured to analyze the target image and output a prediction result for the type of weed seed. like Figure 2 As shown, the dedicated model for weed seed identification is configured with the following modules: Multi-scale space adapter ( Figure 2 The STA (Spatial Tuning Adapter) is configured to perform spatial feature extraction and multi-scale downsampling on a target image to output at least a first spatial feature tensor, a second spatial feature tensor, and a third spatial feature tensor in descending order of resolution; specifically, as shown below. Figure 2 As shown, the multi-scale spatial adapter includes a 3×3 convolutional layer, a max pooling layer, and three cascaded 3×3 convolutional layers connected in sequence. The three cascaded 3×3 convolutional layers output feature maps of different sizes, which are 1 / 8, 1 / 16, and 1 / 32 of the target image, respectively. Visual Fundamental Model (VFM, preferred) Figure 2 DINOv3 (in this context) is a visual feature encoding network pre-trained in a self-supervised manner, configured to receive the same target image as input to the multi-scale spatial adapter, and output deep semantic feature tensors corresponding to spatial feature tensors at each scale; specifically as follows... Figure 2 As shown, the visual foundation model is the DINOv3 backbone network, which includes a Patch Embed layer and multiple attention blocks. Each attention block outputs a multi-scale deep semantic feature tensor, such as [B, C, H / 8, W / 8], where B represents the batch size, C represents the number of channels (and the depth of the feature map), H / 8 represents 1 / 8 of the target image height, and W / 8 represents 1 / 8 of the target image width. The core output of DINOv3 is high-dimensional semantic encoding; that is, the number of channels C is very large, while the spatial size becomes very small after downsampling. "Deep semantics" here is manifested in the loss of pixel-level details, but the preservation of high-level category and structural information.

[0030] Hybrid encoder ( Figure 2 The Hybrid Encoder is configured to aggregate the spatial feature tensor and its corresponding deep semantic feature tensor at the same scale to obtain at least a first aggregated feature tensor, a second aggregated feature tensor, and a third aggregated feature tensor in descending order of scale. The aggregation operation includes the following three aspects: First, channel alignment, projecting the high-dimensional features of DINOv3 (e.g., 384 / 1024 dimensions) onto a unified hidden layer dimension (e.g., 192 dimensions), and using 3×3 convolution to fuse local context to enhance spatial feature representation; second, weighted fusion of STA details with the semantics of DINOv3.

[0031] The feature enhancement path of the hybrid encoder is as follows: the first aggregated feature tensor is downsampled through a first-level spatial channel ( Figure 2 After the SCDown module in the middle, it is fused with the second aggregated feature tensor. The fused feature tensor is then downsampled by the second spatial channel ( Figure 2The SCDown module in the middle is then fused with the third aggregated feature tensor to output a hybrid encoded multi-scale enhanced feature tensor; The DEIM Transformer decoder is configured to receive and decode the multi-scale augmented feature tensor output by the hybrid encoder; and The detection head is configured to output the category of weed seeds based on the decoding result of the DEIM Transformer decoder. In addition to the category, the detection head can also output the corresponding confidence level and location information.

[0032] In one embodiment that enhances the model’s ability to represent the edges and textures of weed seeds, the hybrid encoder is also equipped with a feature upsampling module, which uses a content-aware feature reconstruction mechanism (CARAFE) to reconstruct the third aggregated feature tensor at high resolution to obtain the first reconstructed feature tensor. The second aggregated feature tensor is fused with the first reconstructed feature tensor to obtain the first fused feature tensor; The feature upsampling module again uses the content-aware feature reconstruction mechanism (CARAFE) to reconstruct the first fused feature tensor at high resolution to enhance the feature representation of weed seed edges and textures, thus obtaining the second reconstructed feature tensor; The second reconstructed feature tensor is fused with the first aggregated feature tensor to obtain the second fused feature tensor; Finally, the feature enhancement path is updated to a bottom-up fusion process based on these reconstructed and fused features: the second fused feature tensor is fused with the first fused feature tensor after first-level spatial channel downsampling (SCDown), and the fused feature tensor is fused with the third aggregated feature tensor after second-level spatial channel downsampling (SCDown) to output a multi-scale enhanced feature tensor after hybrid encoding.

[0033] For weed seed targets, their discrimination information highly depends on local texture and edge structure. Fixed interpolation often weakens high-frequency details, thus affecting the detection head's accurate target localization and fine-grained category discrimination. To improve the ability of the feature upsampling stage to express fine-grained spatial information, this invention introduces a Content-Aware ReAssembly of Features (CARAFE) mechanism to replace the traditional interpolation-based upsampling operation. CARAFE compresses the input features through channels and predicts position-dependent reconstruction kernels, enabling the upsampling process to adaptively reconstruct high-resolution feature maps based on local context information. Unlike fixed interpolation kernels, the reconstruction kernels generated by CARAFE are spatially adaptive, preserving and enhancing local structural and texture features during the upsampling process.

[0034] In an embodiment of explicit enhancement of high-frequency details, the hybrid encoder is further configured with a fusion enhancement module, which is configured to extract high-frequency detail features from the first aggregated feature tensor using a detail branch module, and send the extracted high-frequency detail features to the DEIM Transformer decoder via a first branch to enhance explicit modeling of weed seed edges and textures, and to a module for first-level spatial channel downsampling via a second branch to connect the feature enhancement paths.

[0035] After multi-scale feature fusion, differences still exist in semantic hierarchy and spatial distribution among features of different scales. Although the fusion operation can enhance high-level semantic information, the texture details of a single weed seed are concentrated, and high-level semantic responses often dominate during the fusion process, causing low-level high-frequency detail information to be partially masked, thereby reducing the model's ability to perceive local discriminative features. This invention introduces a lightweight detail reshaping branch in the fusion stage of the Hybrid Encoder to explicitly model and compensate for high-frequency detail information in the fused features.

[0036] like Figure 3 As shown, the Detail Branch module includes a depthwise separable convolutional unit, a cross-channel information recombination unit, a batch normalized activation unit, and an SE calibration unit. The depthwise separable convolutional unit, the cross-channel information recombination unit, and the batch normalized activation unit are connected sequentially. The SE calibration unit is configured to perform SE attention mechanism processing on the intermediate feature tensor output by the batch normalized activation unit to obtain the detail feature tensor. The extracted details are then compensated back to the original features through residual connections: the detail feature tensor is added element-wise to the feature tensor input to the depthwise separable convolutional unit to obtain the high-frequency detail features.

[0037] Specifically, the depthwise separable convolutional unit extracts the local spatial texture response using the following formula: Where DWConv(·) represents the depthwise convolution operation, F This represents the feature tensor input to the DetailBranch module; The cross-channel information reconstruction unit uses the following formula to reconstruct cross-channel information from the extracted local spatial texture response: Where PWConv(·) represents a 1×1 pointwise convolution operation; The batch normalization activation unit performs batch normalization and activation operations on the feature tensor of cross-channel information reorganization using the following formula: Where BN(·) represents the batch normalization function, and δ(·) represents the nonlinear activation function, such as the SiLU activation function; The SE calibration unit uses the following formula to perform SE attention mechanism processing: ,in, F d Represents the detail feature tensor. SE (·) represents the function representation of the compression and stimulation mechanisms of attention; The high-frequency detail features F’ It is calculated using the following expression: F’ = F + F d .

[0038] In one embodiment that enhances the modeling of the overall structure and long-range dependencies of weed seeds, the hybrid encoder is further configured with a structure-aware module that employs a large-kernel separable attention mechanism (i.e., Figure 2 The LSKA module is used to model the overall structure of weed seeds and their dependence on long-range space. The input of the structure-aware module is connected to the input of the secondary spatial channel downsampling (SCDown), and the output of the structure-aware module is connected to the DEIM Transformer decoder.

[0039] Individual weed seeds vary in shape, appearing as elongated strips, oblong shapes, circles, or irregular shapes. While traditional small convolutional kernels excel at capturing local details, their limited receptive field makes it difficult to fully model long-range spatial dependencies. Directly introducing large kernel convolutions or global attention mechanisms often incurs significant computational overhead, hindering deployment requirements in real-time detection scenarios. To enhance structure perception while maintaining computational efficiency, this embodiment introduces a Large Separable Kernel Attention (LSKA) mechanism in the detection output stage. For example, the structure perception module receives intermediate features after first-level spatial channel downsampling and fusion processing. It expands the receptive field by decomposing a large kernel (e.g., 11×11) into a series of small kernel one-dimensional convolutions (e.g., 1×3, 3×1, 1×5, 5×1), generating a spatial attention map, and then outputting the enhanced feature tensor to the decoder through attention weighting. The structure perception module's structure is as follows: Figure 4 As shown, the target large kernel scale used in the Large Kernel Separable Attention (LSKA) mechanism is set to... k =11, and the factorization factor is set to... d =2, such as Figure 4 The following operations are performed sequentially as shown: ,in, ZThis represents the feature tensor received at the input of the structure-aware module. A 1 represents the feature tensor obtained from one-dimensional convolution, DWConv 1×3 (·) indicates a depthwise convolution operation using a 1×3 kernel, DWConv 3×1 (·) indicates a depthwise convolution operation using a 3×1 kernel; Then, a one-dimensional convolution with a kernel size of 5 is used to apply the feature tensor. A 1. Expanding the spatial range: Among them, DWConv 1×5 (·) indicates a depthwise convolution operation using a 1×5 kernel, DWConv 5×1 (·) represents a depthwise convolution operation using a 5×1 kernel, and σ(∙) represents the Sigmoid activation function; The output of the structure-aware module obtains an enhanced feature tensor after spatial attention recalibration through attention weighting. Z’ : Z’ = Z ⊙ A 2, where ⊙ represents element-wise multiplication.

[0040] See Figure 2 Each fused feature vector is subjected to deep feature extraction through stacked reparameterized convolutional blocks: the hybrid encoder includes multiple cascaded RepNCSPELAN5 feature extraction modules, which are set in the shallow, middle and deep layers of the encoder, respectively, to perform progressively refined extraction and fusion of feature maps from the DINOv3 backbone network at different downsampling factors (1 / 8, 1 / 16, 1 / 32).

[0041] For the task of identifying single weed seeds, this embodiment uses precision rate (P), recall rate (R), F1 score, and mAP as evaluation metrics to evaluate the performance of the dedicated weed seed identification model: Precision P measures the proportion of samples that the model identifies as belonging to a certain type of weed seed, and that proportion actually belong to that category. Precision is calculated using the following formula. ,in, TP This indicates the number of target weed seeds that were correctly identified. FP This indicates the number of non-target weed seeds that were mistakenly identified as target weed seeds; Recall R measures the proportion of samples in a given category of weed seeds that are correctly identified by the model. The recall rate is calculated using the following formula. ,in, FNThis indicates the number of target weed seeds that were identified as non-target weed seed categories or were not identified. F1 is the harmonic mean of precision and recall, comprehensively considering both aspects of the model's performance. It is a commonly used metric for measuring the overall performance of a model. A higher F1 score indicates that the model performs well in both precision and recall, demonstrating more balanced classification performance. The F1 score is calculated using the following formula: ; mAP is the mean average precision (AP) across all weed seed categories. It is a key metric for comprehensively evaluating model performance in multi-class classification tasks; a higher mAP value indicates better model performance in detecting multiple weed seed categories. The mean average precision is calculated using the following formula. Among them, average accuracy , N This represents the total number of weed seed species. In this example, N is 171, and images of 171 weed seed species are shown below. Figure 6 As shown.

[0042] In another embodiment of the present invention, a weed seed identification system based on DEIMv2 is provided, such as... Figure 5 As shown, the system includes a user layer, an interaction and business logic layer, and an intelligent core layer. The user layer is configured to collect target images of the seeds to be identified and upload them to the interaction and business logic layer. The interaction and business logic layer is configured to call the weed seed identification-specific model of the intelligent core layer to analyze the target image; The dedicated model for weed seed identification is configured to output prediction results for weed seed types, and the dedicated model for weed seed identification includes the following modules: A multi-scale spatial adapter is configured to perform spatial feature extraction and multi-scale downsampling on a target image to output at least a first spatial feature tensor, a second spatial feature tensor, and a third spatial feature tensor with resolutions ranging from high to low. The visual base model, which is a visual feature encoding network pre-trained in a self-supervised manner, is configured to receive the same target image as input to the multi-scale spatial adapter, and output deep semantic feature tensors corresponding to spatial feature tensors at each scale. A hybrid encoder is configured to aggregate the spatial feature tensor and its corresponding deep semantic feature tensor at the same scale to obtain at least a first aggregated feature tensor, a second aggregated feature tensor, and a third aggregated feature tensor in descending order of scale. The feature enhancement path of the hybrid encoder is as follows: the first aggregated feature tensor is downsampled through a first-level spatial channel and then fused with the second aggregated feature tensor; the fused feature tensor is downsampled through a second-level spatial channel and then fused with the third aggregated feature tensor to output a multi-scale enhanced feature tensor after hybrid encoding. The DEIM Transformer decoder is configured to receive and decode the multi-scale augmented feature tensor output by the hybrid encoder; and The detection head is configured to output the category of weed seeds based on the decoding results of the DEIM Transformer decoder.

[0043] The identification system provided in this embodiment realizes the engineering deployment and practical application of the single weed seed identification algorithm in port quarantine scenarios, such as... Figure 5 As shown, the system platform adopts a layered architecture with front-end and back-end separation, consisting of a user layer, an interaction and business logic layer, an intelligent core layer, and a data persistence layer. The platform users include two types of personnel: one type is the identification personnel, who mainly complete image uploading, result viewing, and knowledge query through the web or mobile terminal; the other type is the expert user, who participates in online Q&A and assisted interpretation through the web or mobile terminal, thus forming a closed-loop process of "collection-identification-feedback-consultation".

[0044] The platform's client includes a web client and a mobile app: the web client is implemented based on the Vue3 architecture, using Element Plus for page componentization and interactive display, and provides route management to support multi-module navigation; the mobile app is developed based on the Android platform, using Android Studio and the Java technology stack, and incorporating the Jetpack component library for UI and business logic organization, and is adapted for deployment on Android 8.0 and above. Both types of front-ends uniformly initiate HTTP requests to call backend services through Axios, ensuring consistent business capabilities and data interface specifications across terminals.

[0045] The interaction and business logic layer is implemented using the Spring Boot microservice architecture. It is responsible for providing unified external authentication business interfaces, graphic knowledge query interfaces, and online support interfaces. Spring Security is used to complete permission verification and access control to ensure that different roles and different function entry points can access the system within the authorized scope after authentication, thus meeting the port business's requirements for security compliance and traceability. In terms of business module division, the platform includes three core capabilities: a "weed seed image and text module," an "intelligent identification service module," and an "online support module." The weed seed image and text module manages biological information and image and text knowledge related to weed seeds, supporting identification personnel to search and filter by keywords or categories, serving as the knowledge basis for manual interpretation and result verification. The intelligent identification service module provides image upload and result feedback interfaces. Identifiers complete image selection or shooting on the user end and submit it to the backend. The backend receives the request and triggers the intelligent recognition process, ultimately returning structured results such as species name, similarity, and key feature descriptions, serving as an auxiliary reference for on-site identification. The online support module is used to build a collaborative mechanism of "Q&A community - expert docking - message push." ​​Identifiers can initiate consultations in questionable scenarios. The system organizes questions and related images and result information into traceable conversations and promotes rapid expert response through message push, thereby improving the efficiency and consistency of handling complex samples.

[0046] The intelligent core layer is responsible for completing the computational process related to model inference, organized according to the "image preprocessing—detection and discrimination—result feedback" chain. After receiving the raw image uploaded by the user, the system first performs preprocessing to meet the model's input requirements; then it enters the DEIMv2-seed model for inference, returning the inferred category and similarity in a structured manner; finally, in the output stage, it generates return content for the business side, providing the final name, similarity, and necessary feature descriptions, facilitating manual review and archiving by identification personnel. The above detection process is decoupled from the backend business modules, facilitating subsequent replacement and upgrades of the recognition model.

[0047] The data persistence layer uses MyBatis-Plus as the data access and persistence framework, with MySQL at the bottom layer storing business data, including user information, sample and annotation information, text and image knowledge entries, Q&A and expert feedback records, ensuring data consistency and auditability. Redis is also introduced as a caching layer to accelerate frequently accessed data readings and hot queries, reducing database pressure and improving end-to-end response performance. The platform's data sources include plant specimen literature and knowledge organization data, as well as port-measured sample data. Through continuous and structured accumulation, stable data support is provided for knowledge updates in the text and image module and iterative training of the recognition model.

[0048] The architecture features clear layering across terminal form, business modules, security control, intelligent inference, and data systems. It not only meets the application requirements for rapid identification and interpretable feedback at the port, but also provides a sustainable engineering foundation for future expansion into multi-model version management, enhanced online expert collaboration mechanisms, and performance optimization.

[0049] The hardware consists of an Intel Core i9 13900K processor, a 4TB hard drive, 125GB of RAM, and an NVIDIA GeForce RTX 4090 graphics card. The software and development environment run Ubuntu 20.04.6, Python 3.11, Anaconda 23.7.4, and CUDA 12.2.

[0050] This embodiment employs the AdamW (Adaptive Moment Estimation with Weight Decay) optimization algorithm with flat-cosine learning rate scheduling. The total training epochs are set to 34 epochs, with the first 16 epochs maintaining a fixed learning rate followed by cosine annealing; data augmentation is stopped in the last 8 epochs. Input images are uniformly adjusted to 640×640 resolution during training, with a total batch size of 8, and a batch size of 16 during validation. After model training, the final model parameters are saved based on the epoch with the best detection performance on the validation set for subsequent experimental evaluation and system deployment.

[0051] The user layer consists of applications (APPs) carried on smart terminals, such as... Figure 15 As shown, it includes a knowledge dictionary, intelligent recognition, and online support. The intelligent recognition function uses a specialized model for weed seed identification to predict weed seed types. Click... Figure 15 The smart recognition button in the middle will jump to Figure 9 The interface allows users to upload target images of weed seeds to be identified using either photo mode or album mode. Taking album mode as an example, the user is redirected to the album image selection interface. They then select an image, such as... Figure 10 As shown, the upload status after selecting the target image and the status of waiting for the prediction result are as follows: Figure 11 As shown in the image. The prediction results of the dedicated model for weed seed identification are displayed on the app as follows. Figure 12The prediction results interface shown, for example, displays a similarity of 93.63% for *Hypericum perforatum*. This is the confidence level output by the model along with the prediction type. Each prediction result corresponds to a checkbox labeled "Confirmed as this weed." This is to collect user feedback on the prediction results. If the user believes all predictions are correct, they can also provide feedback such as "None of the above results are correct." This feedback is beneficial for further optimization and updates to the weed seed identification model. For example, if the user confirms that the weed seed with the lowest similarity is correct, the model will adjust its weight parameters; if the user confirms that none of the above results are correct, experts can be consulted to optimize the model based on their identification results.

[0052] exist Figure 12 On the prediction results screen shown, you can also click "Details" to jump to... Figure 13 and Figure 14 The details page interface shown.

[0053] In addition to the intelligent recognition module, this embodiment also provides, for example, Figure 17 The knowledge dictionary section shown, and such as Figure 15 and Figure 16 The online support shown is as follows: Figure 15 As shown, users can ask questions in the message board and wait for a reply from any authorized expert; for example... Figure 16 As shown, users can also select a specific expert from the list for a one-on-one connection, including but not limited to instant messaging, voice calls, or video calls.

[0054] To improve the detection performance of single weed seeds under fine-grained conditions, this invention, based on the DEIMv2 detection framework, addresses issues such as blurred upsampling details, weakened details after multi-scale fusion, and insufficient modeling of slender and irregular structures. It introduces a content-aware CARAFE upsampling operator, a detail branch after fusion, and a structure enhancement module based on large kernel separable attention (LSKA). This section uses ablation experiments to verify the actual contribution of each module to the model performance; the experimental results are shown in Table 1.

[0055] Table 1. Impact of three improvement strategies on the DEINMv2 model Meanwhile, to intuitively analyze the impact of each improved module on the detection performance of a single weed seed, this embodiment uses Grad-CAM++ to generate a category judgment heatmap, and the comparison results are as follows: Figure 7 As shown. The first column is the input image, and the remaining columns correspond to the heatmap results of the baseline model DEIMv2 and the models that are progressively introduced with CARAFE, CARAFE+Detail-Branch, and the final DEIMv2-Seed model.

[0056] From Table 1 and Figure 7 As can be seen, replacing the upsampling strategy improves the model's accuracy from 97.15% to 98.12% compared to the basic model. The target response regions in the DEIMv2+CARAFE heatmap are more concentrated, background activation is significantly reduced, and contour boundaries are clearer, indicating that CARAFE plays a positive role in fine-grained feature reconstruction and helps enhance the model's detection capabilities. Introducing the lightweight Detail Branch improves the model's detection accuracy from 97.15% to 98.11%, demonstrating that this branch effectively supplements the main features by explicitly modeling high-frequency texture information, further enhancing the model's ability to perceive the local structural features of single weed seeds under complex background conditions. Introducing LSKA improves the model's detection accuracy from 97.15% to 98.40%, significantly promoting the discrimination of complex morphological target structures. After replacing the upsampling strategy and adding the Detail Branch, the model's detection accuracy improved from 97.15% to 98.71% compared to the base model, as shown in the DEIMv2+CARAFE+Detail-Branch heatmap. The model's response to local high-frequency textures is more continuous and complete, exhibiting more stable structural coverage in elongated or complex-edged samples, indicating that this branch effectively alleviates the detail weakening problem caused by multi-scale fusion. After applying all three improvement strategies, the model's detection accuracy improved from 97.15% to 99.46%, as shown in the DEIMv2-Seed heatmap. The response region is more consistently distributed along the target's principal axis, enhancing the overall modeling ability for irregular structures. This verifies the synergistic effect of each improvement module in feature reconstruction, detail enhancement, and structural modeling.

[0057] Table 2 shows a comprehensive comparison between the weed seed identification model (DEIMv2-Seed) provided in this embodiment and mainstream models: Table 2 Results of weed seed detection using different models The classification models selected were ResNet-50, ResNet-101, and ConvNeXt-small based on convolutional neural networks, and ViT-Base, Swin Transformer, and Dinov3-ViT-S16 based on Transformer architecture. The detection models selected were YOLOv8, Cascade RCNN, and YOLOv12 based on convolutional architecture, and end-to-end detection frameworks based on Transformer, as well as RT-DETR and DETR. In the experiments, the classification models achieved precision ranging from 91.45% to 96.11% and recall ranging from 88.66% to 96.03%. Dinov3-ViT-S16 achieved the highest precision of 96.11% and recall of 96.03%. In contrast, the detection models achieved overall precision exceeding 92% and recall exceeding 94%, while also possessing spatial localization capabilities.

[0058] DEIMv2-Seed achieved 99.46% precision, 99.62% recall, and 99.17% mAP50-95 on the test set. Compared to the well-performing classification models Dinov3-ViT-S16 and Swin Transformer, the precision improved by 3.35% and 4.39%, respectively, and the recall improved by 3.59% and 5.98%, respectively. Compared to detection models, the Deimv2-Seed model outperformed YOLOv8m, Cascade RCNN, YOLOv12m, DETR, RT-DETR-L, and DEIMv2-L on the test set, achieving precision improvements of 6.47, 2.68, 2.99, 2.07, 3.86, and 2.31 percentage points, respectively; recall improvements of 5.58, 3.31, 4.48, 2, 3.13, and 3.41 percentage points, respectively; and mAP50-95 improvements of 2.82, 3.75, 1.58, 2.86, 2.5, and 0.83 percentage points, respectively. The above experimental results fully verify the comprehensive advantages of DEIMv2-Seed in terms of detection accuracy and stability in the task of identifying single weed seeds.

[0059] From the perspective of model complexity and inference efficiency, DEIMv2-Seed has 33.07M parameters, which is on the same order of magnitude as DEIMv2-L (32.23M) and RT-DETR-L (33.12M). This is significantly lower than classification models such as ResNet-101 (42.81M), ViT-Base (85.92M), and Swin transformer (48.96M), and also lower than two-stage detection models such as Cascade R-CNN (69.6M) and DETR (60.26M). While maintaining high detection accuracy, DEIMv2-Seed can still achieve an inference speed of 50.27 f / s in the test environment, meeting the dual requirements of real-time performance and stability in practical application scenarios such as port quarantine.

[0060] To further analyze the discrimination ability of different detection models on weed seed categories with highly similar morphology, this embodiment selects multiple groups of weed seed categories with similar appearance characteristics and easy confusion, and compares and analyzes the performance of the above detection models and the DEIMv2-Seed model proposed in this invention on the Precision index. Figure 8 As shown, YOLOv8, YOLOv12, RT-DETR-L, and Cascade R-CNN exhibit significant drops in precision for categories with subtle local texture differences and highly similar morphological contours, reflecting their insufficient stability in fine-grained discrimination. In contrast, DEIMv2-Seed maintains higher precision with less fluctuation in most similar categories, significantly reducing false positives and demonstrating more stable fine-grained discrimination capabilities. The results indicate that compared to traditional detection frameworks, the improved DEIMv2-Seed model of this invention demonstrates superior overall performance under similar category conditions. The model achieves 99.46% precision, 99.62% recall, and 99.17% mAP50-95 on the test set, better meeting the practical requirements of high precision and high stability for single-seed weed identification tasks at port quarantine.

[0061] In one embodiment of the present invention, a dedicated model architecture for weed seed identification is provided, comprising the following modules: A multi-scale spatial adapter is configured to perform spatial feature extraction and multi-scale downsampling on a target image to output at least a first spatial feature tensor, a second spatial feature tensor, and a third spatial feature tensor with resolutions ranging from high to low. The visual base model, which is a visual feature encoding network pre-trained in a self-supervised manner, is configured to receive the same target image as input to the multi-scale spatial adapter, and output deep semantic feature tensors corresponding to spatial feature tensors at each scale. A hybrid encoder is configured to aggregate the spatial feature tensor and its corresponding deep semantic feature tensor at the same scale to obtain at least a first aggregated feature tensor, a second aggregated feature tensor, and a third aggregated feature tensor in descending order of scale. The feature enhancement path of the hybrid encoder is as follows: the first aggregated feature tensor is downsampled through a first-level spatial channel and then fused with the second aggregated feature tensor; the fused feature tensor is downsampled through a second-level spatial channel and then fused with the third aggregated feature tensor to output a multi-scale enhanced feature tensor after hybrid encoding. The DEIM Transformer decoder is configured to receive and decode the multi-scale augmented feature tensor output by the hybrid encoder; and The detection head is configured to output the category of weed seeds based on the decoding results of the DEIM Transformer decoder.

[0062] The weed seed identification system and dedicated model architecture based on DEIMv2 provided in this embodiment belong to the same inventive concept as the weed seed identification method based on DEIMv2 provided in the above embodiment. Here, all the contents of the embodiment of the weed seed identification method based on DEIMv2 are incorporated into this embodiment of the weed seed identification system and dedicated model architecture based on DEIMv2 by reference, and will not be repeated.

[0063] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0064] The above description is only a specific embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for identifying weed seeds based on DEIMv2, characterized in that, Includes the following steps: Acquire target images of the seeds to be identified; The target image is input into a pre-trained weed seed identification model; The dedicated model for weed seed identification is configured to analyze the target image and output a prediction result for the type of weed seed. The dedicated model for weed seed identification is equipped with the following modules: A multi-scale spatial adapter is configured to perform spatial feature extraction and multi-scale downsampling on a target image to output at least a first spatial feature tensor, a second spatial feature tensor, and a third spatial feature tensor with resolutions ranging from high to low. The visual base model is a visual feature encoding network pre-trained in a self-supervised manner, which is configured to receive the same target image as input to the multi-scale spatial adapter, and output deep semantic feature tensors corresponding to spatial feature tensors at each scale. A hybrid encoder is configured to aggregate the spatial feature tensor and its corresponding deep semantic feature tensor at the same scale to obtain at least a first aggregated feature tensor, a second aggregated feature tensor, and a third aggregated feature tensor in descending order of scale. The feature enhancement path of the hybrid encoder is as follows: the first aggregated feature tensor is downsampled through a first-level spatial channel and then fused with the second aggregated feature tensor; the fused feature tensor is downsampled through a second-level spatial channel and then fused with the third aggregated feature tensor to output a multi-scale enhanced feature tensor after hybrid encoding. The DEIM Transformer decoder is configured to receive and decode the multi-scale augmented feature tensor output by the hybrid encoder. The detection head is configured to output the category of weed seeds based on the decoding results of the DEIM Transformer decoder.

2. The method for identifying weed seeds according to claim 1, characterized in that, The hybrid encoder is also equipped with a feature upsampling module, which uses a content-aware feature reorganization mechanism to reconstruct the third aggregated feature tensor at high resolution to obtain the first reconstructed feature tensor. The second aggregated feature tensor is fused with the first reconstructed feature tensor to obtain the first fused feature tensor; The feature upsampling module also employs a content-aware feature recombination mechanism to reconstruct the first fused feature tensor at high resolution to enhance the feature representation of weed seed edges and textures, thereby obtaining a second reconstructed feature tensor. The second reconstructed feature tensor is fused with the first aggregated feature tensor to obtain the second fused feature tensor; The feature enhancement path of the hybrid encoder is replaced as follows: the second fused feature tensor is downsampled through the first-level spatial channel and then fused with the first fused feature tensor. The fused feature tensor is downsampled through the second-level spatial channel and then fused with the third aggregated feature tensor to output the multi-scale enhanced feature tensor after hybrid encoding.

3. The method for identifying weed seeds according to claim 1, characterized in that, The hybrid encoder is also configured with a fusion enhancement module, which is configured to extract high-frequency detail features from the first aggregated feature tensor using the Detail Branch module, and send the extracted high-frequency detail features to the DEIM Transformer decoder through a first branch to enhance the explicit modeling of weed seed edges and textures, and send them through a second branch to a module for first-level spatial channel downsampling to connect the feature enhancement path.

4. The method for identifying weed seeds according to claim 3, characterized in that, The Detail Branch module includes a depthwise separable convolutional unit, a cross-channel information recombination unit, a batch normalized activation unit, and an SE calibration unit. The depthwise separable convolutional unit, the cross-channel information recombination unit, and the batch normalized activation unit are connected sequentially. The SE calibration unit is configured to perform SE attention mechanism processing on the intermediate feature tensor output by the batch normalized activation unit to obtain the detail feature tensor. The high-frequency detail features are obtained by adding the detail feature tensor element-wise to the feature tensor input to the depthwise separable convolutional unit.

5. The method for identifying weed seeds according to claim 4, characterized in that, The depthwise separable convolutional unit extracts the local spatial texture response using the following formula: Where DWConv(·) represents the depthwise convolution operation, F This represents the feature tensor input to the Detail Branch module; The cross-channel information reconstruction unit uses the following formula to reconstruct cross-channel information from the extracted local spatial texture response: Where PWConv(·) represents a 1×1 pointwise convolution operation; The batch normalization activation unit performs batch normalization and activation operations on the feature tensor of cross-channel information reorganization using the following formula: Where BN(·) represents the batch normalization function and δ(·) represents the nonlinear activation function; The SE calibration unit uses the following formula to perform SE attention mechanism processing: ,in, F d Represents the detail feature tensor. SE (·) represents the function representation of the compression and stimulation mechanisms of attention; The high-frequency detail features F’ It is calculated using the following expression: F’ = F + F d .

6. The method for identifying weed seeds according to claim 1, characterized in that, The hybrid encoder is also equipped with a structure-aware module, which is configured to use a large kernel separable attention mechanism to model the overall structure of weed seeds and their long-range spatial dependencies. The input of the structure-aware module is connected to the input of the secondary spatial channel downsampling, and the output of the structure-aware module is connected to the DEIM Transformer decoder.

7. The method for identifying weed seeds according to claim 6, characterized in that, The large kernel separable attention mechanism uses a target large kernel size of 11 and a decomposition factor of 2, which decomposes the 11×11 large kernel convolution into a series of separable one-dimensional convolutions with a kernel size of 3: ,in, Z This represents the feature tensor received at the input of the structure-aware module. A 1 represents the feature tensor obtained from one-dimensional convolution, DWConv 1×3 (·) indicates a depthwise convolution operation using a 1×3 kernel, DWConv 3×1 (·) indicates a depthwise convolution operation using a 3×1 kernel; Then, a one-dimensional convolution with a kernel size of 5 is used to apply the feature tensor. A 1. Expanding the spatial range: Among them, DWConv 1×5 (·) indicates a depthwise convolution operation using a 1×5 kernel, DWConv 5×1 (·) represents a depthwise convolution operation using a 5×1 kernel, and σ(∙) represents the Sigmoid activation function; The output of the structure-aware module obtains an enhanced feature tensor after spatial attention recalibration through attention weighting. Z’ : Z’ = Z ⊙ A 2, where ⊙ represents element-wise multiplication.

8. The method for identifying weed seeds according to claim 1, characterized in that, The performance of the dedicated weed seed identification model was evaluated using the following methods: Calculate the accuracy using the following formula ,in, TP This indicates the number of target weed seeds that were correctly identified. FP This indicates the number of non-target weed seeds that were mistakenly identified as target weed seeds; Calculate recall using the following formula ,in, FN This indicates the number of target weed seeds that were identified as non-target weed seed categories or were not identified. Calculate the F1 score using the following formula: ; Calculate the mean precision using the following formula. Among them, average accuracy , N This indicates the total number of weed seed species.

9. The method for identifying weed seeds according to any one of claims 1 to 8, characterized in that, The multi-scale spatial adapter includes a 3×3 convolutional layer, a max pooling layer, and three cascaded 3×3 convolutional layers connected in sequence. The three cascaded 3×3 convolutional layers output feature maps of different sizes, which are 1 / 8, 1 / 16, and 1 / 32 of the target image, respectively. The visual foundation model is the DINOv3 backbone network, which includes a Patch Embed layer and multiple attention blocks.

10. The method for identifying weed seeds according to any one of claims 1 to 8, characterized in that, Each fused feature vector is subjected to deep feature extraction through stacked reparameterized convolutional blocks.

11. The method for identifying weed seeds according to any one of claims 1 to 8, characterized in that, The dedicated model for weed seed identification outputs a prediction result for one or more weed seed types; The method for identifying weed seeds also includes: Receive user feedback on the prediction results, wherein the feedback is either confirming one of the prediction results or denying all prediction results; The dedicated model for weed seed identification is configured to be optimized and updated based on the feedback information.

12. A weed seed identification system based on DEIMv2, characterized in that, It includes a user layer, an interaction and business logic layer, and an intelligent core layer. The user layer is configured to collect the target image of the seed to be identified and upload it to the interaction and business logic layer. The interaction and business logic layer is configured to call the weed seed identification-specific model of the intelligent core layer to analyze the target image; The dedicated model for weed seed identification is configured to output prediction results for weed seed types, and the dedicated model for weed seed identification includes the following modules: A multi-scale spatial adapter is configured to perform spatial feature extraction and multi-scale downsampling on a target image to output at least a first spatial feature tensor, a second spatial feature tensor, and a third spatial feature tensor with resolutions ranging from high to low. The visual base model is a visual feature encoding network pre-trained in a self-supervised manner, which is configured to receive the same target image as input to the multi-scale spatial adapter, and output deep semantic feature tensors corresponding to spatial feature tensors at each scale. A hybrid encoder is configured to aggregate the spatial feature tensor and its corresponding deep semantic feature tensor at the same scale to obtain at least a first aggregated feature tensor, a second aggregated feature tensor, and a third aggregated feature tensor in descending order of scale. The feature enhancement path of the hybrid encoder is as follows: the first aggregated feature tensor is downsampled through a first-level spatial channel and then fused with the second aggregated feature tensor; the fused feature tensor is downsampled through a second-level spatial channel and then fused with the third aggregated feature tensor to output a multi-scale enhanced feature tensor after hybrid encoding. The DEIM Transformer decoder is configured to receive and decode the multi-scale augmented feature tensor output by the hybrid encoder; and The detection head is configured to output the category of weed seeds based on the decoding results of the DEIM Transformer decoder.

13. The weed seed identification system based on DEIMv2 according to claim 12, characterized in that, The user layer consists of applications hosted on smart terminals. Includes the following units: The target image uploading unit is configured to upload the target image of the seed to be identified to the interaction and business logic layer; The prediction result display unit is configured to display the prediction results of the weed seed type output by the dedicated weed seed identification model; The prediction result details unit is configured to display knowledge information about the corresponding weed seeds in response to a query operation on the prediction result.

14. The weed seed identification system based on DEIMv2 according to claim 12, characterized in that, The user layer is an application carried by a smart terminal, and it further includes one or more of the following units: The message board is configured to post questions and receive and display replies. The expert connection unit is configured to display a list of experts and send messages, voice call requests, or video call requests to the experts in the list. The knowledge dictionary unit is configured to retrieve and display knowledge information about weed seeds that match a query request in response to the query request.

15. A dedicated model framework for weed seed identification, characterized in that, Includes the following modules: A multi-scale spatial adapter is configured to perform spatial feature extraction and multi-scale downsampling on a target image to output at least a first spatial feature tensor, a second spatial feature tensor, and a third spatial feature tensor with resolutions ranging from high to low. The visual base model is a visual feature encoding network pre-trained in a self-supervised manner, which is configured to receive the same target image as input to the multi-scale spatial adapter, and output deep semantic feature tensors corresponding to spatial feature tensors at each scale. A hybrid encoder is configured to aggregate the spatial feature tensor and its corresponding deep semantic feature tensor at the same scale to obtain at least a first aggregated feature tensor, a second aggregated feature tensor, and a third aggregated feature tensor in descending order of scale. The feature enhancement path of the hybrid encoder is as follows: the first aggregated feature tensor is downsampled through a first-level spatial channel and then fused with the second aggregated feature tensor; the fused feature tensor is downsampled through a second-level spatial channel and then fused with the third aggregated feature tensor to output a multi-scale enhanced feature tensor after hybrid encoding. The DEIM Transformer decoder is configured to receive and decode the multi-scale augmented feature tensor output by the hybrid encoder. as well as The detection head is configured to output the category of weed seeds based on the decoding results of the DEIM Transformer decoder.