Tree core detection training model, training method thereof and tree core detection model

By combining the feature extraction module, the attention mechanism module, and the tree core probability and density prediction module, the accuracy and efficiency issues of the tree core detection model in complex orchard scenarios are solved, and the accuracy of tree core localization and model adaptability are improved.

CN121280908APending Publication Date: 2026-01-06SHENZHEN AVIC AIRCRAFT EQUIPMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511511274.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-21
Publication Date
2026-01-06

AI Technical Summary

Technical Problem

In existing technologies, tree core detection models suffer from insufficient tree core localization accuracy and low model extraction efficiency due to the direct transfer of general target detection frameworks. Furthermore, their detection accuracy and efficiency are not high in complex orchard scenarios.

Method used

A combination of feature extraction, attention mechanism, tree core probability prediction, and tree core density prediction modules is used to extract multi-scale features through the VGG16 network. Combined with channel and spatial attention weighting, tree core location probability maps and density distribution maps are generated, and the model is optimized using a dedicated training dataset and loss function.

Benefits of technology

It achieves a significant improvement in tree core localization accuracy and model efficiency, can accurately detect tree cores in complex backgrounds, adapts to changes in different tree species, ages and planting densities, and has good adaptability and generalization ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121280908A_ABST
    Figure CN121280908A_ABST
Patent Text Reader

Abstract

The invention relates to a tree core detection training model, a training method thereof and a tree core detection model, belongs to the technical field of machine vision, and solves the problems of insufficient precision and low model extraction efficiency of a tree core detection model obtained by an existing method in a tree core point positioning task. The tree core detection training model comprises a feature extraction module, an attention mechanism module, a tree core probability prediction module and a tree core density prediction module, during training, the tree core detection training model is jointly optimized through weighted total loss by utilizing a generated real tree core position map and a real tree density distribution map, and after training is completed, the tree core probability prediction module is used for predicting the tree core probability. And removing the tree core density prediction module to obtain a tree core detection model comprising a feature extraction module, an attention mechanism module and a tree core probability prediction module.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of machine vision technology, and in particular to a tree core detection training model and its training method, and a tree core detection model. Background Technology

[0002] In the development of smart agriculture, utilizing advanced information technology to improve agricultural production efficiency and precision has become a core direction of modern agricultural innovation. Among these, the key foundation for achieving precision plant protection, automated harvesting, and digital cultivation lies in how to use computer vision technology for intelligent identification and management of orchard production. Especially in plant protection, traditional uniform spraying not only leads to significant pesticide waste but also puts continuous pressure on the environment; while point-based application relying on manual experience is inefficient and costly, failing to meet the management needs of large-scale orchards.

[0003] In recent years, with the development of computer vision and drone technology, the method of using drones equipped with cameras to collect orchard images and combining them with image processing algorithms for tree identification and localization has gradually attracted attention. However, existing technologies mostly focus on the overall detection of trees. General object detection models that directly transfer data are difficult to accurately locate the target at the tree center due to their inherent bounding box regression mechanism, and lack accurate extraction of the tree center. At the same time, existing models are limited in practical applications by factors such as image resolution, lighting changes, and orchard terrain, resulting in low detection accuracy and efficiency for tree center detection. Summary of the Invention

[0004] Based on the above analysis, the embodiments of the present invention aim to provide a tree core detection training model and its training method, as well as a tree core detection model, to solve the problems of insufficient tree core localization accuracy and low model extraction efficiency caused by directly transferring a general object detection framework to the detection models obtained by existing methods.

[0005] The objective of this invention is mainly achieved through the following technical solutions:

[0006] This invention provides a tree core detection training model, including a feature extraction module, an attention mechanism module, a tree core probability prediction module, and a tree core density prediction module;

[0007] The feature extraction module is used to extract features from the input image to obtain a multi-scale feature map; wherein, the input image is an image including trees;

[0008] The attention mechanism module is used to perform attention weighting processing on the multi-scale feature map to enhance the features of the tree region and suppress background interference;

[0009] The tree center probability prediction module is used to perform regression processing on the features output by the attention mechanism module to generate a tree center position probability map with the same size as the input image.

[0010] The tree core density prediction module is used to perform regression processing on the features output by the attention mechanism module to generate a tree density distribution map with the same size as the input image, and to learn the distribution density features of trees in the input image.

[0011] Furthermore, the feature extraction module is the feature extraction part of the VGG16 network model, which is used to perform convolution and downsampling operations on the input image, extract image features layer by layer, and obtain multi-scale feature maps.

