Crop target counting method, system, computer device and medium

This method for counting crop targets, which utilizes multimodal data fusion and adaptive feature enhancement, solves the problem of low counting accuracy in existing technologies. It enables efficient and low-cost multi-crop counting in complex field scenarios and is suitable for drones or inspection robots.

CN121053546BActive Publication Date: 2026-03-24GUIZHOU UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-03
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

Existing technologies suffer from interactive rigidity, visual dilemmas, and fine-grained gaps in crop counting, resulting in low counting accuracy and making it difficult to achieve efficient and low-cost accurate counting in multi-crop and complex field scenarios.

Method used

It employs multimodal input data combined with multi-scale feature extraction and adaptive enhancement, dynamically fuses text prompts and visual example features, adaptively selects key features through frequency decoupling and dynamic modulation mechanisms, and achieves target detection through semantic injection and deep interaction, outputting optimized counting results.

Benefits of technology

It enables multi-crop counting without model retraining, significantly reduces missed and false detections, improves counting accuracy and stability, reduces time and labor costs, and is suitable for field scenarios with occlusion and drastic scale changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121053546B_ABST
    Figure CN121053546B_ABST
Patent Text Reader

Abstract

The application provides a crop target counting method, system, computer device and medium, and belongs to the field of agricultural target detection and counting. The method uses multi-modal input of images, visual examples and text prompts, dynamically enhances key scale features in the frequency domain by using an MDSF module, injects semantics into the image space by a CMA module, realizes pixel-level accurate separation of dense targets by deep interaction of a Transformer, and finally outputs the count by a cross decoder. The application uses the above crop target counting method, system, computer device and medium, does not need to retrain the model according to crops, can adapt to multiple crops in real time by a single system, significantly reduces the missed detection and mis-detection in the field scene with occlusion and dramatic scale change, and provides an efficient and low-cost counting means for yield estimation and accurate management.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of agricultural target detection counting, in particular to a crop target counting method, system, computer device and medium. BACKGROUND

[0002] In the state-of-the-art of precision agriculture and automated production, automatic counting has become a basic capability, but it is difficult to truly land due to the inherent high-entropy characteristics of agricultural scenes. The bottlenecks can be summarized as three points:

[0003] (1) Interaction rigidity: the mainstream solution still follows the "category-specific" supervised paradigm, and each new crop variety must go through the expensive closed loop of "collection-annotation-retraining", losing flexibility and economy.

[0004] (2) Visual dilemma: the scale changes dramatically in the field, there is dense occlusion, and the foreground and background are highly homogeneous in color, making it difficult for even advanced Vision Transformers to capture both macro contours and micro textures, resulting in high false positives and false negatives.

[0005] (3) Fine-grained gap: even Foundation Models, when there is only a weak feature difference between "countable parts and non-countable parts", the attention mechanism is still trapped in "feature confusion", unable to achieve pixel-level accurate focusing, and the counting accuracy is capped. SUMMARY

[0006] The purpose of the present application is to provide a crop target counting method, system, computer device and medium, which can adapt to multiple crops in real time without retraining the model for each crop, significantly reduce false positives and false negatives in occluded and scale-varying field scenes, and provide an efficient and low-cost counting means for yield estimation and precision management.

[0007] To achieve the above purpose, the present application provides a crop target counting method, comprising the following steps:

[0008] Step S1, obtaining multi-modal input data, including a digital image of a crop to be processed, at least one visual example interactively framed by a user on the image, and a text prompt for specifying the semantic identity of the target to be counted;

[0009] Step S2, performing multi-scale feature extraction and adaptive enhancement on the digital image of the crop to obtain enhanced image features; meanwhile, performing feature encoding on the text prompt and the visual example to obtain text features and visual example features, respectively;

[0010] Step S3, dynamically fusing the text features and the visual example features to generate fusion guide features;

[0011] Step S4, semantic injection of enhanced image features and fusion guidance features, output of optimized final image features and final guidance features;

[0012] Step S5, target detection decoding based on final image features and final guidance features, and crop counting result through post-processing.

