Seedling stem diameter measurement method and system based on instance segmentation and monocular depth estimation
By employing instance segmentation and monocular depth estimation, the problems of misselection and instability in stem diameter measurement in seedling scenarios are solved, enabling automated and robust stem diameter measurement under monocular vision conditions, thus improving the accuracy and robustness of the measurement.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG UNIV
- Filing Date
- 2026-06-23
- Publication Date
- 2026-07-21
AI Technical Summary
In existing technologies for seedling cultivation in facility agriculture, monocular visual stem diameter measurement is prone to selecting the wrong measurement object due to dense seedlings. Furthermore, the bending of the seedling stems and the presence of fuzz on the edges lead to irregular mask extraction, resulting in unstable measurement results and difficulty in maintaining consistency across different batches and imaging conditions.
A method based on instance segmentation and monocular depth estimation is adopted. The image is acquired by a monocular camera for instance segmentation and depth estimation. The longitudinal coordinate information of the candidate stem and the detection confidence are combined for comprehensive evaluation. Morphological processing and distance transformation are performed to select the target stem and calculate the stem diameter.
It improves the consistency of reliable selection of target stems from multiple candidate stems and the stability of measurement results, enhances the accuracy and robustness of stem diameter measurement, and is suitable for high-throughput phenotypic acquisition and non-destructive automatic grading of seedlings in factory seedling production.
Smart Images