[0012] Furthermore, the attention mechanism module is a convolutional block attention module, including a channel attention module and a spatial attention module, which are used to sequentially perform channel attention weighting and spatial attention weighting on the multi-scale feature map output by the feature extraction module.

[0013] Furthermore, the tree core probability prediction module includes a first standard convolutional layer, a second standard convolutional layer, a probability output layer, and a Sigmoid activation function;

[0014] The first standard convolutional layer includes a convolutional layer and an activation function, used to extract local features of the image output by the attention mechanism module;

[0015] The second standard convolutional layer includes a convolutional layer and an activation function, which are used to further extract local features of the feature map output by the first standard convolutional layer and reduce the dimension of the feature map;

[0016] The probability output layer includes a convolutional layer for feature fusion of multi-channel features in the feature map output by the second standard convolutional layer.

[0017] Furthermore, the tree core density prediction module includes a first dilated convolutional layer, a second dilated convolutional layer, and a density output layer, which are used to expand the receptive field through the dilated convolutional structure and generate a tree density distribution map of the global distribution density of trees.

[0018] Furthermore, the first dilated convolutional layer includes a convolutional layer with a dilation rate of 2 and an activation function, used to initially extract features of the image output by the attention mechanism module of the tree core detection training model and expand the receptive field.

[0019] The second dilated convolutional layer includes a convolutional layer with a dilation rate of 2 and an activation function, which are used to further extract features from the feature map output by the first dilated convolutional layer, reduce the dimension of the feature map, and expand the receptive field again.

[0020] The density output layer includes a convolutional layer for feature fusion of multi-channel features in the feature map output by the second dilated convolutional layer.

[0021] On the other hand, the present invention provides a training method for a tree core detection training model, used to train a tree core detection training model including any of the above-mentioned methods, the method comprising:

[0022] Acquire several images containing trees and label the location of the center of each tree in the images;

[0023] Generate a true tree core location map and a true tree density distribution map based on the labeled tree core locations in the image;

[0024] Construct a training dataset for the tree core detection training model; wherein, the training dataset includes several sets of training samples, each set of training samples includes an image of a tree and the corresponding real tree core location map and the real tree density distribution map;

[0025] Each training sample in the training dataset is loaded into the tree core detection training model. The tree core detection training model is trained using a weighted total loss of the density loss function and the tree core position loss function, and the model parameters are updated. Training ends when the weighted total loss converges, resulting in a trained tree core detection training model.

[0026] The density loss function is a mean squared error loss function, used to calculate the difference between the predicted density map output by the tree core density prediction module and the actual density map;

[0027] The tree core location loss function is a mean squared error loss function, used to calculate the difference between the tree core location probability map output by the tree core probability prediction module and the actual tree core location map;

[0028] When calculating the weighted total loss, a first weight is assigned to the density loss function and a second weight is assigned to the tree center position loss function. By adjusting the magnitudes of the first and second weights, the influence of the two loss functions on model training is balanced.

[0029] Furthermore, based on the labeled tree core locations in the image, a true tree core location map is generated, including:

[0030] Create a two-dimensional matrix with the same size as the image of the training sample, and initialize the element values ​​in the matrix to 0;

[0031] Map the coordinates of the heart positions of each tree marked in the image to the corresponding positions in the two-dimensional matrix, and set the element values ​​to 1;

[0032] The assigned two-dimensional matrix serves as the actual tree center location map.

[0033] Furthermore, based on the labeled tree center locations in the image, a true tree density distribution map is generated, including:

[0034] For each tree center point in the real tree center location map, create a two-dimensional matrix with the same size as the image of the training sample and all element values ​​of 0, and set the element value of the corresponding tree center point position in the matrix to 1, as a single-point binary map of each tree center;

[0035] Based on the average distance between each tree center and several tree center points that are close to it, construct the Gaussian kernel function for each tree center;

[0036] The single-point binary map of each tree core is convolved with the corresponding Gaussian kernel function to obtain the single-point Gaussian response map of each tree core.

[0037] The Gaussian response maps of each tree center are accumulated pixel by pixel to obtain the true tree density distribution map.

[0038] On the other hand, the present invention provides a tree core detection model, which includes a detection model and a training model;

[0039] The detection model includes a feature extraction module, an attention mechanism module, and a tree core probability prediction module;

[0040] The training model is the tree center detection training model that includes any one of the above-mentioned features;