[0013] Preferably, in step S2, the following steps are included:

[0014] Step S21, inputting the crop digital image into the pre-trained image encoder to extract multi-scale image features ;

[0015] Step S22, sending the feature map of each scale into the MDSF module for enhancement, obtaining enhanced image features ;

[0016] Step S23, inputting the text prompt into the text encoder to obtain text features ;

[0017] Step S24, extracting visual example features from the enhanced image features through the RoIAlign operation using the coordinates of the visual example box.

[0018] Preferably, the MDSF module is processed through two steps of frequency decoupling and dynamic modulation;

[0019] Step S221, frequency decoupling: processing each scale of feature map through parallel branches with different size convolution kernels, and concatenating the results, the formula is:

[0020] ;

[0021] wherein, represents the output feature map after frequency decoupling, represents the feature concatenation operation, represents batch normalization, represents the convolution layer of the th branch, represents the input feature map of the th scale, represents the total number of parallel branches;

[0022] Step S222, dynamic modulation: learning channel weights from through the modulator network , and the enhanced image features are obtained through residual connection , and the enhanced image features are obtained through residual connection

[0023] ;

[0024] ;

[0025] wherein, represents a Sigmoid activation function, , both represent a fully connected layer, represents an activation function, and represents element-wise multiplication, represents a global average pooling.

[0026] Preferably, in step S3, the following steps are included:

[0027] Step S31, performing dimension alignment on the visual example features through a linear adapter layer Adapter to obtain aligned visual example features ;

[0028] Step S32, calculating attention weights between the aligned visual example features and the corresponding text label features through a lightweight attention enhancer Enhancer, and generating a context vector , and the enhanced image features are obtained through residual connection , and the enhanced image features are obtained through residual connection

[0029] ;

[0030] ;

[0031] wherein, represents a normalized activation function, represents a square root calculation, represents the dimension of the key, represents a matrix transpose symbol;

[0032] Step S33, calculating adaptive fusion weights through a learnable gating network Gate according to the spliced features of and , and generating enhanced visual example features , and the enhanced image features are obtained through residual connection , and the enhanced image features are obtained through residual connection

[0033] ;

[0034] ;

[0035] Step S34, inputting the enhanced visual example features inserted into the corresponding position of the original text feature to form a fusion guide feature .

[0036] Preferably, step S4 includes the following steps:

[0037] Step S41, send the enhanced image feature together with the fusion guide feature into the CMA module, and the CMA module modulates the feature channels of the enhanced image feature by taking the fusion guide feature as a query instruction, so as to realize semantic injection, and the calculation process is as follows:

[0038] ;

[0039] ;

[0040] ;

[0041] ;

[0042] ;

[0043] wherein, represents a query vector, represents a key vector, Expand represents a dimension expansion operation, represents an attention score of the CMA module, represents a value vector, and γ represents a learnable scalar parameter, represents an image feature after semantic injection;

[0044] Step S42, send the image feature after semantic injection together with the fusion guide feature into a Transformer-based feature interaction encoder , and finally output the final image feature and the final guide feature through multi-layer self-attention and cross-attention calculation.

[0045] Preferably, step S5 includes the following steps:

[0046] Step S51, select TopK candidate regions as initial queries by calculating the similarity between the final image feature and the final guide feature .

[0047] Step S52, inputting the initial query together with the final features to the cross-modal decoder , iteratively optimizing the position and confidence of the candidate region, and outputting the decoded hidden state and reference point ;

[0048] Step S53, based on the hidden state and reference point , calculating the bounding box and classification confidence of each candidate target through the prediction head, the formula is:

[0049] ;

[0050] ;

[0051] wherein, represents the bounding box embedding function, represents the inverse Sigmoid function, represents the category embedding function;

[0052] Step S54, post-processing the prediction results, first filtering out the detection boxes with a confidence less than or equal to 0.23 low score through a confidence threshold , and then removing redundant detection boxes through a non-maximum suppression algorithm with an overlap threshold to obtain a final detection box set ;

