Fruit tree trunk identifying and positioning method based on binocular machine vision
By improving the YOLOv7-tiny model and binocular machine vision technology, and combining it with the SGBM algorithm, accurate identification and positioning of fruit tree trunks were achieved, solving the problems of trunk damage and inaccurate identification by orchard weeders, and improving orchard management efficiency and intelligence level.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-18
- Publication Date
- 2026-04-10
AI Technical Summary
Existing orchard weeders are prone to damaging tree trunks when weeding between fruit trees, and the YOLOv7-tiny has insufficient trunk recognition capabilities under complex lighting and background interference, resulting in inaccurate positioning.
A method for identifying fruit tree trunks based on binocular machine vision is adopted. By improving the YOLOv7-tiny model, introducing the PConv module and SimAM attention mechanism, and combining dataset augmentation and normalization processing, the method is combined with the SGBM algorithm for localization to achieve accurate identification and localization of tree trunks.
It significantly improves the accuracy and efficiency of tree trunk identification, ensures the accuracy of tree trunk identification and the reliability of three-dimensional positioning, reduces manual intervention, and promotes intelligent management of orchards.
Smart Images

Figure CN121837366A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of intelligent agricultural equipment autonomous operation, and in particular to a fruit tree trunk recognition and positioning method based on binocular machine vision. BACKGROUND
[0002] The existing orchard weeding machine can only weed in the effective area between the fruit tree rows, and the weeds between the fruit trees still need to be removed manually. Although some weeding machines are equipped with inter-plant weeding mechanisms to weed between plants, the inter-plant weeding mechanism mainly relies on touching the trunk to perceive the trunk position, thereby performing obstacle avoidance. This contact type inter-plant obstacle avoidance method can easily cause damage to the trunk and affect the growth of the fruit trees. With the development of agricultural intelligent technology, non-contact active obstacle avoidance technology for orchard weeding machines has become a research focus. For example, the inter-plant weeding device is combined with a deep learning algorithm to realize active obstacle avoidance operation between fruit trees.
[0003] Currently, although single-stage target recognition technology represented by YOLOv7-tiny has natural advantages in detection speed, its target recognition ability under complex orchard lighting and background interference is still insufficient, which leads to missed detection and positioning deviation in dense plant type or occlusion scenes, which hinders the realization of real-time operation at the end side of the orchard inter-plant weeding equipment.
[0004] Therefore, a new YOLOv7 recognition and positioning method is developed to improve the accuracy of trunk positioning in complex orchard environments while realizing lightweight technology, to solve the problems in the active avoidance type weeding technology between fruit trees. SUMMARY
[0005] The present application aims to solve the above problems and proposes a fruit tree trunk recognition and positioning method based on binocular machine vision.
[0006] To achieve the above purpose, the present application adopts the following technical solutions:
[0007] A fruit tree trunk recognition and positioning method based on binocular machine vision, comprising:
[0008] Step 1: Data set creation and preprocessing, obtaining fruit tree trunk image data, and performing enhancement and normalization processing to construct fruit tree trunk data;
[0009] Step 2: Trunk recognition model optimization and construction, using YOLOv7-tiny as the basic model, light weight module, replacing part of the convolution units in the original structure; adding an attention mechanism module to construct an improved YOLOv7-tiny orchard fruit tree trunk recognition model;
[0010] Step three: training of trunk recognition model, based on the obtained training set, the improved YOLOv7-tiny-based orchard fruit tree trunk recognition model is trained to obtain the optimal trunk recognition model;
[0011] Step four: evaluation of trunk recognition model, to evaluate the effectiveness of the improved YOLOv7-tiny-based orchard fruit tree trunk recognition model;
[0012] Step five: trunk recognition model detection, input the test set in step one into the optimal recognition model obtained in step three, and then output the trunk detection result;
[0013] Step six: positioning model construction and trunk position solving, based on the optimal trunk recognition model obtained in step three, a positioning algorithm based on semi-global block matching is introduced.
[0014] Preferably, the data set in step one covers multiple typical scenes and fruit tree types, specifically including single independent growth fruit trees, low and short fruit trees, tall and large fruit trees, and fruit trees affected by complex light and background in natural open environment.
[0015] Preferably, the step two improves the original YOLOv7-tiny model, including: introducing PConv convolution into each ELAN module in the backbone network, replacing the regular convolution with a convolution kernel size of 3 and a step size of 1, obtaining a P-ELAN module, and introducing a SimAM attention mechanism module in the neck network, the SimAM module is arranged behind each ELAN module in the neck network.
[0016] Preferably, the PConv convolution module selectively uses regular convolution on only a part of the input channels for feature extraction without affecting the remaining channels.
[0017] For continuous or regular memory access, the first or last continuous channel is considered as a representative of the entire feature map for calculation, and the memory access times of PConv.
[0018] Preferably, the SimAM attention mechanism module is a 3D attention module that can synchronize and coordinate the channel dimension information and spatial dimension information of the feature map, the core of which completes the quantitative calculation of attention weight through an energy function, and the output value of the energy function directly represents the importance of each neuron in trunk feature extraction, achieving the reinforcement of key features and the suppression of redundant information.
[0019] Preferably, in step three, the improved YOLOv7-tiny orchard fruit tree trunk recognition model is trained, and the training parameters are set as follows: optimizer SGD, batch size 8, training times 200, initial learning rate 0.01, and learning rate momentum 0.937.
[0020] Preferably, in step four, ablation experiments and comparative experiments are used to evaluate the effectiveness of the orchard tree trunk recognition model based on the improved YOLOv7-tiny, specifically by introducing precision, recall, mean precision, and model volume.
[0021] Preferably, the ablation experiment and the comparison experiment in step four both use the YOLOv7-tiny model as the benchmark experimental model to carry out systematic experimental design. The ablation experiment designs multiple component combination schemes for the PConv convolution module and the SimAM attention mechanism, including three improvement forms: introducing the PConv module alone, embedding the SimAM mechanism alone, and introducing two components at the same time. Ablation tests are carried out on each improvement scheme to determine the optimal component configuration.
[0022] The comparative experiment selected mainstream models in the field of object detection as reference objects and compared their performance with Faster-RCNN, YOLOv3, YOLOv4, and YOLOv5 models, completing a comprehensive performance comparison from the dimensions of recognition accuracy and recall.
[0023] Preferably, the specific implementation steps of step six are as follows:
[0024] a: Binocular camera calibration: The Zhang Zhengyou calibration method is used to calibrate the binocular camera. The stereo calibration of the binocular camera is completed by using the intrinsic and extrinsic parameters of the binocular camera through the image of the checkerboard calibration board.
[0025] b: Improve the YOLOv7-tiny tree trunk model detection by taking the left and right view image pairs acquired synchronously by the binocular camera as input and inputting them into the optimal improved YOLOv7-tiny tree trunk recognition model obtained in step three, and outputting the detection box information of the tree trunk target;
[0026] c: Extract the center point of the tree trunk target box. Based on the tree trunk detection box information output in step b, calculate the pixel coordinates of the center point of each tree trunk detection box.
[0027] Preferably, the method further includes:
[0028] d: SGBM algorithm disparity map generation: Based on the camera calibration parameters obtained in step a, epipolar correction is performed on the left and right views, and stereo matching operation is performed on the corrected left and right views to generate a high-density disparity map of the entire image.
[0029] e: Calculation of depth information and location of center point: Based on the pixel coordinates of the center point of the tree trunk in the left and right views obtained in step c, extract the disparity value corresponding to the center point from the disparity map generated in step d. Combine the baseline distance and focal length obtained from the binocular camera calibration to calculate the depth information of the center point of the tree trunk. Then, convert the pixel coordinates to world coordinates through the camera intrinsic parameters and output the three-dimensional spatial position information of the tree trunk in the orchard.
[0030] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:
[0031] 1. This invention significantly improves tree trunk recognition performance through multi-dimensional optimization, with its core advantage lying in the balance between recognition accuracy and operational efficiency. The dataset construction covers diverse scenarios such as single trees, tall and short stalks, and complex lighting backgrounds. After HSV enhancement and flipping, the data exhibits strong robustness, laying the foundation for accurate recognition. In terms of model improvement, the PConv module replaces conventional convolution to reduce computational redundancy, and the SimAM attention mechanism strengthens key tree trunk features, enabling the improved YOLOv7-tiny model to perform optimally in ablation experiments.
[0032] 2. This invention calibrates the parameters of the binocular camera using the Zhang Zhengyou calibration method, and generates a high-density disparity map using the SGBM algorithm to eliminate vertical disparity interference and ensure the accuracy of disparity value extraction. Based on the principle of triangulation, it accurately calculates the trunk depth using the camera baseline distance, focal length, and disparity value, and outputs reliable three-dimensional position information by converting pixel coordinates to world coordinates. This positioning capability solves the problem of easy identification but difficult positioning in traditional methods, and can be directly applied to scenarios such as navigation of plant protection robots and positioning of automatic harvesting equipment, reducing manual intervention, improving operational efficiency and accuracy, reducing orchard management costs, and promoting the intelligent development of facility orchards. Attached Figure Description
[0033] Further details, features, and advantages of this application are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:
[0034] Figure 1 This is a flowchart of the method of the present invention;
[0035] Figure 2 This is a schematic diagram of a portion of the dataset used in this invention;
[0036] Figure 3 This is a schematic diagram of the overall structure of the improved YOLOv7-tiny trunk recognition model of the present invention;
[0037] Figure 4 This is a schematic diagram of the PConv convolutional module structure used in the improved YOLOv7-tiny trunk recognition model of the present invention;
[0038] Figure 5A structure diagram of a P-ELAN module in the improved YOLOv7-tiny trunk recognition model of the application is shown in the figure.
[0039] Figure 6 A structure diagram of a SimAM attention mechanism module used in the improved YOLOv7-tiny trunk recognition model of the application is shown in the figure.
[0040] Figure 7 An ablation experiment result diagram of the improved YOLOv7-tiny trunk recognition model of the application is shown in the figure.
[0041] Figure 8 A comparative experiment result diagram of the improved YOLOv7-tiny trunk recognition model of the application is shown in the figure.
[0042] Figure 9 A trunk recognition and detection effect comparison diagram of the improved YOLOv7-tiny trunk recognition model of the application and the original model on the same orchard image sample is shown in the figure.
[0043] Figure 10 A binocular camera calibration parameter result diagram of the application is shown in the figure.
[0044] Figure 11 A fruit tree trunk recognition and positioning result effect diagram based on binocular machine vision of the application is shown in the figure. DETAILED DESCRIPTION
[0045] Several embodiments of the present application will be described in detail with reference to the accompanying drawings, so as to enable those skilled in the art to implement the present application. The present application can be embodied in many different forms and purposes and should not be limited to the embodiments described herein. These embodiments are provided to make the present application comprehensive and complete, and to fully convey the scope of the present application to those skilled in the art. The embodiments do not limit the present application.
[0046] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the relevant art and / or the present specification, and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
[0047] Embodiment 1
[0048] The detailed description is accompanied by the attached drawings which serve to better illustrate specific embodiments of the application. Figure 1 The attached drawings are included to provide a further understanding of the application. Figure 11 The detailed description is accompanied by the attached drawings which serve to better illustrate specific embodiments of the application.
[0049] The attached drawings are included to provide a further understanding of the application. Figure 1A flow chart of a fruit tree trunk recognition and positioning method based on binocular machine vision is provided for the embodiments of the present application, which shows the complete steps from the creation and preprocessing of the data set to the construction of the positioning model and the solution of the trunk position.
[0050] In the present embodiment, it comprises:
[0051] Step one: creation and preprocessing of the data set, fruit tree trunk image data is acquired by shooting with a binocular camera in a facility orchard base, and enhanced and normalized processing is performed, thereby constructing a fruit tree trunk data set, then image labeling is performed using open source software LabelImg, and the labeled image data is divided into a training set and a test set;
[0052] The enhanced processing includes HSV image enhancement, image flipping, image translation, and image cropping, and the normalized processing includes adjusting the resolution of all image data in the data set to 640x640 and the format to JPG, the processed image data is manually labeled, and is divided into a training set and a test set in a ratio of 8:2;
[0053] The data set covers various typical scenarios and fruit tree types, specifically including single independent growth fruit trees, low and short fruit trees, tall and high fruit trees, and fruit trees affected by complex light and background in a natural open environment.
[0054] Step two: YOLOv7-tiny trunk recognition model optimization and construction, YOLOv7-tiny is used as the basic model, PConv (PartialConvolution) lightweight modules are introduced into the efficient layer aggregation network (ELAN) structure of the model backbone network, and part of the convolution units in the original structure are replaced; a SimAM attention mechanism module is added in the neck network, thereby constructing a fruit tree trunk recognition model based on the improved YOLOv7-tiny in the orchard;
[0055] The original YOLOv7-tiny model is improved, including: introducing PConv convolution into each ELAN module in the backbone network, replacing the regular convolution with a convolution kernel size of 3 and a step size of 1, obtaining a P-ELAN module, and introducing a SimAM attention mechanism module in the neck network, the SimAM module is arranged behind each ELAN module in the neck network.
[0056] The PConv convolution module selectively extracts features on only part of the input channels using regular convolution (Conv), without affecting the remaining channels, effectively avoiding the calculation redundancy of the feature map;
[0057] For continuous or regular memory access, the first or last continuous channel is regarded as the representative of the entire feature map for calculation. The Memory Access Cost (MAC) calculation process of PConv is as follows: ; wherein, is the height of the input feature, is the width of the input feature, is the size of the convolution kernel, is the number of channels, is the number of regular convolution channels.
[0058] The SimAM attention mechanism module is a 3D attention module that can synchronize and coordinate the channel dimension information and spatial dimension information of the feature map. The core of the module is to complete the quantitative calculation of the attention weight through an energy function. The output value of the energy function directly represents the importance of each neuron in the trunk feature extraction, realizes the strengthening of key features and the suppression of redundant information, and the energy function is as follows: ; wherein, is the weight, is the offset, represents the number of neurons, represents the target neuron in the same channel of the input feature map, and represents other neurons, is a constant.
[0059] Step three: training of the trunk recognition model, based on the obtained training set, the orchard fruit tree trunk recognition model based on the improved YOLOv7-tiny is trained, and then the optimal trunk recognition model is obtained;
[0060] The improved YOLOv7-tiny orchard fruit tree trunk recognition model is trained, and the training parameters are set as follows: optimizer SGD, batch size 8, training times 200, initial learning rate 0.01, and learning rate momentum 0.937.
[0061] Step four: evaluation of the trunk recognition model, the effectiveness of the orchard fruit tree trunk recognition model based on the improved YOLOv7-tiny is evaluated through ablation experiments and comparative experiments;
[0062] The effectiveness of the orchard fruit tree trunk recognition model based on the improved YOLOv7-tiny is evaluated through ablation experiments and comparative experiments, specifically by introducing four key indicators for measuring model performance: precision (Precision, ), recall (Recall, ), mean average precision (Mean Average Precision, ), and model size (Size), which are calculated according to the following equations:
[0063] ; ; ;
[0064] wherein, represents the number of correctly identified tree trunks, represents the number of objects identified as tree trunks that are not tree trunks, represents the number of unidentifiable waxberries, is the number of classes of test samples, in this experiment = 1, is the average accuracy of identification of a single type.
[0065] Both the ablation experiment and the comparative experiment use the YOLOv7-tiny model as the benchmark experiment model. The ablation experiment targets the PConv convolution module and the SimAM attention mechanism, and designs multiple component combination schemes, including separately introducing the PConv module, separately embedding the SimAM mechanism, and simultaneously introducing both components in three improvement forms. Each improvement scheme is tested to determine the optimal component configuration method.
[0066] The comparative experiment selects mainstream models in the target detection field as reference objects and compares the performance with the Faster-RCNN, YOLOv3, YOLOv4, and YOLOv5 models in terms of key indicators such as identification accuracy and recall rate to verify the superiority of the improved YOLOv7-tiny model used in this method.
[0067] Step five: tree trunk identification model detection, input the test set in step one into the optimal identification model obtained in step three, and then output the tree trunk detection results; and then analyze the recognition ability of the model for fruit tree trunks;
[0068] Step six: positioning model construction and tree trunk position solving, based on the optimal tree trunk identification model obtained in step three, introduce the positioning algorithm based on semi-global block matching (SGBM) to realize accurate position solving of the tree trunk identification results;
[0069] Step six is based on the optimal tree trunk identification model obtained in step three, introducing the positioning algorithm based on semi-global block matching (SGBM) to realize accurate position solving of the tree trunk identification results. The following are the specific implementation steps:
[0070] a: binocular camera calibration, Zhang Zhengyou calibration method is used to calibrate the binocular camera. By shooting multiple groups of different posture checkerboard calibration board images, the internal and external parameters of the binocular camera are calculated using OpenCV software to complete the stereo correction of the binocular camera;
[0071] b: Improved YOLOv7-tiny trunk model detection, taking the left and right view image pairs synchronously collected by the binocular camera as input, and inputting them into the optimal improved YOLOv7-tiny trunk recognition model obtained in step three respectively, to output the detection frame information of the trunk target, the detection frame information including the upper left corner coordinates, width and height of the frame body;
[0072] c: Trunk target frame center point extraction, calculating the center point pixel coordinates of each trunk detection frame according to the trunk detection frame information output in step b, the calculation formula being: target frame center point (x, y) = (x + w / 2, y + h / 2), wherein x and y are the upper left corner coordinates of the detection frame, and w and h are the width and height of the detection frame;
[0073] d: SGBM algorithm disparity map generation, based on the camera calibration parameters obtained in step a, performing epipolar rectification on the left and right views to eliminate the vertical disparity between the image pairs, and then configuring the SGBM algorithm parameters to perform stereo matching operation on the rectified left and right views to generate a high-density disparity map of the entire image;
[0074] e: Center point depth information calculation and position solving: according to the left and right view trunk center point pixel coordinates obtained in step c, extracting the disparity value d corresponding to the center point in the disparity map generated in step d, combining the baseline distance B and focal length f obtained by binocular camera calibration, and calculating the depth information Z of the trunk center point according to the triangulation principle, the calculation formula being Z = (f x B) / d, and then converting the pixel coordinates into world coordinate system coordinates through the camera intrinsic parameters, and finally outputting the three-dimensional space position information of the trunk in the orchard.
[0075] The above formulas are dimensionless numerical calculations, and the formulas are obtained by software simulation of a large amount of data to obtain the most real situation, and the preset parameters in the formulas are set by a person skilled in the art according to the actual situation.
[0076] The above only describes certain exemplary embodiments of the present application by way of illustration, and it is needless to say that those skilled in the art can modify the described embodiments in various ways without departing from the spirit and scope of the present application. Therefore, the above figures and descriptions are illustrative in nature and should not be understood as limiting the scope of protection of the claims of the present application.
[0077] It should be noted that, in the present document, relational terms are used to convey a relationship of one entity or action to another entity or action. For example, without necessarily implying any actual relationship or order between entities or actions, the terms "first," "second," "top" and "bottom" are used to name different entities and actions, and are used to distinguish one entity or action from another entity or action, without necessarily conveying any actual relationship or order between such entities or actions. Furthermore, the terms "comprise," "include," and "have," and variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises, includes, or has a list of elements is not necessarily limited to those elements, but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without limitation, an element preceded by "comprises... a," "includes... a," or "has... a" does not, without more constraints, foreclose the existence of additional identical elements other than the one listed or other elements not expressly listed or inherent to such process, method, article, or apparatus.
[0078] It should be understood that the sequence numbers of the processes described above do not mean execution sequence in various embodiments of the present application, and the execution sequence of the processes should be determined according to their functions and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0079] Those skilled in the art can clearly understand that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software mode depends on the specific application and design constraints of the technical solution. The skilled person can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of the present application.
[0080] Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working processes of the above-described system, device and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be described here.
[0081] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e. they can be located in one place or distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the present embodiment.
[0082] In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically, or two or more units can be integrated into one unit.
[0083] The above merely provides the specific implementation of the present application, but the protection scope of the present application is not limited to this. Any person skilled in the art can easily think of the changes or replacements within the technical range disclosed by the present application, which should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
[0084] The foregoing merely describes certain exemplary embodiments of this application by way of illustration. Obviously, for those skilled in the art, modifications and changes can be made to the described embodiments in various different ways without departing from the spirit and scope of the application. Therefore, the above drawings and descriptions are illustrative in nature, and should not be construed as limiting the scope of the claims of the present application.
Claims
1. A method for identifying and locating fruit tree trunks based on binocular machine vision, characterized in that, include: Step 1: Dataset creation and preprocessing. Obtain fruit tree trunk image data, and perform enhancement and normalization processing on it to construct fruit tree trunk data; Step 2: Optimize and build the YOLOv7-tiny tree trunk recognition model. Use YOLOv7-tiny as the base model and a lightweight module to replace some convolutional units in the original structure; add an attention mechanism module to build an orchard fruit tree trunk recognition model based on the improved YOLOv7-tiny. Step 3: Training the tree trunk recognition model. Based on the obtained training set, train the orchard tree trunk recognition model based on the improved YOLOv7-tiny to obtain the optimal tree trunk recognition model. Step 4: Evaluation of the tree trunk recognition model, assessing the effectiveness of the orchard tree trunk recognition model based on the improved YOLOv7-tiny; Step 5: Tree trunk recognition model detection. Input the test set from Step 1 into Step 3 to obtain the optimal recognition model, and then output the tree trunk detection result. Step Six: Localization Model Construction and Trunk Position Determination. Based on the optimal trunk recognition model obtained in Step Three, a localization algorithm based on semi-global block matching is introduced.
2. The method for identifying and locating fruit tree trunks based on binocular machine vision according to claim 1, characterized in that, The dataset in Step 1 covers a variety of typical scenarios and fruit tree types, including single, independently growing fruit trees, short-statured fruit trees, tall fruit trees, and fruit trees in natural open-air environments affected by complex lighting and backgrounds.
3. The method for identifying and locating fruit tree trunks based on binocular machine vision according to claim 1, characterized in that, Step two improves the original YOLOv7-tiny model by introducing PConv convolutions into each ELAN module in the backbone network, replacing the regular convolutions with a kernel size of 3 and a stride of 1 to obtain P-ELAN modules, and introducing a SimAM attention mechanism module in the neck network, wherein the SimAM module is set after each ELAN module in the neck network.
4. The method for identifying and locating fruit tree trunks based on binocular machine vision according to claim 3, characterized in that, The PConv convolution module selectively extracts features using regular convolution on a subset of input channels without affecting the remaining channels. For consecutive or regular memory accesses, the first or last consecutive channel is treated as a representative of the entire feature map for computation.
5. The method for identifying and locating fruit tree trunks based on binocular machine vision according to claim 3, characterized in that, The SimAM attention mechanism module is a 3D attention module that can synchronously coordinate the channel dimension information and spatial dimension information of the feature map. Its core is to complete the quantitative calculation of attention weights through an energy function. The output value of the energy function directly represents the importance of each neuron in the trunk feature extraction, thereby strengthening key features and suppressing redundant information.
6. The method for identifying and locating fruit tree trunks based on binocular machine vision according to claim 1, characterized in that, In step three, the improved YOLOv7-tiny orchard tree trunk recognition model is trained, and the training parameters are set as follows: optimizer SGD, batch size 8, training times 200, initial learning rate 0.01, and learning rate momentum 0.
937.
7. The method for identifying and locating fruit tree trunks based on binocular machine vision according to claim 1, characterized in that, In step four, ablation experiments and comparative experiments were used to evaluate the effectiveness of the orchard tree trunk recognition model based on the improved YOLOv7-tiny, specifically by introducing precision, recall, mean precision, and model volume.
8. The method for identifying and locating fruit tree trunks based on binocular machine vision according to claim 7, characterized in that, The ablation experiment and comparison experiment described in step four both use the YOLOv7-tiny model as the benchmark experimental model to carry out systematic experimental design. The ablation experiment designs multiple component combination schemes for the PConv convolution module and the SimAM attention mechanism, including three improvement forms: introducing the PConv module alone, embedding the SimAM mechanism alone, and introducing two components at the same time. Ablation tests are carried out on each improvement scheme to determine the optimal component configuration. The comparative experiment selected mainstream models in the field of object detection as reference objects and compared their performance with Faster-RCNN, YOLOv3, YOLOv4, and YOLOv5 models, completing a comprehensive performance comparison from the dimensions of recognition accuracy and recall.
9. The method for identifying and locating fruit tree trunks based on binocular machine vision according to claim 1, characterized in that, The specific implementation steps for step six are as follows: a: Binocular camera calibration: The Zhang Zhengyou calibration method is used to calibrate the binocular camera. The stereo calibration of the binocular camera is completed by using the intrinsic and extrinsic parameters of the binocular camera through the image of the checkerboard calibration board. b: Improve the YOLOv7-tiny tree trunk model detection. Take the left and right view image pairs acquired synchronously by the binocular camera as input, and input them into the optimal improved YOLOv7-tiny tree trunk recognition model obtained in step three, and output the detection box information of the tree trunk target. c: Extract the center point of the tree trunk target box. Based on the tree trunk detection box information output in step b, calculate the pixel coordinates of the center point of each tree trunk detection box.
10. A method for identifying and locating fruit tree trunks based on binocular machine vision according to claim 1, characterized in that, Also includes: d: SGBM algorithm disparity map generation: Based on the camera calibration parameters obtained in step a, epipolar correction is performed on the left and right views, and stereo matching operation is performed on the corrected left and right views to generate a high-density disparity map of the entire image. e: Calculation of depth information and location of center point: Based on the pixel coordinates of the center point of the tree trunk in the left and right views obtained in step c, extract the disparity value corresponding to the center point from the disparity map generated in step d. Combine the baseline distance and focal length obtained from the binocular camera calibration to calculate the depth information of the center point of the tree trunk. Then, convert the pixel coordinates to world coordinates through the camera intrinsic parameters and output the three-dimensional spatial position information of the tree trunk in the orchard.