[0041] The feature extraction module, the attention mechanism module, and the tree core probability prediction module in the detection model are trained through the tree core detection training model.

[0042] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:

[0043] 1. The tree core detection training model constructed in this invention introduces an innovative architecture of attention mechanism and dual-branch collaborative training. The model accurately focuses on the key feature regions of trees through the attention mechanism, which can effectively suppress interference from complex backgrounds. Through the collaborative design of feature extraction and dual prediction modules, the model has multi-scale adaptability and can accurately cope with changes in different tree species, tree ages and planting densities, thus achieving a significant improvement in tree core localization accuracy and model efficiency.

[0044] 2. This invention constructs a dedicated training dataset that includes a real tree core location map and a real tree density distribution map, as well as a tree core probability prediction module and a tree core density prediction module designed in parallel. This enables the model to learn the precise location of the tree core point and the global information of the tree distribution simultaneously during the training process, thereby improving the detection accuracy and generalization ability of the model in complex orchard scenarios.

[0045] 3. The tree core detection model of the present invention automatically focuses on the tree area and suppresses interference from complex backgrounds through the attention mechanism module, effectively overcoming the influence of factors such as changes in lighting, shadow occlusion and overlapping branches and leaves. At the same time, its feature extraction module can integrate multi-level features and contextual information, so that the model is not limited to tree species, tree age and planting method during the reasoning process and has good adaptability.

[0046] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained from what is particularly pointed out in the description and drawings. Attached Figure Description

[0047] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts.

[0048] Figure 1 This is a logical schematic diagram of a tree core detection training model in an embodiment of the present invention;

[0049] Figure 2 This is a schematic diagram of the convolutional block attention module in an embodiment of the present invention;

[0050] Figure 3 This is a schematic diagram of the training method for a tree core detection training model in an embodiment of the present invention;

[0051] Figure 4 This is a logical schematic diagram of a tree core detection model in an embodiment of the present invention. Detailed Implementation

[0052] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.

[0053] A specific embodiment of the present invention discloses a tree center detection training model, such as... Figure 1As shown, the tree core detection training model includes a feature extraction module, an attention mechanism module, a tree core probability prediction module, and a tree core density prediction module.

[0054] The feature extraction module is used to extract features from the input image to obtain a multi-scale feature map; wherein the input image is an image including trees.

[0055] The attention mechanism module is used to perform attention-weighted processing on the multi-scale feature map to enhance the features of the tree region and suppress background interference.

[0056] The tree center probability prediction module is used to perform regression processing on the features output by the attention mechanism module to generate a tree center position probability map with the same size as the input image.

[0057] The tree core density prediction module is used to perform regression processing on the features output by the attention mechanism module to generate a tree density distribution map with the same size as the input image, and to learn the distribution density features of trees in the input image.

[0058] Specifically, the tree core detection training model constructed in this embodiment uses a feature extraction-attention enhancement-dual-branch collaborative architecture. By setting up the parallel tree core probability prediction module and the tree core density prediction module, a significant improvement in localization accuracy and feature learning efficiency is achieved. The probability prediction module focuses on pixel-level precise localization of the tree core position, while the density prediction module provides spatial relationship supervision for the feature extraction module by capturing global contextual information about tree distribution.

[0059] Furthermore, the feature extraction module is the feature extraction part of the VGG16 network model, which is used to perform convolution and downsampling operations on the input image, extract image features layer by layer, and obtain multi-scale feature maps.

[0060] Specifically, the VGG16 network model is a deep convolutional neural network model, which includes five convolutional blocks connected in sequence and three fully connected layers. The five convolutional blocks connected in sequence serve as the feature extraction part of the VGG16 network model, which is used to perform hierarchical feature extraction on the input image, gradually converting the original pixel information into a high-dimensional feature representation rich in semantic information.

[0061] More specifically, the first and second convolutional blocks of the feature extraction module each include two convolutional layers and one max pooling layer, and the third, fourth, and fifth convolutional blocks each include three convolutional layers and one max pooling layer.

[0062] The input image is convolved by the first convolutional layer of the feature extraction module, which has a size of 3×3, 3 input channels (corresponding to the three color channels of an RGB image), and 64 output channels. The ReLU activation function is then used to obtain an activation feature map with 64 channels. This 64-channel activation feature map is then convolved by the second convolutional layer, which also has a size of 3×3, 64 input channels, and 64 output channels. The ReLU activation function is then used to obtain a feature-enhanced activation feature map. Finally, the activation feature map from the two convolutional layers is downsampled by a 2×2 max pooling layer with a stride of 2, resulting in a pooled feature map that reduces spatial resolution while retaining key features. This completes the extraction of the primary visual features of the input image.

