Gardening cultivation space structure identification and layout optimization method based on Capsule network
Through the multi-scale perception enhancement capsule network and Black Widow optimization algorithm based on Capsule network, the accuracy and multi-objective optimization problems in horticultural cultivation structure recognition and layout optimization are solved, and high-precision horticultural cultivation spatial structure recognition and layout optimization are achieved.
Patent Information
- Application Number
- CN202510591432.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-08
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2045-05-08
AI Technical Summary
The existing horticultural cultivation structure recognition methods are difficult to achieve high-precision recognition in complex crossover or occlusion scenarios, and the existing layout optimization methods lack multi-objective optimization capabilities and cannot effectively handle multimodal data and spatial constraints.
A multi-scale perception enhancement capsule network based on Capsule network is used for semantic recognition and spatial structure extraction of cultivation grooves, scaffolds, etc., and combined with multi-objective fitness function and black widow optimization algorithm, the horticulture layout is optimized through multi-scale feature tensors and structural constraint matrix.
The accuracy and consistency of spatial structure recognition of horticultural cultivation is improved, the multi-objective coordination and constraint satisfaction rate of the layout plan are optimized, and high-density intelligent cultivation and automated layout adjustment are realized.
Smart Images

Figure CN120509301A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of horticultural technology, and in particular to a method for identifying and optimizing the spatial structure of horticultural cultivation based on a Capsule network. Background Art
[0002] With the development of artificial intelligence, computer vision and optimization algorithms, intelligent spatial analysis and layout planning technologies have gradually been introduced into horticultural cultivation scenarios to achieve improved cultivation efficiency and rational allocation of spatial resources. As an important part of modern agricultural digitalization, horticultural cultivation spatial structure identification and layout optimization are directly related to the coordination and optimization of key elements such as plant lighting conditions, ventilation environment, irrigation system construction, and agricultural robot operation paths.
[0003] At present, horticultural cultivation structure recognition mainly relies on traditional convolutional neural networks or three-dimensional point cloud geometric rule reasoning methods to segment and identify plant parts such as trunks, branches, leaves and fruits. Existing methods are usually unable to fully characterize the spatial topological structure and multi-scale structural characteristics between plant organs, and the recognition accuracy is significantly reduced in complex intersection or occlusion scenes. In addition, existing methods lack an effective fusion mechanism when processing multimodal input data, and cannot uniformly express the posture, category and spatial information between cross-scale and multi-source data in horticultural structures, resulting in the structural modeling results being difficult to support subsequent fine layout optimization.
[0004] In terms of horticultural layout optimization, some studies have attempted to introduce genetic algorithms, particle swarm algorithms, or ant colony algorithms heuristic optimization algorithms to adjust the position of cultivation troughs, bracket layout, and irrigation paths. However, existing methods often rely on single-objective or coarse-grained evaluation functions, lack a joint modeling mechanism for multi-dimensional objectives such as light uniformity, ventilation efficiency, shortest irrigation path, and robotic arm accessibility in horticultural scenarios, and have weak constraint processing capabilities. As a result, the optimization results often cannot be directly applied because they violate the actual limitations of the spatial structure.
[0005] In summary, there is an urgent need to propose a horticultural cultivation structure recognition and layout optimization method that has both high-precision spatial recognition capabilities and strong coupled multi-objective optimization capabilities, so as to break through the technical bottlenecks of current methods in structure perception and intelligent spatial scheduling. Summary of the Invention
[0006] One objective of the present invention is to propose a method for identifying and optimizing the spatial structure of horticultural cultivation based on a capsule network. This method comprehensively enhances the intelligence, refinement, and practicality of spatial structure identification and layout planning for horticultural cultivation, from perception modeling to optimization execution. The method is suitable for high-density intelligent cultivation and automated layout adjustment operations in a variety of horticultural scenarios.
[0007] According to an embodiment of the present invention, a method for identifying and optimizing the structure of a horticultural cultivation space based on a Capsule network includes the following steps:
[0008] S1. Collecting horticultural multimodal raw data, performing temporal synchronization, spatial registration, and scale normalization preprocessing on the horticultural multimodal raw data, and generating horticultural multimodal fusion input data;
[0009] S2. Input the horticultural cultivation multimodal fusion input data into a multi-scale perception-enhanced capsule network to extract cross-scale feature tensors. Based on the cross-scale feature tensors, the learnable posture matrix fusion module and structure-aware dynamic routing mechanism within the multi-scale perception-enhanced capsule network are used to perform semantic recognition and spatial structure extraction of cultivation troughs, supports, plant trunks, branches, leaves, and fruits, obtaining horticultural cultivation spatial structure recognition results.
[0010] S3. Construct a digital twin model of the horticultural cultivation space based on the results of spatial structure recognition. The digital twin model includes topological information, category labels, geometric dimensions, and posture vectors. Based on the digital twin model, an operational spatial coordinate grid is discretely generated. Groove positions, support angles, plant spacing, light source angles, and irrigation pipeline paths are extracted to form a horticultural cultivation layout variable vector.
[0011] S4. Based on the posture vector and topological information as well as the horticultural layout variable vector, a multi-objective fitness function is constructed and a structural constraint matrix is generated to constrain lighting uniformity, ventilation efficiency, irrigation system pipeline length, and mechanical accessibility.
[0012] S5. Initialize the Black Widow Optimization Algorithm population based on the horticultural cultivation layout variable vector, set the mating ratio, engulfment rate, and mutation rate according to the structural constraint matrix, execute the Black Widow Optimization Algorithm's mating, engulfment, mutation, and enhanced widow recombination operations, iteratively update the population fitness value using the structurally coupled fitness guidance mechanism, obtain the Pareto optimal horticultural cultivation layout solution set, and select the optimal horticultural cultivation layout solution from the Pareto optimal horticultural cultivation layout solution set according to the target weight set set by the user;
[0013] S6. Map the optimal horticultural cultivation layout plan to the digital twin model of the horticultural cultivation space, generate layout adjustment instructions through the digital twin platform and send them to the execution device to adjust the cultivation troughs, supports, plant transplanting points, light sources and irrigation pipelines to optimize the horticultural cultivation layout.
[0014] Optionally, the S1 includes the following steps:
[0015] S11. Acquire multimodal raw horticultural cultivation data, including red, green, and blue (RGB) image data, depth image data, three-dimensional point cloud data, and spectral reflectance data. The RGB image data and depth image data are collected by a RGB-depth camera, the three-dimensional point cloud data is collected by a time-of-flight lidar, and the spectral reflectance data is collected by a spectral imaging device. The horticultural cultivation multimodal raw data is uniformly timestamped to construct a time-synchronized multimodal data set.
[0016] S12. Spatial registration is performed on the data in the time-synchronized multimodal data set. The spatial registration is based on the pixel coordinates of the RGB image data and the corresponding depth value d of the depth image data. By using the intrinsic parameter matrix of the RGB-depth camera and the rigid transformation matrix from the lidar to the camera, the data from different sources are converted into a unified 3D point cloud coordinate system in the RGB camera coordinate system. The 3D point cloud coordinates are used to represent the actual position of each pixel in physical space.
[0017] S13. Perform scale normalization on the 3D point cloud data set after spatial registration, unify all point cloud coordinates into a fixed-scale spatial range, and let the original point cloud set be represented as For each point's coordinate value, subtract the minimum value of the coordinate axis and then divide it by the difference between the maximum and minimum values of the coordinate axis to obtain the normalized point cloud set P. ′ , where x o 、y o 、z o Respectively represent the horizontal, vertical and height coordinates of the o-th point;
[0018] S14. The normalized three-dimensional point cloud set P ′ , Red, green and blue image data D after registration RGB , depth image data D Depth With spectral reflectance data D Spectral Perform fusion encoding to retain the spatial alignment relationship and time synchronization properties between various data types, and combine the encoding results into horticultural cultivation multimodal fusion input data D Unified .
[0019] Optionally, the multi-scale perception enhancement capsule network consists of a scale-adaptive convolution module, a primary capsule layer, a scale-aware posture fusion capsule layer and a structure-aware dynamic routing capsule layer.
[0020] Optionally, the S2 includes the following steps:
[0021] S21. Fusion of multimodal horticultural cultivation input data D UnifiedThe input is fed into the multi-scale perception enhancement capsule network. The scale-adaptive convolution module performs parallel convolution operations with different convolution kernel sizes on the horticultural multimodal fusion input data to extract a set of cross-scale feature tensors covering multiple spatial receptive fields. The number of scales S is dynamically determined based on the plant size and structural complexity in the gardening scene, and the feature tensor F at each scale s is s The dimensions are unified as H×W×C s , where H and W are the uniform height and width of the spatial feature map, C s is the number of channels at the sth scale;
[0022] S22. Set the cross-scale feature tensor F MS Input primary capsule layer, the primary capsule layer is used to calculate the feature tensor F of each scale s Generate primary capsule units through convolution mapping to form a primary scale capsule set U s , each capsule u in the primary scale capsule set s,i is a vector with a fixed dimension, used to represent the local characteristic posture information of plant organs at a specific scale in a horticultural scene;
[0023] S23. Input the primary scale capsule set of all scales into the scale-aware posture fusion capsule layer, and learn the scale attention weight β s Determine the importance of capsule units at each scale and learn the scale attention weight β s Computation using scale-aware self-attention network:
[0024]
[0025] Among them, FC(·) is the fully connected layer mapping function, which is used to transform each scale feature F s Mapped to a unified scale attention value, generating scale attention weight β s , S is the number of parallel convolution channels used by the scale-adaptive convolution module in the multi-scale perception enhancement capsule network;
[0026] S24. The scale-aware posture fusion capsule layer further passes the scale correlation matrix M Scale The topological correlation modeling is performed on the primary capsule unit set of each scale, and the scale correlation matrix M Scale Defined as:
[0027]
[0028] Among them, M Scale (u s,i ,u k,j) represents the cosine similarity between the i-th capsule in scale s and the j-th capsule in scale k, which is used to measure the topological similarity between plant organ features at different scales;
[0029] S25. Using scaled attention weight β s , scale correlation matrix M Scale Fusion weight matrix W with scale features s Fuse the primary scale capsule set to generate the pose constraint fusion matrix M Pose , the posture constraint fusion matrix is used to represent the unified posture relationship of the cultivation trough, bracket, plant trunk, branches, leaves and fruits at multiple scales in the horticultural space:
[0030]
[0031] Among them, W s is the learnable scale feature weight matrix, which regulates the contribution of posture fusion of plant features at different scales. ° represents element-wise matrix multiplication.
[0032] S26. Fusion matrix M Pose Input structure-aware dynamic routing capsule layer to construct dynamic routing structure graph G Caps , calculate the structure-sensitive dynamic routing probability r in the dynamic routing structure graph ij , characterizing the topological relationship between capsule units of different scales:
[0033]
[0034] Among them, r ij is the dynamic routing probability of the bottom i-th capsule to the top j-th capsule, γ ij It is a structure-sensitive parameter based on horticultural layout objectives, used to highlight key plant organ characteristics. represents the pose constraint fusion matrix of the i-th bottom-level capsule unit, represents the pose constraint fusion matrix of the j-th bottom-level capsule unit, represents the pose constraint fusion matrix of the k-th bottom-level capsule unit, Sim(·) is the cosine similarity or Euclidean distance similarity function;
[0035] S27. Using dynamic routing structure diagram G Caps Update the high-level capsule unit output vector v j , through the pose alignment matrix P Align Adjust the spatial consistency of the capsule output vector:
[0036] v j =h(∑ i r ij ·(u ij °PAlign ));
[0037] Among them, u ij is the fusion matrix M through the posture constraint Pose The obtained capsule prediction vector, P Align is the pose alignment constraint matrix between specific plant organs in the horticultural scene, which is used to standardize the pose range of the capsule vector. h(·) is the nonlinear squeezing activation function suitable for the horticultural scene.
[0038] S28. Based on the high-level capsule unit output vector v j , generating horticultural cultivation spatial structure recognition results, including the semantic category labels of cultivation troughs, supports, plant trunks, branches, leaves and fruits, the spatial topological relationships between plant organs, geometric dimensions and unified posture vectors.
[0039] Optionally, S3 includes the following steps:
[0040] S31. Based on the results of horticultural cultivation space structure recognition, a digital twin model of horticultural cultivation space is constructed. The digital twin model of horticultural cultivation space is based on the graph structure G Twin =(V Twin ,E Twin ) indicates that the node set Represents the digital representation of each structural element in the horticultural cultivation scene, including cultivation trough nodes, support nodes, plant trunk nodes, branch nodes, leaf nodes and fruit nodes. The number of nodes is N v ;Edge set E Twin ={e kz} represents the topological connection relationship between various structural elements;
[0041] S32. Assign a unified attribute vector A to each node in the digital twin model of horticultural cultivation space i , attribute vector A k Contains category label C k , geometric center coordinates L k 、Geometric size S k With the posture vector Q k , where the category label C k The value is one of the cultivation trough, support, plant trunk, branch, leaf and fruit, and the geometric center coordinate L k Indicates the three-dimensional geometric coordinates of the node center, the geometric dimension S k Represents the width, height and depth of the node structure element, the posture vector Q k Represents the spatial posture information of the node structure elements;
[0042] S33. Generate a unified operational spatial coordinate grid G based on the digital twin model of horticultural cultivation spaceGrid The unified operational space coordinate grid is composed of regularly arranged three-dimensional space grids, and the node geometric center coordinates L of the digital twin model of horticultural cultivation space are k Discrete mapping to the corresponding spatial grid coordinates G Grid (m,n,p), the spatial grid coordinate G Grid (m, n, p) represent the discrete coordinate indexes of the horizontal, vertical and height directions of the spatial grid respectively;
[0043] S34. According to the node distribution of the horticultural cultivation space digital twin model in the spatial grid, the geometric center coordinates of each cultivation trough node are extracted to form the cultivation trough position set T Cult , and extract the inclination angle of each support node relative to the horizontal plane to form the support angle set Θ Sup ;
[0044] S35. Calculate the Euclidean distance between each two plant trunk nodes based on the geometric center coordinates of the plant trunk nodes in the digital twin model of the horticultural cultivation space. Calculate the square root of the sum of the squares of the horizontal, vertical, and height coordinate differences between the two plant trunk nodes to form the plant spacing set D. Plant ;
[0045] S36. Based on the geometric center coordinates of the light source device nodes in the digital twin model of the horticultural cultivation space, extract the inclination angle of each light source device node relative to the vertical direction to form a light source angle set Φ Light ;
[0046] S37. Based on the geometric center coordinates of the cultivation trough node and the irrigation equipment node in the digital twin model of the horticultural cultivation space, the Euclidean distance between the two nodes is calculated by calculating the square root of the sum of the squares of the horizontal, vertical, and height coordinate differences between the two nodes. Based on the Euclidean distance between the nodes, the shortest path connecting the cultivation trough node and the irrigation equipment node is determined to form the irrigation pipeline path set P. Irrig ;
[0047] S38. Set the cultivation trough position set T Cult 、bracket angle set Θ Sup , plant spacing set D Plant , light source angle set Φ Light and irrigation pipe path set P Irrig Combined to form the horticultural cultivation layout variable vector X Layout .
[0048] Optionally, the S4 includes the following steps:
[0049] S41. Based on the horticultural cultivation layout variable vector, node posture vector set, geometric center coordinate set, geometric size set and topological edge set, a multi-objective fitness function f(X) for horticultural cultivation layout optimization is constructed. Layout ), the multi-objective fitness function value is used to comprehensively evaluate the performance of the horticultural cultivation layout plan in terms of light uniformity, ventilation efficiency, irrigation system pipeline length, and mechanical accessibility. The multi-objective fitness function value is obtained by multiplying the light uniformity objective function value, ventilation efficiency objective function value, irrigation system pipeline length objective function value, and mechanical accessibility objective function value by the corresponding user-set objective weight coefficient and then summing them up:
[0050] f(X Layout )=w1·f light +w2·f vent +w3·f pipe +w4·f reach ;
[0051] Among them, f light represents the illumination uniformity objective function, f vent represents the ventilation efficiency objective function, f pipe represents the objective function of the irrigation system pipeline length, f reach represents the mechanical accessibility objective function, w1, w2, w3, w4 are the objective weight coefficients set by the user;
[0052] S42. The illumination uniformity objective function value is used to assess the uniformity of illumination received by all leaf nodes within the horticultural cultivation space. The illumination uniformity objective function value is obtained by calculating the cosine of the angle between the light source direction and the attitude vector of each leaf node, multiplying it by the light transmittance factor per unit area of the leaf node to obtain the received illumination intensity of each leaf node. The square of the difference between the received illumination intensity of all leaf nodes and the average illumination intensity of the leaf nodes is then calculated, and the average sum of these squared differences is then taken for all leaf nodes.
[0053] S43. The ventilation efficiency objective function value is used to evaluate the overall ventilation resistance level of the ventilation paths between plant trunk nodes within a horticultural cultivation space. The ventilation efficiency objective function value is calculated by multiplying the air density between each pair of plant trunk nodes with a ventilation path by the spatial distance between the pair of trunk nodes, and then dividing the result by the effective ventilation cross-sectional area between the two trunk nodes. The ventilation resistance value for each pair of trunk nodes is then calculated by summing the ventilation resistance values for all pairs of trunk nodes with a ventilation path.
[0054] S44. The irrigation system pipeline length objective function value is used to evaluate the total length of the irrigation pipeline path within the horticultural cultivation space. The irrigation system pipeline length objective function value is obtained by connecting the geometric center coordinates of each node on each irrigation pipeline path within the horticultural cultivation space, calculating the spatial distance between each two consecutive nodes, and then accumulating the spatial distances between all consecutive nodes in the path to sum the lengths of all irrigation pipeline paths within the horticultural cultivation space.
[0055] S45. A mechanical accessibility objective function value is used to evaluate the overall alignment between the posture vector of the robot arm end-effector and the posture vectors of the fruit nodes within the horticultural cultivation space. The mechanical accessibility objective function value is obtained by calculating the angle between the posture vector of each fruit node and the posture vector of the robot arm end-effector, and calculating the difference between the cosine value of the angle and 1 to obtain the degree of posture deviation between each fruit node and the robot arm end-effector. The posture deviation degrees are then summed for all fruit nodes.
[0056] S46. Constructing the structural constraint matrix C Struct ,The structural constraint matrix is used to limit the rigid spatial constraints that the horticultural cultivation layout ,variable vector must satisfy during the layout optimization process. ,The structural constraint matrix is generated by defining the rigid spatial constraints.
[0057] Optionally, the rigid spatial constraints include: the minimum ventilation distance between plants must not be lower than a safety threshold, the slope of the irrigation pipeline path must not exceed the maximum allowable slope, the location of the cultivation trough must be within the specified layout boundary, and the geometric dimensions between the support and the spatial area corresponding to the fruit node do not overlap.
[0058] Optionally, the S5 includes the following steps:
[0059] S51. Initialize the Black Widow Optimization Algorithm population based on the horticultural cultivation layout variable vector and construct the initial population set Where N is the population size, Represents the fth individual layout variable vector. During the initialization process, the layout variable vector elements are sampled in the feasible domain according to the spatial boundary and node distribution range of the gardening scene to ensure that each individual satisfies the structural constraint matrix C Struct All constraints defined;
[0060] S52. Setting the mating ratio μ of the Black Widow Optimization Algorithm mate , phagocytosis rate ρ kill and mutation rate τ mut , the mating ratio indicates the proportion of individuals participating in mating, the phagocytosis rate indicates the proportion of individuals eliminated after generating offspring, and the mutation rate indicates the proportion of individuals subjected to mutation operations after generating offspring;
[0061] S53. For population P (g) Calculate the multi-objective fitness value of all individual layout variable vectors The multi-objective fitness value result is used as the fitness record of the current iteration algebra g, and the structural constraint matrix C is converted into Struct The unsatisfied items in the fitness function are added as penalty function items to obtain the corrected fitness function value
[0062]
[0063] Among them, λ is the structural constraint penalty coefficient, φ r (·) is the rth constraint function, R is the number of constraints in the structural constraint matrix;
[0064] S54. Perform a pairing operation on the individuals with the selected mating ratio and generate a set of offspring C in a random pairing manner. (g) , each child in the children collection Calculated as:
[0065]
[0066] in, and is the parent generation of the pairing, α is the pairing weight factor, which controls the degree of deviation of the offspring generation toward the parent generation;
[0067] S55. According to the phagocytosis rate ρ kill For the descendant set C (g) All offspring calculate the modified fitness function value Sort by fitness function value from small to large, and keep the first (1-ρ kill )·C (g) The offspring with better fitness enter the candidate offspring set, and the rest are eliminated;
[0068] S56. Perform enhanced widow recombination on all offspring. The enhanced widow recombination is achieved by exchanging feature subvectors across individuals in a high-dimensional space, that is, swapping some layout variable dimensions of two individuals and recombining them to generate new individuals. Used to improve search space coverage;
[0069] S57. The recombined offspring and some of the parent individuals with the best fitness function values in the current generation together form the next generation population P (g+1) , and return to step S53 for iterative update until the maximum number of iterations G is reached max or meet the convergence criterion;
[0070] S58. Extract the non-dominated solution set of fitness function value from the final population to form the Pareto optimal horticultural cultivation layout solution set X Pareto , use the target weight coefficients (w1, w2, w3, w4) set by the user to comprehensively sort the solution set, and select the layout variable vector with the smallest weighted objective function value as the optimal horticultural cultivation layout solution
[0071] Optionally, S6 includes the following steps:
[0072] S61. Mapping the optimal horticultural cultivation layout plan to the horticultural cultivation space digital twin model, and updating the cultivation trough position set, support angle set, plant spacing set, light source angle set, and irrigation pipeline path set included in the optimal horticultural cultivation layout plan to the corresponding nodes and edges in the horticultural cultivation space digital twin model through the node mapping relationship;
[0073] S62. Using the digital twin platform, the node and edge changes in the updated digital twin model of the horticultural cultivation space are converted into a directly executable set of layout adjustment instructions, including cultivation trough adjustment instructions, support adjustment instructions, plant transplanting point adjustment instructions, light source adjustment instructions, and irrigation pipeline adjustment instructions;
[0074] S63. Send the generated layout adjustment instruction set to the execution device, which completes the actual adjustment of the cultivation trough position, bracket angle, plant transplanting point, light source angle and irrigation pipeline path according to the layout adjustment instruction set to achieve layout optimization of the horticultural cultivation space.
[0075] Optionally, the cultivation trough adjustment instruction is used to guide the optimization adjustment of the position of the cultivation trough node, and the optimization adjustment of the position of the cultivation trough node is achieved by moving the cultivation trough node from an initial position to a target position corresponding to the optimal horticultural cultivation layout plan;
[0076] The support adjustment instruction is used to guide the angle optimization adjustment of the support node, and the angle optimization adjustment of the support node is achieved by adjusting the initial tilt angle of the support node to the target tilt angle corresponding to the optimal horticultural cultivation layout plan;
[0077] The plant transplanting point adjustment instruction is used to guide the spatial layout adjustment between the plant trunk nodes, and the spatial layout adjustment between the plant trunk nodes is achieved by moving the plant trunk nodes from the initial geometric center coordinates to the target geometric center coordinates that meet the plant spacing requirements in the optimal horticultural cultivation layout plan;
[0078] The light source adjustment instruction is used to guide the angle optimization adjustment of the light source device node, and the angle optimization adjustment of the light source device node is achieved by adjusting the initial tilt angle of the light source device node to the target tilt angle corresponding to the optimal horticultural cultivation layout plan;
[0079] The irrigation pipeline adjustment instruction is used to guide the layout optimization adjustment of the irrigation pipeline path. The layout optimization adjustment of the irrigation pipeline path is achieved by moving the irrigation pipeline node from the initial geometric center coordinate to the target geometric center coordinate that meets the irrigation pipeline path requirements in the optimal horticultural cultivation layout plan, thereby achieving an optimized layout with the shortest pipeline path length and reasonable slope restrictions.
[0080] The beneficial effects of the present invention are:
[0081] (1) The present invention introduces a scale-adaptive convolution module and a scale-aware posture fusion mechanism. By dynamically constructing a cross-scale feature tensor set and combining scale attention with inter-scale topological modeling, it can adapt to the multi-scale deformation characteristics of different plant parts in complex horticultural scenes, effectively capture the semantic and geometric information of cultivation troughs, supports, trunks, branches, leaves and fruits, and construct a structure-aware dynamic routing mechanism to enhance the spatial consistency expression between structural elements. Compared with traditional structural segmentation methods based on fixed receptive field convolution or shallow capsule networks, the organ recognition accuracy under complex occlusion or staggered layouts is improved, and the structural topology restoration rate index is also improved.
[0082] (2) The present invention constructs a multi-objective fitness function including illumination uniformity, ventilation efficiency, irrigation pipeline length and mechanical accessibility in layout optimization. At the same time, a structural constraint matrix is introduced to characterize the key spatial boundaries, angle restrictions and equipment accessibility areas in the gardening space. The constraint information is embedded in the optimization search process as a dynamic penalty term through the structural coupling fitness guidance mechanism, which significantly improves the constraint satisfaction rate and increases the proportion of feasible solutions.
[0083] (3) The improved Black Widow Optimization Algorithm of the present invention introduces a mating ratio self-adjustment mechanism and a high-dimensional sub-vector recombination operation, combined with a structure-sensitive fitness correction strategy, which effectively alleviates the problems of premature convergence and insufficient exploration of feasible solution space in traditional population evolution algorithms. By designing the characteristic-level variation of offspring individuals and the parent-generation elite recombination strategy, a comprehensive search and local fine-tuning of high-dimensional space layout variables are achieved. The Pareto frontier solution set finally generated is superior to the existing genetic algorithm and particle swarm algorithm in terms of multi-objective harmony and convergence stability. BRIEF DESCRIPTION OF THE DRAWINGS
[0084] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0085] Figure 1 This is a flowchart of a method for identifying and optimizing the spatial structure of horticultural cultivation based on Capsule networks proposed in the present invention;
[0086] Figure 2 This is a structural block diagram of a multi-scale perception-enhanced capsule network in the capsule network-based horticultural cultivation space structure recognition and layout optimization method proposed in the present invention. DETAILED DESCRIPTION
[0087] The present invention will now be described in further detail with reference to the accompanying drawings, which are simplified schematic diagrams that illustrate the basic structure of the present invention in a schematic manner.
[0088] refer to Figure 1-Figure 2 A method for identifying and optimizing the spatial structure of horticultural cultivation based on a Capsule network comprises the following steps:
[0089] S1. Collecting horticultural multimodal raw data, performing temporal synchronization, spatial registration, and scale normalization preprocessing on the horticultural multimodal raw data, and generating horticultural multimodal fusion input data;
[0090] S2. Input the horticultural cultivation multimodal fusion input data into a multi-scale perception-enhanced capsule network to extract cross-scale feature tensors. Based on the cross-scale feature tensors, the learnable posture matrix fusion module and structure-aware dynamic routing mechanism within the multi-scale perception-enhanced capsule network are used to perform semantic recognition and spatial structure extraction of cultivation troughs, supports, plant trunks, branches, leaves, and fruits, obtaining horticultural cultivation spatial structure recognition results.
[0091] S3. Construct a digital twin model of the horticultural cultivation space based on the results of spatial structure recognition. The digital twin model includes topological information, category labels, geometric dimensions, and posture vectors. Based on the digital twin model, an operational spatial coordinate grid is discretely generated. Groove positions, support angles, plant spacing, light source angles, and irrigation pipeline paths are extracted to form a horticultural cultivation layout variable vector.
[0092] S4. Based on the posture vector and topological information as well as the horticultural layout variable vector, a multi-objective fitness function is constructed and a structural constraint matrix is generated to constrain lighting uniformity, ventilation efficiency, irrigation system pipeline length, and mechanical accessibility.
[0093] S5. Initialize the Black Widow Optimization Algorithm population based on the horticultural cultivation layout variable vector, set the mating ratio, engulfment rate, and mutation rate according to the structural constraint matrix, execute the Black Widow Optimization Algorithm's mating, engulfment, mutation, and enhanced widow recombination operations, iteratively update the population fitness value using the structurally coupled fitness guidance mechanism, obtain the Pareto optimal horticultural cultivation layout solution set, and select the optimal horticultural cultivation layout solution from the Pareto optimal horticultural cultivation layout solution set according to the target weight set set by the user;
[0094] S6. Map the optimal horticultural cultivation layout plan to the digital twin model of the horticultural cultivation space, generate layout adjustment instructions through the digital twin platform and send them to the execution device to adjust the cultivation troughs, supports, plant transplanting points, light sources and irrigation pipelines to optimize the horticultural cultivation layout.
[0095] In this embodiment, S1 includes the following steps:
[0096] S11. Acquire multimodal raw horticultural cultivation data, including red, green, and blue (RGB) image data, depth image data, three-dimensional point cloud data, and spectral reflectance data. The RGB image data and depth image data are collected by a RGB-depth camera, the three-dimensional point cloud data is collected by a time-of-flight lidar, and the spectral reflectance data is collected by a spectral imaging device. The horticultural cultivation multimodal raw data is uniformly timestamped to construct a time-synchronized multimodal data set.
[0097] S12. Spatial registration is performed on the data in the time-synchronized multimodal data set. The spatial registration is based on the pixel coordinates of the RGB image data and the corresponding depth value d of the depth image data. By using the intrinsic parameter matrix of the RGB-depth camera and the rigid transformation matrix from the lidar to the camera, the data from different sources are converted into a unified 3D point cloud coordinate system in the RGB camera coordinate system. The 3D point cloud coordinates are used to represent the actual position of each pixel in physical space.
[0098] S13. Perform scale normalization on the 3D point cloud data set after spatial registration, unify all point cloud coordinates into a fixed-scale spatial range, and let the original point cloud set be represented as For each point's coordinate value, subtract the minimum value of the coordinate axis and then divide it by the difference between the maximum and minimum values of the coordinate axis to obtain the normalized point cloud set P. ′ , where x o 、y o 、z o Respectively represent the horizontal, vertical and height coordinates of the o-th point;
[0099] S14. The normalized three-dimensional point cloud set P ′ , Red, green and blue image data D after registration RGB , depth image data D Depth With spectral reflectance data D Spectral Perform fusion encoding to retain the spatial alignment relationship and time synchronization properties between various data types, and combine the encoding results into horticultural cultivation multimodal fusion input data D Unified .
[0100] In this embodiment, the multi-scale perception enhancement capsule network consists of a scale-adaptive convolution module, a primary capsule layer, a scale-aware posture fusion capsule layer, and a structure-aware dynamic routing capsule layer.
[0101] In this embodiment, S2 includes the following steps:
[0102] S21. Fusion of multimodal horticultural cultivation input data D Unified The input is fed into the multi-scale perception enhancement capsule network. The scale-adaptive convolution module performs parallel convolution operations with different convolution kernel sizes on the horticultural multimodal fusion input data to extract a set of cross-scale feature tensors covering multiple spatial receptive fields. The number of scales S is dynamically determined based on the plant size and structural complexity in the gardening scene, and the feature tensor F at each scale s is s The dimensions are unified as H×W×C s , where H and W are the uniform height and width of the spatial feature map, C s is the number of channels at the sth scale;
[0103] S22. Set the cross-scale feature tensor F MS Input primary capsule layer, the primary capsule layer is used to calculate the feature tensor F of each scale s Generate primary capsule units through convolution mapping to form a primary scale capsule set U s , each capsule u in the primary scale capsule set s,i is a vector with a fixed dimension, used to represent the local characteristic posture information of plant organs at a specific scale in a horticultural scene;
[0104] S23. Input the primary scale capsule set of all scales into the scale-aware posture fusion capsule layer, and learn the scale attention weight β s Determine the importance of capsule units at each scale and learn the scale attention weight β s Computation using scale-aware self-attention network:
[0105]
[0106] Among them, FC(·) is the fully connected layer mapping function, which is used to transform each scale feature F s Mapped to a unified scale attention value, generating scale attention weight β s , S is the number of parallel convolution channels used by the scale-adaptive convolution module in the multi-scale perception enhancement capsule network;
[0107] The formula is used to measure the feature tensor F at each scale sThe importance of attention is to assign a normalized scale attention weight β according to the response strength of plant structures of different sizes (such as small branches and larger cultivation troughs) at multiple scales in the horticultural cultivation scene. s FC(·) is the fully connected layer function, which represents the linear mapping of the feature tensor. exp(·) is combined with the Softmax form to normalize the weights at different scales.
[0108] The significance lies in dynamically learning which scales are more suitable for the current cultivation structure recognition task. For example, fine-scale features may be required, while supports and cultivation troughs rely more on large scales.
[0109] S24. The scale-aware posture fusion capsule layer further passes the scale correlation matrix M Scale The topological correlation modeling is performed on the primary capsule unit set of each scale, and the scale correlation matrix M Scale Defined as:
[0110]
[0111] Among them, M Scale (u s,i ,u k,j ) represents the cosine similarity between the i-th capsule in scale s and the j-th capsule in scale k, which is used to measure the topological similarity between plant organ features at different scales;
[0112] The formula is used to measure the similarity of posture or spatial structure between primary capsule units at different scales. s,i Represents the i-th structural unit (such as a branch) at the s-th scale, and measures its similarity with the unit u at other scales through cosine similarity k,j The purpose is to establish a structural alignment relationship between multiple scales, so that the system can find the consistency of the same plant structure at different scales, thereby eliminating scale interference and improving the robustness of structure recognition.
[0113] S25. Using scaled attention weight β s , scale correlation matrix M Scale Fusion weight matrix W with scale features s Fuse the primary scale capsule set to generate the pose constraint fusion matrix M Pose , the posture constraint fusion matrix is used to represent the unified posture relationship of the cultivation trough, bracket, plant trunk, branches, leaves and fruits at multiple scales in the horticultural space:
[0114]
[0115] Among them, W sis the learnable scale feature weight matrix, which regulates the contribution of posture fusion of plant features at different scales. ° represents element-wise matrix multiplication.
[0116] The formula converts the multi-scale primary capsule output U s , scale attention weight β s and scale correlation matrix M Scale Fusion, generate a cross-scale consistency pose matrix M Pose . Matrix multiplication ° preserves the inter-scale similarity between structures, W s Strengthening scale-specific feature contributions to learnable parameters.
[0117] In essence, the "recognition results of each structural unit at multiple scales" are uniformly expressed as an information vector with topological context, realizing "uniform expression of scales" and facilitating spatial structure recognition.
[0118] S26. Fusion matrix M Pose Input structure-aware dynamic routing capsule layer to construct dynamic routing structure graph G Caps , calculate the structure-sensitive dynamic routing probability r in the dynamic routing structure graph ij , characterizing the topological relationship between capsule units of different scales:
[0119]
[0120] Among them, r ij is the dynamic routing probability of the bottom i-th capsule to the top j-th capsule, γ ij It is a structure-sensitive parameter based on horticultural layout objectives, used to highlight key plant organ characteristics. represents the pose constraint fusion matrix of the i-th bottom-level capsule unit, represents the pose constraint fusion matrix of the j-th bottom-level capsule unit, represents the pose constraint fusion matrix of the k-th bottom-level capsule unit, Sim(·) is the cosine similarity or Euclidean distance similarity function;
[0121] The formula is used to construct the connection probability of each bottom-level capsule unit to the high-level capsule unit in the dynamic routing graph, r ij It measures the degree of support of the underlying structure i for the higher-level structure j. Sim(·) is a similarity function (such as cosine or Euclidean distance), γ ij It is a structure-sensitive parameter used to enhance the structural recognition capability of key parts of fruits and trunks.
[0122] A "dynamic voting mechanism" between structures is implemented, that is, in horticultural cultivation, if multiple branches point in the direction of fruit formation, the probability of fruit existence is higher.
[0123] S27. Using dynamic routing structure diagram G Caps Update the high-level capsule unit output vector v j , through the pose alignment matrix P Align Adjust the spatial consistency of the capsule output vector:
[0124] v j =h(∑ i r ij ·(u ij °P Align ));
[0125] Among them, u ij is the fusion matrix M through the posture constraint Pose The obtained capsule prediction vector, P Align is the pose alignment constraint matrix between specific plant organs in a horticultural scenario, used to normalize the pose range of the capsule vector. h(·) is a nonlinear squeezing activation function suitable for horticultural scenarios. The nonlinear squeezing activation function is an activation function used in the Capsule Network to normalize the amplitude of the capsule output vector. Its main function is to compress vectors of arbitrary length to the range between 0 and 1, thereby reflecting the probability of detection of the entity represented by the vector. The nonlinear squeezing activation function often uses the squash function.
[0126] The formula defines the final high-level capsule unit output vector v j The output is formed by weighted fusion of all underlying structures, P Align is a posture alignment matrix, used to standardize structural logic such as "fruit must hang at the end of a branch." The nonlinear function h(·) further ensures the standardization of the vector output, so that the output corresponds to a clear structural category (such as fruit or leaf).
[0127] The significance lies in forming the most realistic spatial expression of horticultural structure through dynamic fusion + posture constraint + structural normalization, which is the prerequisite for digital twin modeling of cultivation space.
[0128] S28. Based on the high-level capsule unit output vector v j , generating horticultural cultivation spatial structure recognition results, including the semantic category labels of cultivation troughs, supports, plant trunks, branches, leaves and fruits, the spatial topological relationships between plant organs, geometric dimensions and unified posture vectors.
[0129] In this embodiment, S3 includes the following steps:
[0130] S31. Based on the results of horticultural cultivation space structure recognition, a digital twin model of horticultural cultivation space is constructed. The digital twin model of horticultural cultivation space is based on the graph structure G Twin =(V Twin ,E Twin) indicates that the node set Represents the digital representation of each structural element in the horticultural cultivation scene, including cultivation trough nodes, support nodes, plant trunk nodes, branch nodes, leaf nodes and fruit nodes. The number of nodes is N v ;Edge set E Twin ={e kz} represents the topological connection relationship between various structural elements;
[0131] S32. Assign a unified attribute vector A to each node in the digital twin model of horticultural cultivation space i , attribute vector A k Contains category label C k , geometric center coordinates L k 、Geometric size S k With the posture vector Q k , where the category label C k The value is one of the cultivation trough, support, plant trunk, branch, leaf and fruit, and the geometric center coordinate L k Indicates the three-dimensional geometric coordinates of the node center, the geometric dimension S k Represents the width, height and depth of the node structure element, the posture vector Q k Represents the spatial posture information of the node structure elements;
[0132] S33. Generate a unified operational spatial coordinate grid G based on the digital twin model of horticultural cultivation space Grid The unified operational space coordinate grid is composed of regularly arranged three-dimensional space grids, and the node geometric center coordinates L of the digital twin model of horticultural cultivation space are k Discrete mapping to the corresponding spatial grid coordinates G Grid (m,n,p), the spatial grid coordinate G Grid (m, n, p) represent the discrete coordinate indexes of the horizontal, vertical and height directions of the spatial grid respectively;
[0133] S34. According to the node distribution of the horticultural cultivation space digital twin model in the spatial grid, the geometric center coordinates of each cultivation trough node are extracted to form the cultivation trough position set T Cult , and extract the inclination angle of each support node relative to the horizontal plane to form the support angle set Θ Sup ;
[0134] S35. Calculate the Euclidean distance between each two plant trunk nodes based on the geometric center coordinates of the plant trunk nodes in the digital twin model of the horticultural cultivation space. Calculate the square root of the sum of the squares of the horizontal, vertical, and height coordinate differences between the two plant trunk nodes to form the plant spacing set D. Plant ;
[0135] S36. Based on the geometric center coordinates of the light source device nodes in the digital twin model of the horticultural cultivation space, extract the inclination angle of each light source device node relative to the vertical direction to form a light source angle set Φ Light ;
[0136] S37. Based on the geometric center coordinates of the cultivation trough node and the irrigation equipment node in the digital twin model of the horticultural cultivation space, the Euclidean distance between the two nodes is calculated by calculating the square root of the sum of the squares of the horizontal, vertical, and height coordinate differences between the two nodes. Based on the Euclidean distance between the nodes, the shortest path connecting the cultivation trough node and the irrigation equipment node is determined to form the irrigation pipeline path set P. Irrig ;
[0137] S38. Set the cultivation trough position set T Cult 、bracket angle set Θ Sup , plant spacing set D Plant , light source angle set Φ Light and irrigation pipe path set P Irrig Combined to form the horticultural cultivation layout variable vector X Layout .
[0138] In this embodiment, S4 includes the following steps:
[0139] S41. Based on the horticultural cultivation layout variable vector, node posture vector set, geometric center coordinate set, geometric size set and topological edge set, a multi-objective fitness function f(X) for horticultural cultivation layout optimization is constructed. Layout ), the multi-objective fitness function value is used to comprehensively evaluate the performance of the horticultural cultivation layout plan in terms of light uniformity, ventilation efficiency, irrigation system pipeline length, and mechanical accessibility. The multi-objective fitness function value is obtained by multiplying the light uniformity objective function value, ventilation efficiency objective function value, irrigation system pipeline length objective function value, and mechanical accessibility objective function value by the corresponding user-set objective weight coefficient and then summing them up:
[0140] f(X Layout )=w1·f light +w2·f vent +w3·f pipe +w4·f reach ;
[0141] Among them, f light represents the illumination uniformity objective function, f vent represents the ventilation efficiency objective function, f pipe represents the objective function of the irrigation system pipeline length, f reach represents the mechanical accessibility objective function, w1, w2, w3, w4 are the objective weight coefficients set by the user;
[0142] S42. The illumination uniformity objective function value is used to assess the uniformity of illumination received by all leaf nodes within the horticultural cultivation space. The illumination uniformity objective function value is obtained by calculating the cosine of the angle between the light source direction and the attitude vector of each leaf node, multiplying it by the light transmittance factor per unit area of the leaf node to obtain the received illumination intensity of each leaf node. The square of the difference between the received illumination intensity of all leaf nodes and the average illumination intensity of the leaf nodes is then calculated, and the average sum of these squared differences is then taken for all leaf nodes.
[0143] S43. The ventilation efficiency objective function value is used to evaluate the overall ventilation resistance level of the ventilation paths between plant trunk nodes within a horticultural cultivation space. The ventilation efficiency objective function value is calculated by multiplying the air density between each pair of plant trunk nodes with a ventilation path by the spatial distance between the pair of trunk nodes, and then dividing the result by the effective ventilation cross-sectional area between the two trunk nodes. The ventilation resistance value for each pair of trunk nodes is then calculated by summing the ventilation resistance values for all pairs of trunk nodes with a ventilation path.
[0144] S44. The irrigation system pipeline length objective function value is used to evaluate the total length of the irrigation pipeline path within the horticultural cultivation space. The irrigation system pipeline length objective function value is obtained by connecting the geometric center coordinates of each node on each irrigation pipeline path within the horticultural cultivation space, calculating the spatial distance between each two consecutive nodes, and then accumulating the spatial distances between all consecutive nodes in the path to sum the lengths of all irrigation pipeline paths within the horticultural cultivation space.
[0145] S45. A mechanical accessibility objective function value is used to evaluate the overall alignment between the posture vector of the robot arm end-effector and the posture vectors of the fruit nodes within the horticultural cultivation space. The mechanical accessibility objective function value is obtained by calculating the angle between the posture vector of each fruit node and the posture vector of the robot arm end-effector, and calculating the difference between the cosine value of the angle and 1 to obtain the degree of posture deviation between each fruit node and the robot arm end-effector. The posture deviation degrees are then summed for all fruit nodes.
[0146] S46. Constructing the structural constraint matrix C Struct ,The structural constraint matrix is used to limit the rigid spatial constraints that the horticultural cultivation layout ,variable vector must satisfy during the layout optimization process. ,The structural constraint matrix is generated by defining the rigid spatial constraints.
[0147] In this embodiment, the rigid spatial constraints include: the minimum ventilation distance between plants must not be lower than the safety threshold, the slope of the irrigation pipeline path must not exceed the maximum allowable slope, the location of the cultivation trough must be within the limited layout boundary range, and the geometric dimensions between the support and the spatial area corresponding to the fruit node do not overlap.
[0148] In this embodiment, S5 includes the following steps:
[0149] S51. Initialize the Black Widow Optimization Algorithm population based on the horticultural cultivation layout variable vector and construct the initial population set Where N is the population size, Represents the fth individual layout variable vector. During the initialization process, the layout variable vector elements are sampled in the feasible domain according to the spatial boundary and node distribution range of the gardening scene to ensure that each individual satisfies the structural constraint matrix C Struct All constraints defined;
[0150] S52. Setting the mating ratio μ of the Black Widow Optimization Algorithm mate , phagocytosis rate ρ kill and mutation rate τ mut , the mating ratio indicates the proportion of individuals participating in mating, the phagocytosis rate indicates the proportion of individuals eliminated after generating offspring, and the mutation rate indicates the proportion of individuals subjected to mutation operations after generating offspring;
[0151] S53. For population P (g) Calculate the multi-objective fitness value of all individual layout variable vectors The multi-objective fitness value result is used as the fitness record of the current iteration algebra g, and the structural constraint matrix C is converted into Struct The unsatisfied items in the fitness function are added as penalty function items to obtain the corrected fitness function value
[0152]
[0153] Among them, λ is the structural constraint penalty coefficient, φ r (·) is the rth constraint function, R is the number of constraints in the structural constraint matrix;
[0154] In the actual scene of horticultural cultivation, the plant structure is dense, the support is intricate, and the coupling between the light source and the irrigation system is complex. Optimization efforts (e.g., pursuing better light uniformity or shorter irrigation paths) may ignore practical feasibility in the physical layout, such as overlapping growing troughs or excessive pipe slopes.
[0155] The introduction of the modified fitness function value is actually to introduce a penalty term for the scheme that violates the structural constraints. The scores of individuals that do not meet the constraints will be automatically lowered in the fitness evaluation to guide the algorithm to reject physically infeasible solutions, thereby ensuring the feasibility of the layout in real gardening operations.
[0156] In the present invention, the horticultural structure information is abstracted as a structure constraint matrix, where each constraint function φ r It actually corresponds to a space rule or safety standard, which comes from the actual production standards in the horticultural field.
[0157] By embedding rules into the fitness function, the Black Widow optimization algorithm always considers structural feedback during the search process, achieving the organic coupling of layout variable vector optimization and spatial structure perception. This is an important innovation that distinguishes it from the traditional Black Widow algorithm.
[0158] The penalty coefficient λ in the formula is an adjustable parameter, which is used to balance the relationship between the "optimization goal" and the "structural constraint". In the initial exploration stage, a small value can be set to increase the search space coverage, and gradually increased in the later convergence stage to strengthen feasibility screening.
[0159] The introduction of this correction formula enables the optimization of horticultural cultivation space structure to pursue not only "optimal" but also "feasible and optimal", reflecting the deep integration of intelligent optimization and horticultural structure knowledge, and is the core connection hub of the multi-objective intelligent optimization logic of the present invention.
[0160] S54. Perform a pairing operation on the individuals with the selected mating ratio and generate a set of offspring C in a random pairing manner. (g) , each child in the children collection Calculated as:
[0161]
[0162] in, and is the parent generation of the pairing, α is the pairing weight factor, which controls the degree of deviation of the offspring generation toward the parent generation;
[0163] S55. According to the phagocytosis rate ρ kill For the descendant set C (g) All offspring calculate the modified fitness function value Sort by fitness function value from small to large, and keep the first (1-ρ kill )·C (g) The offspring with better fitness enter the candidate offspring set, and the rest are eliminated;
[0164] S56. Perform enhanced widow recombination on all offspring. The enhanced widow recombination is achieved by exchanging feature subvectors across individuals in a high-dimensional space, that is, swapping some layout variable dimensions of two individuals and recombining them to generate new individuals. Used to improve search space coverage;
[0165] S57. The recombined offspring and some of the parent individuals with the best fitness function values in the current generation together form the next generation population P (g+1) , and return to step S53 for iterative update until the maximum number of iterations G is reached max or meet the convergence criterion;
[0166] S58. Extract the non-dominated solution set of fitness function value from the final population to form the Pareto optimal horticultural cultivation layout solution set X Pareto , use the target weight coefficients (w1, w2, w3, w4) set by the user to comprehensively sort the solution set, and select the layout variable vector with the smallest weighted objective function value as the optimal horticultural cultivation layout solution
[0167] In this embodiment, S6 includes the following steps:
[0168] S61. Mapping the optimal horticultural cultivation layout plan to the horticultural cultivation space digital twin model, and updating the cultivation trough position set, support angle set, plant spacing set, light source angle set, and irrigation pipeline path set included in the optimal horticultural cultivation layout plan to the corresponding nodes and edges in the horticultural cultivation space digital twin model through the node mapping relationship;
[0169] S62. Using the digital twin platform, the node and edge changes in the updated digital twin model of the horticultural cultivation space are converted into a directly executable set of layout adjustment instructions, including cultivation trough adjustment instructions, support adjustment instructions, plant transplanting point adjustment instructions, light source adjustment instructions, and irrigation pipeline adjustment instructions;
[0170] S63. Send the generated layout adjustment instruction set to the execution device, which completes the actual adjustment of the cultivation trough position, bracket angle, plant transplanting point, light source angle and irrigation pipeline path according to the layout adjustment instruction set to achieve layout optimization of the horticultural cultivation space.
[0171] In this embodiment, the cultivation trough adjustment instruction is used to guide the optimization adjustment of the position of the cultivation trough node, and the optimization adjustment of the position of the cultivation trough node is achieved by moving the cultivation trough node from the initial position to the target position corresponding to the optimal horticultural cultivation layout plan;
[0172] The support adjustment instruction is used to guide the angle optimization adjustment of the support node. The angle optimization adjustment of the support node is achieved by adjusting the initial tilt angle of the support node to the target tilt angle corresponding to the optimal horticultural cultivation layout plan;
[0173] The plant transplant point adjustment instruction is used to guide the spatial layout adjustment between the plant trunk nodes. The spatial layout adjustment between the plant trunk nodes is achieved by moving the plant trunk nodes from the initial geometric center coordinates to the target geometric center coordinates that meet the plant spacing requirements in the optimal horticultural cultivation layout plan;
[0174] The light source adjustment instruction is used to guide the angle optimization adjustment of the light source device node. The angle optimization adjustment of the light source device node is achieved by adjusting the initial tilt angle of the light source device node to the target tilt angle corresponding to the optimal horticultural cultivation layout plan;
[0175] The irrigation pipeline adjustment instruction is used to guide the layout optimization adjustment of the irrigation pipeline path. The layout optimization adjustment of the irrigation pipeline path is achieved by moving the irrigation pipeline node from the initial geometric center coordinate to the target geometric center coordinate that meets the irrigation pipeline path requirements in the optimal horticultural cultivation layout plan, thereby achieving an optimized layout with the shortest pipeline path length and reasonable slope restrictions.
[0176] Example 1:
[0177] The Smart Horticulture Demonstration Base conducted field tests on identifying and optimizing horticultural cultivation space structures and layouts in a spring pepper nursery area. The base selected Area B2 of the nursery area as the test area, covering approximately 96 square meters and containing 24 cultivation troughs, 28 supports, and approximately 150 pepper seedlings. The test aimed to address the following three core issues with traditional cultivation layouts:
[0178] Uneven light distribution causes some plants to grow slowly;
[0179] Tangled irrigation lines lead to water waste;
[0180] There is serious shading and space waste between plants.
[0181] On the first day of the test, the system completed the acquisition of red, green, and blue image data, depth image data, 3D point cloud data, and spectral reflectance data of the area through a multimodal acquisition platform. The acquisition equipment included an Intel RealSense D435i camera and a LIVOXAVIA lidar. The unified acquisition frequency was set to 30Hz and the acquisition time was 120 seconds. After the acquisition was completed, the system generated fused input data D after unified timestamp calibration, spatial registration, and scale normalization. Unified And input into the improved multi-scale perception enhancement capsule network.
[0182] A total of 354 structural units were identified through the structure-aware dynamic routing mechanism, including:
[0183] Cultivation trough nodes: 24; support nodes: 28; trunk nodes: 147; branch nodes: 301; leaf nodes: 512; fruit nodes (including young fruits): 73.
[0184] Use the structure recognition results to build a digital twin model G Twin And generate a unified spatial grid G Grid , the system further extracts layout variables:
[0185] Cultivation trough position, support inclination angle;
[0186] Trunk spacing D Plant (average 23.4cm, as low as 15cm in some areas);
[0187] Irrigation path P Irrig (Total length is 108.7m, with a distribution overlap rate of up to 18%);
[0188] Light source inclination angle Φ Light (9 groups of lighting angles are less than 30°);
[0189] And combined into the layout variable vector X Layout .
[0190] The system constructed a multi-objective fitness function encompassing four objectives: illumination uniformity, ventilation efficiency, irrigation length, and mechanical accessibility. This function was combined with a structural constraint matrix, such as a minimum spacing between cultivation troughs greater than 25 cm and a pipe slope less than 5°. The improved Black Widow optimization algorithm was then initialized, with the following parameters set:
[0191] Mating ratio μ mate =0.7; phagocytosis rate ρ kill =0.3; mutation rate τ mut =0.1; maximum number of iterations G max =100.
[0192] The system converged in the 63rd iteration, eventually forming a Pareto optimal solution set and selecting the optimal solution. It then automatically generated adjustment commands and sent them to the electric lifting bracket, light source rotation module, and irrigation equipment.
[0193] The system detected that the angle between bracket nodes S14 and S16 was only 18.6°, and the orientation of the fruit nodes in this area overlapped, resulting in a light obstruction of up to 42%. The system automatically issued a code command for bracket rotation:
[0194]
[0195] After the rotation adjustment was completed, the attitude vector deviation angle of fruit G73 decreased from 41.3° to 11.5°, and the light intensity of leaves in the same area increased by 21.2%.
[0196] In a comparative experiment with the traditional manual layout scheme (adjusted by a gardener based on experience), the present invention achieved the following key performance improvements:
[0197] Table 1 Comparison data between the method of the present invention and the traditional manual layout solution
[0198]
[0199]
[0200] In addition, after the harvest period was advanced by two days, the base records showed that the average weight of the peppers increased by 7.9% compared with the same batch last year, and the uniformity of maturity was significantly improved. All tasks were completed by the automatic system without the need for manual repositioning of supports or pipelines.
[0201] The present invention introduces a scale-adaptive convolution module and a scale-aware posture fusion mechanism. By dynamically constructing a cross-scale feature tensor set and combining scale attention with inter-scale topological modeling, it can adapt to the multi-scale deformation characteristics of different plant components in complex horticultural scenes, effectively capture the semantic and geometric information of cultivation troughs, supports, trunks, branches, leaves and fruits, and construct a structure-aware dynamic routing mechanism to enhance the spatial consistency expression between structural elements. Compared with traditional structural segmentation methods based on fixed receptive field convolution or shallow capsule networks, the organ recognition accuracy under complex occlusion or staggered layouts has been improved, and the structural topology restoration rate index has also been improved.
[0202] The present invention constructs a multi-objective fitness function including illumination uniformity, ventilation efficiency, irrigation pipeline length and mechanical accessibility in layout optimization. At the same time, it introduces a structural constraint matrix to characterize the key spatial boundaries, angle restrictions and equipment accessibility areas in the gardening space. The constraint information is embedded in the optimization search process as a dynamic penalty term through a structural coupling fitness guidance mechanism, which significantly improves the constraint satisfaction rate and increases the proportion of feasible solutions.
[0203] The improved Black Widow Optimization Algorithm of the present invention introduces a mating ratio self-adjustment mechanism and a high-dimensional sub-vector recombination operation, combined with a structure-sensitive fitness correction strategy, to effectively alleviate the problems of premature convergence and insufficient exploration of feasible solution space in traditional population evolution algorithms. By designing a strategy for characteristic-level variation of offspring individuals and elite recombination of the parent generation, a comprehensive search and local fine-tuning of high-dimensional space layout variables are achieved. The resulting Pareto frontier solution set is superior to existing genetic algorithms and particle swarm algorithms in terms of multi-objective compatibility and convergence stability.
[0204] The above description is only a preferred specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with the technical field, within the technical scope disclosed by the present invention, who makes equivalent replacements or changes based on the technical solution and inventive concept of the present invention, should be covered by the scope of protection of the present invention.
Claims
1. A method for identifying and optimizing the spatial structure of horticultural cultivation based on a Capsule network, characterized in that: The steps include: S1. Collect and preprocess horticultural cultivation multimodal raw data to generate horticultural cultivation multimodal fusion input data; S2. Input the horticultural cultivation multimodal fusion input data into a multi-scale perception-enhanced capsule network to extract cross-scale feature tensors. The multi-scale perception-enhanced capsule network is then used to perform semantic recognition and spatial structure extraction of cultivation troughs, supports, plant trunks, branches, leaves, and fruits, obtaining horticultural cultivation spatial structure recognition results. S3. Build a digital twin model of the horticultural cultivation space based on the results of the horticultural cultivation space structure recognition. Extract the cultivation trough position, support angle, plant spacing, light source angle, and irrigation pipeline path to form a horticultural cultivation layout variable vector. S4. Based on the posture vector and topological information and the horticultural cultivation layout variable vector, construct a multi-objective fitness function and generate a structural constraint matrix; S5. Initialize the Black Widow Optimization Algorithm population based on the horticultural cultivation layout variable vector, set the mating ratio, engulfment rate, and mutation rate according to the structural constraint matrix, execute the Black Widow Optimization Algorithm, obtain the Pareto optimal horticultural cultivation layout solution set, and select the optimal horticultural cultivation layout solution from the Pareto optimal horticultural cultivation layout solution set according to the target weight set set by the user; S6. Map the optimal horticultural cultivation layout plan to the digital twin model of the horticultural cultivation space, adjust the cultivation troughs, supports, plant transplanting points, light sources and irrigation pipelines, and optimize the horticultural cultivation layout.
2. The method for identifying and optimizing the horticultural cultivation space structure based on Capsule network according to claim 1, characterized in that: Said S1 comprises the following steps: S11. Acquire horticultural multimodal raw data, including red, green, and blue image data, depth image data, three-dimensional point cloud data, and spectral reflectance data, perform unified time stamping on the horticultural multimodal raw data, and construct a time-synchronized multimodal data set; S12. Perform spatial registration on the data in the time-synchronized multimodal data set, converting the data from different sources into the coordinate system of the red, green, and blue cameras to form a unified three-dimensional point cloud coordinate system; S13. performing scale normalization processing on the three-dimensional point cloud data set after spatial registration; S14. The normalized three-dimensional point cloud set P ′ , Red, green and blue image data D after registration RGB , depth image data D Depth With spectral reflectance data D Spectral Perform fusion encoding and combine the encoding results into horticultural cultivation multimodal fusion input data D Unified .
3. The method for identifying and optimizing the horticultural cultivation space structure based on Capsule network according to claim 2, characterized in that: The multi-scale perception enhancement capsule network consists of a scale-adaptive convolution module, a primary capsule layer, a scale-aware posture fusion capsule layer and a structure-aware dynamic routing capsule layer.
4. The method for identifying and optimizing the horticultural cultivation space structure based on Capsule network according to claim 3, characterized in that: The S2 comprises the following steps: S21. Fusion of horticultural multimodal input data D Unified The input is fed into the multi-scale perception enhancement capsule network. The scale-adaptive convolution module performs parallel convolution operations with different convolution kernel sizes on the horticultural multimodal fusion input data to extract a set of cross-scale feature tensors covering multiple spatial receptive fields. Among them, the scale number S is dynamically determined based on the plant size and structural complexity in the gardening scene; S22. Set the cross-scale feature tensor F MS Input primary capsule layer, the primary capsule layer is used to calculate the feature tensor F of each scale s Generate primary capsule units through convolution mapping to form a primary scale capsule set U s , each capsule u in the primary scale capsule set s,i is a vector with fixed dimension; S23. Input the primary scale capsule set of all scales into the scale-aware posture fusion capsule layer, and learn the scale attention weight β s Determine the importance of capsule units at each scale and learn the scale attention weight β s Use scale-aware self-attention network to perform fully connected layer mapping calculations; S24. The scale-aware posture fusion capsule layer further passes through the scale correlation matrix M Scale The topological correlation modeling is performed on the primary capsule unit set of each scale, and the scale correlation matrix M Scale Defined as: Among them, M Scale (u s,i ,u k,j ) represents the cosine similarity between the i-th capsule in scale s and the j-th capsule in scale k, which is used to measure the topological similarity between plant organ features at different scales; S25. Using scaled attention weight β s , scale correlation matrix M Scale Fusion weight matrix W with scale features s Fuse the primary scale capsule set to generate the pose constraint fusion matrix M Pose , the posture constraint fusion matrix is used to represent the unified posture relationship of the cultivation trough, bracket, plant trunk, branches, leaves and fruits at multiple scales in the horticultural space: Among them, W s is the learnable scale feature weight matrix that regulates the contribution of posture fusion of plant features at different scales, ° represents element-wise matrix multiplication, and S is the number of parallel convolution channels used by the scale-adaptive convolution module in the multi-scale perception enhancement capsule network; S26. Fusion matrix M Pose Input structure-aware dynamic routing capsule layer to construct dynamic routing structure graph G Caps , calculate the structure-sensitive dynamic routing probability r in the dynamic routing structure graph ij , characterizing the topological relationship between capsule units of different scales: Among them, r ij is the dynamic routing probability of the bottom i-th capsule to the top j-th capsule, γ ij It is a structure-sensitive parameter based on horticultural layout objectives, used to highlight key plant organ characteristics. represents the pose constraint fusion matrix of the i-th bottom-level capsule unit, represents the pose constraint fusion matrix of the j-th bottom-level capsule unit, represents the pose constraint fusion matrix of the k-th bottom-level capsule unit, Sim(·) is the cosine similarity or Euclidean distance similarity function; S27. Using dynamic routing structure diagram G Caps Update the high-level capsule unit output vector v j , through the pose alignment matrix P Align Adjust the spatial consistency of capsule output vectors; S28. Based on the high-level capsule unit output vector v j , generating horticultural cultivation spatial structure recognition results, including the semantic category labels of cultivation troughs, supports, plant trunks, branches, leaves and fruits, the spatial topological relationships between plant organs, geometric dimensions and unified posture vectors.
5. The method for identifying and optimizing the horticultural cultivation space structure based on Capsule network according to claim 4, characterized in that: The S3 includes the following steps: S31. Based on the results of horticultural cultivation space structure recognition, a digital twin model of horticultural cultivation space is constructed. The digital twin model of horticultural cultivation space is based on the graph structure G Twin =(V Twin ,E Twin ) indicates that the node set Represents the digital representation of each structural element in the horticultural cultivation scene, including cultivation trough nodes, support nodes, plant trunk nodes, branch nodes, leaf nodes and fruit nodes. The number of nodes is N v ;Edge set E Twin ={e kz } represents the topological connection relationship between various structural elements; S32. Assign a unified attribute vector A to each node in the digital twin model of horticultural cultivation space i , attribute vector A k Contains category label C k , geometric center coordinates L k 、Geometric size S k With the posture vector Q k , where the category label C k The value is one of the cultivation trough, support, plant trunk, branch, leaf and fruit, and the geometric center coordinate L k Indicates the three-dimensional geometric coordinates of the node center, the geometric dimension S k Represents the width, height and depth of the node structure element, the posture vector Q k Represents the spatial posture information of the node structure elements; S33. Generate a unified operational spatial coordinate grid G based on the digital twin model of horticultural cultivation space Grid The unified operational space coordinate grid is composed of regularly arranged three-dimensional space grids, and the node geometric center coordinates L of the digital twin model of horticultural cultivation space are k Discrete mapping to the corresponding spatial grid coordinates G Grid (m,n,p), the spatial grid coordinate G Grid (m, n, p) represent the discrete coordinate indexes of the horizontal, vertical and height directions of the spatial grid respectively; S34. According to the node distribution of the horticultural cultivation space digital twin model in the spatial grid, the geometric center coordinates of each cultivation trough node are extracted to form the cultivation trough position set T Cult , and extract the inclination angle of each support node relative to the horizontal plane to form the support angle set Θ Sup ; S35. Calculate the Euclidean distance between each two plant trunk nodes based on the geometric center coordinates of the plant trunk nodes in the digital twin model of the horticultural cultivation space. Calculate the square root of the sum of the squares of the horizontal, vertical, and height coordinate differences between the two plant trunk nodes to form the plant spacing set D. Plant ; S36. Based on the geometric center coordinates of the light source device nodes in the digital twin model of the horticultural cultivation space, extract the inclination angle of each light source device node relative to the vertical direction to form a light source angle set Φ Light ; S37. Based on the geometric center coordinates of the cultivation trough node and the irrigation equipment node in the digital twin model of the horticultural cultivation space, the Euclidean distance between the two nodes is calculated by calculating the square root of the sum of the squares of the horizontal, vertical, and height coordinate differences between the two nodes. Based on the Euclidean distance between the nodes, the shortest path connecting the cultivation trough node and the irrigation equipment node is determined to form the irrigation pipeline path set P. Irrig ; S38. Set the cultivation trough position set T Cult 、bracket angle set Θ Sup , plant spacing set D Plant , light source angle set Φ Light and irrigation pipe path set P Irrig Combined to form the horticultural cultivation layout variable vector X Layout .
6. The method for identifying and optimizing the horticultural cultivation space structure based on Capsule network according to claim 5, characterized in that: The S4 comprises the following steps: S41. Based on the horticultural cultivation layout variable vector, node posture vector set, geometric center coordinate set, geometric size set and topological edge set, a multi-objective fitness function f(X) for horticultural cultivation layout optimization is constructed. Layout ): f(X Layout )=w1·f light +w2·f vent +w3·f pipe +w4·f reach ; Among them, f light represents the illumination uniformity objective function, f vent represents the ventilation efficiency objective function, f pipe represents the objective function of the irrigation system pipeline length, f reach represents the mechanical accessibility objective function, w1, w2, w3, w4 are the objective weight coefficients set by the user; S42. Constructing the structural constraint matrix C Struct ,The structural constraint matrix is used to limit the rigid spatial constraints that the horticultural cultivation layout variable vector must satisfy during the layout optimization process.
7. The method for identifying and optimizing the horticultural cultivation space structure based on Capsule network according to claim 6, characterized in that: The rigid spatial constraints include: the minimum ventilation distance between plants must not be lower than the safety threshold, the slope of the irrigation pipeline path must not exceed the maximum allowable slope, the location of the cultivation trough must be within the specified layout boundary, and the geometric dimensions between the support and the spatial area corresponding to the fruit node do not overlap.
8. The method for identifying and optimizing the horticultural cultivation space structure based on Capsule network according to claim 6, characterized in that: The S5 comprises the following steps: S51. Initialize the Black Widow Optimization Algorithm population based on the horticultural cultivation layout variable vector and construct the initial population set Where N is the population size, Represents the fth individual layout variable vector. During the initialization process, the layout variable vector elements are sampled in the feasible domain according to the spatial boundary and node distribution range of the gardening scene to ensure that each individual satisfies the structural constraint matrix C Struct All constraints defined; S52. Setting the mating ratio μ of the Black Widow Optimization Algorithm mate , phagocytosis rate ρ kill and mutation rate τ mut , the mating ratio indicates the proportion of individuals participating in mating, the phagocytosis rate indicates the proportion of individuals eliminated after generating offspring, and the mutation rate indicates the proportion of individuals subjected to mutation operations after generating offspring; S53. For population P (g) Calculate the multi-objective fitness value of all individual layout variable vectors The multi-objective fitness value result is used as the fitness record of the current iteration algebra g, and the structural constraint matrix C is converted into Struct The unsatisfied items in the fitness function are added as penalty function items to obtain the corrected fitness function value S54. Perform a pairing operation on the individuals with the selected mating ratio and generate a set of offspring C in a random pairing manner. (g) , each child in the children collection Calculated as: in, and is the parent generation of the pairing, α is the pairing weight factor, which controls the degree of deviation of the offspring generation toward the parent generation; S55. According to the phagocytosis rate ρ kill For the descendant set C (g) All offspring calculate the modified fitness function value Sort by fitness function value from small to large, and keep the first (1-ρ kill )·C (g) The offspring with better fitness enter the candidate offspring set, and the rest are eliminated; S56. Perform enhanced widow recombination on all offspring. The enhanced widow recombination is achieved by exchanging feature subvectors across individuals in a high-dimensional space, that is, swapping some layout variable dimensions of two individuals and recombining them to generate new individuals. Used to improve search space coverage; S57. The recombined offspring and some of the parent individuals with the best fitness function values in the current generation together form the next generation population P (g+1) , and return to step S53 for iterative update until the maximum number of iterations G is reached max or meet the convergence criterion; S58. Extract the non-dominated solution set of fitness function value from the final population to form the Pareto optimal horticultural cultivation layout solution set X Pareto , use the target weight coefficients (w1, w2, w3, w4) set by the user to comprehensively sort the solution set, and select the layout variable vector with the smallest weighted objective function value as the optimal horticultural cultivation layout solution 9. The method for identifying and optimizing the horticultural cultivation space structure based on Capsule network according to claim 8, characterized in that: The S6 comprises the following steps: S61. Mapping the optimal horticultural cultivation layout plan to the horticultural cultivation space digital twin model, and updating the horticultural cultivation space digital twin model; S62. Using the digital twin platform, the node and edge changes in the updated digital twin model of the horticultural cultivation space are converted into a directly executable set of layout adjustment instructions, including cultivation trough adjustment instructions, support adjustment instructions, plant transplanting point adjustment instructions, light source adjustment instructions, and irrigation pipeline adjustment instructions; S63. Send the generated layout adjustment instruction set to the execution device, which completes the actual adjustment of the cultivation trough position, bracket angle, plant transplanting point, light source angle and irrigation pipeline path according to the layout adjustment instruction set to achieve layout optimization of the horticultural cultivation space.
10. The method for identifying and optimizing the horticultural cultivation space structure based on Capsule network according to claim 9, characterized in that: The cultivation trough adjustment instruction is used to guide the optimization adjustment of the position of the cultivation trough node, which is achieved by moving the cultivation trough node from the initial position to the target position corresponding to the optimal horticultural cultivation layout plan; The support adjustment instruction is used to guide the angle optimization adjustment of the support node, which is achieved by adjusting the initial tilt angle of the support node to the target tilt angle corresponding to the optimal horticultural cultivation layout plan; The plant transplant point adjustment instruction is used to guide the spatial layout adjustment between the plant trunk nodes, which is achieved by moving the plant trunk nodes from the initial geometric center coordinates to the target geometric center coordinates that meet the plant spacing requirements in the optimal horticultural cultivation layout plan; The light source adjustment instruction is used to guide the angle optimization adjustment of the light source device node, which is achieved by adjusting the initial tilt angle of the light source device node to the target tilt angle corresponding to the optimal horticultural cultivation layout plan; The irrigation pipeline adjustment instruction is used to guide the layout optimization adjustment of the irrigation pipeline path. By moving the irrigation pipeline node from the initial geometric center coordinate to the target geometric center coordinate that meets the irrigation pipeline path requirements in the optimal horticultural cultivation layout plan, an optimized layout with the shortest pipeline path length and reasonable slope restrictions is achieved.
Citation Information
Patent Citations
Wire instance detection method and system based on key point matching
CN119672004A
Scene flow digital twin method and system based on dynamic trajectory flow
WO2023207437A1