A variety-independent plant counting method and system
By employing image patch feature extraction and fusion, dynamic multi-scale counting regression, and attention-guided generation, this method addresses the problem of existing plant counting methods relying on specific species, achieving high-precision plant counting across species and growth stages, and possessing strong species independence and interpretability.
Patent Information
- Application Number
- CN202511212349.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-28
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2045-08-28
AI Technical Summary
Existing plant counting methods rely on specific species, lack generalization ability, are difficult to adapt to different types and growth stages of plants, have low counting accuracy, and perform poorly, especially in non-rigid deformation and complex field environments.
We employ image patch feature extraction and fusion, dynamic multi-scale image patch-level counting regression, normalization, and attention-guided generation methods. By decoupling the attention mechanism and multi-scale dynamic counters, we generate highly discriminative feature representations and attention matching maps that are adaptable to counting different types and growth stages of plants.
It achieves species-independent plant counting, adapts to plant image inputs of different species and growth stages, has strong accuracy and interpretability, supports a unified counting framework, and does not require retraining of the model for specific plant species.
Smart Images

Figure CN120725894B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of plant phenotyping, in particular, to a variety-independent plant counting method and system. BACKGROUND
[0002] Plant counting is a key technology in agricultural automation and plant phenotyping, widely used in crop yield prediction, planting density evaluation, early disease identification and other tasks. With the globalization and refinement of global agricultural production, the demand for plant counting is growing. However, traditional plant counting methods usually rely on manual operation, which is inefficient and prone to errors. In recent years, with the rapid development of deep learning technology, plant counting methods based on computer vision have gradually become a research hotspot. These methods can efficiently and accurately complete the counting task by automatically analyzing plant images, providing strong technical support for agricultural production.
[0003] With the continuous evolution of deep learning technology, the vision transformer (ViT) as a new type of neural network structure is gradually applied to various tasks in computer vision. Compared with traditional convolutional neural networks (CNN), the vision transformer has stronger global modeling ability, which can capture long-distance dependencies in images through self-attention mechanism, and is suitable for processing challenging problems such as complex background and dense targets. In the target counting task, the global perception characteristics of the vision transformer are gradually introduced into the class-agnostic counting (CAC) research, providing a theoretical basis and technical support for cross-class and cross-scene target number estimation. Related work shows that the fusion of example-guided mechanism, self-attention structure and scale modeling strategy is expected to improve the counting accuracy in non-rigid structure, high intra-class variation and complex field environment.
[0004] In recent years, plant counting task has become an important branch of deep counting research, and the academic community has proposed a variety of counting models for specific plant targets. Lu et al. proposed TasselNet in 2017 (Lu., et al. "TasselNet: Counting maize tassels in the wild via local counts regression network" Plant methods. 2017; 13: 1-17.), which first used deep learning for the maize tassel counting task and achieved density estimation using a local regression strategy. Xiong et al. proposed TasselNetV2 in 2019 (Xiong., et al. "TasselNetV2: Counting maize tassels via local counts regression network" Plant methods. 2019; 15: 150), which introduced context information and local region division mechanism, significantly improving the counting performance in dense overlapping areas. Lu et al. proposed TasselNetV3 in 2021 (Lu., et al. "Counting dense objects in remote sensing images via hierarchical local regression network" Remote Sensing. 2021; 60: 1-15), which combined hierarchical convolution structure and feature pyramid technology to enhance the model's ability to recognize and interpret multi-scale targets. These models have promoted the development of plant image counting research, but they generally lack variety independence and are difficult to directly reuse across plant species or different growth stages. To address this issue, Lu et al. proposed the GMNet model in 2019 (Lu., et al. "Class-agnostic counting." Asian Conference on Computer Vision. 2019; 669-684), which uses CNN to extract features from images and examples and matches them through inner product to achieve class-agnostic counting.Subsequently, Shi et al. proposed BMNet+ in 2022 (Shi., et al. "Towards Class-Agnostic Counting via Similarity Learning." Conference on Computer Vision and Pattern Recognition. 2022; 9529-9538) to introduce a similarity-aware mechanism and a metric learning framework, further improving the generalization ability. However, the above methods still perform poorly when facing non-rigid deformation and complex field interference in plant counting tasks, and need to be further optimized by combining the characteristics of plant targets.
[0005] Therefore, although the prior art has achieved certain success in specific plant counting tasks, there are still many deficiencies. First, existing methods are usually designed for specific plant species, and when the target plant species changes, data needs to be collected and the model needs to be retrained. Second, plants are dynamic systems, and their shape and appearance change with growth stages and environmental conditions. Existing methods perform poorly when dealing with non-rigid plant targets. In addition, existing technologies lack effective adaptability when dealing with plant instances of different scales and densities, especially when plant size and morphology change greatly with growth stages in field environments, the counting accuracy decreases significantly. SUMMARY
[0006] Therefore, the present application provides a variety-independent plant counting method and system to solve the problems of existing plant counting models
[0007] that are dependent on specific species and non-rigid plant morphology, resulting in insufficient generalization ability, low counting accuracy, and other issues.
[0008] To achieve the above-mentioned purposes, the technical solutions adopted by the present application are as follows:
[0009] A variety-independent plant counting method, comprising:
[0010] S1: Image block feature extraction and fusion: First, the to-be-detected image and the plant prompt sample image are segmented into fixed-size image blocks; then, an encoder is used to extract features from the image blocks of the to-be-detected image and the plant prompt sample image, generate a main feature map, and dynamically calculate the similarity between the image blocks of the to-be-detected image and the image blocks of the plant prompt sample image through a decoupling attention mechanism (Decouple Attention) to generate a fused high-discriminability feature representation and an attention match map (Attention Match Map), and then the main feature map and the attention match map are spliced in the channel dimension, the distortion of multi-target response caused by the softmax function is corrected through width / height compensation mapping (Width / Height Compensation Map) to form an enhanced feature map, and the plant prompt sample condition is injected into the enhanced feature;
[0011] S2: Dynamic multi-scale image block level counting regression: based on the enhanced feature, a multi-scale dynamic counter is used for local counting at the image block level, the multi-scale dynamic counter includes a plurality of counting heads corresponding to plant instances of different scales or image blocks of different sizes, the receptive field (block_size) and the step (output_stride) of the counting head can be dynamically adjusted according to the scale information of the target plant, and each counting head processes the enhanced feature through an average pooling layer and a convolution layer; a redundant counting map is regressed at the image block level;
[0012] S3: Normalization: the redundant counting map is normalized using an overlapping region weighted average strategy to eliminate context redundancy and obtain a more accurate local counting map;
[0013] S4: Attention-guided explainability generation: the local counting map and the attention match map (Attention Match Map) are combined to generate an attention-guided prompt map, the normalized local counting map and the attention-guided prompt map are fused and up-sampled to generate a final high-resolution visual counting result map, and the attention-guided prompt map is used to indicate the possible position and number of plants to further improve the explainability of the counting result.
[0014] Optionally, the method further comprises, before step S1:
[0015] Preprocessing: uniform standardization processing is performed on the collected to-be-detected image and plant prompt sample image, including size normalization of the image, and image enhancement method is used to improve the image quality to reduce the influence of environmental factors.
[0016] Optionally, step S1, which dynamically calculates the similarity between image patches of the image to be detected and image patches of the plant cue sample image through a decoupled attention mechanism to generate a fused high-discrimination feature representation and attention match map, specifically includes:
[0017] The decoupled attention mechanism models the global contextual information between tokens in the images to be detected through self-attention; and injects the tokens of the plant cue sample images as prior information into the images to be detected through cross-attention, generating a fused high-discrimination feature representation and attention matching map.
[0018] Optionally, the attention matching graph is decoupled into four parts:
[0019]
[0020] in, This represents the self-attention mechanism within the image to be detected. This represents the cross-modal similarity between the image to be detected and the plant cue sample image. This indicates a reverse matching from the plant cue sample image to the image to be detected. This indicates self-attention within the plant cue sample image.
[0021] Optionally, step S2, which uses a multi-scale dynamic counter to perform local counting at the token level, specifically includes:
[0022] Based on the size information of the plant sample, an appropriate local counting branch is selected for density prediction; each local counting head corresponds to a different set of block sizes and output step sizes.
[0023] Optionally, in step S2, there are specifically three counting heads, each corresponding to an image block resolution of [size missing]. , and In the formula These are the height and width of the input image patch, respectively. The resolution scaling factor for the counting heads is used, and the three counting heads correspond to three counting branches respectively. The step of regressing the redundant counting map at the image patch level specifically includes:
[0024] S2.1: Counting branch 1: Corresponding image patch resolution size is The counting head performs average pooling on the enhanced feature map to reduce spatial resolution, and extracts local features through a set of convolutional layers and normalized activation units to generate local counting maps of the corresponding scale.
[0025] S2.2: Counting branch 2: Corresponding image patch resolution size is The counting head performs average pooling on the enhanced feature map to reduce spatial resolution, and extracts local features through a set of convolutional layers and normalized activation units to obtain feature representations in the mid-scale range and output a local counting map.
[0026] S2.3: Counting branch 3: Corresponding image patch resolution size is The counting head performs average pooling on the enhanced feature map to reduce spatial resolution, and extracts local features through a set of convolutional layers and normalized activation units to adapt to the feature extraction needs of larger-scale target instances, and outputs the corresponding counting map.
[0027] S2.4: Dynamic routing: Based on the original width and height of the target instance in the plant cue sample image, calculate the interval to which its scale belongs, and use a routing mechanism to select the output result of the branch corresponding to the interval to which the scale belongs from the three counting branches.
[0028] Optionally, the dynamic routing process can be formally represented as:
[0029]
[0030] in, Indicates the encoder backbone network. Parameters representing different counting heads, Indicates the size of the target. Indicates a preset size range. This is a hard switching function. This indicates different counting heads.
[0031] Optionally, the method may also include the following steps before step S4:
[0032] Based on the bounding boxes of target instances in the plant cue sample images, their width and height information are extracted, and a scale embedding vector is constructed. The scale embedding vector is then expanded in dimension to the spatial dimension of the feature map of the image to be detected through a broadcast mechanism, and concatenated with the image patch features of the image to be detected in the channel dimension to provide scale prior information. Then, the concatenated features are fed into the multi-head decoupled attention module in the visual converter structure to guide the attention distribution while maintaining the spatial structure.
[0033] Optionally, step S4, which involves fusing and upsampling the normalized local counting map with the attention-guided cue map to generate the final high-resolution visualized counting result map, specifically includes:
[0034] S4.1: Perform bilinear interpolation on the local counting map to match its resolution with the attention. Figure One To;
[0035] S4.2: Based on predicted counts Plant-related sample size compensation factor In the formula Provide the length and width of the plant sample image token. Calculate the number of key regions based on the original length and width of the plant cue sample image. ;
[0036] S4.3: Select the top two lines with the highest similarity from the attention matching graph. Generate a binary mask from a number of image patches;
[0037] S4.4: Perform a Hadamard product operation between the binary mask and the local counting map to generate a density map or detection mask, thereby providing understandable counting results;
[0038] The final high-resolution visualization of the counting results is typically presented in two forms: one is a density map, which visually displays the density of plant distribution through color gradients; the other is a detection mask, which visually displays the location of each counting target by marking the center or boundary of the target instance.
[0039] A variety-independent plant counting system includes an encoder, a multi-scale dynamic counter, a normalizer, and a visualizer;
[0040] Encoder: Used for image patch feature extraction and fusion: First, the image to be detected and the plant cue sample image are segmented into image patches of fixed size; then, the encoder extracts features from the image patches of the image to be detected and the plant cue sample image to generate a master feature map, and dynamically calculates the similarity between the image patches of the image to be detected and the image patches of the plant cue sample image through a decoupled attention mechanism to generate a fused high-discrimination feature representation and an attention match map. Subsequently, the master feature map and the attention match map are concatenated in the channel dimension, and the multi-target response distortion caused by the softmax function is corrected through a width / height compensation map to form an enhanced feature map, and the plant cue sample conditions are injected into the enhanced features;
[0041] Multi-scale dynamic counter: This counter performs local counting at the image patch level based on enhanced features. It comprises multiple counting heads, each corresponding to plant instances of different scales or image patches of different sizes. The receptive field (block_size) and output stride of each counting head are dynamically adjusted according to the scale information of the target plant. Each counting head processes enhanced features through average pooling and convolutional layers. Width / Height Compensation Map is used to correct multi-target response distortion caused by the softmax function. Redundant counting maps are regressed at the image patch level.
[0042] Normalizer: Used to normalize redundant count maps by employing an overlapping region weighted averaging strategy, eliminating contextual redundancy to obtain a more accurate local count map;
[0043] Visualizer: For attention-guided interpretability generation: The local count map and the attention match map are combined to generate an attention-guided cue map. The normalized local count map and the attention-guided cue map are fused and upsampled to generate a final high-resolution visualized count result map. The attention-guided cue map is used to indicate the possible location and quantity of plants, further improving the interpretability of the count results.
[0044] Compared with the prior art, the beneficial effects of this application are:
[0045] 1. The system of this application can adapt to the input of plant images of different types and different growth stages, supports a unified counting framework and output format, and has strong variety independence, accuracy and interpretability.
[0046] 2. This application automatically selects the corresponding branch for output based on the size of the plant cue sample during inference, which is suitable for counting tasks of plant targets at multiple scales.
[0047] 3. This application achieves a unified counting of different plant species without the need to retrain the model for specific plant species; and it can adapt to plant targets at different scales and growth stages, solving the challenges of non-rigid plant shape and high intraclass variability. Attached Figure Description
[0048] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0049] Figure 1 This is a flowchart of a plant counting method unrelated to the species described in this application.
[0050] Figure 2 This is a framework diagram of the variety-independent plant counting system provided in this application.
[0051] Figure 3 This is a flowchart of the encoder and single decoder provided in this application.
[0052] Figure 4 This is a diagram of the architecture of the multi-scale perceptible plant counting system provided in this application.
[0053] Figure 5 This is a flowchart of the attention mechanism provided in this application.
[0054] Figure 6 This is an original field photo of wheat provided in this application.
[0055] Figure 7 This is an original image of a nut provided in this application.
[0056] Figure 8 This is an original image of grapevines among the branches provided in this application.
[0057] Figure 9 This application provides for the Figure 6 A labeled wheat truth map.
[0058] Figure 10 This application provides for the Figure 7 A truth graph of nuts with annotations.
[0059] Figure 11 This application provides for the Figure 8 A labeled truth map of grapes.
[0060] Figure 12 Yes Figure 6 A graph showing wheat counting results obtained using a common local counting algorithm.
[0061] Figure 13 Yes Figure 6 A graph showing the wheat counting results obtained using the method described in this application.
[0062] Figure 14 Yes Figure 7 A graph showing the nut counting results obtained using the method described in this application.
[0063] Figure 15 Yes Figure 8 A graph showing the grape counting results obtained using the method described in this application.
[0064] Figure 16This application presents a structural block diagram of a variety-independent plant counting system. Detailed Implementation
[0065] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of this application, but not all embodiments.
[0066] like Figure 1 and Figure 2 As shown, a method for counting plant species unrelated to species includes:
[0067] S1: Image Patch Feature Extraction and Fusion: First, the image to be detected and the plant cue sample image are segmented into image patches of fixed size. Then, the encoder extracts features from the image patches of the image to be detected and the plant cue sample image to generate a master feature map. The similarity between the image patches of the image to be detected and the image patches of the plant cue sample image is dynamically calculated through a decoupled attention mechanism to generate a fused high-discrimination feature representation and an attention match map. Subsequently, the master feature map and the attention match map are concatenated along the channel dimension. The multi-target response distortion caused by the softmax function is corrected through a width / height compensation map to form an enhanced feature map. The plant cue sample conditions are then injected into the enhanced features.
[0068] The image to be detected is the image from which plant counting is required, and the plant cue sample image refers to a single plant image. The image to be detected and the plant cue sample image are divided into fixed block sizes, for example, each image is uniformly divided into... Small patches of pixels. Each image patch is transformed into a fixed-dimensional embedding vector through a linear mapping. This transformation process can be described as follows: ,in, For the preset projection matrix, For bias.
[0069] The encoder first reads the image to be detected ( ) and plant cue sample images ( ) respectively generated as and The token sequence is obtained by concatenating the token of the image to be detected with the token of the plant cue sample image into a unified sequence, which is then transformed linearly to generate the query (Q), key (K), and value (V). Under the multi-head self-attention mechanism, the formula is used:
[0070]
[0071] Calculate the attention weights, where Q, K, and V represent the query, key, and value vectors, respectively, and D is the feature dimension.
[0072] Then, the Vision Transformer (ViT) module in the encoder dynamically calculates the similarity between the image patch to be detected and the plant cue sample image patch through a self-attention mechanism, generating an attention matching map, specifically including:
[0073] The global contextual information between tokens in the images to be detected is modeled by a self-attention mechanism; and the tokens of plant cue sample images are injected into the images to be detected as prior information by a cross-attention mechanism, generating a fused high-discrimination feature representation and attention matching map.
[0074] like Figure 4 As shown ( Figures 2-5 The input image in the process is the image to be detected. This attention matching map is then passed to a multi-scale dynamic counter. Figure 4 The architecture connection between the feature fusion module and the multi-scale dynamic counter is shown in detail.
[0075] like Figure 5 As shown, firstly, a self-attention mechanism is used to model the global contextual information between the tokens in the images to be detected. Then, a decoupled attention mechanism is employed, treating the attention map calculated through self-attention as a simultaneously computed self-attention map and a cross-attention map: the self-attention part focuses on the internal dependencies between the tokens in the images to be detected, while the cross-attention part injects prior information from the tokens in the plant cue sample images into the images to be detected. By dynamically matching the feature similarity between the tokens in the images to be detected and the tokens in the plant cue sample images, fused features are generated. Specifically, the attention map is decoupled into four parts:
[0076]
[0077] in, This represents the self-attention mechanism within the image to be detected. This represents the cross-modal similarity between the image to be detected and the plant cue sample image. This indicates a reverse matching from the plant cue sample image to the image to be detected. This represents the self-attention within the plant cue sample image. In a specific implementation, after N layers of stacking, the output fused feature sequence contains both the global semantics of the image to be detected and the feature information of the plant cue sample image. These fused features are then passed to a multi-scale dynamic counter.
[0078] Optionally, the method further includes the following steps before step S1:
[0079] Preprocessing: The collected images to be detected and plant suggestion sample images are uniformly standardized, including image size normalization and image enhancement methods to improve image quality and reduce the impact of environmental factors.
[0080] The preprocessing stage first involves standardizing the acquired images to be detected and the plant suggestion sample images, such as... Figures 6-8 As shown, the images to be detected include wheat in a field, nuts, and grapes among tree branches. The system normalizes the image size and improves image quality through image enhancement methods to reduce the impact of environmental factors on the model. Specifically, the images to be detected are uniformly adjusted to [size missing]. pixels, while the plant cue sample image was adjusted to Pixels are used to ensure that all input data are consistent in size, brightness, and color. Then, an image normalization algorithm (e.g., normalizing pixel values to the [0,1] range) is used to eliminate differences under different lighting conditions.
[0081] S2: Dynamic Multi-Scale Token-Level Counting Regression: Based on enhanced features, a multi-scale dynamic counter is used to perform local counting at the token level. The multi-scale dynamic counter includes multiple counting heads, each corresponding to plant instances of different scales or image patches of different sizes. The receptive field (block_size) and stride (output_stride) of the counting head can be dynamically adjusted according to the scale information of the target plant. Each counting head is processed through average pooling layers and convolutional layers to enhance features; redundant counting maps are regressed at the image patch level.
[0082] Multi-scale dynamic counters are used to predict the local density of the fused feature map output by the encoder, such as... Figure 4 As shown. In a specific embodiment, the fused feature output by the encoder is of size [size missing]. The two-dimensional feature map is used. The token-level design uses image blocks as the smallest computational unit and optimizes contextual information fusion by constraining the block size to an integer multiple of the step size.
[0083] Optionally, step S2, which uses a multi-scale dynamic counter to perform local counting at the token level, specifically includes:
[0084] Based on the size information of the plant sample, an appropriate local counting branch is selected for density prediction; each local counting head corresponds to a different set of block sizes and output step sizes.
[0085] Optionally, in step S2, there are specifically three counting heads, each corresponding to an image block resolution of [size missing]. , and The three counting heads correspond to three counting branches, and the regression of the redundancy counting map at the image patch level specifically includes:
[0086] S2.1: Counting branch 1: Corresponding image patch resolution size is The counting head performs average pooling on the enhanced feature map to reduce spatial resolution, and extracts local features through a set of convolutional layers and normalized activation units to generate local counting maps of the corresponding scale.
[0087] S2.2: Counting branch 2: Corresponding image patch resolution size is The counting head performs average pooling on the enhanced feature map to reduce spatial resolution, and extracts local features through a set of convolutional layers and normalized activation units to obtain feature representations in the mid-scale range and output a local counting map.
[0088] S2.3: Counting branch 3: Corresponding image patch resolution size is The counting head performs average pooling on the enhanced feature map to reduce spatial resolution, and extracts local features through a set of convolutional layers and normalized activation units to adapt to the feature extraction needs of larger-scale target instances, and outputs the corresponding counting map.
[0089] S2.4: Dynamic routing: Based on the original width and height of the target instance in the plant cue sample image, calculate the interval to which its scale belongs, and use a gating mechanism to select the output result of the branch corresponding to the interval to which the scale belongs from the three counting branches.
[0090] Specifically, the image block resolution size of counting branch 1 is Suitable for seedlings or small crops, such as wheat and cotton; the image patch resolution size of counting branch 2 is [missing information]. Suitable for medium-scale plants, such as nut-bearing targets; the image patch size for counting branch 3 is [missing information]. This method is suitable for mature plants or those with densely packed ears of fruit, such as grapes or corn ears. In each branch, the input fused feature map is first subjected to a 3×3 average pooling operation with a stride of 16, used to... The feature maps are compressed into local block features with lower spatial resolution, which also serves to aggregate local information. Then, the pooled features are fed into a standard 3×3 convolutional layer to perform feature extraction and density regression within the local region, outputting a local count map for the current branch. Finally, each branch outputs a... Local density map of spatial size. The three local counting branches mentioned above perform forward inference simultaneously, but the system only uses the output of one branch as the final result. The system will use the original width and height information of the target in the plant cue sample image (via...) (Calculated to determine the actual perceived size of the target instance)
[0091] Optionally, the dynamic routing process can be formally represented as:
[0092]
[0093] in, Indicates the encoder backbone network. Parameters representing different counting heads, Indicates the size of the target. Indicates a preset size range. This is a hard switching function. This indicates different counting heads.
[0094] During the training phase, the system calculates the target scale and the size of each preset block ( , , The system uses the Euclidean distance between the three branches to select the branch with the smallest distance as the training sample, which participates in forward propagation and backward update. During the testing phase, the system directly selects the branch with the closest target size from the three branches according to a rule, known as the "hard routing" strategy. This formula implements a dynamic counter selection mechanism based on target size priority. The final output local count map comes from the selected branch, representing the local density estimate of the plant region at the current scale. This map is then fed into the normalization module, where it is combined with the attention matching map for further processing to generate a normalized density map at a uniform resolution.
[0095] S3: Normalization: The redundant count map is normalized by using the overlapping region weighted average strategy to eliminate contextual redundancy and obtain a more accurate local count map.
[0096] The normalization module processes the redundant count map output by the dynamic multi-scale local counting module. First, adaptive Gaussian smoothing is used to smooth the redundant count map. Then, a weighted average is calculated for the local count values within each overlapping region. After smoothing, the weighted average of the local count values within each overlapping region, and this normalization process, results in a standardized local count map that accurately reflects the true plant quantity in each region.
[0097] S4: Interpretability generation of attention-guided data: The local counting map and the attention match map are combined to generate an attention-guided cue map. The normalized local counting map and the attention-guided cue map are fused and upsampled to generate a final high-resolution visualized counting result map. The attention-guided cue map is used to indicate the possible location and quantity of plants, further improving the interpretability of the counting results.
[0098] Optionally, the final high-resolution visualized counting result map is usually displayed in two forms: one is a density map, which visually shows the density of plant distribution through color gradients; the other is a detection mask, which visually shows the position of each counting target by marking the center position or boundary of the target instance.
[0099] Optionally, step S4, which involves fusing and upsampling the normalized local counting map with the attention-guided cue map to generate the final high-resolution visualized counting result map, specifically includes:
[0100] S4.1: Perform bilinear interpolation on the local counting map to match its resolution with the attention. Figure One To;
[0101] Bilinear interpolation is used to upsample the normalized count map to the same resolution as the cross-attention map output by the encoder, thereby providing data of uniform size for the next module.
[0102] S4.2: Based on predicted counts Plant-related sample size compensation factor ( ), where Provide the length and width of the plant sample image token. Calculate the number of key regions based on the original length and width of the plant cue sample image. ( );
[0103] S4.3: Select the top two lines with the highest similarity from the attention matching graph. Generate a binary mask from a number of image patches;
[0104] S4.4: Perform a Hadamard product operation between the binary mask and the local counting map to generate a corrected counting map or detection mask, thereby providing an understandable counting result.
[0105] The mask calculation is based on predictive counts and plant cue sample scale compensation factors to determine key areas, achieving a dual interpretation of instance location and density distribution.
[0106] The attention-guided cue map generation step further enhances the normalized count map using cross-attention information output by the encoder.
[0107] like Figure 5 As shown, the cross-attention matching map is extracted from the decoupled attention mechanism and identifies regions of high similarity between the image patch to be detected and the plant cue sample image patch.
[0108] First, regions with high responses are extracted from the cross-attention matching map, and the similarity of each region is calculated. The model then naturally selects the regions with the highest responses based on their similarity. A binary dynamic mask is generated from a number of image patches. Here... The value can be obtained through the current prediction count. With scale compensation factor The product is determined, that is The generated binary mask directly identifies the possible locations of the plant targets. Subsequently, this mask is multiplied element-wise with the upsampled normalized count map to obtain the output cue map H, whose expression is: Here, U(R) represents the upsampled count map. This cue map visually represents densely planted areas using color gradients and also marks the center or boundary of target instances in detection mode. The output of the cue map serves as the input for the next module, scale-aware optimization. Figure 13 As shown, for Figure 6 The original field map of wheat, generated using the method described in this application, clearly marks the locations of wheat instances; such as... Figure 14 As shown, for Figure 7 The counting results from the original nut plot show the nut distribution; as shown in the image. Figure 15 As shown, for Figure 8 The counting results of the original grape map highlight the dense areas of grape instances.
[0109] The visualization stage in this step fuses and upsamples the normalized local counting map with the attention-guided cue map to generate the final high-resolution counting result map. The training labels are derived from the ground truth annotations of the PAC-105 dataset, such as... Figure 9 As shown, for Figure 6 True value plot of wheat with original field chart annotations; such as Figure 10 As shown, for Figure 7 The truth graph of the nut tree with the original icon annotation; such as Figure 11 As shown, for Figure 8 The original image of grapes is used as the ground truth map. An upsampling operator is employed to restore the low-resolution counting map to the same size as the original image. The output is typically displayed in two forms: a density map, which visually represents the density of plant distribution through color gradients; and a detection mask, which visually displays the location of each counted target by marking the center or boundary of the target instance. Figure 12 As shown, for Figure 6 The original wheat field map obtained using a common local counting algorithm is coarse and makes it difficult to distinguish instance locations; while... Figure 13 As shown, the counting result map generated using the method of this application clearly marks the locations of wheat instances. Similarly, as... Figure 14 and Figure 15 The system displays separate images showing the counting results for nuts and grapes, highlighting the fine detail of the target distribution. The visualization module ultimately outputs the fused high-resolution image for users to directly observe and further analyze.
[0110] Optionally, the method may also include the following steps before step S4:
[0111] Based on the bounding boxes of target instances in the plant cue sample images, their width and height information are extracted, and a scale embedding vector is constructed. The scale embedding vector is then expanded in dimension to the spatial dimension of the feature map of the image to be detected through a broadcast mechanism, and concatenated with the image patch features of the image to be detected in the channel dimension to provide scale prior information. Then, the concatenated features are fed into the multi-head decoupled attention module in the visual converter structure to guide the attention distribution while maintaining the spatial structure.
[0112] This step performs scale-aware optimization to compensate for scale distortion caused by fixed token partitioning. The original size information of the target plant is extracted from the plant cue sample image, generating width compensation maps and height compensation maps respectively. These are then broadcast-summed to form a scale embedding vector. This vector is concatenated with the original features of the tokens in the image to be detected and input into the decoupled attention layer to correct scale distortion. Specifically, firstly, the original size information of the target plant (e.g., ...) is extracted from the plant cue sample image. Width compensation maps and height compensation maps are generated separately, and then summed via broadcasting to form a scale embedding vector S. S is concatenated with the original features F of the token in the image to be detected to obtain the enhanced features. This concatenation operation allows the subsequent decoupled attention layer to fine-tune the features using additional size information, automatically favoring larger counting branches when the target size is large and smaller counting branches when the target has rich details. The scale-aware optimized enhanced features are then passed as input to the final visualization module.
[0113] Specifically, in this application, the parameter is set to image resolution. Plant-related sample image resolution Image patch size scaling factor Number of visual converter modules The scope of protection of this application is not limited to the specific parameter values listed in the embodiments. Although specific parameter settings were used in the experiments to verify the feasibility and effectiveness of the invention, the scope of protection of this application should cover all other parameter settings that can achieve the same or similar functions. Specifically, the parameter range involved in this application should not be understood only as the specific values used in the experiments, but should include all technically feasible parameter combinations that can achieve the purpose of the invention.
[0114] This application extracts the original width and height of the target instance when encoding plant cue sample images, generates a scale embedding vector, expands it through a broadcast mechanism, and concatenates it with the image patch features of the main image. During the converter encoding process, scale prior information is introduced to guide attention to the region that matches the target size.
[0115] like Figure 16 As shown, a variety-independent plant counting system includes an encoder 110, a multi-scale dynamic counter 120, a normalizer 130, and a visualizer 140.
[0116] Encoder 110: Used for image patch feature extraction and fusion: First, the image to be detected and the plant cue sample image are segmented into image patches of fixed size; then, the encoder extracts features from the image patches of the image to be detected and the plant cue sample image to generate a master feature map, and dynamically calculates the similarity between the image patches of the image to be detected and the image patches of the plant cue sample image through a decoupled attention mechanism to generate a fused high-discrimination feature representation and an attention match map; then, the master feature map and the attention match map are concatenated in the channel dimension to form an enhanced feature map, and the plant cue sample conditions are injected into the enhanced feature map;
[0117] The image to be detected is the image for which plant counting is required, and the plant cue sample image refers to a single plant image. The image to be detected and the plant cue sample image are divided into fixed block sizes, for example, each image is uniformly divided into 16×16 pixel blocks. Each image patch is linearly mapped to a fixed-dimensional embedding vector; the transformation process can be described as follows: ,in, For the preset projection matrix, For bias.
[0118] Encoder 110 first reads the image to be detected ( ) and plant cue sample images ( ) respectively generated as and The token sequence is obtained by concatenating the token of the image to be detected with the token of the plant cue sample image into a unified sequence, which is then transformed linearly to generate the query (Q), key (K), and value (V). Under the multi-head self-attention mechanism, the formula is used:
[0119]
[0120] Calculate the attention weights, where Q, K, and V represent the query, key, and value vectors, respectively, and D is the feature dimension.
[0121] Then, the visual converter module in the encoder dynamically calculates the similarity between the image patch to be detected and the plant cue sample image patch through a self-attention mechanism, generating an attention matching map, specifically including:
[0122] The self-attention mechanism models the global contextual information between tokens in the images to be detected; and the plant cue sample image tokens are injected into the images to be detected as prior information through the cross-attention mechanism, generating a fused high-discrimination feature representation and attention matching map.
[0123] like Figure 4 As shown, the attention matching map is then passed to a multi-scale dynamic counter. Figure 4 The architecture connection between the feature fusion module and the multi-scale dynamic counter is shown in detail.
[0124] like Figure 5 As shown, firstly, a self-attention mechanism is used to model the global contextual information between the tokens in the images to be detected. Then, a decoupled attention mechanism is employed, treating the attention map calculated through self-attention as a simultaneously computed self-attention map and a cross-attention map: the self-attention part focuses on the internal dependencies between the tokens in the images to be detected, while the cross-attention part injects prior information from the tokens in the plant cue sample images into the images to be detected. By dynamically matching the feature similarity between the tokens in the images to be detected and the tokens in the plant cue sample images, fused features are generated. Specifically, the attention map is decoupled into four parts:
[0125]
[0126] in, This represents the self-attention mechanism within the image to be detected. This represents the cross-modal similarity between the image to be detected and the plant cue sample image. This indicates a reverse matching from the plant cue sample image to the image to be detected. This represents the self-attention within the plant cue sample image. In a specific implementation, after N layers of stacking, the output fused feature sequence contains both the global semantics of the image to be detected and the feature information of the plant target image. These fused features are then passed to a multi-scale dynamic counter.
[0127] Multi-scale dynamic counter 120: Used for local counting at the image patch level based on enhanced features. The multi-scale dynamic counter includes multiple counting heads, each corresponding to plant instances of different scales or image patches of different sizes. The receptive field (block_size) and stride (output_stride) of the counting head can be dynamically adjusted according to the scale information of the target plant. Each counting head processes enhanced features through average pooling layers and convolutional layers; the multi-target response distortion caused by the softmax function is corrected through a width / height compensation map; and redundant counting maps are regressed at the image patch level.
[0128] The multi-scale dynamic counter 120 is used to perform local density prediction on the fused feature map output by the encoder, such as... Figure 4 As shown. In a specific embodiment, the fused feature output by the encoder is of size [size missing]. Two-dimensional feature map.
[0129] Optionally, the step of using a multi-scale dynamic counter to perform local counting at the token level specifically includes:
[0130] Based on the size information of the plant sample, an appropriate local counting branch is selected for density prediction; each local counting head corresponds to a different set of block sizes and output step sizes.
[0131] Optionally, the plurality of counting heads specifically comprises three, each corresponding to an image patch with a resolution size of [missing information]. , and The three counting heads correspond to three counting branches, and the regression of the redundancy counting map at the image patch level specifically includes:
[0132] S2.1: Counting branch 1: Corresponding image patch resolution size is The counting head performs average pooling on the enhanced feature map to reduce spatial resolution, and extracts local features through a set of convolutional layers and normalized activation units to generate local counting maps of the corresponding scale.
[0133] S2.2: Counting branch 2: Corresponding image patch resolution size is The counting head performs average pooling on the enhanced feature map to reduce spatial resolution, and extracts local features through a set of convolutional layers and normalized activation units to obtain feature representations in the mid-scale range and output a local counting map.
[0134] S2.3: Counting branch 3: Corresponding image patch resolution size is The counting head performs average pooling on the enhanced feature map to reduce spatial resolution, and extracts local features through a set of convolutional layers and normalized activation units to adapt to the feature extraction needs of larger-scale target instances, and outputs the corresponding counting map.
[0135] S2.4: Dynamic routing: Based on the original width and height of the target instance in the plant cue sample image, calculate the interval to which its scale belongs, and use a gating mechanism to select the output result of the branch corresponding to the interval to which the scale belongs from the three counting branches.
[0136] Specifically, the image block resolution size of counting branch 1 is Suitable for seedlings or small crops, such as wheat and cotton; the image patch resolution size of counting branch 2 is [missing information]. Suitable for medium-scale plants, such as nut-bearing targets; the image patch size for counting branch 3 is [missing information]. This method is suitable for mature plants or those with densely packed ears of fruit, such as grapes or corn ears. In each branch, the input fused feature map is first subjected to a 3×3 average pooling operation with a stride of 16, used to... The feature maps are compressed into local block features with lower spatial resolution, which also serves to aggregate local information. Then, the pooled features are fed into a standard 3×3 convolutional layer to perform feature extraction and density regression within the local region, outputting a local count map for the current branch. Finally, each branch outputs a... Local density map of spatial size. The three local counting branches mentioned above perform forward inference simultaneously, but the system only uses the output of one branch as the final result. The system will use the original width and height information of the target in the plant cue sample image (via...) (Calculated to determine the actual perceived size of the target instance)
[0137] Optionally, the dynamic routing process can be formally represented as:
[0138]
[0139] in, Indicates the encoder backbone network. Parameters representing different counting heads, Indicates the size of the target. Indicates a preset size range. This is a hard switching function. This indicates different counting heads.
[0140] During the training phase, the system calculates the target scale and the size of each preset block ( , , The system uses the Euclidean distance between the three branches to select the branch with the smallest distance as the training sample, which participates in forward propagation and backward update. During the testing phase, the system directly selects the branch with the closest target size from the three branches according to a rule, known as the "hard routing" strategy. This formula implements a dynamic counter selection mechanism based on target size priority. The final output local count map comes from the selected branch, representing the local density estimate of the plant region at the current scale. This map is then fed into the normalization module, where it is combined with the attention matching map for further processing to generate a normalized density map at a uniform resolution.
[0141] Normalizer 130: Used to normalize the redundant count map by employing an overlapping region weighted average strategy, eliminating contextual redundancy to obtain a more accurate local count map;
[0142] Normalizer 130 processes the redundant count map output by the dynamic multi-scale local counting module. First, it uses adaptive Gaussian smoothing to smooth the redundant count map. Then, it performs a weighted average of the local count values within each overlapping region. After smoothing, the weighted average of the local count values within each overlapping region, and this normalization process, results in a standardized local count map that accurately reflects the true plant quantity in each region.
[0143] Visualizer 140: For attention-guided interpretability generation: The local count map and the attention match map are combined to generate an attention-guided cue map. The normalized local count map and the attention-guided cue map are fused and upsampled to generate a final high-resolution visualized count result map. The attention-guided cue map is used to indicate the possible location and quantity of plants, further improving the interpretability of the count results.
[0144] Optionally, the final high-resolution visualized counting result map is usually displayed in two forms: one is a density map, which visually shows the density of plant distribution through color gradients; the other is a detection mask, which visually shows the position of each counting target by marking the center position or boundary of the target instance.
[0145] Optionally, the step of fusing and upsampling the normalized local counting map with the attention-guided cue map to generate the final high-resolution visualized counting result map specifically includes:
[0146] S4.1: Perform bilinear interpolation on the local counting map to match its resolution with the attention. Figure One To;
[0147] Bilinear interpolation is used to upsample the normalized count map to the same resolution as the cross-attention map output by the encoder, thereby providing data of uniform size for the next module.
[0148] S4.2: Based on predicted counts Plant-related sample size compensation factor ( ), where Provide the length and width of the plant sample image token. Calculate the number of key regions based on the original length and width of the plant cue sample image. ( );
[0149] S4.3: Select the top two lines with the highest similarity from the attention matching graph. Generate a binary mask from a number of image patches;
[0150] S4.4: Perform a Hadamard product operation between the binary mask and the local counting map to generate a density map or detection mask, thereby providing understandable counting results.
[0151] The mask calculation is based on predictive counts and plant cue sample scale compensation factors to determine key areas, achieving a dual interpretation of instance location and density distribution.
[0152] The attention-guided cue map generation step further enhances the normalized count map using cross-attention information output by the encoder.
[0153] like Figure 5 As shown, the cross-attention matching map is extracted from the decoupled attention mechanism and identifies regions of high similarity between the image patch to be detected and the plant cue sample image patch.
[0154] First, regions with high responses are extracted from the cross-attention matching map, and the similarity of each region is calculated. The model then naturally selects the regions with the highest responses based on their similarity. A binary dynamic mask is generated from a number of image patches. Here... The value can be obtained through the current prediction count. With scale compensation factor The product is determined, that is The generated binary mask directly identifies the possible locations of the plant targets. Subsequently, this mask is multiplied element-wise with the upsampled normalized count map to obtain the output cue map H, whose expression is: Here, U(R) represents the upsampled count map. This cue map visually represents densely planted areas using color gradients and also marks the center or boundary of target instances in detection mode. The output of the cue map serves as the input for the next module, scale-aware optimization. Figure 13 As shown, for Figure 6 The original field map of wheat, generated using the method described in this application, clearly marks the locations of wheat instances; such as... Figure 14 As shown, forFigure 7 The counting results from the original nut plot show the nut distribution; as shown in the image. Figure 15 As shown, for Figure 8 The counting results of the original grape map highlight the dense areas of grape instances.
[0155] Visualizer 140 fuses and upsamples the normalized local counting map with the attention-guided cue map to generate the final high-resolution counting result map. The training labels are derived from the ground truth annotations of the PAC-105 dataset, such as... Figure 9 As shown, for Figure 6 True value plot of wheat with original field chart annotations; such as Figure 10 As shown, for Figure 7 The truth graph of the nut tree with the original icon annotation; such as Figure 11 As shown, for Figure 8 The original image of grapes is used as the ground truth map. An upsampling operator is employed to restore the low-resolution counting map to the same size as the original image. The output is typically displayed in two forms: a density map, which visually represents the density of plant distribution through color gradients; and a detection mask, which visually displays the location of each counted target by marking the center or boundary of the target instance. Figure 12 As shown, for Figure 6 The original wheat field map obtained using a common local counting algorithm is coarse and makes it difficult to distinguish instance locations; while... Figure 13 As shown, the counting result map generated using the method of this application clearly marks the locations of wheat instances. Similarly, as... Figure 14 and Figure 15 The system displays separate images showing the counting results for nuts and grapes, highlighting the fine detail of the target distribution. The visualization module ultimately outputs the fused high-resolution image for users to directly observe and further analyze.
[0156] The system proposed in this application can adapt to the input of plant images of different types and growth stages, supports a unified counting framework and output format, and has strong variety independence, accuracy and interpretability.
[0157] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for counting plant species unrelated to their variety, characterized in that, include: S1: Image Patch Feature Extraction and Fusion: First, the image to be detected and the plant cue sample image are segmented into image patches of fixed size. Then, the encoder extracts features from the image patches of the image to be detected and the plant cue sample image to generate a master feature map. The similarity between the image patches of the image to be detected and the image patches of the plant cue sample image is dynamically calculated through a decoupled attention mechanism to generate a fused high-discrimination feature representation and attention matching map. Subsequently, the master feature map and the attention matching map are concatenated in the channel dimension. The multi-target response distortion caused by the softmax function is corrected through amplitude compensation mapping to form an enhanced feature map. The plant cue sample conditions are injected into the enhanced features. S2: Dynamic Multi-Scale Image Patch-Level Counting Regression: Based on enhanced features, a multi-scale dynamic counter is used to perform local counting at the image patch level. The multi-scale dynamic counter includes multiple counting heads, each corresponding to plant instances of different scales or image patches of different sizes. The receptive field and stride of the counting head can be dynamically adjusted according to the scale information of the target plant. Each counting head is processed with enhanced features through average pooling layers and convolutional layers; redundant counting maps are regressed at the image patch level. S3: Normalization: The redundant count map is normalized by using a weighted average strategy for overlapping regions to eliminate contextual redundancy and obtain a more accurate local count map. S4: Attention-guided interpretability generation: The local counting map and the attention matching map are combined to generate an attention-guided cue map. The normalized local counting map and the attention-guided cue map are fused and upsampled to generate a final high-resolution visualized counting result map. The attention-guided cue map is used to indicate the possible location and quantity of plants, further improving the interpretability of the counting results.
2. The method for counting plant species unrelated to species as described in claim 1, characterized in that, The method further includes the following steps before step S1: Preprocessing: The collected images to be detected and plant suggestion sample images are uniformly standardized, including image size normalization and image enhancement methods to improve image quality and reduce the impact of environmental factors.
3. A method for counting plant species unrelated to species as described in claim 1 or 2, characterized in that, In step S1, the similarity between image patches of the image to be detected and image patches of the plant cue sample image is dynamically calculated by decoupling the attention mechanism, and the fused high-discrimination feature representation and attention matching map are generated. Specifically, this includes: The decoupled attention mechanism models the global contextual information between tokens in the images to be detected through self-attention; and injects tokens from plant cue sample images as prior information into the images to be detected through cross-attention, generating a fused high-discrimination feature representation and attention matching map.
4. The method for counting plant species unrelated to species as described in claim 3, characterized in that, The attention matching graph is decoupled into four parts: in, This represents the self-attention mechanism within the image to be detected. This represents the cross-modal similarity between the image to be detected and the plant cue sample image. This indicates a reverse matching from the plant cue sample image to the image to be detected. This indicates self-attention within the plant cue sample image.
5. The method for counting plant species unrelated to species as described in claim 4, characterized in that, The step S2, which employs a multi-scale dynamic counter for local counting at the token level, specifically includes: Based on the size information of the plant sample, an appropriate local counting branch is selected for density prediction; each local counting head corresponds to a different set of block sizes and output step sizes.
6. The method for counting plant species unrelated to species as described in claim 5, characterized in that, In step S2, there are specifically three counting heads, each corresponding to an image block resolution size of [missing information]. , and In the formula These are the height and width of the input image patch, respectively. The resolution scaling factor for the counting heads is used, and the three counting heads correspond to three counting branches respectively. The step of regressing the redundant counting map at the image patch level specifically includes: S2.1: Counting branch 1: Corresponding image patch resolution size is The counting head performs average pooling on the enhanced feature map to reduce spatial resolution, and extracts local features through a set of convolutional layers and normalized activation units to generate local counting maps of the corresponding scale. S2.2: Counting branch 2: Corresponding image patch resolution size is The counting head performs average pooling on the enhanced feature map to reduce spatial resolution, and extracts local features through a set of convolutional layers and normalized activation units to obtain feature representations in the mid-scale range and output a local counting map. S2.3: Counting branch 3: Corresponding image patch resolution size is The counting head performs average pooling on the enhanced feature map to reduce spatial resolution, and extracts local features through a set of convolutional layers and normalized activation units to adapt to the feature extraction needs of larger-scale target instances, and outputs the corresponding counting map. S2.4: Dynamic routing: Based on the original width and height of the target instance in the plant cue sample image, calculate the interval to which its scale belongs, and use a routing mechanism to select the output result of the branch corresponding to the interval to which the scale belongs from the three counting branches.
7. The method for counting plant species unrelated to species as described in claim 6, characterized in that, The dynamic routing process can be formally represented as: in, Indicates the encoder backbone network. Parameters representing different counting heads, Indicates the size of the target. Indicates a preset size range. This is a hard switching function. This indicates different counting heads.
8. The method for counting plant species unrelated to species as described in claim 7, characterized in that, The steps preceding step S4 also include: Based on the bounding boxes of target instances in the plant cue sample images, their width and height information are extracted, and a scale embedding vector is constructed. The scale embedding vector is then dimensionally expanded by broadcasting to the spatial dimension of the feature map of the image to be detected, and concatenated with the image patch features of the image to be detected in the channel dimension to provide scale prior information. Then, the concatenated features are fed into the multi-head decoupled attention module in the visual converter structure to guide the attention distribution while maintaining the spatial structure.
9. The method for counting plant species unrelated to species as described in claim 8, characterized in that, Step S4, which involves fusing and upsampling the normalized local counting map with the attention-guided cue map to generate the final high-resolution visualized counting result map, specifically includes: S4.1: Perform bilinear interpolation on the local counting map to make its resolution consistent with the attention matching map; S4.2: Based on predicted counts Plant-related sample size compensation factor In the formula Provide the length and width of the plant sample image token. Calculate the number of key regions based on the original length and width of the plant cue sample image. ; S4.3: Select the top two lines with the highest similarity from the attention matching graph. Generate a binary mask from a number of image patches; S4.4: Perform a Hadamard product operation between the binary mask and the local counting map to generate a density map or detection mask, thereby providing understandable counting results; The final high-resolution visualization of the counting results is typically presented in two forms: one is a density map, which visually displays the density of plant distribution through color gradients; the other is a detection mask, which visually displays the location of each counting target by marking the center or boundary of the target instance.
10. A variety-independent plant counting system, characterized in that, Includes encoders, multi-scale dynamic counters, normalizers, and visualizers; Encoder: Used for image patch feature extraction and fusion: First, the image to be detected and the plant cue sample image are segmented into image patches of fixed size; then, the encoder extracts features from the image patches of the image to be detected and the plant cue sample image to generate a master feature map, and dynamically calculates the similarity between the image patches of the image to be detected and the image patches of the plant cue sample image through a decoupled attention mechanism to generate a fused high-discrimination feature representation and attention matching map. Subsequently, the master feature map and the attention matching map are concatenated in the channel dimension, and the multi-target response distortion caused by the softmax function is corrected through amplitude compensation mapping to form an enhanced feature map, and the plant cue sample conditions are injected into the enhanced features; Multi-scale dynamic counter: Used for local counting at the image patch level based on enhanced features. The multi-scale dynamic counter includes multiple counting heads, each corresponding to plant instances of different scales or image patches of different sizes. The receptive field and stride of the counting head can be dynamically adjusted according to the scale information of the target plant. Each counting head is processed through average pooling layer and convolutional layer to enhance features. Multi-target response distortion caused by the softmax function is corrected by amplitude compensation mapping; redundancy count map is regressed at the image patch level. Normalizer: Used to normalize redundant count maps by employing an overlapping region weighted averaging strategy, eliminating contextual redundancy to obtain a more accurate local count map; Visualizer: For attention-guided interpretability generation: The local count map and the attention matching map are combined to generate an attention-guided cue map. The normalized local count map and the attention-guided cue map are fused and upsampled to generate a final high-resolution visualized count result map. The attention-guided cue map is used to indicate the possible location and quantity of plants, further improving the interpretability of the count results.
Citation Information
Patent Citations
An interpretable plant counting method and system
CN112037294A
Crop seedling stage plant counting method based on improved multi-column convolutional neural network
CN115424257A