[0063] The output feature map of the first convolutional block is then downsampled again through a third convolutional layer (3×3, 64 input channels, 128 output channels) and a ReLU activation function, a fourth convolutional layer (3×3, 128 input channels, 128 output channels) and a ReLU activation function, and a 2×2 max pooling layer with a stride of 2. This further reduces the spatial resolution of the feature map and expands the number of channels. While compressing spatial information, it enhances the model's representational ability in the channel dimension, enabling it to learn more complex feature patterns.

[0064] The output feature map of the second convolutional block is then downsampled again through the fifth convolutional layer (3×3 size, 128 input channels, 256 output channels) and ReLU activation function, the sixth convolutional layer (3×3 size, 256 input channels, 256 output channels) and ReLU activation function, the seventh convolutional layer (3×3 size, 256 input channels, 256 output channels) and ReLU activation function, and a 2×2 max pooling layer with a stride of 2. This further reduces the spatial resolution of the feature map and extracts more semantically meaningful high-level features.

[0065] The output feature map of the third convolutional block is downsampled again through the 8th convolutional layer (3×3, 256 input channels, 512 output channels) and ReLU activation function, the 9th convolutional layer (3×3, 512 input channels, 512 output channels) and ReLU activation function, the 10th convolutional layer (3×3, 512 input channels, 512 output channels) and ReLU activation function, and a 2×2 max pooling layer with a stride of 2, in order to capture and integrate rich global contextual information.

[0066] The output feature map of the fourth convolutional block is then downsampled again through the 11th convolutional layer (3×3, 512 input channels, 512 output channels) and ReLU activation function of the fifth convolutional block, the 12th convolutional layer (3×3, 512 input channels, 512 output channels) and ReLU activation function, the 13th convolutional layer (3×3, 512 input channels, 512 output channels) and ReLU activation function, and a 2×2 max pooling layer with a stride of 2, to obtain the feature map with 512 channels output by the feature extraction module.

[0067] Furthermore, the attention mechanism module is a convolutional block attention module, including a channel attention module and a spatial attention module, which are used to sequentially apply channel attention weighting and spatial attention weighting to the multi-scale feature map output by the feature extraction module to enhance the features of the tree region.

[0068] Specifically, such as Figure 2 As shown, the Convolutional Block Attention Module (CBAM) is a module that combines channel attention and spatial attention. By concatenating the channel attention module and the spatial attention module, attention maps of feature maps are calculated from both channel and spatial dimensions, and then multiplied with the input feature map to achieve adaptive learning of features.

[0069] In the channel attention module, global average pooling is performed on each channel of the feature map output by the feature extraction module to generate a channel descriptor. The channel descriptor is then passed through a fully connected layer and a ReLU activation function to reduce the dimensionality of the features while retaining important feature information. After passing through another fully connected layer to generate channel weights to reflect the importance of each channel, the weights of each channel are normalized using a Sigmoid activation function to obtain channel weights for weighting the feature map input to the channel attention module.

[0070] The enhanced feature map is obtained by multiplying the feature map output by the feature extraction module with the channel weights.

[0071] In the spatial attention module, the feature maps output by the channel attention module are subjected to max pooling and average pooling respectively to generate corresponding max pooling spatial descriptors and average pooling spatial descriptors to reflect the importance of each spatial location. The two spatial descriptors are concatenated along the channel dimension and then passed through a 7×7 convolutional layer to obtain spatial attention weights. The spatial attention weights are then normalized using the Sigmoid activation function to weight the feature maps input to the spatial attention module.

[0072] The enhanced feature map is obtained by multiplying the feature map output by the channel attention module with the normalized spatial attention weights. In this way, the model can selectively enhance important spatial regions and suppress unimportant spatial regions. In this embodiment, the role of the attention mechanism is to make the model focus on the tree region rather than other regions.

[0073] Furthermore, the feature map output by the attention mechanism module is used by the tree center probability prediction module to accurately locate the position of each tree center, wherein,

[0074] The tree core probability prediction module includes a first standard convolutional layer, a second standard convolutional layer, a probability output layer, and a sigmoid activation function connected in sequence. It is used to perform convolution processing based on the tree region features output by the attention mechanism module to generate a tree core position probability map corresponding to the input image size.

