A fruit counting method based on guided perception and sharpening
By employing a guided perception and sharpening fruit counting method, and utilizing a progressive spatial aggregation encoder and an adaptive similarity perception module to generate a high-precision density map, the accuracy and robustness issues in counting small and dense fruits are resolved, achieving efficient fruit counting in complex environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ANHUI UNIV
- Filing Date
- 2025-09-28
- Publication Date
- 2026-04-24
AI Technical Summary
Existing technologies suffer from low accuracy and poor robustness in fruit counting, especially in small and densely packed fruit scenarios where they struggle to effectively cope with complex background interference and diverse fruit shapes, leading to large counting errors.
A fruit counting method based on guidance perception and sharpening is adopted. Multi-level features are extracted by progressive spatial aggregation encoder, and combined with adaptive similarity perception module and interleaved channel reconstruction decoder to generate high-precision fruit density map.
It improves the accuracy and robustness of fruit counting, effectively handles fruit counting tasks in complex natural orchard environments, and enhances the reliability of yield assessment and resource management.
Smart Images

Figure CN121236751B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a fruit counting method based on guidance perception and sharpening. Background Technology
[0002] With the development of agricultural modernization, fruit counting plays an important role in yield assessment, resource management, and precision agriculture. However, traditional methods such as random sampling and manual measurement are not only labor-intensive, inefficient, and inaccurate, but also difficult to adapt to the management needs of large-scale orchards.
[0003] In recent years, computer vision technology has provided new solutions for fruit counting. Object detection methods count by identifying individual fruits and generating bounding boxes, but their ability to handle densely packed fruit scenes is limited, and they are prone to missed detections or duplicate counts due to overlap and occlusion. Density map methods count by generating density maps of fruit distribution, which can alleviate some overlap problems. However, their uniform smoothing strategy is difficult to effectively handle complex background interference, fruit morphological diversity, and fruit adhesion when dealing with small and densely packed fruits (such as cherries), often leading to blurred fruit boundaries, loss of regional information, and local counting bias.
[0004] Furthermore, natural orchard environments present numerous uncertainties, including significant variations in light intensity, dense interlacing of branches and leaves, and differences in proportions due to varying shooting angles. These factors further complicate fruit counting. Therefore, there is an urgent need for a fruit counting method that can improve the accuracy and robustness of counting in complex natural orchard environments, providing reliable support for yield assessment and resource management. Summary of the Invention
[0005] In view of the above-mentioned deficiencies of the prior art, the present invention provides a fruit counting method based on guidance perception and sharpening to solve the technical problem of low counting accuracy for small and dense fruits in the prior art.
[0006] To achieve the above and other related objectives, this invention provides a fruit counting method based on guidance perception and sharpening, comprising: acquiring a first image to be processed, and randomly selecting several fruits in the first image; using a progressive spatial aggregation encoder in a trained fruit guidance perception and sharpening network to perform multi-level feature extraction on the first image to obtain overall features and detail features; extracting features of the selected region from the overall features and performing average processing to obtain example features; using an adaptive similarity perception module in the fruit guidance perception and sharpening network to process the overall features and the example features to obtain a similarity map; multiplying the detail features with the similarity map and inputting the result into an interleaved channel reconstruction decoder in the fruit guidance perception and sharpening network to generate a density map; and obtaining the number of fruits in the first image based on the density map.
[0007] In one embodiment of the present invention, the progressive spatial convergence encoder can be expressed by the following formula:
[0008] X6=H CSFF (H FAC (Conv(X in ))),
[0009] F0=Conv 3×3 (X6),
[0010] F1=Conv 3×3 (X6),
[0011] In the formula, X in For the first image, Conv is the convolution operation, and H... FAC For foreground-aware convolutional blocks, H CSFF X6 is the output feature of the cross-stage feature fusion unit, and F0 and F1 are the overall feature and the detailed feature, respectively.
[0012] In one embodiment of the present invention, the processing steps of the foreground-aware convolutional block are as follows: performing continuous convolution operations on the input features of the foreground-aware convolutional block to obtain a region-aware offset, so as to capture spatial context information on the feature map; obtaining a vector P based on the average height and average width of the selected region; mapping the vector P to a high-dimensional feature space using a multilayer perceptron, and performing reshaping and tensor copy expansion operations to obtain a size-aware offset; obtaining a dynamic offset based on the region-aware offset and the size-aware offset; calculating the output features of the foreground-aware convolutional block based on the dynamic offset, wherein the feature value y(p) of the output features of the foreground-aware convolutional block at position p is calculated by the following formula:
[0013] ,
[0014] In the formula, w(j) is the weight of the convolution kernel at position j, R is the coverage area of the convolution kernel, and x(p+j+S) is the weight of the kernel at position j. a ) represents the value sampled from the input feature map after applying the offset.
[0015] In one embodiment of the present invention, the cross-stage feature fusion unit can be expressed by the following formula:
[0016] X1=H FAC (PoolConv1Block(X0)),
[0017] X2 = X1 + H down (X0),
[0018] X3=H FAC (PoolConv3Block(X2)),
[0019] X4 = X3 + H down (X2),
[0020] X5=H FAC (PoolConv3Block(X4)),
[0021] X6 = X5 + H down (X4),
[0022] In the formula, X0 represents the input feature of the cross-stage feature fusion unit, PoolConv1Block and PoolConv3Block are the first-order pooling convolutional block and the third-order pooling convolutional block, respectively, and H... down X1~X5 are the intermediate features, which are the downsampling functions.
[0023] In one embodiment of the present invention, the first-order pooling convolutional block is formed by cascading a max pooling layer and a convolutional layer, and the third-order pooling convolutional block is formed by cascading a max pooling layer and three convolutional layers.
[0024] In one embodiment of the present invention, the processing steps of the adaptive similarity perception module are as follows: dividing the overall features and the example features into multiple groups along the channel dimension; performing a convolution operation on each group of overall features to generate shift parameters; performing a convolution operation on each group of overall features and combining it with the Softmax function to generate weight factors; and generating similarity maps for each group using the following formula:
[0025] ,
[0026] In the formula, Let be the similarity value of position (i,j) in the g-th group. and These are the example features and the overall features of the g-th group, respectively. The weighting factor is... and The displacement parameter is used; the adaptive similarity maps of each group are merged along dimension g to obtain the similarity map.
[0027] In one embodiment of the present invention, the interleaved channel reconstruction decoder includes cascaded components: two 3×3 convolutional layers, three interleaved rearrangement models, one 3×3 convolutional layer, and one ReLU activation function.
[0028] In one embodiment of the present invention, the expression of the staggered rearrangement model is as follows:
[0029] ,
[0030] ,
[0031] In the formula, The input features of the interleaving rearrangement model are... This refers to the output features of the staggered rearrangement model.
[0032] The beneficial effects of this invention are as follows: This invention proposes a fruit counting method based on guided perception and sharpening. This method uses a progressive spatial aggregation encoder to focus on the fruit region by enhancing spatial perception; the adaptive similarity perception module uses morphologically guided adaptation to perform robust fruit phenotypic recognition; and the interleaved channel reconstruction decoder improves the clarity of fruit distribution through cross-arrangement technology, ultimately achieving high-precision counting. Attached Figure Description
[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. The accompanying drawings are incorporated in and constitute a part of this specification, illustrating embodiments consistent with this application, and are used together with the description to explain the principles of this application. Obviously, the drawings described below are merely some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings without creative effort.
[0034] Figure 1 A flowchart of a fruit counting method provided in an embodiment of the present invention;
[0035] Figure 2 This is an architecture diagram of a fruit-guided perception and sharpening network provided in an embodiment of the present invention;
[0036] Figure 3 This is an architectural diagram of a progressive spatial aggregation encoder provided in an embodiment of the present invention;
[0037] Figure 4 A flowchart illustrating the processing of a foreground-aware convolutional block according to an embodiment of the present invention;
[0038] Figure 5 This is an architectural diagram of a foreground-aware convolutional block provided in an embodiment of the present invention;
[0039] Figure 6 This is an architectural diagram of a cross-stage feature fusion unit provided in an embodiment of the present invention;
[0040] Figure 7 This is an architecture diagram of a first-order pooling convolutional block provided in an embodiment of the present invention;
[0041] Figure 8 This is an architectural diagram of a third-order pooling convolutional block provided in an embodiment of the present invention;
[0042] Figure 9 This is a flowchart of the adaptive similarity perception module provided in an embodiment of the present invention;
[0043] Figure 10 This is an architecture diagram of an adaptive similarity perception module provided in an embodiment of the present invention;
[0044] Figure 11 This is an architecture diagram of an interleaved channel reconstruction decoder provided in an embodiment of the present invention;
[0045] Figure 12 This is an architectural diagram of an alternating rearrangement model provided in an embodiment of the present invention. Detailed Implementation
[0046] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. It should be noted that, unless otherwise specified, the following embodiments and features can be combined with each other. In addition to the specific methods, equipment, and materials used in the embodiments, based on the knowledge of the prior art and the description of the present invention by those skilled in the art, any prior art methods, equipment, and materials similar to or equivalent to the methods, equipment, and materials in the embodiments of the present invention can be used to implement the present invention.
[0047] It should be understood that the terminology used in the embodiments of this invention is for describing specific implementations and not for limiting the scope of protection of this invention. Unless otherwise defined, all technical and scientific terms used in this invention have the same meaning as commonly understood by one of ordinary skill in the art.
[0048] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the invention. However, it will be apparent to those skilled in the art that embodiments of the invention may be practiced without these specific details. In some embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the invention.
[0049] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functions, and operations that may be implemented in the methods and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0050] Please see Figure 1 , Figure 1 A fruit counting method based on guidance perception and sharpening is provided in one embodiment of the present invention, including steps S101 to S106.
[0051] Step S101: Obtain the first image to be processed, and randomly select several fruits from the first image. The first image is a pre-processed image adapted to the input feature size of the fruit-guided perception and sharpening network. Pre-processing may include, for example, denoising, cropping, and resizing. Unlike other conventional methods, this invention requires manually selecting three fruits randomly from the first image for subsequent processing.
[0052] Step S102: Using the Progressive Spatial Aggregation Encoder (PSAE) in the trained fruit-guided perception and sharpening network, multi-level feature extraction is performed on the first image to obtain overall and detail features. The structure of the fruit-guided perception and sharpening network is as follows: Figure 2 As shown.
[0053] Please see Figure 3 In a specific embodiment of the present invention, the progressive spatial convergence encoder can be expressed by the following formula:
[0054] X6=H CSFF (H FAC (Conv(X in ))),
[0055] F0=Conv 3×3 (X6),
[0056] F1=Conv 3×3 (X6),
[0057] In the formula, X in For the first image, Conv represents the convolution operation, and H... FAC For foreground-aware convolutional blocks, H CSFF X6 is the output feature of the cross-stage feature fusion unit, and F0 and F1 are the overall feature and detail feature, respectively. The overall feature F0 is used to highlight the fruit area, thereby effectively suppressing environmental interference caused by changes in branches, leaves and light. The detail feature F1 is used to preserve structural information such as fruit edges and textures, providing fine-grained support for the subsequent generation of high-precision density maps.
[0058] Please see Figure 4 In a specific embodiment of the present invention, the processing steps of the foreground-aware convolutional block include steps S401 to S405, which are described below in conjunction with... Figure 5 These steps will be explained in further detail.
[0059] Step S401: Input features x of the foreground-aware convolutional block n Perform continuous convolution operations (corresponding to) Figure 5 In C), the region-aware offset S is obtained. r This is to capture spatial context information on the feature map, which can be expressed by the formula:
[0060] S r =Conv 3×3 (ReLU(Conv 3×3 (x n ))),
[0061] Region-aware offset S r This method captures the spatial variation features of the fruit region by performing continuous convolution operations (including ReLU activation) on the input of the foreground-aware convolutional block.
[0062] Step S402: Based on the average height and average width of the selected area (corresponding to...) Figure 5 We obtain vector P by taking Size h and Sizew from the bounding boxes. For example, if there are three selected regions with heights h1, h2, and h3, the average of these three heights is... Similarly, the average of the three widths w1, w2, and w3 is The final vector P is obtained from and The constructed two-dimensional vector, i.e. .
[0063] Step S403: Utilize a multilayer perceptron (MLP) Figure 5 The vector P (abbreviated as M) is mapped to a high-dimensional feature space, and then reshaped and repeated using tensor copying to obtain the size-aware offset S. s It can be expressed by the formula:
[0064] ,
[0065] Size-aware offset S s Sample information is extracted using a multilayer perceptron, then reshaped and expanded to match the region-aware offset S. r Same spatial dimension.
[0066] Step S404: Based on the region-aware offset and the size-aware offset, the final dynamic offset is obtained. This process can be expressed by the formula:
[0067] ,
[0068] In the above formula, Concat represents concatenation. The final dynamic offset is obtained after concatenation. Subsequently, the offset parameter is applied to the sampling position through convolution operation to achieve adaptive adjustment of the receptive field.
[0069] Step S405: Calculate the output features of the foreground-aware convolutional block based on the dynamic offset. The feature value y(p) of the foreground-aware convolutional block at position p is calculated using the following formula:
[0070] ,
[0071] In the formula, w(j) is the weight of the convolution kernel at position j, R is the coverage area of the convolution kernel, and x(p+j+S) is the weight of the kernel at position j. a The value is the sampled value from the input feature map after applying the offset. In this step, the foreground-aware convolutional block can dynamically adjust the receptive field according to the actual size and spatial characteristics of the target region, thereby more accurately aligning fruit regions such as cherries and improving the accuracy and robustness of feature extraction.
[0072] Please see Figure 6 In a specific embodiment of the present invention, the cross-stage feature fusion unit (CSFF) can be expressed by the formula:
[0073] X1=H FAC (PoolConv1Block(X0)),
[0074] X2 = X1 + H down (X0),
[0075] X3=H FAC (PoolConv3Block(X2)),
[0076] X4 = X3 + H down (X2),
[0077] X5=H FAC (PoolConv3Block(X4)),
[0078] X6 = X5 + H down (X4),
[0079] In the formula, X0 represents the input feature of the cross-stage feature fusion unit, PoolConv1Block and PoolConv3Block are the first-order pooling convolutional block and the third-order pooling convolutional block, respectively, and H... down The downsampling function is defined by X1 to X5, which are intermediate features. The cross-stage feature fusion unit consists of a foreground-aware convolutional block (FAC), a first-order pooling convolutional block, a third-order pooling convolutional block, and the downsampling function. The structure of the foreground-aware convolutional block is described above. Figure 5 As shown above, this has already been described in detail and will not be repeated here.
[0080] In this embodiment, PoolConv1Block compresses and initially extracts the input feature X0 through a combination of pooling and convolution, while the FAC module further enhances the expression of local structure and detail information. Subsequently, CSFF downsamples the input feature X0, adjusting its resolution to match the feature map of the current stage. Finally, the feature maps of the two stages are fused by element-wise summation to generate a feature representation that integrates shallow details and deep semantics.
[0081] Then, after further joint processing by PoolConv3Block and FAC, a deeper representation is obtained, resulting in feature X3. Based on this, CSFF further merges X2 and X3 to achieve complementarity and information transfer between shallow and deep features, resulting in feature X4.
[0082] Finally, X4 is further extracted using PoolConv3Block and FAC to obtain X5. CSFF then further fuses X5 and X4 to fully integrate multi-level feature information, resulting in the final feature X6. Finally, feature X6 is subjected to convolution operations to obtain the overall feature F0 and detail features F1.
[0083] Please see Figure 7 and Figure 8In a specific embodiment of the present invention, a first-order pooling convolutional block is formed by cascading a max-pooling layer and a convolutional layer, such as... Figure 7 As shown, a third-order pooling convolutional block consists of a max-pooling layer and three convolutional layers cascaded together, as follows: Figure 8 As shown.
[0084] Step S103: Extract the features of the selected region from the overall features and perform averaging to obtain the example features F. e Understandably, before performing averaging, all cropped selected areas can be adjusted to a uniform size before averaging across channels. The size adjustment operation can be performed, for example, by using an interpolation algorithm (such as bilinear interpolation) to scale (resize) all three feature blocks to the same uniform size.
[0085] Step S104: Using the Adaptive Similarity Perception Module (ASPM) in the Fruit-Guided Perception and Sharpening Network, process the overall features and example features to obtain a similarity map.
[0086] Please see Figure 9 In a specific embodiment of the present invention, the processing steps of the adaptive similarity perception module include S901~S905, which are described below in conjunction with... Figure 10 These steps are explained in detail.
[0087] Step S901: Combine the overall feature F0 and the example feature F e Divide into multiple groups along the channel dimension to obtain and The superscript g indicates the number of groups.
[0088] Step S902: For each group of overall features Performing a convolution operation generates shift parameters, which can be expressed by the formula:
[0089] , ,
[0090] In the formula, For horizontal displacement parameters, These are vertical displacement parameters used to adjust the sampling position on the input feature map, enabling it to dynamically shift to the region most similar to the sample feature map.
[0091] Step S903: For each group of overall features Perform convolution operations and combine them with the Softmax function to generate weight factors w. g It can be expressed by the formula:
[0092] .
[0093] Step S904: Generate similarity graphs for each group using the following formula:
[0094] ,
[0095] In the formula, Let be the similarity value of position (i,j) in the g-th group. and These are the example features and the overall features of the g-th group, respectively. and The weighting factors w are respectively g Horizontal displacement parameters and vertical displacement parameters The value at the corresponding position.
[0096] Step S905: Adaptive similarity maps of each group Merging along dimension g yields the similarity graph F. s .
[0097] Step S105: Compare the detail features F1 with the similarity map F s After multiplication, the data is input into the Interleaved Channel Reconstruction Decoder (ICRD) in the Fruit-Guided Perception and Sharpening Network to generate a density map.
[0098] Please see Figure 11 In one specific embodiment of the present invention, the Interleaved Channel Reconstruction Decoder (ICRD) comprises a cascaded array of: two 3×3 convolutional layers, three Crisscross Rearrangement Models (CRMs), one 3×3 convolutional layer, and a ReLU activation function. The ICRD first performs preliminary processing on the input features through two cascaded 3×3 convolutional layers, enhancing the model's ability to capture edges and textures of the input image while maintaining the spatial resolution of the features. Subsequently, the features are sequentially processed by the three Crisscross Rearrangement Models (CRMs). Each CRM segments the input features into four sub-tensors along the channel dimension. This segmentation process uniformly divides the channels of the feature tensor into four subsets according to predefined rules, with each subset retaining complete spatial dimensional information. Then, the CRMs recombine these sub-tensors in an interleaved manner, recombining the spatial and channel information of the sub-tensors through a specific arrangement strategy to generate the rearranged feature representation.
[0099] After three CRM processes, the features are further integrated through an additional 3×3 convolutional layer. This layer refines the rearranged features, optimizing their spatial consistency and density distribution accuracy. Finally, ICRD applies the ReLU activation function to perform a non-linear transformation on the output features, enhancing the model's non-linear expressive power and ensuring that the generated density map has higher robustness and discriminative power.
[0100] Please see Figure 12 In a specific embodiment of the present invention, the expression for the staggered rearrangement model is as follows:
[0101] ,
[0102] ,
[0103] In the formula, The input features for the staggered rearrangement model are... This represents the output feature of the staggered rearrangement model.
[0104] The first formula above divides the input feature map into four groups evenly along the channel dimension. In the formula, F... n Let H be the input feature map of the nth CRM module, and its shape is (H). n W n C n );c n For the input feature map F n The number of channels; k is the index of the group, k∈{1,2,3,4}; Let H be the k-th subtensor after grouping, and its shape is (H n W n C n / 4), which contains the original feature map F n One-quarter of the channels. The function of the second formula above is to refill the four groups of sub-tensors into a new feature map with double the spatial size in an "interleaved" manner.
[0105] Step S106: Obtain the number of fruits in the first image based on the density map. The density map is a single-channel grayscale image of the same size as the original image. Each pixel value in this image is not a color, but rather the probability density of the presence of a "target" (such as a cherry) at that location. High (bright) pixel values indicate that the area is very likely the central region of a target; low (dark) pixel values indicate that the area is the background or a non-target region; the total number of pixel values in the entire image equals the estimated total number of targets in the image. Figure 2 The right-hand image shows the result of overlaying the density map with the original image, for easier visualization and understanding.
[0106] In a specific embodiment of the present invention, the fruit-guided perception and sharpening network uses the mean squared error loss function (L2 Loss) as the optimization objective during training to measure the difference between the predicted density map and the true density map. Specifically, for any image in the training samples, let the predicted density map be F. out The corresponding true density map is F. gt The loss function is then defined as:
[0107] ,
[0108] in, To represent the number of samples in a batch, This represents the square norm operation. This loss function guides the model to gradually reduce the overall bias between the predicted and true density maps during backpropagation by summing and averaging the pixel-by-pixel squared differences between the predicted and true density maps. The L2 loss function has a higher penalty for predictions with larger errors, helping to force the model to improve regression accuracy in dense fruit regions during training and reduce local counting bias.
[0109] To evaluate the accuracy of the fruit orientation sensing and sharpening network, mean error (MAE) and root mean square error (RMSE) can be used to assess the network.
[0110] To further verify the effectiveness of the proposed method in the dense small fruit counting task, we conducted a systematic comparative experiment on the cherry dataset with six other density map counting models (FamNet, MCNN, CSTrans-B, BMNet+, PSGCNet, and LOCA). The test results are shown in Table 1.
[0111] Table 1: Comparison of results with other density map models on the cherry dataset
[0112]
[0113] As can be seen from Table 1, the Fruit Direction Perception and Sharpening Network (FOPSN) in this invention performed best in all experimental results, demonstrating its superiority in the fruit counting task.
[0114] It should be noted that the steps of the various methods described above are only for clarity. In practice, they can be combined into one step or some steps can be split into multiple steps. As long as they contain the same logical relationship, they are all within the scope of protection of this application. Adding insignificant modifications or introducing insignificant designs to the algorithm or process, but without changing the core design of the algorithm and process, are also within the scope of protection of this patent.
[0115] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.
Claims
1. A fruit counting method based on guidance perception and sharpening, characterized in that, include: Obtain the first image to be processed, and randomly select several fruits from the first image; Using the progressive spatial aggregation encoder in the trained fruit guidance perception and sharpening network, multi-level feature extraction is performed on the first image to obtain overall features and detail features. The features of the selected region are extracted from the overall features and averaged to obtain example features; The adaptive similarity perception module in the fruit-guided perception and sharpening network is used to process the overall features and the example features to obtain a similarity map. The detailed features are multiplied by the similarity map and then input into the interleaved channel reconstruction decoder in the fruit guidance perception and sharpening network to generate a density map. The number of fruits in the first image is obtained based on the density map; The progressive spatial convergence encoder can be expressed by the following formula: X6=H CSFF (H FAC (Conv(X in ))), F0=Conv 3×3 (X6), F1=Conv 3×3 (X6), In the formula, X in For the first image, Conv is the convolution operation, and H... FAC For foreground-aware convolutional blocks, H CSFF X6 is the output feature of the cross-stage feature fusion unit, and F0 and F1 are the overall feature and the detailed feature, respectively. The processing steps for the foreground-aware convolutional block are as follows: The input features of the foreground-aware convolutional block are subjected to continuous convolution operations to obtain the region-aware offset, so as to capture the spatial context information on the feature map; Based on the average height and average width of the selected area, obtain vector P; The vector P is mapped to a high-dimensional feature space using a multilayer perceptron, and then reshaping and tensor copying expansion operations are performed to obtain the size-aware offset. The dynamic offset is obtained based on the region-aware offset and the size-aware offset; Based on the dynamic offset, the output features of the foreground-aware convolutional block are calculated, wherein the feature value y(p) of the output features of the foreground-aware convolutional block at position p is calculated using the following formula: , In the formula, w(j) is the weight of the convolution kernel at position j, R is the coverage area of the convolution kernel, and x(p+j+S) is the weight of the kernel at position j. a S represents the value sampled from the input feature map after applying the offset. a This refers to the dynamic offset. The cross-stage feature fusion unit can be expressed by the following formula: X1=H FAC (PoolConv1Block(X0)), X2=X1+H down (X0), X3=H FAC (PoolConv3Block(X2)), X4=X3+H down (X2), X5=H FAC (PoolConv3Block(X4)), X6=X5+H down (X4), In the formula, X0 represents the input feature of the cross-stage feature fusion unit, PoolConv1Block and PoolConv3Block are the first-order pooling convolutional block and the third-order pooling convolutional block, respectively, and H... down X1~X5 are the intermediate features, which are the downsampling functions.
2. The fruit counting method based on guidance perception and sharpening according to claim 1, characterized in that, The first-order pooling convolutional block is composed of a max-pooling layer and a convolutional layer cascaded together, and the third-order pooling convolutional block is composed of a max-pooling layer and three convolutional layers cascaded together.
3. The fruit counting method based on guidance perception and sharpening according to claim 1, characterized in that, The processing steps of the adaptive similarity perception module are as follows: The overall feature and the example feature are divided into multiple groups along the channel dimension; Perform a convolution operation on each group of overall features to generate displacement parameters; Perform a convolution operation on each set of overall features and combine it with the Softmax function to generate weight factors; The similarity graphs for each group are generated using the following formula: , In the formula, Let be the similarity value of position (i,j) in the g-th group. and These are the example features and the overall features of the g-th group, respectively. The weighting factor is... and The displacement parameter; The adaptive similarity maps of each group are merged along dimension g to obtain the similarity map.
4. The fruit counting method based on guidance perception and sharpening according to claim 1, characterized in that, The interleaved channel reconstruction decoder comprises cascaded: Two 3×3 convolutional layers, Three staggered rearrangement models A 3×3 convolutional layer, and A ReLU activation function.
5. The fruit counting method based on guidance perception and sharpening according to claim 4, characterized in that, The expression for the staggered rearrangement model is as follows: , , In the formula, The input features of the interleaving rearrangement model are... c represents the output feature of the staggered rearrangement model. n For the input feature map F n The number of channels; k is the index of the group, k∈{1,2,3,4}; This is the k-th subtensor after grouping.
Citation Information
Patent Citations
A method and system for recognizing chart image data based on deep learning
CN118115819A
Optical remote sensing image change detection method and system based on change perception and semantic guidance, storage medium and electronic equipment
CN119494830A