Citrus tree canopy edge segmentation method based on YOLO-BBR
By introducing BoTNet module, BiFPN network and frost ice optimization algorithm RIME in the YOLO-BBR segmentation model, the problems of low canopy segmentation accuracy and high computing resource consumption are solved, and efficient and accurate canopy edge segmentation of citrus fruit tree are achieved. .
Patent Information
- Application Number
- CN202411608362.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-02-18
AI Technical Summary
The prior art has low accuracy in the canopy segmentation of citrus fruit trees in the natural environment of citrus orchards, and the calculation resources are consumed by deep learning methods, low adaptability, and artificial parameter adjustment depends on experience, and low efficiency.
Using the YOLO-BBR-based citrus fruit tree canopy edge segmentation method, the BoTNet module and BiFPN network are introduced into the YOLOv8-seg model, the model's ability to extract local information and reduce parameters, thereby reducing latency. At the same time, the fused frost ice optimization algorithm RIME optimizes hyperparameters and uses the group intelligent iteration mechanism to improve model performance.
The accuracy of edge segmentation of the canopy layer of citrus fruit trees is improved, the consumption of computing resources is reduced, the adaptability and performance of the model is improved, the dependence of manual parameter adjustment is reduced, and the segmentation efficiency is improved.
Smart Images

Figure CN119477947A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image segmentation, and in particular to a citrus tree canopy edge segmentation method based on YOLO-BBR. Background Art
[0002] The canopy is the place where fruit trees carry out their main physiological activities. It reflects the growth activities of trees and the spatial attributes of forests, and directly affects the photosynthesis efficiency, fruit quality and overall yield of fruit trees. Accurately obtaining fruit tree canopy information is also important for monitoring tree growth and preventing tree diseases and pests.
[0003] At present, domestic and foreign scholars have proposed many solutions to the problem of citrus orchard canopy segmentation in natural environments. In the research process, researchers have used traditional image segmentation algorithms such as watershed method, graph cut method and K-means clustering to extract the canopy boundary of citrus fruit trees, but traditional methods mostly rely on basic features such as color, texture and grayscale for segmentation, and the segmentation accuracy is low in the complex scenes of the natural environment of the orchard. Some scholars have proposed a segmentation algorithm based on deep learning, but in the current related work, researchers mostly focus on shooting from the side of the fruit tree to segment the canopy.
[0004] However, most of my country's citrus orchards are located in mountainous orchards with rugged roads. The fruit trees are densely planted, the canopy is relatively small, and there is mutual occlusion between them. The traditional manual survey and field measurement methods of citrus canopy are time-consuming and laborious. The datasets used by deep learning-based citrus canopy segmentation methods are mostly concentrated on the side of the fruit tree to shoot the canopy, and these methods require a long model calculation time and high computing resources, which will bring high computational costs. In addition, the acquisition distance and lighting conditions shot from the side of the fruit tree are relatively fixed, and the scene adaptability is not high; and most of them achieve significant segmentation effects by redesigning and adjusting the model structure, which will bring high computational costs. Summary of the invention
[0005] In view of the shortcomings of the prior art, the present invention provides a citrus canopy edge segmentation method based on YOLO-BBR. The YOLOv8-seg model is used as the basis, and the BoTNet module is used to improve the backbone network, thereby improving the ability of the model to extract local information and reducing parameters, thereby minimizing the delay. The BiFPN network is also integrated into the Head task head network to better integrate the multi-layer features of the image and improve the segmentation accuracy of the model. In addition, the present invention adopts the frost optimization algorithm RIME to optimize the hyperparameters of the YOLO-BBR segmentation model, and uses the iterative mechanism of swarm intelligence to further improve the model performance.
[0006] The technical solution of the present invention is: a citrus tree canopy edge segmentation method based on YOLO-BBR, comprising the following steps:
[0007] S1), construct a citrus canopy dataset, expand and annotate the dataset, and then divide it into a training set and a validation set;
[0008] S2), build a YOLO-BBR segmentation model;
[0009] S3), using the training set to train the YOLO-BBR segmentation model, during the training process, using the frost optimization algorithm RIME to optimize the hyper parameters of the YOLO-BBR segmentation model;
[0010] S4) Use the validation set to verify the trained YOLO-BBR segmentation model.
[0011] Preferably, in step S2), the construction of the YOLO-BBR segmentation model includes:
[0012] First, based on the YOLOv8-seg model, the BoTNet module was added to the backbone network of the YOLOv8-seg model;
[0013] Secondly, the weighted bidirectional feature pyramid network BiFPN is integrated into the head part network of the Head task of the YOLOv8-seg model.
[0014] Preferably, in step S2), the BoTNet module introduces a multi-head attention layer MHSA, and the BoTNet module uses convolution operations to learn abstract and low-resolution features from a large number of images, and uses the multi-head attention layer MHSA to process and aggregate the information contained in the feature maps captured by the convolution.
[0015] Preferably, in step S2), the weighted bidirectional feature pyramid network BiFPN allows information between features of different scales to flow and fuse more effectively by establishing bidirectional connections between top-down and bottom-up paths; by deleting nodes with only one input edge, adding additional edges between input and output nodes at the same level, and treating each bidirectional path as a feature network layer and repeating it multiple times to achieve more advanced feature fusion, optimizing cross-scale connections and introducing learnable weights to determine the importance of different input features, thereby improving the effect of feature fusion.
[0016] Preferably, in step S2), the weighted bidirectional feature pyramid network BiFPN adds an additional weight to each input through a fast normalization fusion method, and allows the network to learn the importance of each input feature, that is:
[0017]
[0018] Where O represents the fused image or dataset; w i Represents the i-th learnable weight; by j Do ReLU operation to ensure w j ≥0;∈=0.0001 is a small amount that ensures numerical stability; I i Represents the i-th normalized image or dataset.
[0019] Preferably, in step S3), the frost optimization algorithm RIME searches by simulating the movement of soft frost particles and the puncture behavior between hard frost particles. The frost optimization algorithm RIME can quickly cover the entire search space and avoid falling into a local optimal solution.
[0020] Preferably, in step S3), in a breeze environment, the growth of soft frost has strong randomness, so that frost particles can freely cover the surface of the object, but the growth speed in the same direction is slow. By simulating the motion characteristics of soft frost, it is specifically expressed as follows:
[0021]
[0022] In the formula, is the position of the frost particles after the update, R best,j is the best frost particle in the frost population; t1 is a random number in the interval (-1, 1) that controls the direction of particle movement; cosθ changes with the number of iterations; β is an environmental factor that simulates the influence of the external environment with the number of iterations to ensure the convergence of the algorithm; h is the degree of adhesion, which is a random number in the interval (0, 1) and is used to control the distance between the centers of two frost particles; [·] indicates rounding; Ub ij and Lb ij are the upper and lower bounds of the particle motion space respectively; r2 is a random number within a range, which controls the particle position update together with E; E is the adhesion coefficient, which affects the probability of particle condensation and increases with the increase of the number of iterations; t is the current iteration number, T is the maximum number of iterations of the algorithm; w is a constant term.
[0023] Preferably, in step S3), under strong wind conditions, the growth of hard frost is simpler and more regular, but because the growth direction is the same, the frost ice is easy to cross each other, resulting in frost ice puncture phenomenon. By simulating the puncture phenomenon, the hard frost puncture mechanism is obtained, which is specifically expressed as follows:
[0024]
[0025] In the formula, is the position of the frost particles after the update, R best,j is the best frost particle in the frost population; t3 is a random number in the interval (-1, 1); F normr (S i ) is the normalized value of the current frost particle fitness; S i Represents the current i-th frost particle.
[0026] Preferably, in step S3), an active greedy selection mechanism is proposed to participate in the population update, and the fitness value of the frost particle after the update is compared with the fitness value before the update. If the updated fitness value is better than the value before the update, a replacement operation is performed to replace the positions of the two frost particles at the same time, ensuring that the population evolves in a better direction in each iteration.
[0027] The beneficial effects of the present invention are:
[0028] 1. The present invention integrates the BoTNet module, BiFPN network and frost optimization algorithm into the YOLO model to obtain the YOLO-BBR segmentation model, so that the model improves the ability to extract local information and reduces parameters, thereby minimizing the delay. The model integrates features of different scales and improves the expression of image features, which is more conducive to the model to segment images;
[0029] 2. The present invention uses the frost optimization algorithm to avoid changing the model network structure, and uses the swarm intelligence optimization iterative mechanism to quickly converge and obtain the most optimal hyperparameter combination, thereby improving model performance and solving the problem of manual parameter adjustment relying too much on experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 It is a schematic diagram of the process of the present invention;
[0031] Figure 2 A schematic diagram of the framework of the YOLO-BBR segmentation model constructed by the present invention;
[0032] Figure 3 Schematic diagram of the framework of the multi-head attention layer MHSA of the present invention;
[0033] Figure 4 Schematic diagram of the framework of the BiFPN network of the present invention;
[0034] Figure 5 It is a schematic diagram of the framework of the soft cream search strategy of the present invention;
[0035] Figure 6 It is a schematic diagram of the framework of the hard frost puncture mechanism of the present invention;
[0036] Figure 7 It is a thermal comparison diagram of the model segmentation image in an embodiment of the present invention. DETAILED DESCRIPTION
[0037] The specific implementation of the present invention will be further described below in conjunction with the accompanying drawings:
[0038] like Figure 1 As shown in FIG. 1 , the citrus tree canopy edge segmentation method based on YOLO-BBR includes the following steps:
[0039] S1), construct a citrus canopy dataset, expand and annotate the dataset, and then divide it into a training set and a validation set;
[0040] In this embodiment, the citrus trees are collected in a natural environment using a drone-mounted camera. Considering that the height of the citrus trees is about 2.5 meters, to ensure that each image can capture the complete crown of the target tree, the drone is 10 meters above the ground of the orchard, and the camera shoots vertically downward at 90°, thereby constructing a citrus tree canopy dataset, and the citrus tree canopy dataset is expanded using brightness adjustment, Gaussian blur, and salt and pepper noise; then the ISAT withsegment anything interactive semi-automatic image annotation tool is used to annotate the expanded citrus tree canopy dataset, and the annotated citrus tree canopy dataset is divided into a training set and a validation set in a ratio of 8:2.
[0041] S2), build a YOLO-BBR segmentation model;
[0042] like Figure 2 As shown, the construction of the YOLO-BBR segmentation model described in this embodiment includes:
[0043] First, based on the YOLOv8-seg model, the BoTNet module was added to the backbone network of the YOLOv8-seg model;
[0044] Secondly, the weighted bidirectional feature pyramid network BiFPN is integrated into the head part network of the Head task of the YOLOv8-seg model.
[0045] In this embodiment, the backbone network Backbone of the YOLO-BBR segmentation model includes an input layer input, multiple convolutional layers Conv, multiple C2f modules, a SPFF module, and a BoTNet module; the specific process is:
[0046] First, the input image passes through the initial convolutional layer Conv of the backbone network. The convolutional layer Conv gradually extracts low-level features in the image through convolution operations, activation functions, and possible pooling operations. These features are transmitted layer by layer in the form of feature maps.
[0047] Next, the feature map goes through four repeated convolutional layer Conv-C2f module steps. The C2f module is a feature fusion module that receives the feature map from the convolution layer and further extracts deep features in the image by fusing information across channels and scales. The design of the C2f module aims to enhance the model's ability to process complex information in the image and improve the expressiveness and robustness of the features.
[0048] The processed feature map continues to be passed down through the SPFF module. The SPFF module divides the feature map into grids of different scales through spatial pyramid pooling operations and performs pooling operations within each grid. This operation can capture multi-scale information in the feature map and further enhance the model's ability to detect objects of different sizes in the image. The feature map output by the SPFF module has stronger scale invariance and robustness. At the end of the backbone network, the BoTNet module is added. The BoTNet module is a backbone architecture that combines the self-attention mechanism and the convolutional neural network. It captures global information by replacing the spatial convolution layer with a global self-attention layer in the last few bottleneck blocks of ResNet.
[0049] The framework of BoTNeT is shown in Table 1. The design of the BoTNeT module is to replace the last three spatial (3×3) convolutions in ResNet with a multi-head self-attention layer MHSA. Figure 3As shown in Table 2, the framework of ResNet implements global self-attention on 2D feature maps. The BoTNeT module consists of five stages, called [c1, c2, c3, c4, c5], where [c2, c3, c4] consists of multiple bottleneck blocks with residual connections. In the c5 stage, the last three spatial (3×3) convolutions in ResNet are replaced with a multi-head self-attention layer MHSA, which forms the basis of the BoTNeT module. First, the input feature map enters the c1 stage, 64 convolution kernels of size 7×7 and stride 2, and outputs a feature image of size 512×512. Then it enters the c2 stage, passes through a 3×3 maximum pooling layer with a stride of 2, and then passes through three bottleneck blocks of the same size, including 64 convolutions of size 1×1, 64 3×3 and 256 1×1, and the output feature map size is 256×256. Then it enters the c3 stage, passes through four bottleneck blocks of the same size, including 128 convolutions of size 1×1, 12 8 3×3 and 512 1×1 convolutions, the output feature map size is 128×128, and then enters the c4 stage, after six bottleneck blocks of the same size, including 256 1×1, 256 3×3 and 1024 1×1 convolutions, the output feature map size is 64×64, and finally passes through the c5 stage, after three bottleneck blocks of the same size, including 512 1×1, 512 MHSA layers and 512 1×1 convolutions, the output feature map size is 32×32.
[0050] Table 1 Framework parameters of BoTNeT
[0051]
[0052]
[0053] Table 2 ResNet framework parameters
[0054]
[0055]
[0056] The Head task head part network of the YOLO-BBR segmentation model includes multiple upsampling modules Upsample, multiple C2f modules, a weighted bidirectional feature pyramid network BiFPN, and a convolutional layer Conv.
[0057] After the backbone network, it enters the task head network. The detailed processing process is: first, it passes through the upsampling module to improve the resolution of the feature map so that it is consistent with the subsequent feature map in size, which is convenient for subsequent feature fusion and segmentation tasks. Then it passes through the BiFPN module. BiFPN introduces bidirectional connections between adjacent levels of the feature pyramid, which means that information can flow from higher-level features to lower-level features (top-down path), or from lower-level features to higher-level features (bottom-up path). This bidirectional connection helps to integrate information from different levels of the feature pyramid in two directions, so as to more effectively capture multi-scale features; BiFPN also adopts a weighted feature fusion mechanism to combine features at different levels. The fusion weights are learned during the training process to ensure the best feature integration. This mechanism enables BiFPN to better adapt to objects of different sizes and complexities and improve the effect of target detection. Then it enters the C2f module. The C2f module is usually a feature extraction network composed of one or more convolutional layers, which is used to further extract and transform feature maps. This module can extract deeper feature information and provide more powerful support for subsequent detection tasks. Finally, after some convolutional layer modules, the feature map is further extracted.
[0058] The idea of the BiFPN module is actually based on the idea of path-enhanced FPN (PANet), which is to fuse the top-down features followed by the bottom-up features. BiFPN deletes nodes with only one input edge, and adds an extra edge between the original input node and the output node in the same layer. Finally, each bidirectional path (top-down and bottom-up) is treated as a feature network layer, and the same layer is repeated multiple times to achieve higher-level feature fusion. The framework of BiFPN is as follows: Figure 4 As shown in Figure 2, there are five feature input layers, P3-P7, in the BiFPN module. in Indicates that the resolution of the input image is 1 / 2 i The operations between the layers are introduced by taking the sixth layer P6 as an example:
[0059]
[0060] in, is the intermediate feature of the sixth layer of the top-down path, is the output feature of the 6th layer of the bottom-up path; is the input feature of the sixth layer; w irepresents the i-th learnable weight, which can be a scalar (per feature), a vector (per channel), or a multidimensional tensor; ∈ = 0.0001, which is a small quantity that ensures numerical stability. The remaining feature layers are operated in the same way.
[0061] In this embodiment, the BoTNet module introduces a multi-head attention layer MHSA. The BoTNet module uses convolution operations to learn abstract and low-resolution features from a large number of pictures, and uses the multi-head attention layer MHSA to process and aggregate the information contained in the feature maps captured by convolution, effectively processing large images, and performing spatial downsampling through convolution, so that attention works at a smaller resolution.
[0062] like Figure 3 As shown, the multi-head attention layer MHSA focuses on a 2D feature map, and the relative positions of height and width are encoded as R h and R w .W V , W K , W Q are matrices from the same input, W, H, and d represent the width, height, and length of the matrix respectively. The attention logic is qk T +qr T , where q, k, and r represent query code, key code, and position code, respectively. and They represent element-wise summation and matrix multiplication, respectively, while 1×1 represents point-wise convolution. With the use of multiple heads, the highlighted dashed boxes (position encoding and value projection) are the only three elements that are not present in the non-local layer.
[0063] In this embodiment, Figure 4 As shown, the weighted bidirectional feature pyramid network BiFPN allows information between features of different scales to flow and fuse more effectively by establishing bidirectional connections between top-down and bottom-up paths; by deleting nodes with only one input edge, adding additional edges between input and output nodes at the same level, and treating each bidirectional path as a feature network layer and repeating it multiple times to achieve more advanced feature fusion, optimizing cross-scale connections introduces learnable weights to determine the importance of different input features, thereby improving the effect of feature fusion.
[0064] Specifically, the main idea of the weighted bidirectional feature pyramid network BiFPN is efficient bidirectional cross-scale connection and weighted feature fusion. After the top-down feature fusion, it is followed by another bottom-up fusion. First, BiFPN removes nodes with only one input edge. Second, if the original input and output nodes are at the same level, an extra edge is added between the original input and output nodes to fuse more features without adding too much cost. Third, unlike PANet, which has only one top-down and one bottom-up path, BiFPN treats each bidirectional (top-down and bottom-up) path as a feature network layer and repeats the same layer multiple times to achieve more advanced feature fusion.
[0065] The weighted bidirectional feature pyramid network BiFPN adds an additional weight to each input through a fast normalization fusion method, and allows the network to learn the importance of each input feature. These weights are learnable, specifically:
[0066]
[0067] Where O represents the fused image or dataset; w i represents the i-th learnable weight, which can be a scalar (per feature), a vector (per channel), or a multidimensional tensor; by j Do ReLU operation to ensure w j ≥0;∈=0.0001, which is a small amount to ensure numerical stability; I i Represents the i-th normalized image or dataset.
[0068] By i Then apply a Relu activation function to ensure that w i is greater than or equal to 0, and ∈ is equal to 0.0001 to avoid numerical instability.
[0069] S3) Use the training set to train the YOLO-BBR segmentation model. During the training process, use the frost optimization algorithm RIME to optimize the hyperparameters of the YOLO-BBR segmentation model, and use the swarm intelligence optimization iterative mechanism to quickly converge and obtain the most effective hyperparameter combination;
[0070] In this embodiment, the frost and ice optimization algorithm RIME searches by simulating the movement of soft frost particles and the puncture behavior between hard frost particles. The frost and ice optimization algorithm RIME can quickly cover the entire search space and avoid falling into a local optimal solution.
[0071] First, in a breeze environment, the growth of soft frost is highly random, so that frost particles can freely cover the surface of the object, but the growth speed in the same direction is slow. By simulating the motion characteristics of soft frost, a soft frost search strategy is obtained, which can quickly cover the entire search space and avoid falling into the local optimal solution, such as Figure 5 As shown, Figure 5 In the figure, the blue balls represent different soft frost particles, and the colors range from light to dark, indicating the movement routes of the frost particles. D1, D2, D3, and D4 represent different groups of soft frost particles.
[0072] The soft cream search strategy is specifically expressed as follows:
[0073]
[0074] In the formula, is the position of the frost particles after the update, R best,j is the best frost particle in the frost population; r1 is a random number in the interval (-1, 1) that controls the direction of particle movement; cosθ changes with the number of iterations; β is an environmental factor that simulates the influence of the external environment with the number of iterations to ensure the convergence of the algorithm; h is the degree of adhesion, which is a random number in the interval (0, 1) and is used to control the distance between the centers of two frost particles; [·] indicates rounding; Ub ij and Lb ij are the upper and lower bounds of the particle motion space respectively; r2 is a random number within a range, which controls the particle position update together with E; E is the adhesion coefficient, which affects the probability of particle condensation and increases with the increase of the number of iterations; t is the current iteration number, T is the maximum number of iterations of the algorithm; the value of w is 5.
[0075] Secondly, under strong wind conditions, the growth of hard frost is simpler and more regular, but because the growth direction is the same, the frosts are easy to cross each other, resulting in frost puncture. By simulating the puncture phenomenon, the hard frost puncture mechanism is obtained to improve the convergence of the algorithm and the ability to jump out of the local optimum, such as Figure 6 As shown, Figure 6 In the figure, blue balls represent different hard frost particles. D1, D2, D3, and D4 represent different groups of soft frost particles. The hard frost puncture mechanism is specifically expressed as:
[0076]
[0077] In the formula, is the position of the frost particles after the update, R best,j is the best frost particle in the frost population; r3 is a random number in the interval (-1, 1); F normr (S i ) is the normalized value of the current frost particle fitness; Si Represents the current i-th frost particle.
[0078] Finally, an active greedy selection mechanism participating in population update is proposed to compare the fitness value of the frost particle after update with the fitness value before update. If the updated fitness value is better than the value before update, a replacement operation is performed to replace the positions of the two frost particles at the same time, ensuring that the population evolves in a better direction in each iteration.
[0079] In this embodiment, the hyperparameter optimization of the YOLO-BBR segmentation model based on the frost optimization algorithm RIME specifically includes the following steps:
[0080] S31), Initialization parameters and population: Set algorithm-related parameters, including population number popnum, maximum number of iterations T, upper and lower bounds of hyperparameters Ub and Ul, initialize population position, and each individual represents a set of hyperparameters;
[0081] S32), each frost particle in the population updates its position information, and the number of updates is t=t+1;
[0082] S33), fitness update: compare the updated fitness value of each frost particle with the value before the update, record the optimal fitness value, and record the current optimal particle;
[0083] S34), when the algorithm termination condition is met, the optimized hyperparameters are used to train the YOLO-BBR segmentation model to obtain the final YOLO-BBR segmentation model.
[0084] S4) Use the validation set to verify the trained YOLO-BBR segmentation model.
[0085] Example 2
[0086] This embodiment provides a citrus tree canopy edge segmentation method based on YOLO-BBR, including:
[0087] Data collection module, used to collect citrus tree canopy data sets;
[0088] In this embodiment, the data acquisition module uses the drone-mounted camera to collect data from citrus trees in a natural environment. Considering that the height of citrus trees is about 2.5 meters, to ensure that each image can capture the complete crown of the target fruit tree, the drone is 10 meters above the ground of the orchard, and the camera shoots vertically downward at 90°, thereby constructing a citrus tree canopy dataset.
[0089] A data preprocessing module, used for preprocessing the citrus canopy dataset and dividing the preprocessed citrus canopy dataset into a training set and a test set;
[0090] The preprocessing of the citrus canopy dataset includes: expanding the citrus canopy dataset using brightness adjustment, Gaussian blur, and salt and pepper noise; then using the ISAT with segment anything interactive semi-automatic image annotation tool to annotate the expanded citrus canopy dataset. The label file is in json format, and code is written to convert the json format label file into a txt format annotation file. The annotated dataset is divided into training set and validation set in a ratio of 8:2.
[0091] The citrus canopy edge segmentation module is used to segment the citrus canopy using the YOLO-BBR segmentation model;
[0092] The YOLO-BBR model is based on the YOLOv8-seg model, adds a BoTNet module to the backbone network, and integrates the weighted bidirectional feature pyramid network BiFPN in the head task head network.
[0093] The BoTNet module combines the self-attention mechanism to model long-distance dependencies in images, which is crucial for tasks such as object detection and image segmentation. At the same time, by introducing the global multi-head self-attention (MHSA) layer, the BoTNet module can capture global information and improve the accuracy of the model. The BiFPN module enhances the information exchange between features at different levels by introducing a bidirectional feature fusion mechanism, enabling the model to better handle objects of different sizes and complexities. In addition, BiFPN also ensures optimal feature integration through weighted feature fusion, further improving the accuracy of object detection. These advantages enable the YOLOv8n-seg model to better capture the boundaries and details of the target in the segmentation task, thereby improving the segmentation performance.
[0094] During the training of the citrus canopy edge segmentation model, the frost optimization algorithm RIME was used to optimize the hyperparameters of the YOLO-BBR segmentation model, and the swarm intelligence optimization iterative mechanism was used to quickly converge and obtain the most effective hyperparameter combination.
[0095] In this embodiment, the YOLO-BRR model is based on a deep learning segmentation framework, which uses the pytorch1.13.0 framework and is supported by a powerful Intel Core i9-10900K CPU and NVIDIA GeForce RTX 3080 GPU to achieve efficient deep learning training. During the training process, moderate Epochs and Batch Size settings are used, combined with a flexible early stopping strategy, which not only ensures that the model is fully trained, but also effectively avoids the occurrence of overfitting, saving valuable computing resources.
[0096] In this embodiment, the trained YOLO-BBR model is tested using the validation set, and typical evaluation indicators are used to verify the performance of the target segmentation model, including precision (P), recall (R), average precision (AP), and mean average precision (mAP). The calculation formula is as follows:
[0097]
[0098] Among them, TP is true positive, which is the number of true positive samples, FP is false positive, which is the number of false positive samples, and FN is false negative, which is the number of false negative samples. AP is the area under the PR curve, and mAP is the average AP in different categories. In this study, the citrus canopy is 1 category, and the value of n is 1.
[0099] To further analyze the segmentation performance of the YOLO-BBR model, the specific results are as follows: before the improvement, the precision P was 81.71%, the recall rate R was 87.77%, the mAP@0.5 value was 91.23%, and the mAP@0.5:0.95 value was 62.36%; after the improvement, the precision P was 86.34%, the recall rate R was 88.68%, the mAP@0.5 value was 93.41%, and the mAP@0.5:0.95 value was 63.13%. The results show that the model has improved in terms of precision, recall rate, and mean average precision compared with the model before the improvement. The model's precision has increased by 5.67%, the recall rate has increased by 1.04%, the mAP@0.5 value has increased by 2.72%, and the mAP@0.5:0.95 value has increased by 1.23%.
[0100] In order to further explore the segmentation advantages of the YOLO-BBR model in complex scenarios, this embodiment uses the Grad CAM technology to generate a heat map, such as Figure 7 As shown. In the presentation of the heat map, the color value of the data point or area directly maps the data density or the specific value they represent. Specifically, the color changes from cold tones (such as blue) to warm tones (such as red) to express the data density or value size from low to high, so that the hot spots (high value areas) and cold spots (low value areas) of the data distribution can be quickly identified. From the figure below, it can be observed that the YOLO-BBR model can maintain high stability and consistency when processing tree crowns of different densities and shapes, and can accurately segment.
[0101] The above embodiments and descriptions are only for illustrating the principles and best embodiments of the present invention. Without departing from the spirit and scope of the present invention, the present invention may be subject to various changes and improvements, all of which fall within the scope of the present invention to be protected.
Claims
1. A citrus tree canopy edge segmentation method based on YOLO-BBR, characterized in that: The steps include: S1), constructing a citrus tree canopy dataset; S2), build a YOLO-BBR segmentation model; S3), training the YOLO-BBR segmentation model. During the training process, the frost optimization algorithm RIME is used to optimize the hyper parameters of the YOLO-BBR segmentation model; S4) Verify the trained YOLO-BBR segmentation model.
2. The citrus canopy edge segmentation method based on YOLO-BBR according to claim 1, characterized in that: The construction of the YOLO-BBR segmentation model includes: First, based on the YOLOv8-seg model, the BoTNet module was added to the backbone network of the YOLOv8-seg model; Secondly, the weighted bidirectional feature pyramid network BiFPN is integrated into the head part network of the Head task of the YOLOv8-seg model.
3. The citrus canopy edge segmentation method based on YOLO-BBR according to claim 2, characterized in that: In step S2), the BoTNet module introduces a multi-head attention layer MHSA, and the BoTNet module uses convolution operations to learn abstract and low-resolution features from a large number of images, and uses the multi-head attention layer MHSA to process and aggregate the information contained in the feature maps captured by the convolution.
4. The citrus canopy edge segmentation method based on YOLO-BBR according to claim 2, characterized in that: In step S2), the weighted bidirectional feature pyramid network BiFPN establishes a bidirectional connection between the top-down and bottom-up paths through a bidirectional cross-scale connection and a weighted feature fusion mechanism, allowing information between features of different scales to flow and fuse more effectively.
5. The citrus tree canopy edge segmentation method based on YOLO-BBR according to claim 4, characterized in that: In step S2), first, the weighted bidirectional feature pyramid network BiFPN is constructed by deleting nodes with only one input edge; Second, if the original input and output nodes are at the same level, an extra edge is added between the original input and output nodes; Third, each bidirectional path is regarded as a feature network layer and repeated multiple times to achieve more advanced feature fusion. The optimized cross-scale connections introduce learnable weights to determine the importance of different input features, thereby improving the effect of feature fusion.
6. The citrus tree canopy edge segmentation method based on YOLO-BBR according to claim 5, characterized in that: In step S2), the weighted bidirectional feature pyramid network BiFPN adds an additional weight to each input through a fast normalization fusion method, and allows the network to learn the importance of each input feature, that is: Where O represents the fused image or dataset; w i Represents the i-th learnable weight; by j Do ReLU operation to ensure w j ≥0;∈ is a small quantity that ensures numerical stability; I i Represents the i-th normalized image or dataset.
7. The citrus tree canopy edge segmentation method based on YOLO-BBR according to claim 1, characterized in that: In step S3), the frost optimization algorithm RIME searches by simulating the movement of soft frost particles and the puncture behavior between hard frost particles. The frost optimization algorithm RIME can quickly cover the entire search space and avoid falling into a local optimal solution.
8. The citrus tree canopy edge segmentation method based on YOLO-BBR according to claim 7, characterized in that: In step S3), in a breeze environment, the growth of soft frost has strong randomness, so that frost particles can freely cover the surface of the object, but the growth speed in the same direction is slow. The soft frost search strategy is obtained by simulating the motion characteristics of the soft frost, which is specifically expressed as: In the formula, is the position of the frost particles after the update, R best,j is the best frost particle in the frost population; r1 is a random number in the interval (-1, 1) that controls the direction of particle movement; cosθ changes with the number of iterations; β is an environmental factor that simulates the influence of the external environment with the number of iterations to ensure the convergence of the algorithm; h is the degree of adhesion, which is a random number in the interval (0, 1) and is used to control the distance between the centers of two frost particles; [·] indicates rounding; Ub ij and Lb ij are the upper and lower bounds of the particle motion space respectively; r2 is a random number within a range, which controls the particle position update together with E; E is the adhesion coefficient, which affects the probability of particle condensation and increases with the increase of the number of iterations; t is the current iteration number, T is the maximum number of iterations of the algorithm; w is a constant term.
9. The citrus tree canopy edge segmentation method based on YOLO-BBR according to claim 8, characterized in that: In step S3), under strong wind conditions, the growth of hard frost is simpler and more regular, but because the growth direction is the same, the frost ice is easy to cross each other, and the frost ice puncture phenomenon occurs. By simulating the puncture phenomenon, the hard frost puncture mechanism is obtained, which is specifically expressed as follows: In the formula, is the position of the frost particles after the update, R best,j is the best frost particle in the frost population; r3 is a random number in the interval (-1, 1); F normr (S i ) is the normalized value of the current frost particle fitness; S i Represents the current i-th frost particle.
10. The citrus tree canopy edge segmentation method based on YOLO-BBR according to claim 9, characterized in that: In step S3), the updated fitness value of the frost particle is finally compared with the fitness value before the update through the active greedy selection mechanism participating in the population update. If the updated fitness value is better than the value before the update, the replacement operation is performed to replace the positions of the two frost particles at the same time, ensuring that the population evolves in a better direction in each iteration.
Citation Information
Cited By
Intelligent segmentation model and system for natural fractures of tight sandstone core
CN120147649A
Litchi tree canopy segmentation method fusing FasterNet and BiFPN
CN121685957A