[0075] The first standard convolutional layer includes a 3×3 convolutional layer with 256 input and 256 output channels, and uses the ReLU activation function to extract local features of the image output by the attention mechanism module. Specifically, due to the small kernel size, the first standard convolutional layer can capture detailed information in the image, while the 256 input and output channels maintain the dimensionality of the feature map, ensuring that the information in the feature map is not lost due to the reduction in the number of channels.

[0076] The second standard convolutional layer includes a 3×3 convolutional layer with 256 input channels and 128 output channels. It uses the ReLU activation function to further extract local features from the feature map output by the first standard convolutional layer and reduce the dimension of the feature map. Specifically, based on the first standard convolutional layer, the second standard convolutional layer further extracts local features and enhances feature representation. At the same time, the number of channels in the second standard convolutional layer is reduced from 256 to 128, which reduces the dimension of the feature map, reduces computational complexity, and retains important feature information.

[0077] The probability output layer includes a 1×1 convolutional layer with 128 input channels and 1 output channel, used to fuse the multi-channel features in the feature map output by the second standard convolutional layer; specifically, the probability output layer is a 1×1 convolutional layer used to compress multi-channel feature information into one channel for feature fusion.

[0078] The feature map output by the probability output layer is normalized to the range [0,1] by the Sigmoid activation function, which represents the probability that each position is the tree center.

[0079] Furthermore, the tree core density prediction module includes a first dilated convolutional layer, a second dilated convolutional layer, and a density output layer connected in sequence, used to expand the receptive field through the dilated convolutional structure and generate a tree density distribution map of the global tree distribution density; wherein,

[0080] The first dilated convolutional layer includes a 3×3 convolutional layer with 256 input and 256 output channels and a dilation rate of 2, and a ReLU activation function. It is used to initially extract features of the image output by the attention mechanism module and expand the receptive field. Specifically, because the kernel size of the first dilated convolutional layer is small, the first standard convolutional layer can capture detailed information in the image. The 256 input and output channels keep the dimension of the feature map unchanged, ensuring that the information in the feature map is not lost due to the reduction in the number of channels. The convolutional layer with a dilation rate of 2 can expand the receptive field, capture a wider range of contextual information, and help the model understand the global distribution of trees.

[0081] The second dilated convolutional layer includes a 3×3 convolutional layer with 256 input channels, 128 output channels, and a dilation rate of 2, and a ReLU activation function. This is used to further extract features from the feature map output by the first dilated convolutional layer, reduce the feature map's dimensionality, and further expand the receptive field. Specifically, based on the first dilated convolutional layer, the second dilated convolutional layer further extracts local features and enhances feature representation. Simultaneously, in the second standard convolutional layer, the number of channels is reduced from 256 to 128, reducing the feature map's dimensionality and computational complexity while retaining important feature information. The dilation rate of 2 further expands the receptive field, capturing a wider range of contextual information.

[0082] The density output layer includes a 1×1 convolutional layer with 128 input channels and 1 output channel, used to fuse the multi-channel features in the feature map output by the second dilated convolutional layer; specifically, the probability output layer is a 1×1 convolutional layer used to compress the multi-channel feature information into one channel for feature fusion, and its output single-channel feature map represents the tree density at each location.

[0083] It should be noted that the tree density distribution map is a continuous heat map, and the value of each pixel represents the density of trees near that location.

[0084] Understandably, the tree core probability prediction module primarily focuses on local features, preserving local feature details through a standard convolutional structure to generate a tree core location probability map. While this local feature extraction can accurately locate individual tree cores, the lack of global information can lead to false detections and missed detections when processing densely populated or overlapping areas of tree cores. Therefore, in this embodiment, a tree core density prediction module is set up in parallel with the tree core probability prediction module. This module generates a tree density distribution map corresponding to the input image size based on the tree region features output by the attention mechanism module during the training phase. This allows the tree density distribution map generated by the tree core density prediction module during training to provide global tree distribution information, helping the model better understand the overall tree distribution in densely populated or overlapping areas. Simultaneously, the output of the tree core density prediction module serves as additional supervision signals for training, enabling the model to learn tree core features more accurately, thereby improving the accuracy and robustness of tree core detection.

[0085] Another embodiment of the present invention discloses a training method for a tree core detection training model, used to train the tree core detection training model as described above, such as... Figure 3 As shown, the method includes the following steps S1-S4:

[0086] Step S1: Obtain several images containing trees and label the location of the heart of each tree in the images.