[0053] Step S55, obtaining the final crop counting result by enumerating and counting the final detection box set , , .

[0054] The present application also provides a crop target counting system, comprising:

[0055] a data acquisition module for acquiring multi-modal input data, including a digital image of crops to be processed, at least one visual example interactively framed by a user on the image, and a text prompt for specifying the semantic identity of the target to be counted;

[0056] a feature extraction and enhancement module for multi-scale feature extraction and adaptive enhancement of the digital image of crops to obtain enhanced image features; meanwhile, the text prompt and the visual example are feature-encoded to obtain text features and visual example features, respectively;

[0057] ​a feature fusion module, configured to dynamically fuse the text features and the visual example features to generate fusion guide features;

[0058] a semantic injection and interaction module, configured to perform semantic injection and deep interaction between the enhanced image features and the fusion guide features, and output optimized final image features and final guide features;

[0059] a target detection and counting module, configured to perform target detection decoding based on the final image features and the final guide features, and obtain a crop counting result through post-processing.

[0060] The application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the crop target counting method when executing the computer program.

[0061] The application further provides a computer readable storage medium, which stores a computer program, and the computer program implements the steps of the crop target counting method when executed by a processor.

[0062] Therefore, the crop target counting method, system, computer device and medium have the following beneficial technical effects:

[0063] (1) By dynamically fusing the text prompt (defining "what is it") and the visual example (defining "what does it look like"), the application breaks free from the shackles of the traditional method of "one crop needs one model". The user only needs to switch the text label (such as "corn" to "rice") and provide a local example image of the corresponding crop, and the same system can be reused to complete the counting of new crops, without the need to re-collect large-scale labeled data or re-train the model, significantly reducing the time and labor costs.

[0064] (2) The frequency decoupling and dynamic modulation mechanism of the MDSF module enables the model to adaptively select the most discriminative features in the current scene (such as the subtle texture of the rice ear or the macroscopic contour of the corn ear). Under the conditions of dense planting of crops, branch and leaf shielding, or severe changes in perspective scale in the field, the model can still maintain stable detection performance by enhancing key features and suppressing redundant information, reducing missed detection and false detection.

[0065] (3) The CMA module directly injects the abstract semantics (such as "countable wheat ears") in the user instructions into the visual feature space, forcing to enlarge the feature distance between the target (wheat ear) and the background interference (wheat stem and leaf). Even if the two are highly similar in low-order features such as color and texture, the model can still achieve accurate separation according to the semantic constraints, breaking through the counting accuracy bottleneck caused by "feature confusion" in traditional methods.

[0066] (4) The overall framework reduces redundant calculations while maintaining high accuracy through multi-modal feature collaborative optimization and efficient interaction with the Transformer architecture. BRIEF DESCRIPTION OF DRAWINGS

[0067] Figure 1 Flowchart of the crop target counting method of the present application;

[0068] Figure 2 Flowchart of dynamically fusing text prompts and visual examples;

[0069] Figure 3 Flowchart of the frequency decoupling and dynamic modulation mechanism of the MDSF module;

[0070] Figure 4 Flowchart of the CMA module;

[0071] Figure 5 Test set result chart; wherein, Figure 5 (a) in FIG. 1 is a wheat spike test scene; Figure 5 (b) in FIG. 1 is a corn tassel test scene; Figure 5 (c) in FIG. 1 is a soybean test scene; Figure 5 (d) in FIG. 1 is a rice test scene. DETAILED DESCRIPTION

[0072] The technical solutions of the present application are further described below through the drawings and examples.

[0073] Unless otherwise defined, the technical terms or scientific terms used in the present application shall have the usual meanings understood by persons having ordinary skills in the art to which the present application belongs.

[0074] Example 1

[0075] As shown in FIG. 1, the crop target counting method comprises the following steps: Figure 1

[0076] Step S1, obtaining multi-modal input data, including a digital image of a crop to be processed, at least one visual example interactively framed by a user on the image, and a text prompt for specifying the semantic identity of the target to be counted.

