Dormant period walnut tree branch segmentation and pruning point positioning method based on improved YOLO11 and agronomic rules
By improving the combination of the YOLO11 model and agronomic rules, the problems of accuracy and computational cost in walnut tree branch segmentation and pruning point positioning were solved, enabling precise, efficient, and standardized pruning of dormant walnut trees and improving the model's adaptability and agronomic compliance in small sample target domains.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SOUTHWEST FORESTRY UNIVERSITY
- Filing Date
- 2026-04-27
- Publication Date
- 2026-07-21
AI Technical Summary
Existing technologies for walnut tree branch segmentation and pruning point positioning suffer from insufficient segmentation accuracy, high computational overhead, and difficulty in achieving standardized pruning. In particular, under the complex background of dormant walnut trees, conventional models are unable to meet the requirements of accuracy, speed, and agronomic compliance.
An improved YOLO11 model is adopted, combined with the SDFM feature fusion module and the LiteSeg lightweight segmentation head. Through transfer learning and agronomic rules, branch segmentation and pruning point localization are achieved, including dataset construction, model improvement, transfer learning training, branch mask optimization and skeleton extraction, tree structure analysis and pruning point localization.
It improves segmentation accuracy, reduces computational overhead, adapts to orchard equipment, achieves accurate trunk identification and high consistency of pruning points, adapts to small sample target domains, and meets the needs of precise, efficient, and standardized pruning of dormant walnut trees.
Smart Images