[0087] Specifically, using drones or other imaging equipment, a large number of high-resolution images of the same size are collected from multiple angles, under different lighting conditions, in different seasons, and covering areas with different tree species and planting densities. This ensures that the images can represent various real-world scenarios that the model may encounter. It should be noted that data augmentation techniques, including but not limited to random cropping, rotation, scaling, color transformation, adding noise, and affine transformations, are used to increase the diversity of the training data and improve the robustness of the model.

[0088] More specifically, on each image, the annotators determine and mark the geometric center of the canopy projection of each tree based on the visual shape of the canopy, as the location of the tree's heart.

[0089] Step S2: Generate a true tree core location map and a true tree density distribution map based on the tree core locations marked in the image.

[0090] Furthermore, based on the labeled tree core locations in the image, a true tree core location map is generated, including:

[0091] Create a two-dimensional matrix with the same size as the image containing trees in the training samples, and initialize the element values ​​in the matrix to 0;

[0092] Map the coordinates of the heart positions of each tree marked in the image to the corresponding positions in the two-dimensional matrix, and set the element values ​​to 1;

[0093] The assigned two-dimensional matrix serves as the actual tree center location map.

[0094] Specifically, the actual tree center location map obtained through the above steps is a binary image, in which the pixel value of each tree center location is 1, and the pixel value of other locations is 0.

[0095] Furthermore, a true tree density distribution map is generated based on the marked tree center locations in the image, including steps S21-S24:

[0096] Step S21: Create a two-dimensional matrix with all elements equal to the size of the image containing trees in the training sample for each tree center point in the real tree center location map. Set the element value of the corresponding tree center point position in the matrix to 1 to serve as a single-point binary map of each tree center.

[0097] Specifically, by setting the element values ​​at each tree center point to 1 and the element values ​​at other points to 0, an independent label map is created for each tree center point to clearly mark the location of each tree center. At the same time, the single-point binary map of each tree center point will also be used for subsequent Gaussian kernel convolution operations to generate the Gaussian response map of each tree center point.

[0098] Step S22: Construct the Gaussian kernel function for each tree center based on the average distance between each tree center and several tree center points that are close to it.

[0099] Specifically, the Gaussian kernel function is a function based on the Gaussian distribution (normal distribution) and is used to smooth data, generate heatmaps, and simulate the local distribution of data. By convolving the Gaussian kernel function with the image, noise in the image can be reduced while retaining important features.

[0100] In this embodiment of the Gaussian kernel function, the standard deviation of the Gaussian kernel is used to control the width of the Gaussian kernel. By adjusting the standard deviation of the Gaussian kernel, the density distribution around the tree center can be simulated. A larger standard deviation can simulate a larger density distribution around the tree center, suitable for densely wooded areas; a smaller standard deviation can simulate a smaller density distribution around the trees, suitable for sparsely wooded areas. By adjusting the standard deviation, a smoother density distribution map can be generated, providing gradient information around the tree center and helping the model better learn the features of the tree center. In this embodiment, the standard deviation of the Gaussian kernel is set to k times the average distance from the current tree center point to its three nearest other tree center points, where k can be set to 0.6. It should be noted that the distance from the current tree center point to other tree center points can use Euclidean distance.

[0101] More specifically, the maximum standard deviation limit of the Gaussian kernel is used to prevent the Gaussian kernel from becoming too broad due to an excessively large standard deviation. This ensures computational efficiency and avoids excessive smoothing and increased computational complexity caused by an overly large diffusion range of the Gaussian kernel. In this embodiment, the maximum standard deviation limit of the Gaussian kernel can be set to 200 pixels.

[0102] Step S23: Convolve the single-point binary map of each tree core with the corresponding Gaussian kernel function to obtain the single-point Gaussian response map of each tree core.

[0103] Specifically, the single-point binary map of each tree core is convolved with the corresponding Gaussian kernel function to convert the discrete tree core position into a smooth tree density distribution map, while providing gradient information around each tree core.

[0104] Step S24: Accumulate the single-point Gaussian response map of each tree core pixel by pixel to obtain the real tree density distribution map.

[0105] Specifically, the single-point Gaussian response map of each tree core describes the density contribution of the current tree core to the surrounding pixels, simulating the distribution of the tree crown influence that smoothly decays from the center to the surrounding area. By accumulating the single-point Gaussian response maps of all tree cores pixel by pixel, the resulting real tree density distribution map is the total density contribution of all tree cores to every pixel in the image.