[0077] Step S2, performing multi-scale feature extraction and adaptive enhancement on the digital image of the crop to obtain enhanced image features; at the same time, performing feature encoding on the text prompt and the visual example to obtain text features and visual example features, respectively.

[0078] Step S21, inputting the digital image of the crop into a pre-trained image encoder to extract multi-scale image features ; ​

[0079] Step S22, the feature maps of each scale are sent into a Modulated Dynamic Spectral Fusion (MDSF) module for enhancement to obtain enhanced image features As shown in Figure 3 ;

[0080] The MDSF module processes through two steps of frequency decoupling and dynamic modulation.

[0081] Step S221, frequency decoupling: the feature maps of each scale are processed through parallel branches with different size convolution kernels, and the results are concatenated, with the formula being:

[0082] ;

[0083] wherein, F represents the output feature map after frequency decoupling, represents a feature concatenation operation, represents batch normalization, represents a convolution layer of the i-th branch, represents the input feature map of the i-th scale, and represents the total number of parallel branches. Step S222, dynamic modulation: a modulator network is used to learn channel weights from the feature maps of each scale, and enhanced image features are obtained through a residual connection, with the formula being: ;

[0084] wherein, represents a Sigmoid activation function, and represents a fully connected layer.

[0085] ;

[0086] ;

[0087] wherein, represents a Sigmoid activation function, and represents a fully connected layer.

[0088] Step S23, a text prompt is input into a text encoder to obtain text features ;

[0089] ​​​​​​​​​​​​​​​​​​Step S24, the visual example feature is extracted from the enhanced image feature by RoIAlign operation using the coordinates of the visual example box.

[0090] Step S3, dynamically fusing the text feature and the visual example feature to generate the fusion guide feature, as shown in Figure 2

[0091] Step S31, performing dimension alignment on the visual example feature by a linear adaptation layer Adapter to obtain the aligned visual example feature

[0092] Step S32, calculating the attention weight between the aligned visual example feature and the corresponding text label feature by a lightweight attention enhancer Enhancer, and generating a context vector , the formula is:

[0093]

[0094]

[0095] wherein, denotes a normalized activation function, denotes a square root calculation, denotes the dimension of the key, denotes a matrix transpose symbol;

[0096] Step S33, calculating an adaptive fusion weight by a learnable gating network Gate according to the spliced features of and , and generating an enhanced visual example feature , the formula is:

[0097]

[0098]

[0099] Step S34, inserting the enhanced visual example feature into the corresponding position of the original text feature to form a fusion guide feature .

[0100] Step S4, performing semantic injection and deep interaction between the enhanced image feature and the fusion guide feature, and outputting an optimized final image feature and a final guide feature.

[0101] Step S41, as​​​​​​​​Figure 4 As shown, the enhanced image features With fusion guidance features Together, they are fed into the Channel Modulation Attention (CMA) module, which fuses the guiding features. Modulate and enhance image features as a query instruction The feature channels are used to achieve semantic injection, and the calculation process is as follows:

[0102] ;

[0103] ;

[0104] ;

[0105] ;

[0106] ;

[0107] in, Represents the query vector. This represents the key vector, and Expand represents the dimension expansion operation. This represents the attention score of the CMA module. Let represent a value vector, and γ represent a learnable scalar parameter. This represents the image features after semantic injection;

[0108] Step S42: Inject semantically injected image features With fusion guidance features Together they are fed into the Transformer-based feature interactive encoder Through multi-layered self-attention and cross-attention calculations, the final output is a deep-aligned and optimized image feature. and final guiding features .

[0109] Step S5: Perform target detection and decoding based on the final image features and final guiding features, and obtain the crop counting results through post-processing.

[0110] Step S51: Calculate the final image features and final guiding features Based on the similarity between them, the Top K candidate regions are selected as the initial query. ;

[0111] Step S52: Initial query With final features , Input together to the cross-mode decoder Iteratively optimize the position and confidence of the candidate regions, and output the decoded hidden state. and reference points ;