Figure CN122434937A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method for measuring the stem thickness of seedlings, and to the field of agricultural information technology, specifically to a method and system for measuring the stem thickness of seedlings based on instance segmentation and monocular depth estimation. Background Technology
[0002] In the process of seedling cultivation in facility agriculture and factory seedling production, the stem diameter of seedlings is an important phenotypic parameter for measuring seedling vigor, grading seedlings, and quality traceability. Currently, production sites mostly rely on manual visual inspection or caliper sampling, which suffers from low efficiency, high labor intensity, poor repeatability, and difficulty in meeting the requirements for batch online testing.
[0003] To improve measurement efficiency, the industry has attempted to use machine vision for non-contact estimation of stems. For example, after acquiring images from a fixed perspective, threshold segmentation, edge detection, or morphological methods are used to extract the stem outline and estimate the diameter; or depth cameras, structured light, laser scanning, and binocular vision are used to acquire three-dimensional information and then calculate the diameter. The former usually has lower hardware costs and is easier to deploy, but it is sensitive to imaging conditions and the appearance of the target; the latter can provide more direct spatial information, but the hardware costs and maintenance complexity are higher, and the requirements for on-site installation and lighting conditions are more stringent, making it difficult to promote on a large scale in some seedling cultivation sites.
[0004] In monocular RGB image-based solutions, with the development of deep learning instance segmentation technology, extracting stem masks first through instance segmentation networks and then calculating stem thickness based on the mask regions has become a feasible approach. However, seedling production scenarios are characterized by dense seedlings, side-by-side rows, and complex background textures. A single side-view image often contains multiple stem instances, and instance segmentation models typically output multiple candidate stem masks. These masks may include the outermost stem closest to the camera and thus the target for measurement, as well as stems further behind it. Since these candidate stems may have similar appearance and texture features in the 2D image, relying solely on detection confidence or simple image location rules can easily lead to incorrect target selection, resulting in stem thickness measurements that do not match actual requirements and thus affecting the reliability of subsequent grading and quality inspection.
[0005] In addition, seedling stems often exhibit morphological changes such as bending and tilting, and their edges may be covered with fuzz or small protrusions, resulting in irregular mask boundaries and significant local width fluctuations. If the width is only measured at a single cross-section or a few locations, it is easily affected by local noise and outliers, causing measurement instability and making it difficult to maintain consistency across different batches and imaging conditions.
[0006] Therefore, there is an urgent need for an automated measurement method that can reliably identify the target stem from multiple candidate stems under monocular image conditions and obtain robust stem diameter measurement results under bending, tilting and other conditions. Summary of the Invention
[0007] To address the problems existing in the background technology, this invention provides a method and system for measuring seedling stem thickness based on instance segmentation and monocular depth estimation. This invention addresses the technical problems in existing factory-style agricultural seedling production scenarios, where monocular vision stem thickness measurement is prone to selecting the wrong measurement target due to dense seedlings, and where irregular mask extraction and unstable measurement results are caused by curved seedling stems and fuzzy edges. This invention enables automated stem thickness estimation of target seedlings from multiple candidate targets using only monocular vision.
[0008] The technical solution adopted in this invention is:
[0009] I. A method for measuring seedling stem diameter based on instance segmentation and monocular depth estimation, comprising:
[0010] Step S1: Use a monocular camera to acquire several calibration object images, and obtain pixel physical conversion coefficients after calibration.
[0011] Step S2: Use a monocular camera to acquire a monocular side-view RGB image of the seedling to be measured, perform instance segmentation on the monocular side-view RGB image, extract the mask and detection confidence of several candidate stems, and perform monocular depth estimation on the monocular side-view RGB image to obtain a relative depth map.
[0012] Step S3: Based on the relative depth map, the mask of each candidate stem, and the detection confidence, obtain the comprehensive value of each candidate stem, and then select a number of candidate stems as target stems.
[0013] Step S4: Perform morphological processing and distance transformation on the mask of each target stem to extract the pixel-level stem thickness of each target stem, and finally obtain the actual stem thickness of the target stem through pixel physical conversion coefficients.
[0014] In step S1, a standard cylindrical calibration object with a known physical width is first placed in front of a monocular camera. The standard cylindrical calibration object is moved while the distance between it and the monocular camera remains constant. An image of the calibration object is captured each time the object moves. The minimum bounding rectangle of the standard cylindrical calibration object in each calibration object image is determined, and the average pixel width of each minimum bounding rectangle in its horizontal direction is obtained. The ratio between the average pixel width and the known physical width is used as the pixel physical conversion coefficient.
[0015] In step S2, the monocular side-view RGB image includes the stems below the cotyledons of several seedlings to be measured. The radially intact stems are selected as candidate stems. The monocular side-view RGB image is input into an instance segmentation network optimized by the boundary loss function for instance segmentation. After processing, the mask of each candidate stem and the detection confidence are output.
[0016] In step S2, the monocular side-view RGB image is downsampled and then input into the monocular depth estimation model. After processing, an initial relative depth map is output. The initial relative depth map is then upsampled and restored to the resolution of the monocular side-view RGB image to obtain the final relative depth map.
[0017] In step S3, for each candidate stem, firstly, the median of the effective relative depth pixels in the masked region of the candidate stem in the relative depth map is extracted as the depth feature value. Then, the maximum value of the vertical coordinate of the masked region of each candidate stem is extracted as the position feature value. Then, normalization processing is performed: the depth feature value of each candidate stem is divided by the maximum depth feature value, the position feature value of each candidate stem is divided by the maximum position feature value, and the detection confidence of each candidate stem is divided by the maximum detection confidence. This yields the normalized position feature value, normalized depth feature value, and normalized detection confidence of each candidate stem. Then, a weighted sum is performed based on preset depth weights, position weights, and confidence weights to obtain the comprehensive value of each candidate stem. The k candidate stems with the highest comprehensive value are selected as the target stems.
[0018] In step S4, morphological processing is performed on each target stem. Specifically, a morphological erosion operation is performed on the mask of the target stem to remove the fuzzy interference at the edge of the mask. Then, a thinning algorithm is used to extract the initial skeleton containing branches from the mask of the target stem after the morphological erosion operation. The pixels with a degree of 1 in the initial skeleton are taken as endpoints, and the endpoints with the highest and lowest vertical coordinates are taken as target endpoints. An undirected graph is constructed based on the coordinates of each pixel in the initial skeleton. For each pair of adjacent pixels in the undirected graph, the Euclidean distance between the adjacent pixels is taken as the edge weight between them. Based on each edge weight, the shortest path algorithm is used to search for the path between the two target endpoints in the undirected graph as the main skeleton path after removing the branches.
[0019] In step S4, the distance transformation specifically involves first performing an Euclidean distance transformation on the mask of the target stem to obtain a distance transformation map. Then, the distance transformation values of the coordinates of each pixel point in the main skeleton path are extracted from the distance transformation map. Each distance transformation value is doubled to obtain the pixel diameter, thereby constructing a set of pixel diameters. Pixel diameters in the set with values less than an outlier threshold are removed. The outlier threshold is the largest pixel diameter in the set multiplied by a preset percentage, thereby obtaining an effective sampling set. The median of the pixel diameters in the effective sampling set is used as the pixel-level stem thickness of the target stem. The pixel-level stem thickness is multiplied by the pixel physical conversion coefficient to obtain the actual stem thickness of the target stem.
[0020] II. A seedling stem diameter measurement system based on instance segmentation and monocular depth estimation, comprising:
[0021] The coefficient acquisition module is used to acquire several calibration object images using a monocular camera, and obtain pixel physical conversion coefficients after calibration.
[0022] The instance segmentation and depth estimation module is used to acquire monocular side-view RGB images of the seedlings to be measured using a monocular camera, perform instance segmentation on the monocular side-view RGB images, extract the masks of several candidate stems and the detection confidence; and perform monocular depth estimation on the monocular side-view RGB images to obtain a relative depth map.
[0023] The filtering module is used to obtain the comprehensive value of each candidate stem based on the relative depth map, the mask of each candidate stem, and the detection confidence, so as to select a number of candidate stems as target stems.
[0024] The measurement module performs morphological processing and distance transformation on the masks of each target stem to extract the pixel-level stem thickness of each target stem, and finally obtains the actual stem thickness of the target stem through pixel physical conversion coefficients.
[0025] The electronic device of the present invention includes: a memory and a processor coupled to each other, wherein the memory stores program data, and the processor invokes the program data to execute the method described above.
[0026] The present invention provides a computer-readable storage medium having program data stored thereon, which, when executed by a processor, implements the method described above.
[0027] The beneficial effects of this invention are:
[0028] 1. By introducing monocular depth estimation and combining it with the longitudinal coordinate information of candidate stems in the image and the detection confidence for comprehensive evaluation, the target stem closer to the camera can be reliably selected from multiple candidate stem masks, improving the consistency and reliability of the measurement object selection.
[0029] 2. By performing morphological processing, skeleton extraction, and determination of the main skeleton path, and combining Euclidean distance transformation for diameter measurement, and by employing outlier removal and statistical strategies, the influence of factors such as irregular, curved, or tilted edges on the measurement can be reduced, thereby improving the stability and robustness of stem diameter measurement.
[0030] 3. Achieving non-contact automatic measurement based on monocular side-view acquisition conditions is beneficial to improving the efficiency and standardization of stem diameter phenotypic acquisition in the seedling production process.
[0031] In summary, this invention solves the problems of easy target selection errors in monocular vision in dense seedling raising scenarios, and measurement instability caused by stem bending and edge hairs. It effectively improves the accuracy and robustness of stem diameter measurement in complex scenarios, and provides low-cost and highly reliable visual technology support for high-throughput phenotypic acquisition, non-destructive automatic grading of seedlings, and online quality traceability in factory seedling raising. Attached Figure Description
[0032] Figure 1 A flowchart illustrating the workflow of the seedling stem diameter measurement method based on instance segmentation and monocular depth estimation provided by this invention;
[0033] Figure 2 This is a calibration diagram of a standard cylinder (weight) used to obtain pixel physical conversion coefficients in an embodiment of the present invention;
[0034] Figure 3 This is a scatter plot comparing the measurement accuracy before and after introducing the boundary loss function in this embodiment of the invention. Figure 3 (a) shows the stem diameter measurement results without the introduction of the boundary loss function, and (b) shows the stem diameter measurement results with the introduction of the boundary loss function.
[0035] Figure 4 This is a schematic diagram of the front and rear target selection process based on monocular depth estimation in an embodiment of the present invention, wherein, Figure 4 (a) is the instance segmentation result based on monocular depth estimation. Figure 4 (b) is a relative depth map based on monocular depth estimation. Figure 4 (c) is the screening result diagram based on monocular depth estimation;
[0036] Figure 5 This is a schematic diagram illustrating the extraction of the main stem framework and the actual stem diameter measurement results in an embodiment of the present invention. Figure 5 (a) is the result of the main skeleton extraction. Figure 5 (b) is a graph showing the actual stem diameter measurement results. Detailed Implementation
[0037] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0038] like Figure 1As shown, in specific implementation, this invention automates stem diameter acquisition in densely packed tomato seedling scenes in facility agriculture. First, it requires the same shooting configuration as actual acquisition, including fixed camera intrinsics, an image resolution of 2448×2048, camera side-view orientation, and a fixed shooting distance. Then, a monocular camera is used to acquire 16 calibration images containing a standard cylindrical calibration object (such as a standard weight) of known physical width. Specifically, the standard cylindrical calibration object of known physical width is first placed in front of the monocular camera. The standard cylindrical calibration object is moved while maintaining a constant distance between it and the monocular camera, i.e., it moves left and right. Each movement captures an image of the calibration object. The calibration image only needs to include the complete radial portion of the standard cylindrical calibration object. The minimum bounding rectangle of the standard cylindrical calibration object in each calibration image is calibrated, and the average pixel width of each minimum bounding rectangle in its horizontal direction is obtained, such as... Figure 2 As shown, the minimum bounding rectangle of the standard weight is extracted from each calibration object image. The widths of some minimum bounding rectangles are 668.4 pixels, 660.1 pixels, 645.5 pixels, and 654.6 pixels, respectively. Then, the average pixel width of each minimum bounding rectangle is calculated to be 658.4 pixels. This pixel value is then compared with the known physical width of the standard cylindrical calibration object, 21.88 mm, to obtain the pixel physical conversion coefficient. In this embodiment, the pixel physical conversion coefficient, after calibration, is preferably 0.0332 mm / pixel.
[0039] Then, in an actual production scenario, a monocular camera is used to acquire monocular side-view RGB images of the Saint Laurent tomato seedlings to be measured. These images include the stems below the cotyledons of several seedlings. Radially intact stems are selected as candidate stems, while incomplete or unclear radial stems are not measured. The monocular side-view RGB images are input into an instance segmentation network optimized with a boundary loss function for instance segmentation. After processing, the masks and detection confidence scores of each candidate stem are output. Specifically, the instance segmentation network uses a YOLOv8-seg instance segmentation network optimized with a boundary loss function. Because the projections of seedlings in front and back rows are close in a greenhouse setting, the masks are prone to adhesion and boundary expansion, leading to a systematic overestimation of stem thickness. Therefore, this embodiment uses a YOLOv8-seg instance segmentation network optimized with a boundary loss function to infer from the input image, enhancing the contour alignment and instance separation of candidate stems. Finally, it outputs the masks of several candidate stems detected within the scene and their detection confidence scores. Figure 3 (a) and Figure 3As shown in (b), by introducing a boundary loss function for optimization, the root mean square error (RMSE) of stem thickness estimation on the Saint Laurent tomato seedling dataset significantly decreased from 0.32 mm to 0.23 mm, and the coefficient of determination (R²) increased substantially from 0.74 to 0.87. The dataset samples covered multiple growth stages of Saint Laurent tomato seedlings from the seedling stage to the robust seedling stage before delivery. A total of 75 seedling images were collected during this stage, containing ground truth stem thickness data for 150 seedlings, thus verifying the applicability and stability of this embodiment under different seedling ages and stem thickness conditions. Figure 3 (a) shows the regression equation before optimization: predicted stem diameter = 0.9951 × actual stem diameter + 0.1540; Figure 3 (b) shows the optimized regression equation: Predicted stem diameter = 0.9813 × Actual stem diameter + 0.1778. Both predicted and actual stem diameters are in mm. It can be seen that the slopes of the regression lines before and after optimization are close to 1, indicating good consistency between the predicted and actual stem diameters. Simultaneously, the optimized regression line maintains a stable linear fit, demonstrating that the optimization effectively suppresses local noise interference caused by blurred segmentation boundaries from the algorithm's underlying layer, improving the stability and reliability of the stem diameter measurement results while maintaining overall prediction accuracy. The final segmentation effect is as follows: Figure 4 As shown in (a), this includes three stalk masks and their detection confidence levels: 0.94, 0.93, and 0.95.
[0040] Then, when performing monocular depth estimation on the monocular side-view RGB image, to balance the inference accuracy and computational cost of the high-resolution image, the monocular side-view RGB image is downsampled according to a preset depth inference resolution (e.g., setting the long side size to 640). The downsampled image is input into the monocular depth estimation model, and after processing, an initial relative depth map is output. The initial relative depth map is then processed by upsampling methods such as linear interpolation to restore it to the resolution of the monocular side-view RGB image, 2248×2048, to obtain the final relative depth map. The relative depth map is an affine-invariant inverse depth map; the larger its pixel value, the closer it is to the camera in physical space, such as... Figure 4 As shown in (b), the monocular depth estimation model specifically adopts the Depth Anything V2 model.
[0041] Then, based on the relative depth map, the masks of each candidate stem, and the detection confidence, the comprehensive value of each candidate stem is obtained, thereby selecting several candidate stems as target stems. For each candidate stem, firstly, the median of the effective relative depth pixels in the masked region of the candidate stem in the relative depth map is extracted as the depth feature value. Then, the maximum value of the vertical coordinate of the masked region of each candidate stem is extracted as the position feature value. Then, normalization processing is performed: the depth feature value of each candidate stem is divided by the maximum depth feature value, the position feature value of each candidate stem is divided by the maximum position feature value, and the detection confidence of each candidate stem is divided by the maximum detection confidence value to obtain the comprehensive value of each candidate stem. The normalized position feature value, normalized depth feature value, and normalized detection confidence of each candidate stem are obtained. Then, based on preset depth weight, position weight, and confidence weight, a weighted sum is performed to obtain the comprehensive value of each candidate stem. The k candidate stems with the highest comprehensive value are selected as target stems. In specific implementation, in order to select the seedlings on the outermost side of the seedling tray and closest to the camera from many candidate masks (k=2 in this embodiment), this step constructs a multi-dimensional automatic weighted evaluator: First, depth feature extraction is performed. For the i-th candidate stem, the effective depth pixel values in the relative depth map within its mask area are extracted, and the median is calculated as the depth feature value. Then, positional feature extraction is performed, and the maximum value of the vertical (Y-axis) coordinate of the i-th candidate stalk mask region is extracted as the positional feature value. From a side viewpoint, the root of the foremost seedling often has a larger Y-coordinate in the 2D image. Then, confidence extraction is performed to obtain the detection confidence score output by the segmentation network. Finally, feature normalization and weighting are performed. A ratio normalization method is used, where each feature is divided by the maximum value of its corresponding feature among all candidate stems. Then, a weighted sum is calculated according to preset weights to obtain the comprehensive value of the i-th candidate stem. :
[0042]
[0043] in, For depth weights, For positional weights, As a confidence weight, this embodiment preferably uses... =0.70, =0.20, =0.10. , and These are the depth feature set, the location feature set, and the detection confidence set, respectively. After sorting them in descending order of comprehensive value, the masks of the top two target stalks are selected for subsequent measurements, such as... Figure 4 As shown in (c).
[0044] Finally, the masks of each target stem are morphologically processed. Specifically, morphological denoising is performed on the mask of each target stem. A morphological erosion operation is then performed on the mask of the target stem to be processed, using a preset size (preferably a 3×3 elliptical kernel) to remove the fuzzy interference at the mask edges. Then, a thinning algorithm is used to extract the initial skeleton containing branches from the morphologically eroded target stem mask. The thinning algorithm can specifically employ the Zhang-Suen algorithm. Pixels with a degree of 1 in the initial skeleton are taken as endpoints, and the endpoints with the highest and lowest vertical coordinates are taken as target endpoints. An undirected graph is constructed based on the coordinates of each pixel in the initial skeleton. For each pair of adjacent pixels in the undirected graph, the Euclidean distance between the adjacent pixels is used as the edge weight. A shortest path algorithm, such as Dijkstra's algorithm, is used to search for the path between the two target endpoints in the undirected graph based on the edge weights, which becomes the main skeleton path after removing branches. Figure 5 As shown in (a).
[0045] Then, a distance transformation is performed. Specifically, the distance transformation involves first performing an Euclidean distance transformation on the mask of the target stem to obtain a distance transformation map. The distance transformation value of any pixel within the mask in the distance transformation map is the minimum Euclidean distance from that pixel to the mask boundary. Then, using the pixel coordinates along the main skeleton path as indices, the distance transformation values of each pixel coordinate along the main skeleton path are extracted from the distance transformation map. Each distance transformation value is doubled to obtain the pixel diameter, thus constructing a pixel diameter set. Pixel diameters in the pixel diameter set with values less than an outlier threshold are removed. The outlier threshold is the largest pixel diameter in the pixel diameter set multiplied by a preset percentage, specifically 70%, to obtain an effective sampling set. The median of the pixel diameters in the effective sampling set is used as the pixel-level stem thickness of the target stem. The pixel-level stem thickness is multiplied by the pixel physical conversion coefficient to obtain the actual stem thickness of the target stem. Figure 5 As shown in (b), the stem diameters of the two target stems are 3.58 mm and 4.18 mm, respectively.
[0046] Based on this, this embodiment also provides a seedling stem diameter measurement system based on instance segmentation and monocular depth estimation, including a coefficient acquisition module, an instance segmentation and depth estimation module, a screening module, and a measurement module. The coefficient acquisition module is used to acquire several calibration object images using a monocular camera and obtain pixel physical conversion coefficients after calibration. The instance segmentation and depth estimation module is used to acquire monocular side-view RGB images of the seedlings to be measured using a monocular camera, perform instance segmentation on the monocular side-view RGB images, extract the masks of several candidate stems and the detection confidence; and perform monocular depth estimation on the monocular side-view RGB images to obtain a relative depth map. The screening module is used to obtain the comprehensive value of each candidate stem based on the relative depth map, the masks of each candidate stem, and the detection confidence, thereby selecting several candidate stems as target stems. The measurement module is used to perform morphological processing and distance transformation on the masks of each target stem, extract the pixel-level stem diameter of each target stem, and finally obtain the actual stem diameter of the target stem through pixel physical conversion coefficient conversion.
[0047] In addition, embodiments of the present invention also provide a computer device and a computer-readable storage medium, both configured to execute a computer program to implement the above-mentioned automatic measurement logic for seedling stem diameter.
[0048] Finally, it should be noted that the above embodiments and descriptions are only used to illustrate the technical solutions of the present invention and not to limit it. Those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the disclosure of the technical solutions of the present invention, and all such modifications and substitutions should be covered within the protection scope of the claims of the present invention.
Claims
1. A method for measuring seedling stem diameter based on instance segmentation and monocular depth estimation, characterized in that, include: Step S1: Use a monocular camera to acquire several calibration object images, and obtain pixel physical conversion coefficients after calibration; Step S2: Use a monocular camera to acquire a monocular side-view RGB image of the seedling to be measured, perform instance segmentation on the monocular side-view RGB image, extract the mask and detection confidence of several candidate stems, and perform monocular depth estimation on the monocular side-view RGB image to obtain a relative depth map; Step S3: Based on the relative depth map, the mask of each candidate stem, and the detection confidence, obtain the comprehensive value of each candidate stem, and select a number of candidate stems as target stems; Step S4: Perform morphological processing and distance transformation on the mask of each target stem to extract the pixel-level stem thickness of each target stem, and finally obtain the actual stem thickness of the target stem through pixel physical conversion coefficients.
2. The method for measuring seedling stem diameter based on instance segmentation and monocular depth estimation according to claim 1, characterized in that: In step S1, a standard cylindrical calibration object with a known physical width is first placed in front of a monocular camera. The standard cylindrical calibration object is moved while the distance between it and the monocular camera remains constant. An image of the calibration object is captured each time the object moves. The minimum bounding rectangle of the standard cylindrical calibration object in each calibration object image is determined, and the average pixel width of each minimum bounding rectangle is obtained. The ratio between the average pixel width and the known physical width is used as the pixel physical conversion coefficient.
3. The method for measuring seedling stem diameter based on instance segmentation and monocular depth estimation according to claim 1, characterized in that: In step S2, the monocular side-view RGB image includes the stems below the cotyledons of several seedlings to be measured. The radially intact stems are selected as candidate stems. The monocular side-view RGB image is input into an instance segmentation network optimized by the boundary loss function for instance segmentation. After processing, the mask of each candidate stem and the detection confidence are output.
4. The method for measuring seedling stem diameter based on instance segmentation and monocular depth estimation according to claim 1, characterized in that: In step S2, the monocular side-view RGB image is downsampled and then input into the monocular depth estimation model. After processing, an initial relative depth map is output. The initial relative depth map is then upsampled and restored to the resolution of the monocular side-view RGB image to obtain the final relative depth map.
5. The method for measuring seedling stem diameter based on instance segmentation and monocular depth estimation according to claim 1, characterized in that: In step S3, for each candidate stem, the median of the effective relative depth pixels in the masked region of the candidate stem in the relative depth map is first extracted as the depth feature value, and then the maximum value of the vertical coordinate of the masked region of each candidate stem is extracted as the position feature value. Then, normalization processing is performed. The depth feature value of each candidate stem is divided by the largest depth feature value, the position feature value of each candidate stem is divided by the largest position feature value, and the detection confidence value of each candidate stem is divided by the largest detection confidence value. This yields the normalized position feature value, normalized depth feature value, and normalized detection confidence value of each candidate stem. Then, a weighted sum is performed based on preset depth weight, position weight, and confidence weight to obtain the comprehensive value of each candidate stem. The k candidate stems with the highest comprehensive value are selected as the target stems.
6. The method for measuring seedling stem diameter based on instance segmentation and monocular depth estimation according to claim 1, characterized in that: In step S4, morphological processing is performed on each target stem. Specifically, morphological erosion is performed on the mask of the target stem, and then a thinning algorithm is used to extract the initial skeleton from the mask of the target stem after morphological erosion. The pixels with a degree of 1 in the initial skeleton are taken as endpoints, and the endpoints with the highest and lowest vertical coordinates are taken as target endpoints. An undirected graph is constructed based on the coordinates of each pixel in the initial skeleton. For each pair of adjacent pixels in the undirected graph, the Euclidean distance between the adjacent pixels is used as the edge weight between them. Based on each edge weight, the shortest path algorithm is used to search for the path between the two target endpoints in the undirected graph as the backbone skeleton path.
7. The method for measuring seedling stem diameter based on instance segmentation and monocular depth estimation according to claim 6, characterized in that: In step S4, the distance transformation specifically involves first performing an Euclidean distance transformation on the mask of the target stem to obtain a distance transformation map. Then, the distance transformation values of the coordinates of each pixel point in the main skeleton path are extracted from the distance transformation map. Each distance transformation value is doubled to obtain the pixel diameter, thereby constructing a set of pixel diameters. Pixel diameters in the set with values less than an outlier threshold are removed. The outlier threshold is the largest pixel diameter in the set multiplied by a preset percentage, thereby obtaining an effective sampling set. The median of the pixel diameters in the effective sampling set is used as the pixel-level stem thickness of the target stem. The pixel-level stem thickness is multiplied by the pixel physical conversion coefficient to obtain the actual stem thickness of the target stem.
8. A seedling stem diameter measurement system based on instance segmentation and monocular depth estimation, characterized in that, include: The coefficient acquisition module is used to acquire several calibration object images using a monocular camera, and obtain pixel physical conversion coefficients after calibration. The instance segmentation and depth estimation module is used to acquire monocular side-view RGB images of the seedlings to be measured using a monocular camera, perform instance segmentation on the monocular side-view RGB images, extract the masks of several candidate stems and the detection confidence; and perform monocular depth estimation on the monocular side-view RGB images to obtain a relative depth map. The filtering module is used to obtain the comprehensive value of each candidate stem based on the relative depth map, the mask of each candidate stem, and the detection confidence, so as to select a number of candidate stems as target stems. The measurement module performs morphological processing and distance transformation on the masks of each target stem to extract the pixel-level stem thickness of each target stem, and finally obtains the actual stem thickness of the target stem through pixel physical conversion coefficients.
9. An electronic device, characterized in that, include: A memory and a processor are coupled to each other, wherein the memory stores program data, and the processor invokes the program data to perform the method as described in any one of claims 1-7.
10. A computer-readable storage medium storing program data thereon, characterized in that, When the program data is executed by the processor, the method as described in any one of claims 1-7 is implemented.