[0106] Step S3: Construct the training dataset for the tree core detection training model; wherein, the training dataset includes several sets of training samples, each set of training samples includes an image of a tree and the corresponding real tree core location map and the real tree density distribution map.

[0107] Specifically, the real tree center location map is used to provide direct supervision signals during training, and the real tree density distribution map enables the model to understand the spatial relationships between trees during training.

[0108] Step S4: Load each training sample from the training dataset into the tree core detection training model, train the tree core detection training model using a weighted total loss of the density loss function and the tree core position loss function, and update the model parameters. Training ends when the weighted total loss converges, resulting in a trained tree core detection training model; wherein,

[0109] The density loss function is a mean squared error loss function, used to calculate the difference between the predicted density map output by the tree core density prediction module and the actual density map;

[0110] The tree core location loss function is a mean squared error loss function, used to calculate the difference between the tree core location probability map output by the tree core probability prediction module and the actual tree core location map;

[0111] When calculating the weighted total loss, a first weight is assigned to the density loss function and a second weight is assigned to the tree center position loss function. By adjusting the magnitudes of the first and second weights, the influence of the two loss functions on model training is balanced.

[0112] Specifically, the total loss is calculated using the following formula:

[0113] L total =α·L density +β·L point

[0114] Among them, L total This represents the total loss function; α and β represent the first and second weights, respectively, and the sum of the first and second weights is 1; L density L represents the density loss function; point This represents the tree center location loss function.

[0115] More specifically, by adjusting the first and second weights, the model's learning focus on the overall distribution of trees (density branching) and the precise location of individual trees (point branching) can be balanced. For example, when the second weight value is relatively large, the model will focus more on improving the location accuracy of the tree center point.

[0116] Another embodiment of the present invention discloses a tree core detection model, which includes a detection model and a training model.

[0117] like Figure 4 As shown, the tree core detection model includes a feature extraction module, an attention mechanism module, and a tree core probability prediction module.

[0118] The training model is the tree core detection training model according to any one of claims 1-6;

[0119] The feature extraction module, the attention mechanism module, and the tree core probability prediction module in the detection model are trained through the tree core detection training model.

[0120] Specifically, after the training of the tree core detection training model converges, the tree core density prediction module, which is used to provide context supervision during the training phase, is removed from the network. Only the trained feature extraction module, attention mechanism module, and tree core probability prediction module are retained as the detection model. This ensures that the model maintains high-precision tree core localization capabilities while removing unnecessary computational branches, thus achieving a significant improvement in model lightweighting and inference efficiency.

[0121] In summary, the tree core detection training model and training method of the present invention, and the tree core detection model, have the following beneficial effects:

[0122] 1. The tree core detection training model constructed in this invention achieves a significant improvement in tree core localization accuracy and model efficiency by introducing an innovative architecture of attention mechanism and dual-branch collaborative training. The model accurately focuses on key feature regions of trees through attention mechanism, which can effectively suppress interference from complex backgrounds. Through the collaborative design of feature extraction and dual prediction modules, the model has multi-scale adaptability and can accurately cope with changes in different tree species, tree ages and planting densities.

[0123] 2. This invention constructs a dedicated training dataset that includes a real tree core location map and a real tree density distribution map, as well as a tree core probability prediction module and a tree core density prediction module designed in parallel. This enables the model to learn the precise location of the tree core point and the global information of the tree distribution simultaneously during the training process, thereby improving the detection accuracy and generalization ability of the model in complex orchard scenarios.

[0124] 3. The tree core detection model of the present invention automatically focuses on the tree area and suppresses interference from complex backgrounds through the attention mechanism module, effectively overcoming the influence of factors such as changes in lighting, shadow occlusion and overlapping branches and leaves. At the same time, its feature extraction module can integrate multi-level features and contextual information, so that the model is not limited to tree species, tree age and planting method during the reasoning process and has good adaptability.

[0125] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A tree core detection training model, characterized in that, The model comprises a feature extraction module, an attention mechanism module, a tree core probability prediction module and a tree core density prediction module. The feature extraction module is configured to extract features of an input image to obtain a multi-scale feature map, wherein the input image is an image comprising trees. The attention mechanism module is configured to perform attention weighting processing on the multi-scale feature map to enhance tree region features and suppress background interference. The tree core probability prediction module is configured to perform regression processing on features output by the attention mechanism module to generate a tree core position probability map with the same size as the input image. The tree core density prediction module is configured to perform regression processing on features output by the attention mechanism module to generate a tree density distribution map with the same size as the input image, and learn distribution density features of trees in the input image.