[0112] Step S53, based on hidden state and reference points The bounding box of each candidate target is calculated using the prediction head. and classification confidence The formula is:

[0113] ;

[0114] ;

[0115] in, This indicates the bounding box embedding function. This represents the inverse Sigmoid function. Indicates the category embedding function;

[0116] Step S54: Post-process the prediction results, first by applying a confidence threshold. Detection boxes with confidence scores less than or equal to 0.23 are filtered out, and then non-maximum suppression is applied with an overlap threshold. Redundant detection boxes are removed to obtain the final set of detection boxes. ;

[0117] Step S55: By analyzing the final detection box set Enumerate and count to obtain the final crop count result. , .

[0118] The invention will be further illustrated below with specific examples.

[0119] (1) Test on wheat ears.

[0120] The quantitative evaluation results on the GWHD 2021 wheat ear dataset are shown in Table 1, and the visualization results are shown in […]. Figure 5 In (a), Faster R-CNN, SSD, DETR, WheatLFANet, and YOLOv8 are counting methods based on object detection, CSRNet and CSNet are counting methods based on density estimation, TransCrowd-Token and TransCrowd-GAP are counting methods based on Transformer, and AuxSegCount is a counting method based on auxiliary segmentation. Figure 5The (a) in FIG. 6 is a photographed picture of the wheat ear, and the real number of the wheat ear is 56, and the predicted number is 56. In Table 1, MAE represents the mean absolute error, and RMSE represents the root mean square error.

[0121] Table 1 Comparison of quantitative evaluation results of wheat ear

[0122] ;

[0123] (2) Test on corn.

[0124] The quantitative evaluation results on the MrMT corn tassel data set are shown in Table 2, and the visualization results are shown in FIG. 7(b). Figure 5 The (b) in FIG. 7 is a photographed picture of the corn tassel, and the real number of the corn tassel is 65, and the predicted number is 64. Figure 5

[0125] Table 2 Comparison of quantitative evaluation results of corn tassel

[0126] ;

[0127] (3) Test on soybeans.

[0128] The quantitative evaluation results on the POD soybean data set are shown in Table 3, and the visualization results are shown in FIG. 8(c). Figure 5 The (c) in FIG. 8 is a photographed picture of the soybean, and the real number of the soybean pod is 113, and the predicted number is 110. Figure 5

[0129] Table 3 Comparison of quantitative evaluation results of soybeans

[0130] ;

[0131] (4) Test on rice.

[0132] The quantitative evaluation results on the DRPD rice data set are shown in Table 4, and the visualization results are shown in FIG. 9(c). Figure 5 ​​(d) in FIG. 6. Among them, Panicle-Cloud and PlantBiCNet are counting methods based on target detection. Figure 5 (d) in FIG. 6 is a photographed picture of rice, and the real number of rice panicles is 52, and the predicted number is 53.

[0133] Table 4 Comparison of quantitative evaluation results of rice

[0134] ;

[0135] From the experimental results, it can be seen that the method proposed in the present application performs well on the GWHD 2021 dataset, the MrMT dataset, the POD dataset and the DRPD dataset, and is better than or equal to other comparative models. This result shows that the method proposed in the present application has significant application potential in the counting task of multiple crops in complex scenes.

[0136] Embodiment Two

[0137] The crop target counting system comprises:

[0138] The data acquisition module is configured to acquire multi-modal input data, including a digital image of a crop to be processed, at least one visual example interactively framed by a user on the image, and a text prompt for specifying a semantic identity of a target to be counted.

[0139] The feature extraction and enhancement module is configured to perform multi-scale feature extraction and adaptive enhancement on the digital image of the crop to obtain enhanced image features, and to perform feature encoding on the text prompt and the visual example to obtain text features and visual example features, respectively.

[0140] The feature fusion module is configured to dynamically fuse the text features and the visual example features to generate fusion guide features.

[0141] The semantic injection and interaction module is configured to perform semantic injection and deep interaction between the enhanced image features and the fusion guide features to output optimized final image features and final guide features.