Figure CN122435451A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of smart agriculture technology, and more specifically to a method for dividing dormant walnut tree branches and pruning points based on improved YOLO11 and agronomic rules. Background Technology
[0002] Dormant pruning is a key agronomic measure for improving the quality and efficiency of walnut trees, as it can optimize tree structure, increase fruit set rate, and extend economic lifespan. Traditional pruning relies heavily on manual experience, resulting in low efficiency, inconsistent standards, and the risk of errors or omissions, making it difficult to meet the needs of large-scale, standardized orchard management.
[0003] With the development of smart agriculture, fruit tree perception and pruning decisions based on machine vision have become a research hotspot. Existing branch segmentation methods mostly use models such as U-Net, Mask R-CNN, and YOLOv8-seg, which have shortcomings in terms of thin branch preservation, branch separation, robustness to complex backgrounds, and lightweight deployment. At the same time, most studies only stay at the level of visual perception and fail to transform walnut tree agronomical pruning specifications into computable rules, making it difficult to directly output stable and implementable pruning point location results.
[0004] To address the challenges of dormant walnut trees, such as slender branches, weak texture, dense branching, complex orchard backgrounds, and small target domain sample size, the conventional YOLO11n-seg model suffers from drawbacks including missed detection of fine branches, discontinuous boundaries, and high computational costs. Furthermore, it lacks a complete technical chain from branch segmentation and structural analysis to pruning point decision-making. Therefore, there is an urgent need for an intelligent branch segmentation and pruning point location method that balances accuracy, speed, and agronomic compliance to achieve precise, efficient, and standardized pruning support decisions for dormant walnut trees.
[0005] Therefore, proposing a method for dividing dormant walnut tree branches and pruning points based on an improved YOLO11 and agronomic rules to address the difficulties in existing technologies is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0006] In view of this, the present invention provides a method for dividing dormant walnut tree branches and pruning points based on improved YOLO11 and agronomic rules, in order to solve the technical problems existing in the prior art.
[0007] To achieve the above objectives, the present invention provides the following technical solution: A method for dividing dormant walnut tree branches and pruning points based on improved YOLO 11 and agronomic rules includes the following steps: S1. Constructing the dataset: Collect images of trees on city streets as source domain data, and collect images of dormant walnut trees in Yunnan as target domain data. Label the branches and trunks of the two types of data and divide them into training set, validation set and test set according to the proportion. S2. Improved YOLO11n-seg model construction: Using YOLO11n-seg as the baseline model, an SDFM feature fusion module is introduced at the Neck end, and a LiteSeg lightweight segmentation head is used at the Head end to obtain the YOLO11n-SDFM-LiteSeg segmentation model. S3. Transfer learning training: The YOLO11n-SDFM-LiteSeg segmentation model is pre-trained using source domain data to obtain the optimal pre-training weights, and then the weights are loaded into the target domain data for single-stage end-to-end fine-tuning. S4. Branch Mask Optimization and Skeleton Extraction: The branch mask output by the YOLO11n-SDFM-LiteSeg segmentation model is subjected to small area noise removal, maximum connected component extraction, candidate branch segment screening, minimum spanning tree (MST) bridging repair in sequence. Then, the optimized mask is skeletonized to obtain a single-pixel wide branch skeleton. S5. Tree structure analysis: Extract the trunk and main branches based on the branch skeleton, establish the main branch coordinate system, and complete the branch posture modeling and mounting characterization. S6. Pruning Point Location: Based on agronomic rules, filter out overly vigorous branches, drooping / horizontal extension branches, and overly dense fruiting branches, and output the coordinates of the corresponding pruning points.
[0008] Optionally, the SDFM feature fusion module in S2 operates as follows: The YOLO11 Neck uses the SDFM feature fusion module at three scales (P3, P4, P5) to integrate the Backbone side-connected features and the Neck's top-down fused features at the same scale as two inputs. The fusion weights are generated through global average pooling, pointwise convolution, and Sigmoid gating, and the two input features are adaptively weighted and fused according to channel and spatial dimensions.
[0009] Optionally, the LiteSeg lightweight segmentation head in S2 can be constructed as follows: The segmentation head detection branch incorporates a lightweight feature integration unit, STEM, consisting of two layers of 3×3 grouped convolutions. It employs a dynamic grouping strategy to group the input channels according to C... in / / 16 is divided into groups, and 1×1 convolutions are used to output regression and classification terms respectively. The splitting branch retains the Proto prototype branch and the mask coefficient prediction branch.
[0010] Optionally, the single-stage end-to-end fine-tuning in S3 is as follows: The model is initialized with the optimal weights pre-trained in the source domain, the network is unfrozen throughout the process, and end-to-end joint optimization training is performed on the target domain data.
[0011] Optionally, the steps for minimum spanning tree (MST) bridging repair in S4 are as follows: Morphological expansion is performed based on the largest connected region to construct a reliable corridor. Skeletonize the candidate branch segments and extract the endpoints, then estimate the local tangential orientation of the endpoints. Two types of candidate edges are generated: endpoint-main skeleton point and endpoint-endpoint. Distance threshold, direction cosine similarity and corridor coverage ratio constraints are applied. The candidate edge weights are calculated based on the comprehensive cost function, and the global MST is solved using the Kruskal algorithm. The minimum cost bridging edge is selected to complete the mask breakage repair.
[0012] Optionally, the steps for trunk extraction in S5 are as follows: The point with the largest y-coordinate in the skeleton endpoint set is taken as the starting point of the main trunk; The candidate axes for the main trunk are selected based on the scoring function, which prioritizes paths with large upward gain, small lateral offset, and few detours. Scan upwards along the main axis, and set the connection points in the neighborhood where large branches that meet the size threshold are the termination points of the main axis to complete the extraction of the main axis.
[0013] Optionally, the main branch extraction steps in S5 are as follows: The Y node with 3 exits is detected by 8-neighbor traversal of the skeleton graph, and the root Y node is located at the base of the trunk. Construct a candidate graph consisting of YY branches, and use Dijkstra's algorithm to build a shortest path tree with the root Y node as the source node, retaining the set of parent edges to obtain the main branch skeleton; Number the main branch skeleton by side, sort the skeleton pixels along the direction from the end near the trunk to the far end, and establish the hierarchical identifier of the main branch segment.
[0014] Optionally, the steps for result branch attitude modeling and mounting characterization in S5 are as follows: The attitude is represented by the first and last vectors of the branch segment, the orientation angle of the branch segment is calculated, and the angle is determined by the difference of the circumferential angle. Centered on the nearest support endpoint of the result branch, search for the nearest main branch skeleton pixel within a fixed radius, and set the main branch segment level identifier corresponding to the pixel as the result branch mounting identifier.
[0015] Optionally, the steps for locating pruning points according to agronomic rules are as follows: Short branch elimination: Calculate the average length of effective fruiting branches and remove fruiting branches whose length is lower than the average; Pruning of vigorous shoots: A branch segment whose length is greater than the average length of the main branch and has no subsequent branches is considered a vigorous shoot. The pruning point is taken at the position of the average length of the main branch near the support end. Drooping / Horizontal Extension Branch Retraction: Branch segments with a direction angle between 0° and 180° are classified as drooping branches, and branch segments with a difference of less than 5° from the horizontal direction angle are classified as horizontal extension branches. The near support endpoints of the two types of branch segments are set as retraction points. Thinning of overly dense fruiting branches: Calculate the average load density of the whole tree. When the density is greater than or equal to 3, thin out the fruiting branches of the overly dense main branches according to the priority of being closer to vertical and then the length of the branches from small to large.
[0016] As can be seen from the above technical solution, compared with the prior art, the present invention discloses a method for segmenting dormant walnut tree branches and pruning points based on improved YOLO11 and agronomic rules, the beneficial effects of which are: 1) Improved segmentation accuracy: The SDFM module enhances the representation of fine branches and bifurcation details, with a significant improvement in mAP75 compared to the baseline, and more continuous mask boundaries; 2) Lightweight and easy to deploy: The LiteSeg segmentation head reduces computational overhead, resulting in a small model size, fast inference speed, and compatibility with orchard end-side devices; 3) Strong small sample size adaptation: Cross-domain transfer learning effectively utilizes source domain data with similar morphology to improve the generalization ability of the target domain; 4) Agronomic compliance and reliability: It integrates the standard pruning rules for walnut dormancy, with a 100% accuracy rate in identifying the main stem and a high degree of consistency between the pruning point location and expert advice. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0018] Figure 1 A flowchart of the method for segmenting dormant walnut tree branches and pruning points based on improved YOLO11 and agronomic rules provided by the present invention; Figure 2 The improved YOLO11n-SDFM-LiteSeg model structure diagram provided by this invention; Figure 3 The structure diagram of the SDFM feature fusion module provided by this invention; Figure 4 This is a structural diagram of the seg-efficient module provided by the present invention; Figure 5The process visualization diagram of mask optimization, MST bridging repair and skeleton extraction provided by the present invention; wherein, (a) input segmentation mask; (b) the largest connected component as the main seed (pink area); (c) the reliable corridor obtained based on seed dilation (green semi-transparent area); (d) the candidate branch components (cyan) selected and retained; (e) the selected bridging edge of MST obtained by Kruskal solution (red line); (f) skeleton extraction effect; Figure 6 A visualization of the backbone extraction results provided by this invention; Figure 7 The visualization diagram of the main branch extraction process provided by the present invention includes: (a) Y node detection and root Y node location (purple dot); (b) candidate Y-Y connection edges (cyan skeleton); and (c) the set of main branch edges retained by the shortest path tree (pink skeleton). Figure 8 This is a schematic diagram of the basic tree shape pruning with a layered trunk provided by the present invention. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] See Figure 1 As shown, this invention discloses a method for segmenting dormant walnut tree branches and pruning points based on improved YOLO 11 and agronomic rules, including the following steps: S1. Constructing the dataset: Collect images of trees on city streets as source domain data, and collect images of dormant walnut trees in Yunnan as target domain data. Label the branches and trunks of the two types of data and divide them into training set, validation set and test set according to the proportion. S2. Improved YOLO11n-seg model construction: Using YOLO11n-seg as the baseline model, an SDFM feature fusion module is introduced at the Neck end, and a LiteSeg lightweight segmentation head is used at the Head end to obtain the YOLO11n-SDFM-LiteSeg segmentation model. S3. Transfer learning training: The YOLO11n-SDFM-LiteSeg segmentation model is pre-trained using source domain data to obtain the optimal pre-training weights, and then the weights are loaded into the target domain data for single-stage end-to-end fine-tuning. S4. Branch Mask Optimization and Skeleton Extraction: The branch mask output by the YOLO11n-SDFM-LiteSeg segmentation model is subjected to small area noise removal, maximum connected component extraction, candidate branch segment screening, minimum spanning tree (MST) bridging repair in sequence. Then, the optimized mask is skeletonized to obtain a single-pixel wide branch skeleton. Specifically, the YOLO11n-SDFM-LiteSeg model: First, it introduces an SDFM feature fusion module at the Neck end to enhance cross-layer interaction between shallow details and deep semantics, thereby improving the model's ability to represent fine branches and bifurcation regions; second, it adopts the LiteSeg lightweight segmentation head at the Head end to reduce redundant computation in detection and segmentation branches, thereby improving the model's applicability in edge deployment scenarios.
[0021] S5. Tree structure analysis: Extract the trunk and main branches based on the branch skeleton, establish the main branch coordinate system, and complete the branch posture modeling and mounting characterization. S6. Pruning Point Location: Based on agronomic rules, filter out overly vigorous branches, drooping / horizontal extension branches, and overly dense fruiting branches, and output the coordinates of the corresponding pruning points.
[0022] Furthermore, the SDFM feature fusion module in S2 operates as follows: The YOLO11 Neck uses the SDFM feature fusion module at three scales (P3, P4, P5) to integrate the Backbone side-connected features and the Neck's top-down fused features at the same scale as two inputs. The fusion weights are generated through global average pooling, pointwise convolution, and Sigmoid gating, and the two input features are adaptively weighted and fused according to channel and spatial dimensions.
[0023] Furthermore, the LiteSeg lightweight segmentation head in S2 is constructed as follows: The segmentation head detection branch incorporates a lightweight feature integration unit, STEM, consisting of two layers of 3×3 grouped convolutions. It employs a dynamic grouping strategy to group the input channels according to C... in / / 16 is divided into groups, and 1×1 convolutions are used to output regression and classification terms respectively. The splitting branch retains the Proto prototype branch and the mask coefficient prediction branch.
[0024] Furthermore, the single-stage end-to-end fine-tuning in S3 is as follows: The model is initialized with the optimal weights pre-trained in the source domain, the network is unfrozen throughout the process, and end-to-end joint optimization training is performed on the target domain data.
[0025] Furthermore, the steps for minimum spanning tree (MST) bridging repair in S4 are as follows: Morphological expansion is performed based on the largest connected region to construct a reliable corridor. Skeletonize the candidate branch segments and extract the endpoints, then estimate the local tangential orientation of the endpoints. Two types of candidate edges are generated: endpoint-main skeleton point and endpoint-endpoint. Distance threshold, direction cosine similarity and corridor coverage ratio constraints are applied. The candidate edge weights are calculated based on the comprehensive cost function, and the global MST is solved using the Kruskal algorithm. The minimum cost bridging edge is selected to complete the mask breakage repair.
[0026] Furthermore, the steps for trunk extraction in S5 are as follows: The point with the largest y-coordinate in the skeleton endpoint set is taken as the starting point of the main trunk; The candidate axes for the main trunk are selected based on the scoring function, which prioritizes paths with large upward gain, small lateral offset, and few detours. Scan upwards along the main axis, and set the connection points in the neighborhood where large branches that meet the size threshold are the termination points of the main axis to complete the extraction of the main axis.
[0027] Furthermore, the main branch extraction steps in S5 are as follows: The Y node with 3 exits is detected by 8-neighbor traversal of the skeleton graph, and the root Y node is located at the base of the trunk. Construct a candidate graph consisting of YY branches, and use Dijkstra's algorithm to build a shortest path tree with the root Y node as the source node, retaining the set of parent edges to obtain the main branch skeleton; Number the main branch skeleton by side, sort the skeleton pixels along the direction from the end near the trunk to the far end, and establish the hierarchical identifier of the main branch segment.
[0028] Furthermore, the steps for result branch attitude modeling and mounting characterization in S5 are as follows: The attitude is represented by the first and last vectors of the branch segment, the orientation angle of the branch segment is calculated, and the angle is determined by the difference of the circumferential angle. Centered on the nearest support endpoint of the result branch, search for the nearest main branch skeleton pixel within a fixed radius, and set the main branch segment level identifier corresponding to the pixel as the result branch mounting identifier.
[0029] Furthermore, the steps for locating pruning points according to agronomic rules are as follows: Short branch elimination: Calculate the average length of effective fruiting branches and remove fruiting branches whose length is lower than the average; Pruning of vigorous shoots: A branch segment whose length is greater than the average length of the main branch and has no subsequent branches is considered a vigorous shoot. The pruning point is taken at the position of the average length of the main branch near the support end. Drooping / Horizontal Extension Branch Retraction: Branch segments with a direction angle between 0° and 180° are classified as drooping branches, and branch segments with a difference of less than 5° from the horizontal direction angle are classified as horizontal extension branches. The near support endpoints of the two types of branch segments are set as retraction points. Thinning of overly dense fruiting branches: Calculate the average load density of the whole tree. When the density is greater than or equal to 3, thin out the fruiting branches of the overly dense main branches according to the priority of being closer to vertical and then the length of the branches from small to large.
[0030] In a specific embodiment: I. Implementation Method 1. Dataset Construction Source data: The Kaggle public urban street tree dataset was selected, consisting of 1250 images labeled as Urban_Branch, and divided into a training set of 875 images, a validation set of 125 images, and a test set of 250 images in a 7:1:2 ratio.
[0031] Target domain data: 280 images of dormant large-sized walnuts were collected in Yangbi, Dali, Yunnan, and labeled as Walnut_Branch; 56 images were used as the independent test set, and the remaining 224 images were divided into a training set of 179 images and a validation set of 45 images in an 8:2 ratio.
[0032] Labeling format: LabelMe and CVAT are used for annotation, which is then converted to YOLO format. The annotation content includes the branch instance boundaries and masks.
[0033] 2. Improve the construction of the YOLO11n-SDFM-LiteSeg model
[0034] See Figure 2 The diagram shown is a structural diagram of the improved YOLO11n-SDFM-LiteSeg model. Baseline model: YOLO11n-seg is used, and the structure includes Input, Backbone, Neck, and Head.
[0035] The SDFM feature fusion module is introduced at three scales (P3, P4, and P5) on the Neck side. It takes the Backbone side-connected features and the Neck top-down fused features as two inputs, and generates adaptive weights through global average pooling, pointwise convolution, and Sigmoid to complete channel and spatial weighted fusion.
[0036] The SDFM feature fusion module is used to achieve a dynamic balance between detail preservation and noise suppression in the shallow feature fusion stage, providing stable structural information for subsequent high-level semantic modeling. Unlike direct concatenation or element-wise addition, SDFM generates fusion weights through global average pooling (GAP), pointwise convolution (Pw-Conv), and Sigmoid gating, and adaptively weights the two input features by combining channel and spatial dual attention information. Its core fusion mechanism is shown in Equation (1).
[0037] (1)
[0038] in, and This indicates the two paths to be merged. The fusion weights are obtained from network learning, representing element-wise multiplication. Their structure is as follows: Figure 3 As shown.
[0039] LiteSeg lightweight segmentation head: The YOLO11n-seg instance segmentation head adopts a dual-branch architecture of "detection branch + segmentation branch": The detection branch outputs classification and bounding box regression results at three scales: P3 / P4 / P5; The segmentation branch adds a Proto prototype branch on the basis of the detection branch to generate a shared prototype feature map, and predicts mask coefficients for each instance through the mask coefficient branch. Finally, the coefficients and prototype features are linearly combined to obtain the instance mask.
[0040] The detection branch incorporates a lightweight feature integration unit, STEM, which consists of two 3×3 grouped convolutional layers. By employing a dynamic grouping strategy, the input channels are grouped... Divided into G groups, the number of parameters in the grouped convolution is compressed to approximately 1 / G of the original number compared to the standard convolution (see formula (2)), thereby offsetting to some extent the increase in the number of parameters introduced by the SDFM feature fusion module. The grouped convolution achieves refined feature extraction through channel decoupling, reducing the redundancy of channel information in the standard convolution while maintaining the receptive field of the 3×3 convolution. At the same time, 1×1 convolutions are used to output regression and classification terms respectively, further simplifying the convolution stacking depth before output, reducing the complexity of the segmentation head, and retaining the DFL and bounding box decoding process to ensure consistency between the training and inference interfaces. In terms of the segmentation branch, the LiteSeg head uses the Proto prototype branch and the mask coefficient prediction branch to ensure the stability of the mask generation mechanism. Its structure is as follows Figure 4 As shown, this modification mainly addresses the issue of high computational redundancy in the segmentation head under orchard end-side deployment conditions. While maintaining the instance mask generation capability as much as possible, it compresses the head-end overhead, thereby enabling the model to better balance accuracy and real-time requirements in the dormant walnut tree branch segmentation task.
[0041] (2)
[0042] in, These represent the number of input and output channels of the convolutional layer, respectively; K represents the kernel size; and G represents the number of groups.
[0043] 3. Transfer learning training
[0044] A transfer learning scheme employing source domain pre-training for weight initialization and target domain fine-tuning is adopted. The optimal weights (best.pt) are obtained by training on a city street tree dataset (source domain) and then loaded onto a dormant walnut tree dataset (target domain) for fine-tuning to improve convergence efficiency and target domain adaptability under small sample conditions. To address the risks of overfitting and convergence instability due to the limited sample size in the target domain, two target domain fine-tuning strategies are implemented: one is a two-stage training approach, where the backbone is frozen and only the neck and head are updated to achieve rapid domain adaptation, followed by unfreezing the entire network for end-to-end fine-tuning to strengthen the representation of branch boundaries and structural continuity, using a differentiated learning rate; the other is a single-stage direct fine-tuning approach, where the network is unfrozen throughout the process from initial weights for end-to-end joint optimization.
[0045] 4. Mask optimization and skeleton extraction
[0046] like Figure 5 As shown in (a), the mask optimization stage first eliminates small-area noisy components based on connected component statistics; simultaneously, the connected component with the largest area is used as the seed region for the main structure (trunk / branch). Then, the connected components outside the seed region are further filtered: distance transformation is used to remove fragments with anomalous scale, and morphological indicators such as area, eccentricity, and bounding box aspect ratio are combined to retain branch components with slender features as candidate sets for subsequent connections. The extraction results of the main seed and the filtering effect of candidate components are shown in Figure 1. Figure 5 As shown in (b) and (d) in the figure.
[0047] In the mask repair stage, a global minimum spanning tree (MST) bridging strategy is used to connect broken regions. To avoid false connections that cross the background, morphological dilation is performed based on the main seed region to construct a reliable corridor, and candidate connections are constrained by the corridor coverage (e.g., ...). Figure 5 (c) Specifically, candidate branches are first skeletonized to extract endpoints, and the local tangent at the endpoints is estimated by tracing along the skeleton with a certain step size to restrict the connection direction. Then, candidate edges are generated only in two types of connections: endpoint-main skeleton point and endpoint-endpoint. Nearest neighbor search is used to limit the spatial range, and constraints such as distance threshold, direction cosine similarity, and corridor coverage ratio are applied to filter out infeasible connections. For the candidate edges that pass the screening, weights are further calculated according to the comprehensive cost function (Formula 3) for subsequent MST solving and bridging edge selection.
[0048] (3)
[0049] in, This represents the Euclidean distance between two points. This indicates that the tangential direction of the endpoint is consistent with the direction from the endpoint to the target point (both ends must satisfy the consistency constraint when connecting endpoints). This indicates the proportion of sampling points of the connecting line segment that fall into the corridor (corridor coverage). and The weights of directional penalties and corridor penalties are controlled separately to achieve the middle-order selection. ; After candidate edges are sorted by cost weight, the global MST is solved using the Kruskal algorithm to obtain the set of minimum-cost bridging edges, achieving a reasonable integration of effective branches with the main structure. The bridging segments are then written back to the mask to complete the break repair. Residual unconnected fragments can be selectively discarded to further improve the topological consistency of the mask. The visualization and repair effect of the MST bridging edges are shown below. Figure 5 As shown in (e) in the diagram.
[0050] The skeleton extraction process uses an optimized mask as input. First, small holes are filled to prevent skeleton breakage or pseudo-forks. Then, a single-pixel wide centerline is generated through skeletonization. This skeleton preserves the trunk-branch-end topology, effectively reducing the impact of boundary burrs on structural analysis and facilitating subsequent endpoint detection, fork point localization, and pruning point inference. The skeleton extraction effect is as follows: Figure 5 As shown in (f) in the figure.
[0051] 5. Tree Structure Analysis
[0052] Extraction of the main trunk and branches: The backbone extraction uses the point with the largest y-coordinate in the skeleton endpoint set as the backbone starting point. This aligns with the geometric prior of a tree's natural top-down growth pattern. The trunk axis is selected based on endpoint scoring. The main route from which the signal originates, and the scoring function is shown in formula (4): (4) in, for , From arrive Path length, To balance the factors, the implementation is set as follows: This function favors paths with high upward gain, low lateral offset, and minimal detours to approximate the main axis.
[0053] The main trunk termination point is the connection position where the main trunk enters the canopy and significant lateral branches appear: the main trunk axis is removed from the skeleton to obtain the lateral branch connected domain. Scan along the axis from bottom to top. If there is a large branch that meets the scale threshold T in the lateral connected domain connected to the pixel neighborhood of a certain axis, then the connection point is defined as the main trunk termination point. The threshold is the larger of the fixed lower limit and the proportional lower limit (Formula 5).
[0054] (5)
[0055] in, To fix the minimum threshold, This is the proportionality coefficient. This represents the total number of skeleton pixels.
[0056] The extraction results of the candidate trunk axis and the final trunk are as follows: Figure 6 As shown.
[0057] The main branch extraction focuses on the branching nodes (Y nodes). Based on observations of the morphology of walnut tree main branches, the main branch typically connects two branching points, with the branching nodes serving as boundaries at both ends. Therefore, the root Y node is searched near the base of the trunk (using an 8-neighborhood traversal of the skeleton graph to detect points with 3 exit points), and a candidate graph composed of Y–Y branches is constructed: edges represent pixel paths traced along the skeleton between two branching nodes, with edge weights equal to the path length. To suppress redundant connections and loop interference, a shortest path tree is constructed using Dijkstra's algorithm with the root Y node as the source, retaining only the parent edge set to obtain the tree-like main branch skeleton. The key steps are as follows: Figure 7 As shown, (a) represents Y node detection and root Y node location (purple dot); (b) represents candidate Y–Y connection edges (cyan skeleton); and (c) represents the set of main branch edges retained by the shortest path tree (pink skeleton).
[0058] To uniformly represent positions on the main branches, the main branch skeleton is numbered by edge: each main branch edge is assigned an edge number eid, and the skeleton pixel sequence on that edge is sorted along the path from "nearest end to farthest end" to obtain an edge index k starting from 0. Therefore, any point on the main branch can be uniquely identified using (eid, k). Subsequent main branch truncation points and result branch attachment points are represented in the main branch coordinate system using this index.
[0059] The skeletal structure other than the main trunk and main branches is the fruiting branches. The fruiting branches and main branches are modeled and characterized in a unified manner.
[0060] For any branch segment s, its pixel sequence is denoted as and agreed This is the end near the support (the end near the connection of the trunk / main branch). For the far end. Using the first and last vectors. Characterize the branch posture and calculate the orientation angle. (Image coordinate system: 0° to the right, 90° down, 180° to the left, 270° up). To avoid The comparison error caused by the boundary is determined by the difference in circumferential angle, see formula (6): (6) Based on this, the mounting positions of the fruiting branches are uniformly mapped to the main branch coordinate system: with the fruiting branch near the support endpoint as the coordinate system. Centered on a fixed radius, the system searches for the nearest main branch skeleton pixel and reads the corresponding main branch index (eid, k), which is then denoted as the mounting index of the resulting branch. Thus, the main branch truncation point can be directly represented by the (eid, k) of its corresponding main branch pixel, and the resulting branch establishes a correspondence with the main branch position through the mounting index. This mounting index is used for main branch attribution and linkage processing in rule determination.
[0061] Based on the geometric and topological features of branches that can be stably resolved from two-dimensional images, this paper focuses on two high-frequency operations: shortening overly vigorous branches and reducing (removing) drooping / horizontal extension branches. It also supplements the conditional triggering rules for thinning out overly dense result branches, constructs a minimal rule set for verifying the perception-structure-rule-pruning point suggestion link, and realizes the visualization output of pruning points.
[0062] It should be noted that the key decisions regarding main branch selection, branch angle control, and branch group cultivation in this specification rely on more comprehensive tree information and multi-year growth goals, which this invention does not cover at the level of a single RGB image. Furthermore, the rules proposed in this invention are static geometric discrimination rules based on a single observation and have not yet integrated temporal and comprehensive agronomic information such as tree age and vigor. Figure 8 This is a schematic diagram of the basic tree shape pruning with a main trunk and layered structure.
[0063] When the average mounting density meets the triggering condition, the excessively dense result branches are further thinned out (quantity / density control), and the final output is a set of pixel coordinates of the pruned points. Short branch exclusion is achieved by calculating the average length of the effective result branches. Result branches with a length lower than this average are classified as invalid result branches, and this set does not participate in the execution of subsequent pruning rules.
[0064] To implement the agronomic strategy of "pruning excessively long, elongated branches," branches that are significantly too long and have no branching at the rear are pruned. The pruning is based on the average length of the main branch (…). Based on the truncation, for any branch segment s, if its length is... If the branch segment is determined to be no longer connected to other skeletal branches using an 8-neighborhood method, it is considered an overgrown branch and is pruned: from its nearest support endpoint... Starting from the skeleton distance, the retained length is... Output the cutoff point at the corresponding position. Used as a pruning point.
[0065] To implement the agronomic strategy of shortening drooping branches and horizontally extending branches, a unified determination of branch posture angles is established. For any branch segment s, if its direction satisfies the drooping half-plane condition... If it is a drooping branch, then it is judged as a downward branch; if or ( For the horizontal angle tolerance, take If a branch is drooping or horizontally extending, it is considered a horizontal extension branch. The pruning point for both drooping and horizontal extension branches is the point closest to the support end. .
[0066] Furthermore, to alleviate the shortcomings of relying solely on local rules in scenarios with crowded branches, this invention implements an extended rule for thinning overly dense fruiting branches based on existing structural analysis and attachment relationships: First, according to the attachment relationship from fruiting branches to main branches, each fruiting branch is assigned to its corresponding main branch. Let M be the number of main branches and N be the total number of fruiting branches, then the average attachment density of the entire tree is... .when At that time, for any main branch Let the number of branches resulting from its mounting be... If satisfied If so, it is determined that the main branch is too dense and needs to be thinned out. One fruiting branch. Thin out candidate fruiting branches. The priority is defined as: calculating the angle between its direction and the vertical direction. and branch length ,when ( Prioritize removing candidates that are close to the vertical threshold; if further removal is still necessary, then select from the remaining candidates according to... Thinning is performed sequentially from smallest to largest, thereby generating interpretable pruning point visualization suggestions under high-density conditions.
[0067] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0068] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for segmenting dormant walnut tree branches and pruning points based on improved YOLO 11 and agronomic rules, characterized in that... Includes the following steps: S1. Constructing the dataset: Collect images of trees on city streets as source domain data, and collect images of dormant walnut trees in Yunnan as target domain data. Label the branches and trunks of the two types of data and divide them into training set, validation set and test set according to the proportion. S2. Improved YOLO11n-seg model construction: Using YOLO11n-seg as the baseline model, an SDFM feature fusion module is introduced at the Neck end, and a LiteSeg lightweight segmentation head is used at the Head end to obtain the YOLO11n-SDFM-LiteSeg segmentation model. S3. Transfer learning training: The YOLO11n-SDFM-LiteSeg segmentation model is pre-trained using source domain data to obtain the optimal pre-training weights, and then the weights are loaded into the target domain data for single-stage end-to-end fine-tuning. S4. Branch Mask Optimization and Skeleton Extraction: The branch mask output by the YOLO11n-SDFM-LiteSeg segmentation model is subjected to small area noise removal, maximum connected component extraction, candidate branch segment screening, minimum spanning tree (MST) bridging repair in sequence. Then, the optimized mask is skeletonized to obtain a single-pixel wide branch skeleton. S5. Tree structure analysis: Extract the trunk and main branches based on the branch skeleton, establish the main branch coordinate system, and complete the branch posture modeling and mounting characterization. S6. Pruning Point Location: Based on agronomic rules, filter out overly vigorous branches, drooping / horizontal extension branches, and overly dense fruiting branches, and output the coordinates of the corresponding pruning points.
2. The method for segmenting dormant walnut tree branches and pruning points based on improved YOLOv11 and agronomic rules according to claim 1, characterized in that, The SDFM feature fusion module in S2 works as follows: The YOLO11 Neck uses the SDFM feature fusion module at three scales (P3, P4, P5) to integrate the Backbone side-connected features and the Neck's top-down fused features at the same scale as two inputs. The fusion weights are generated through global average pooling, pointwise convolution, and Sigmoid gating, and the two input features are adaptively weighted and fused according to channel and spatial dimensions.
3. The method for segmenting dormant walnut tree branches and pruning points based on improved YOLO11 and agronomic rules according to claim 1, characterized in that, The LiteSeg lightweight segmentation head in S2 is constructed as follows: The segmentation head detection branch incorporates a lightweight feature integration unit, STEM, consisting of two layers of 3×3 grouped convolutions. It employs a dynamic grouping strategy to group the input channels according to C... in / / 16 is divided into groups, and 1×1 convolutions are used to output regression and classification terms respectively. The splitting branch retains the Proto prototype branch and the mask coefficient prediction branch.
4. The method for segmenting dormant walnut tree branches and pruning points based on improved YOLOv11 and agronomic rules according to claim 1, characterized in that, The single-stage end-to-end fine-tuning in S3 is as follows: The model is initialized with the optimal weights pre-trained in the source domain, the network is unfrozen throughout the process, and end-to-end joint optimization training is performed on the target domain data.
5. The method for segmenting dormant walnut tree branches and pruning points based on improved YOLO11 and agronomic rules according to claim 1, characterized in that, The steps for bridging and repairing the minimum spanning tree (MST) in S4 are as follows: Morphological expansion is performed based on the largest connected region to construct a reliable corridor. Skeletonize the candidate branch segments and extract the endpoints, then estimate the local tangential orientation of the endpoints. Two types of candidate edges are generated: endpoint-main skeleton point and endpoint-endpoint. Distance threshold, direction cosine similarity and corridor coverage ratio constraints are applied. The candidate edge weights are calculated based on the comprehensive cost function, and the global MST is solved using the Kruskal algorithm. The minimum cost bridging edge is selected to complete the mask breakage repair.
6. The method for segmenting dormant walnut tree branches and pruning points based on improved YOLO 11 and agronomic rules according to claim 1, characterized in that, The steps for extracting the backbone in S5 are as follows: The point with the largest y-coordinate in the skeleton endpoint set is taken as the starting point of the main trunk; The candidate axes for the main trunk are selected based on the scoring function, which prioritizes paths with large upward gain, small lateral offset, and few detours. Scan upwards along the main axis, and set the connection points in the neighborhood where large branches that meet the size threshold are the termination points of the main axis to complete the extraction of the main axis.
7. The method for segmenting dormant walnut tree branches and pruning points based on improved YOLOv11 and agronomic rules according to claim 1, characterized in that, The steps for extracting the main branch in S5 are as follows: The Y node with 3 exits is detected by 8-neighbor traversal of the skeleton graph, and the root Y node is located at the base of the trunk. Construct a candidate graph consisting of YY branches, and use Dijkstra's algorithm to build a shortest path tree with the root Y node as the source node, retaining the set of parent edges to obtain the main branch skeleton; Number the main branch skeleton by side, sort the skeleton pixels along the direction from the end near the trunk to the far end, and establish the hierarchical identifier of the main branch segment.
8. The method for segmenting dormant walnut tree branches and pruning points based on improved YOLO 11 and agronomic rules according to claim 1, characterized in that, The steps for result branch attitude modeling and mounting characterization in S5 are as follows: The attitude is represented by the first and last vectors of the branch segment, the orientation angle of the branch segment is calculated, and the angle is determined by the difference of the circumferential angle. Centered on the nearest support endpoint of the result branch, search for the nearest main branch skeleton pixel within a fixed radius, and set the main branch segment level identifier corresponding to the pixel as the result branch mounting identifier.
9. The method for segmenting dormant walnut tree branches and pruning points based on improved YOLO11 and agronomic rules according to claim 1, characterized in that, The steps for locating pruning points according to agronomic rules are as follows: Short branch elimination: Calculate the average length of effective fruiting branches and remove fruiting branches whose length is lower than the average; Pruning of vigorous shoots: A branch segment whose length is greater than the average length of the main branch and has no subsequent branches is considered a vigorous shoot. The pruning point is taken at the position of the average length of the main branch near the support end. Drooping / Horizontal Extension Branch Retraction: Branch segments with a direction angle between 0° and 180° are classified as drooping branches, and branch segments with a difference of less than 5° from the horizontal direction angle are classified as horizontal extension branches. The near support endpoints of the two types of branch segments are set as retraction points. Thinning of overly dense fruiting branches: Calculate the average load density of the whole tree. When the density is greater than or equal to 3, thin out the fruiting branches of the overly dense main branches according to the priority of being closer to vertical and then the length of the branches from small to large.