2. The model of claim 1, wherein, The feature extraction module is a feature extraction part of a VGG16 network model, configured to perform convolution and down-sampling operations on the input image to extract image features layer by layer to obtain a multi-scale feature map.

3. The model of claim 1, wherein, The attention mechanism module is a convolution block attention module, comprising a channel attention module and a spatial attention module, configured to sequentially perform channel attention weighting and spatial attention weighting on the multi-scale feature map output by the feature extraction module.

4. The model of claim 1, wherein, The tree core probability prediction module comprises a first standard convolution layer, a second standard convolution layer, a probability output layer and a Sigmoid activation function. The first standard convolution layer comprises a convolution layer and an activation function, configured to extract local features of an image output by the attention mechanism module. The second standard convolution layer comprises a convolution layer and an activation function, configured to further extract local features of a feature map output by the first standard convolution layer and reduce the dimension of the feature map. The probability output layer comprises a convolution layer, configured to fuse multi-channel features in a feature map output by the second standard convolution layer.

5. The model according to any one of claims 1 to 4, wherein The tree core density prediction module comprises a first dilated convolution layer, a second dilated convolution layer and a density output layer, configured to expand a receptive field through a dilated convolution structure to generate a tree density distribution map of global distribution density of trees.

6. The model of claim 5, wherein The first dilated convolution layer comprises a convolution layer with a dilation rate of 2 and an activation function, configured to preliminarily extract features of an image output by the attention mechanism module of the tree core detection training model and expand a receptive field. The second dilated convolution layer comprises a convolution layer with a dilation rate of 2 and an activation function, configured to further extract features of a feature map output by the first dilated convolution layer, reduce the dimension of the feature map and expand the receptive field again. The density output layer comprises a convolution layer, configured to fuse multi-channel features in a feature map output by the second dilated convolution layer.

7. A training method of a tree core detection training model, used for training the tree core detection training model according to any one of claims 1-6, characterized in that, The method comprises: Obtaining a plurality of images comprising trees and labeling positions of tree cores of each tree in the images; Generating a real tree core position map and a real tree density distribution map based on the labeled tree core positions of each tree in the images; constructing a training data set of the tree core detection training model; wherein the training data set comprises a plurality of training samples, each training sample comprising an image of a tree and corresponding real tree core position map and real tree density distribution map; loading each training sample in the training data set into the tree core detection training model, training the tree core detection training model using a weighted total loss of a density loss function and a tree core position loss function, and updating model parameters, ending training when the weighted total loss converges, to obtain a trained tree core detection training model; wherein, the density loss function is a mean square error loss function for calculating the difference between the predicted density map output by the tree core density prediction module and the real density map; the tree core position loss function is a mean square error loss function for calculating the difference between the tree core position probability map output by the tree core probability prediction module and the real tree core position map; when calculating the weighted total loss, the first weight is assigned to the density loss function, and the second weight is assigned to the tree core position loss function. By adjusting the size of the first weight and the second weight, the influence degree of the two loss functions on model training is balanced.

8. The method of claim 7, wherein, generating a real tree core position map based on the tree core positions of each tree marked in the image, comprising: creating a two-dimensional matrix with the same size as the image of the training sample, and initializing the element values in the matrix to 0; mapping the coordinates of the tree core positions of each tree marked in the image to the corresponding positions of the two-dimensional matrix, and setting the element values to 1; the two-dimensional matrix after assignment is used as the real tree core position map.

9. The method of claim 8, wherein, generating a real tree density distribution map based on the tree core positions of each tree marked in the image, comprising: creating a two-dimensional matrix with the same size as the image of the training sample for each tree core point in the real tree core position map, and setting the element values of the corresponding tree core point positions in the matrix to 1 as single-point binary maps of each tree core; constructing a Gaussian kernel function for each tree core based on the average distance of a number of tree core points with similar distances to the tree core point; convolving the single-point binary maps of each tree core with the corresponding Gaussian kernel function to obtain single-point Gaussian response maps of each tree core; pixel-by-pixel accumulation of single-point Gaussian response maps of each tree core to obtain a real tree density distribution map.

10. A tree core detection model, characterized in that, The tree core detection model comprises a detection model and a training model; The detection model comprises a feature extraction module, an attention mechanism module and a tree core probability prediction module; The training model is the tree core detection training model of any one of claims 1-6; The feature extraction module, the attention mechanism module and the tree core probability prediction module in the detection model are obtained by training the tree core detection training model.