[0142] The target detection and counting module is configured to perform target detection decoding based on the final image features and the final guide features, and to obtain a crop counting result through post-processing.

[0143] If the above functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the parts of the prior art that make contributions or parts of the technical solutions can be embodied in the form of software products. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0144] The logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a list of executable instructions for implementing logic functions, which can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus or device, such as a computer-based system, a system including a processor or other system that can fetch the instructions from the instruction execution system, apparatus or device and execute the instructions, or in conjunction with these instructions execution systems, apparatus or devices. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transport programs for use by or in connection with an instruction execution system, apparatus or device, or in conjunction with these instruction execution systems, apparatus or devices.

[0145] More specific examples (a non-exhaustive list) of the computer-readable medium include the following: an electrical connection having one or more wires (electrical devices), a portable computer diskette (magnetic devices), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CD ROM). In addition, the computer readable medium can even be paper or other suitable medium on which the program can be printed, as the program can be electronically obtained, for example, by optical scanning of the paper or other medium, followed by editing, interpreting or otherwise processing, if necessary, in other suitable ways to obtain the program electronically and then storing it in the computer memory.

[0146] It is worth noting that the contents not elaborated in detail in the present application are all prior art and are well known to those skilled in the art.

[0147] Therefore, the application adopts the crop target counting method, system, computer device and medium, without training a crop weight model, a single system can adapt to multiple crops in real time, the missed detection and mis-detection are significantly reduced in the shielding and scale change field scene, and the counting method can be directly deployed on an unmanned aerial vehicle or a patrol robot, thereby providing an efficient and low-cost counting means for yield estimation and accurate management.

[0148] Finally, it should be noted that: the above examples are only used to illustrate the technical solutions of the present application, but not to limit them, although the present application has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that: the technical solutions of the present application can still be modified or replaced by equivalents, and these modifications or equivalent replacements cannot make the modified technical solutions deviate from the spirit and scope of the technical solutions of the present application.

Claims

1. A method for counting crop targets, characterized in that, Includes the following steps: Step S1: Obtain multimodal input data, including a digital image of the crop to be processed, at least one visual example interactively selected by the user on the image, and a text prompt for specifying the semantic identity of the target to be counted; Step S2: Perform multi-scale feature extraction and adaptive enhancement on the digital image of crops to obtain enhanced image features; at the same time, perform feature encoding on the text prompts and visual examples to obtain text features and visual example features respectively; Step S3: Dynamically fuse text features and visual example features to generate fused guiding features; Step S4: Perform semantic injection and deep interaction on the enhanced image features and fused guidance features to output the optimized final image features and final guidance features; Step S5: Perform target detection and decoding based on the final image features and final guiding features, and obtain the crop counting results through post-processing; Step S3 includes the following steps: Step S31: Align the visual example features dimensionally using the linear adaptation layer (Adapter) to obtain the aligned visual example features. ; Step S32: Calculate the aligned visual example features using a lightweight attention enhancer. Corresponding text label features Attention weights between and generate context vectors. The formula is: ; ; in, Represents the normalized activation function. To represent the calculation of square roots, The dimension representing the key. Represents the matrix transpose symbol; Step S33: Through the learnable gated network Gate, according to and Calculate adaptive fusion weights from splicing features And generate enhanced visual example features. The formula is: ; ; in, This represents the Sigmoid activation function, and ⊙ represents element-wise multiplication. Indicates feature concatenation operation; Step S34: Enhance the visual example features Insert into original text features The corresponding position forms a fusion guidance feature. ; Step S4 includes the following steps: Step S41: Enhance image features With fusion guidance features Together they are sent to the CMA module, which then integrates the bootstrap features. Modulate and enhance image features as a query command The feature channels are used to achieve semantic injection, and the calculation process is as follows: ; ; ; ; ; in, Indicates global average pooling. Represents the query vector. This represents the key vector, and Expand represents the dimension expansion operation. This represents the attention score of the CMA module. Let represent a value vector, and γ represent a learnable scalar parameter. This represents the image features after semantic injection; Step S42: Inject semantically injected image features With fusion guidance features Together they are fed into the Transformer-based feature interactive encoder Through multi-layered self-attention and cross-attention calculations, the final output is a deep-aligned and optimized image feature. and final guiding features .

2. The crop target counting method according to claim 1, characterized in that, Step S2 includes the following steps: Step S21: Input the digital image of the crop into the pre-trained image encoder. Extracting multi-scale image features ; Step S22: Convert the feature map at each scale. The image is fed into the MDSF module for enhancement to obtain enhanced image features. ; Step S23: Input the text prompt into the text encoder. To obtain text features ; Step S24: Using the coordinates of the visual example box, extract the enhanced image features through the RoIAlign operation. Extract visual example features.

3. The crop target counting method according to claim 2, characterized in that, The MDSF module processes data through two steps: frequency decoupling and dynamic modulation. Step S221, Frequency Decoupling: Through Parallel branches with convolutional kernels of different sizes for each scale of feature map The process is performed, and the results are cascaded. The formula is as follows: ; in, This represents the output feature map after frequency decoupling. This indicates a feature concatenation operation. Indicates batch normalization. Indicates the first Convolutional layers with branches, Indicates the first Input feature maps at various scales, Indicates the total number of parallel branches; Step S222, Dynamic Modulation: Through the modulator network from Learning Channel Weights Enhanced image features are obtained through residual connections. The formula is: ; ⊙ ; in, This represents the Sigmoid activation function. , Both represent fully connected layers. This represents the activation function, and ⊙ represents element-wise multiplication. This indicates global average pooling.

4. The crop target counting method according to claim 3, characterized in that, Step S5 includes the following steps: Step S51: Calculate the final image features and final guiding features Based on the similarity between them, the Top K candidate regions are selected as the initial query. ; Step S52: Initial query With final features , Input together to the cross-mode decoder Iteratively optimize the position and confidence of the candidate regions, and output the decoded hidden state. and reference points ; Step S53, based on hidden state and reference points The bounding box of each candidate target is calculated using the prediction head. and classification confidence The formula is: ; ; in, This indicates the bounding box embedding function. This represents the inverse Sigmoid function. Indicates the category embedding function; Step S54: Post-process the prediction results, first by applying a confidence threshold. Detection boxes with a confidence level less than or equal to 0.23 are filtered out, and then non-maximum suppression is applied with an overlap threshold. Redundant detection boxes are removed to obtain the final set of detection boxes. ; Step S55: By analyzing the final detection box set Enumerate and count to obtain the final crop count result. , .

5. A crop target counting system, characterized in that, A method for implementing the crop target counting method according to any one of claims 1-4 includes: The data acquisition module is used to acquire multimodal input data, including digital images of crops to be processed, at least one visual example interactively selected by the user on the image, and text prompts for specifying the semantic identity of the target to be counted. The feature extraction and enhancement module is used to perform multi-scale feature extraction and adaptive enhancement on digital images of crops to obtain enhanced image features; at the same time, it performs feature encoding on text prompts and visual examples to obtain text features and visual example features, respectively. The feature fusion module is used to dynamically fuse text features and visual example features to generate fused guiding features; The semantic injection and interaction module is used to perform semantic injection and deep interaction between the enhanced image features and the fused guiding features, and output the optimized final image features and the final guiding features. The target detection and counting module is used to perform target detection and decoding based on the final image features and the final guiding features, and to obtain the crop counting results through post-processing.

6. A computer device, comprising: Memory and processor; The memory stores a computer program, characterized in that when the processor executes the computer program, it implements the steps of the crop target counting method according to any one of claims 1-4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When a computer program is executed by a processor, it implements the steps of the crop target counting method according to any one of claims 1-4.

Citation Information

Patent Citations

  • Named entity recognition method based on comparative learning and multi-modal semantic interaction

    CN117574904A

  • Multi-modal neural machine translation method guided by multi-granularity visual pivot based on text perception cross-modal comparison decoupling

    CN118313388A