A machine vision-based plug tray large seedling age grading detection method
By using machine vision technology to acquire images of plug seedlings, determine detection points and segment target areas, extract morphological features, and establish seedling age correlation, the problems of low efficiency and insufficient accuracy in plug seedling grading are solved, and high-precision dynamic grading detection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HEFEI JIAFUTE ROBOT TECH CO LTD
- Filing Date
- 2025-12-23
- Publication Date
- 2026-04-24
AI Technical Summary
Existing methods for grading plug seedlings are inefficient and inaccurate. In particular, image processing methods cannot explain the specific growth defects of plug seedlings, leading to reduced classification accuracy.
A machine vision-based hierarchical detection method is adopted. The detection points are determined by image acquisition, the target area is segmented, morphological features are extracted, the correlation between growth difference features and seedling age is established, and dynamic hierarchical detection is achieved by combining morphological feature trend fitting.
It improves the accuracy and efficiency of seedling grading in plug trays, ensures that the grading results are consistent with the actual growth status of the seedlings, reduces background interference and unclear region segmentation, and provides a reliable grading basis.
Smart Images

Figure CN121366360B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of crop seedling technology, specifically a machine vision-based method for grading and detecting seedlings of different ages in seedling trays. Background Technology
[0002] Seedling tray cultivation is a common planting method. Due to factors such as seeds, soil substrate, and sowing, seedlings will exhibit different conditions. To ensure uniform management of older seedlings after transplanting, they need to be graded and screened. Currently, there are two main grading methods: one is based on manual methods, which are inefficient and labor-intensive; the other is based on simple image processing, which lacks accuracy in complex environments and is inefficient for grading seedling trays.
[0003] For example, Chinese Patent Publication No. CN114998656A discloses a method and system for classifying plug seedlings. The method includes acquiring images of plug seedlings at a fixed time each day during the seedling stage, processing these images using image processing methods to establish a time-series dataset of plug seedlings; training the time-series dataset with a deep learning algorithm to obtain seedling growth information, establishing a mapping model between seedling growth information and seedling quality labels; and classifying the seedlings based on their growth quality according to the mapping model.
[0004] In existing technologies, the growth process of plug seedlings is explained by extracting growth information from the visual time series of images. However, growth information is an abstract feature and cannot explain the specific growth defects of bad seedlings, such as weak stems or stunted growth. Therefore, when classifying plug seedlings, the method of distinguishing between good and bad seedlings alone cannot meet the needs of plug seedling scenarios, resulting in reduced classification accuracy. Summary of the Invention
[0005] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is: a machine vision-based method for grading and detecting seedlings of different ages in plug trays, comprising: S1, acquiring images of plug tray seedlings using a preset angle, and determining the detection points corresponding to each seedling in the plug tray.
[0006] S2 uses the coordinates of the detection points in the image to determine the target areas corresponding to the stems and leaves by growing the images.
[0007] S3. Based on the segmented target region, extract the corresponding morphological features of the target region. By the differences in morphological features over continuous time series, determine the growth difference features and classification label of the target region.
[0008] S4. Based on the growth difference characteristics of the target area, establish the correlation between morphological characteristics and seedling age, and combine the average morphological characteristics of the seedlings to perform trend fitting on the growth difference characteristics, thereby obtaining the graded characteristic intervals of the corresponding seedling age.
[0009] S5 uses the grading characteristic intervals and classification labels of each seedling to perform grading detection, determines the grading result under each grading characteristic interval, and when the grading result belongs to the corresponding seedling age, the corresponding data is used as the output tray grading report.
[0010] The beneficial effects of this invention are as follows: First, this invention achieves dynamic grading detection of large-age seedlings in plug trays through a multi-step collaborative process of image acquisition and detection point determination → target region segmentation → growth difference feature extraction → seedling age association model establishment → grading detection output; it solves the technical problem of the disconnect between grading results and actual seedling age growth status under traditional grading, ensuring that the grading results are consistent with the actual growth stage of the seedlings, and improving the accuracy and efficiency of seedling grading processing.
[0011] Second, this invention establishes an image-physical coordinate mapping through chessboard calibration, delineates the rectangular area of the holes, and sets basic detection points; combined with grayscale threshold initial selection and supplementary detection points, it achieves accurate positioning and range verification of the detection points; at the same time, it extracts seedling candidate areas based on green channel components and YOLOv8 segmentation, and calculates the center of the leaf grayscale mean as a supplementary detection point; finally, it completes the selection of the target area through the region growing method, avoiding the problems of unclear region segmentation edges and background interference, and improving the integrity and accuracy of the target area.
[0012] Third, this invention extracts stem diameter, plant height, and leaf area ratio as morphological features to construct a time series vector; calculates the difference features between adjacent seedling ages, matches them with a health benchmark library using Euclidean distance, and sets classification labels; calculates the average slope of plant height / stem diameter and the standard deviation of stem diameter difference as difference factors, and weights and fuses them with static features to enhance the dynamics of the difference features; finally, through the target region connectivity and distance threshold, it determines the target region under the same difference dimension, realizing dimensional clustering of the difference features; so that the growth differences of each seedling can be matched with the static features of stem diameter, plant height, and leaf area ratio, providing a clear label for the seedling growth status.
[0013] Fourth, this invention determines the optimal number of clusters for each seedling age through clustering and constructs a mapping relationship between seedling age and average morphological characteristics; combined with transplanting standard constraints, it fits the graded feature intervals that meet the standards; and it realizes the association relationship between seedling age and morphological characteristics in the way of average morphological characteristics, which improves the scene adaptability of graded feature intervals and corresponding seedlings and provides a reliable basis for subsequent production decisions. Attached Figure Description
[0014] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0015] Figure 1 This is a flowchart illustrating a machine vision-based method for grading and detecting seedlings of advanced age in seedling trays.
[0016] Figure 2 This is a schematic diagram of the YOLOv8 segmentation model for a machine vision-based method for grading and detecting seedlings of different ages in seedling trays.
[0017] Figure 3 This is a schematic diagram of the SConv module in a YOLOv8 segmentation model, which is a machine vision-based method for grading and detecting seedlings of different ages in seedling trays.
[0018] Figure 4 This is a flowchart illustrating step S1 of a machine vision-based method for grading and detecting seedlings of advanced age in seedling trays.
[0019] Figure 5 This is a flowchart illustrating step S3 of a machine vision-based method for grading and detecting seedlings of advanced age in seedling trays.
[0020] Figure 6 This is a flowchart illustrating step S4 of a machine vision-based method for grading and detecting seedlings of advanced age in seedling trays. Detailed Implementation
[0021] The embodiments of the present invention are described in detail below. The embodiments described below are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention. Where specific techniques or conditions are not specified in the embodiments, they shall be performed in accordance with the techniques or conditions described in the literature in the art or in accordance with the product manual.
[0022] See Figure 1 A machine vision-based method for grading and detecting seedlings of different ages in plug trays includes: S1, acquiring images of plug tray seedlings using a preset angle and determining the detection points corresponding to each seedling in the plug tray.
[0023] S2 uses the coordinates of the detection points in the image to determine the target areas corresponding to the stems and leaves by growing the images.
[0024] S3. Based on the segmented target region, extract the corresponding morphological features of the target region. By the differences in morphological features over continuous time series, determine the growth difference features and classification label of the target region.
[0025] S4. Based on the growth difference characteristics of the target area, establish the correlation between morphological characteristics and seedling age, and combine the average morphological characteristics of the seedlings to perform trend fitting on the growth difference characteristics, thereby obtaining the graded characteristic intervals of the corresponding seedling age.
[0026] S5 uses the grading characteristic intervals and classification labels of each seedling to perform grading detection, determines the grading result under each grading characteristic interval, and when the grading result belongs to the corresponding seedling age, the corresponding data is used as the output tray grading report.
[0027] When extracting images of plug seedlings, multiple convolutions are used to extract the features of the seedlings to obtain image features under multidimensional segmentation. These image features are then further identified to obtain image features under multiple dimensions such as plant height, stem diameter, and leaf area. These features are then used to describe the grading detection results for older seedlings.
[0028] During data collection, front and top views are collected from a fixed position. An industrial camera, a ring LED light source, a fixed bracket, and a seedling tray conveying device are used to identify the height of the seedlings and the area of the leaves. Based on the seedling segmentation borders and leaf areas, images of seedlings in different ages and growth states (including healthy seedlings, weak seedlings, and empty holes) are collected. These images are labeled to complete the subsequent training process of the model.
[0029] The acquired raw images were then preprocessed to eliminate noise and interference: Gaussian filtering was used to remove Gaussian noise, and median filtering was used to eliminate salt-and-pepper noise; the color images were converted to grayscale images through grayscale processing to reduce the amount of computation; and gamma correction was used to adjust the image brightness to ensure the consistency of image features under different lighting conditions, thereby completing the processing of the seedling tray images.
[0030] like Figure 4 As shown, the implementation of step S1 includes: S11, using the chessboard calibration method to establish a mapping relationship between the seedling image and physical coordinates; at this time, a standard calibration plate is placed on the plane where the seedling is located, and then the calibration plate image is acquired. The physical coordinates represented by each hole in the calibration plate are mapped to the pixel position of each hole in the seedling image to determine the position of each hole of the seedling under image recognition.
[0031] S12, based on the physical structure of the seedling tray, delineate the rectangular area of each seedling hole and set the center pixel of the seedling hole as the basic detection point; at this time, select the seedling hole as the basic detection point to record the seedling cultivation status in the seedling tray.
[0032] S13, based on the basic detection points, perform initial grayscale threshold selection on the hole area, and output the detection points corresponding to the leaves and stems within the hole area as supplementary detection points. Then, store all detection points as a txt file, thus associating the detection points with their corresponding image positions.
[0033] The implementation of step S13 includes: S131, extracting the green channel component based on the RGB format of the seedling image, and extracting the seedling candidate region based on the green channel pixel value distribution output by the YOLOv8 segmentation model.
[0034] During the initial grayscale threshold selection, the RGB format of the colored plug seedling image is first used as input, and the G value corresponding to the green channel is used as the main processing part. Based on the training results of the YOLOv8 segmentation model, the pixel value distribution corresponding to the green channel in the leaf area is determined. For example, the average G value of the leaf area is 180±20, the stem area is 120±15, and the background is 50±10. The green channel values (0-255) of the leaf area and stem area are normalized to [0, 1], and then the part with a normalized G value greater than 0.3 is selected as the seedling candidate area.
[0035] S132, within the leaf mask of the seedling candidate area, calculate the coordinates of the center of the pixel grayscale mean to determine the supplementary detection point corresponding to the leaf; within the seedling candidate area, using the leaf mask and stem mask output by the YOLOv8 segmentation model, calculate the center of the grayscale mean of the leaf pixels within the leaf mask, and use it as the supplementary detection point for the leaf; within the stem mask, divide the front view into continuous equal intervals along the vertical direction and the top view along the horizontal direction, calculate the coordinates of the center of the grayscale mean between each equal interval, and determine the supplementary detection point corresponding to the stem; it can be divided into 5 equal intervals, and the center of the grayscale mean of the middle 3 intervals is selected to complete the selection of the detection point corresponding to the stem. If the center of the grayscale mean between each equal interval is retained, the detection points are identified based on their distribution, and Euclidean distance filtering is required to complete the processing of the detection points.
[0036] The initial grayscale threshold selection method is based on the YOLOv8 segmentation model, which can effectively distinguish the pixel values of black background and green leaves through multiple iterations, to complete the initial grayscale selection and identify the corresponding supplementary detection points.
[0037] S133: Based on the perspective of the seedling candidate area, extract the feature points corresponding to the local texture and determine the classification label corresponding to the feature points.
[0038] When setting feature points for each seedling in the seedling tray, in the top view, SIFT, SURF, or ORB algorithms are used to detect the corner points, leaf tips, and vein bifurcation points of the leaf edges. In the front view, stem edge points, internode boundaries, and leaf-stem connection points are detected. Color information is used for filtering, prioritizing high-contrast feature points within the green area. These identified feature points are then classified according to local texture and used as output detection points. Detection points are further represented as: leaf feature points located on curved edges with gentle texture changes; stem feature points located on straight edges with consistent texture directions; and bifurcation point feature points where multiple directions intersect. SIFT algorithm parameters can be set to common parameters such as a Gaussian difference pyramid layer of 6 and a feature point threshold of 0.03 to identify detection points at leaf edges and stem edges.
[0039] In step S133, after identifying supplementary detection points, the detected content based on SIFT, SURF, or ORB algorithms is processed to find feature points describing the texture according to the texture of the location. These feature points are then labeled with location information according to the perspectives corresponding to the top view and front view, in order to determine the semantic information of each detection point.
[0040] S134 will integrate all supplementary detection points, basic detection points, and feature points, and use these points as output detection points.
[0041] Each detection point includes pixel coordinates, viewpoint, feature descriptor, detection point type, etc., and finally completes the processing of the detection points.
[0042] S14, perform range verification on the acquired detection points, and store the verified detection points in a standardized manner.
[0043] When performing range testing, the detection points must fall within the rectangular area of the corresponding hole. The Euclidean distance between each detection point cannot be too small to avoid duplicate output of detection points. For example, points with a distance of less than 3 pixels can be considered as duplicate points, and points with higher response values can be retained to complete the setting of detection points.
[0044] In one embodiment of the present invention, step S2 is implemented by: S21, treating the detection point as a seed point, and gradually merging adjacent pixels according to the similarity of pixels.
[0045] The current processing method essentially uses the detection point as the seed point, and gradually merges adjacent pixels based on the similarity of pixels in color, grayscale, and texture, eventually forming a complete target area of stem, leaf, and hole.
[0046] S22, determine the growth criteria and stopping conditions of the current detection point in different regions, and determine the target areas of the stems and leaves after regional growth.
[0047] Since seedlings have a distinct green hue, Gaussian filtering is first used to remove image noise. Then, the G value in the green channel and the grayscale value of the grayscale image are used as the basis for regional growth characteristics. For example, the seedling image is divided into a green channel image and a grayscale image based on color characteristics and grayscale values.
[0048] The growth criteria set represent the values of the G value and grayscale value of the green channel. Based on these two values, adjacent pixels are merged.
[0049] For example, for the seed point corresponding to the leaf, a growth criterion will be set: the absolute difference of the G value between adjacent pixels and the seed point must be <0.05, and the gray value difference must be ≤20. The 0.05 and gray value difference will be set based on the average difference of the G values and the average difference of the gray values between adjacent pixels in the leaf region after multiple labeling of the leaf region by the model, thus determining the growth criterion for the leaf region. The stopping condition is expressed as an absolute difference of G values ≥0.05 and a gray value difference >20. Growth will stop at the corresponding location when the difference exceeds these two values, or when it reaches the boundary of the hole region.
[0050] The seed point corresponding to the leaf will traverse its 8 neighboring pixels (top, bottom, left, right and diagonal) to determine whether the neighboring pixels meet the leaf growth criteria. For pixels that meet the criteria, they will be merged into the leaf region and used as a new seed point to continue traversing its neighborhood. The above process is repeated until there are no pixels that meet the criteria. The final connected region is the target region of the leaf.
[0051] For the detection points corresponding to the stem, the gray-scale difference needs to be used as the basis for judgment. The gray-scale difference between the adjacent pixel and the seed point is required to be ≤15, and the gray-scale gradient value at the edge position during region growth is <30. If these two values are not met or the point is connected to the leaf area, it is considered as the stopping condition for the corresponding position, so as to complete the region growth of the stem.
[0052] Using the seed point corresponding to the stem, its 4 neighboring pixels (up, down, left, right) are traversed. Since the stem is a vertical column, 4-neighbor traversal can more directly obtain the area where the stem grows. Then, it is determined whether the neighboring pixels meet the stem growth criteria. For pixels that meet the criteria, they are merged into the stem area and used as new seed points to continue growing. When the growth reaches the boundary of the leaf area, it stops. The finally formed connected region is the target area of the stem.
[0053] S23. Morphological operations are performed on the grown region, and the processed region is regarded as the output target region. For the target region after the region growth is completed, dilation is used to fill the tiny holes in the region, and then erosion is used to remove the burrs on the edge of the region. The parameters of 3×3 for the dilation kernel and 2×2 for the erosion kernel can be selected, and each is iterated once to complete the morphological operation and make the outline of the target region smoother. Then, the boundary coordinates of each target region are extracted to complete the setting of the target region.
[0054] In steps S1-S3, the image features of stems, leaves and cavities are quantified using an image model-based processing method.
[0055] At this point, the YOLOv8 segmentation model will be used as the base model, and its structure is as follows: Figures 2-3As shown, YOLOv8 is essentially an object detection algorithm. Its core function is to quickly locate the bounding boxes of locations such as leaves, stems, and cavities in an image, and then configure semantic labels and category descriptions for these locations in the form of bounding boxes.
[0056] To improve the accuracy of recognition and feature definition, a region growing algorithm can be introduced to further generalize the contours of leaves, stems, cavities, etc., with the aim of extracting the complete contour of the target and reducing missegmentation of the target and loss of image features due to bounding box delineation.
[0057] Depend on Figure 2 As can be seen, the detection process of YOLOv8 follows the paradigm of feature extraction → feature fusion → prediction output, and its components are shown below.
[0058] Backbone: Input the original image and extract feature maps layer by layer from the bottom layer (edges / texture) to the top layer (semantics) to construct the basic feature representation.
[0059] Neck (Neck Feature Fusion): Fuses multi-scale features (deep semantic high-level + shallow spatial high-level) output from Backbone, and generates spatially and semantically balanced multi-scale enhanced features through modules such as Upsample, Concat, and C2f.
[0060] Head (Detection Head): Processes the multi-scale features output by Neck separately, and enhances the feature expression through operations such as Conv, Split, SConv, and Concat. Finally, the position and category prediction of targets at different scales are output by the Detect module.
[0061] To reduce the computational cost of the model, SConv replaced the Conv module in the YOLOv8 model structure C2f. Figure 3 The specific structure of SConv is known. It divides the feature vector into two parts in a 1:3 ratio and performs convolution on each part using kernels of different sizes. The resulting features are then fused and output to reduce the computational load of directly using the Conv module. At the same time, a CA module is added at the end of the backbone network to achieve multi-scale enhancement of channel and spatial information. This makes the model more capable of perceiving and locating parts such as borders and leaf regions in the image, so as to obtain the seedling images of the plug trays that need to be processed.
[0062] For a frontal view of a plug seedling image, the area used to extract the seedlings will be recorded, along with the ratio between the actual plant height and the plant height in the image, and the ratio between the actual stem diameter and the stem diameter in the image. These ratios will be used to identify the values of plant height and stem diameter in the current image, thereby recording the relative values of morphological features.
[0063] The top view of the plug seedling image is used to record leaf area and further identify the ratio between leaf area and plant height to determine the current growth status of the seedlings.
[0064] The morphological characteristics measured will include stem diameter, plant height, and leaf area-to-plant height ratio (the ratio of leaf area to plant height) to reflect the vigor of seedling growth. The selected leaf area-to-plant height ratio can eliminate the influence of plant size differences while retaining key growth trend information. In subsequent processing, the range of values over continuous time periods will be emphasized to quantify the growth differences in the target area.
[0065] If the ratio of seedling leaf area to plant height decreases significantly in a certain area, it may indicate that the leaves are sparsely distributed in the height direction, and light management needs to be optimized to quantify the differences in each target area.
[0066] In one embodiment of the present invention, such as Figure 5 As shown, step S3 is implemented as follows: S31, extracting stem diameter, plant height, and leaf area from any target region in the seedling tray image, and using stem diameter, plant height, and the ratio of leaf area to plant height as output morphological features to construct feature subsets corresponding to each target region. When constructing feature subsets, all input data are standardized, and feature subsets are set in a normalized manner.
[0067] S32, construct time series vectors by dividing the feature subsets according to their values at multiple seedling ages, and determine the differential features corresponding to the time series vectors based on the differences in the time series vectors at adjacent seedling ages. Each time series vector will extract the values of the same hole seedling at multiple seedling ages according to the changes in stem diameter, plant height, and leaf area-to-plant height ratio over time.
[0068] The output difference characteristics can be recorded in the form of growth rate and growth fluctuation, recording the dynamic differences of seedlings in the same hole; for example, the growth rate is expressed as the first difference and average slope as it increases over time, reflecting the growth of adjacent seedling ages; the growth fluctuation will be expressed in the form of difference standard deviation, reflecting the stability of growth.
[0069] It can be seen that the first difference represents the difference between adjacent time points, the standard deviation of the difference represents the standard deviation of the difference between adjacent time points, and is used to explain the trend of growth rate change; the average slope represents the average ratio of the difference in stem diameter at adjacent time points to the time difference, and its value is used to illustrate the average growth rate of a single seedling at the corresponding time.
[0070] Preferably, step S32 is further implemented by: S321, calculating the average slope of plant height, the average slope of stem diameter, and the standard deviation of stem diameter difference of all seedlings in the target area at adjacent time points, as the difference factor of the corresponding time series vector; these three values can directly reflect the growth rate and reflect the stability and dynamic changes of seedling growth.
[0071] S322, treat the original value of each feature in the feature subset as a static feature, and perform weighted fusion of the difference factor and the static feature, and use the fused feature value as the output difference feature.
[0072] During the fusion and weighting process, the difference factor and static features are first concatenated, and the input features are normalized. Then, the concatenated features are input into the random forest, and the feature that maximizes the reduction of node impurity is selected for splitting. After that, the sum of the reduction in impurity of each feature across all classification nodes is calculated, and the sum of the reduction in impurity is normalized according to the current feature to obtain the weight corresponding to each feature. Finally, the weighted sum is calculated according to the number of current dynamic features and static features to highlight the influence of key features and weaken the interference of current secondary features.
[0073] S33, matching and identifying the difference features of each time series vector to determine the target region under the same difference dimension.
[0074] The implementation of step S33 includes: retrieving the target region corresponding to each difference feature value, and connecting the target regions to form a connection relationship between the target regions.
[0075] After completing the connection relationship of the target regions, determine the type and connection conditions of any two target regions. If the connection conditions meet the distance threshold, determine that they are under the same difference dimension.
[0076] The target regions corresponding to the differential feature values will be grouped and merged. At this time, the target regions processed represent the front and top views of a group of seedling tray images. These images are then connected by mapping to the target regions of the corresponding seedlings.
[0077] As for the type of target region, it is the semantic interpretation of the differential features under the corresponding target region, such as the semantic description of rapid plant height growth and slow stem diameter growth. Selecting target regions under the same type can clearly understand the distribution of the collected plug seedling images under a single seedling age. The connection conditions set afterwards will represent the value of the differential features themselves. The Euclidean distance of the differential feature values is used as the main condition to check the values of static features, difference factors, etc., to prevent some stagnant seedlings from being mixed into the subsequent analysis process.
[0078] Using the difference feature value to calculate the Euclidean distance can illustrate the growth difference pattern between seedlings in different target areas. The smaller the distance value, the closer the growth difference is, and the more the identified seedlings are in the same difference pattern. The Euclidean distance calculated by static features, difference factors, etc. can be checked against specific values to find multiple relatively similar target areas.
[0079] The distance threshold is then set based on the median of the Euclidean distance. For example, if the median × 0.8 is selected, data that is less than the distance threshold is considered to be of the same difference dimension. After identifying the corresponding seedlings one by one, the difference dimension is set, which can reduce the amount of calculation when clustering seedling morphological features.
[0080] S34. For target regions under the same difference dimension, classify the difference features by using the Euclidean distance between the difference features and the healthy seedling growth feature benchmark library, and use the classified data as the output growth difference features.
[0081] The healthy seedling growth characteristic benchmark library will be set based on the values of differential characteristics across multiple batches. For example, time series data of 1,000 healthy seedlings of the same variety will be collected, and the difference factor and static characteristics at the time of splicing will be used to establish benchmark intervals in the form of mean ± standard deviation, such as mean ± 1.5 times standard deviation. Then, benchmark libraries will be established according to seedling age segments, such as 7 days, 14 days, 21 days, and 28 days, to complete the setting of the healthy seedling growth characteristic benchmark library.
[0082] As for the subsequent Euclidean distance, it will be calculated based on the difference factor and static features corresponding to the current difference features, and the corresponding average value in the benchmark library to quantify the difference from the healthy seedling benchmark. Based on this Euclidean distance, a preliminary classification of growth differences can be made, forming a form such as healthy seedlings having a value less than 0.3, weak seedlings having a value between 0.3 and 0.6, and abnormal seedlings having a value greater than or equal to 0.6, thus completing the quantitative processing of growth differences.
[0083] In the overall processing of step S3, the focus is on the centralized analysis of seedlings in a single target area, which is the quantitative processing of the multi-time changes of a single seedling. Subsequently, based on the configuration of the planting holes, all seedlings should be centrally analyzed to determine the changes of seedlings at the corresponding seedling age.
[0084] In one embodiment of the present invention, step S4 combines the growth difference characteristics of the multi-time series of plug seedlings, takes the data corresponding to the growth difference characteristics as input, and calculates the average feature value under the corresponding seedling age based on the values of the difference factor, stem diameter, plant height and leaf area-to-plant height ratio, and the clustering situation among multiple seedlings, establishes a correlation model between seedling age and morphological characteristics, and determines the graded feature intervals of different seedling ages.
[0085] like Figure 6 As shown, the implementation of step S4 includes: S41, based on the data corresponding to the growth difference characteristics, clustering all seedlings with the classification labels corresponding to the growth difference characteristics, and determining the optimal number of clusters for each seedling age.
[0086] When performing clustering, data with the same classification label are used as the benchmark to identify the classification under the corresponding seedling age. The stem diameter, plant height, and leaf area-to-plant height ratio corresponding to the growth difference characteristics are used as clustering indicators. After converting them into vectors, the Euclidean distance between the vectors is used to quantify the data classification in each cluster.
[0087] The current processing is based on growth difference characteristics. It performs clustering processing on the images of plug seedlings collected in each cycle, determines the optimal number of clusters for a single cycle, and uses the optimal number of clusters to calculate the average morphological characteristics of the corresponding seedling age, thus completing the establishment of association relationships.
[0088] When selecting the optimal number of clusters, the k-means algorithm is used as the current clustering algorithm, and the number of clusters corresponding to the maximum silhouette coefficient is regarded as the optimal number of clusters to be used.
[0089] S42, construct a mapping relationship between the clusters under each seedling age according to the classification labels of growth difference characteristics, calculate the average morphological characteristics under the corresponding seedling age, and determine the mapping relationship between the average morphological characteristic value of each cluster and the corresponding seedling age.
[0090] The average morphological feature value of each cluster represents the average value of stem diameter, plant height, and leaf area-to-plant height ratio within the corresponding cluster. This is used to explain the average value under the classification labels corresponding to healthy seedlings, abnormal seedlings, and weak seedlings. Based on these average values, the fitted value of the corresponding seedling under continuous seedling age distribution is determined to explain the relative situation of the corresponding seedling during growth and to help predict the value of the corresponding part as the seedling age increases.
[0091] S43. Based on the mapping relationship between the average morphological feature value of each cluster and the corresponding seedling age, a seedling age-morphological feature association model is established with seedling age as the independent variable and the average morphological feature obtained from clustering as the dependent variable.
[0092] When setting up the seedling age-morphological feature association model, the XGBoost algorithm will be the primary method, using regression calculations to determine the predicted values for different seedling ages. XGBoost integrates multiple decision trees through an additive model; after the k-th iteration, the model's predicted value is the sum of the predicted values from the first k trees.
[0093] The addition model is defined as follows: ;in, This represents the predicted value of the i-th sample after the k-th iteration. Each sample represents a value at a specific time, such as the plant height value input on the 14th day of seedling age. This represents the predicted value after the (k-1)th iteration. In the initial iteration, the predicted value is the mean of all input samples. This represents the learning rate, which can be 0.1 and is used to control the contribution weight of the k-th tree. represents the predicted output of the k-th decision tree for the i-th sample, and represents the weighted sum of the leaf weights of the corresponding decision tree. At this point, the average morphological features of the input are predicted using a decision tree approach to fill in the trends under multiple time points, making the curves corresponding to the average values of stem diameter, plant height, etc., that change over time more complete and comprehensive.
[0094] Then for the k-th decision tree The output at the corresponding seedling age t can be expressed as: ;in, This represents the number of leaf nodes in the k-th tree. The number of leaf nodes is affected by the current decision tree depth. If the decision tree depth is set to 3, the number of leaf nodes is 8. This represents the weight of the j-th leaf node in the k-th tree, where j ranges from 1 to J. The value of this weight depends on the extraction of the input sample and the second derivative, such as... ;in, This represents the gradient of sample i. This represents the second derivative of sample i. This represents the L2 regularization parameter, which can be 0.1 and is used to penalize excessively large leaf weights. This represents the sample interval of the j-th leaf node of the k-th tree, such as the range of values for the corresponding plant height and the range of values for the corresponding seedling age, to illustrate the interval corresponding to each sample; Indicates an indicator function, If the seedling age is within the normal range, I=1; otherwise, I=0. The essence of a decision tree is the mapping between the standardized seedling age value and the weight of the leaf node, which determines the average value of morphological characteristics at different seedling ages through continuous iteration.
[0095] Based on the predicted values obtained through multiple iterations, the iteration stops when the predicted value and the current input value reach the minimum mean square error, and the corresponding predicted value is output, thereby completing the establishment of the seedling age-morphological feature correlation model and obtaining the correlation between the corresponding input morphological features and the seedling age under nonlinear analysis.
[0096] That is, the implementation of step S43 includes: using the average morphological characteristics of seedlings of any age as input samples, constructing a decision tree, and determining the gradient and second derivative of the input samples.
[0097] Calculate the split gain using the second derivative and gradient of the input sample, and use the data with the largest split gain as the root node split point of the decision tree.
[0098] The process is recursively applied to the split points to complete the recursive processing of the leaf nodes. The predicted values of the seedling age-morphological feature association model are updated with the weights corresponding to each leaf node until the predicted values meet the minimum mean square error. The iteration stops then, and the analysis and processing of the seedling age-morphological feature association model is completed.
[0099] It should be noted that when performing decision tree analysis, up to 40 decision trees can be selected for iteration to prevent the accuracy of the output data from being reduced due to feature redundancy.
[0100] Through the above calculation process, the seedling age-morphological characteristic correlation model can be fully established, which not only ensures the nonlinear fitting ability of the model, but also adapts to the average growth pattern of seedlings.
[0101] S44: Retrieve the transplanting standard constraints for the corresponding seedling age from the database, perform trend fitting between the predicted value output by the seedling age-morphological feature association model and the average morphological feature value, and set the graded feature interval using the fitted value that meets the transplanting standard constraints.
[0102] When performing trend fitting, the average morphological feature value of the seedling age cluster plus the predicted value of the intermediate seedling age are combined to form a complete time series. Guided by each classification label, the feature mean curve under the corresponding classification label is generated, such as the feature mean curve of healthy seedlings. At this time, quadratic polynomial or linear regression is used to fit the stem diameter, plant height and leaf area-to-plant height ratio. The grading feature interval is set in the form of the fitted value ± 2 times the standard deviation. The standard deviation is calculated based on the values of stem diameter, plant height and leaf area-to-plant height ratio of multiple inputs.
[0103] The obtained fitted value is essentially the expected mean of a specific seedling age. Based on this fitted value, as well as the standard deviations of the input stem diameter, plant height, and leaf area-to-plant height ratio, the grading feature intervals under the classification labels such as healthy seedlings, weak seedlings, and abnormal seedlings can be set.
[0104] Transplanting standard constraints refer to extracting the required stem diameter, plant height, and leaf area-to-plant height ratio from the database. Seedlings that meet these values are considered as the current segment for processing, thereby determining the specific value ranges for healthy seedlings and unhealthy seedlings such as weak or abnormal seedlings.
[0105] In step S5, based on the classification labels set for each seedling in steps S3 and S4 and the fitting of the clustering process, the identified seedlings will be summarized and processed to form the final grading results of healthy seedlings, weak seedlings, abnormal seedlings, and seedlings to be reviewed. A mapping relationship between seedling age, hole ID, and grading result will be formed to illustrate the final result of each seedling under image recognition.
[0106] Therefore, step S5 is implemented by sequentially extracting the data corresponding to the classification labels and grading feature intervals, determining whether the data mapped to the classification labels and grading feature intervals are the same set of data, and outputting the corresponding data as a seedling tray grading report when they are the same set of data. The output seedling tray grading report includes information such as seedling age distribution, proportion of healthy seedlings, classification labels, and grading feature intervals for weak seedlings.
[0107] When determining whether data belongs to the same group, the essence is to identify whether the data corresponding to healthy seedlings, weak seedlings, and abnormal seedlings in the current classification label and the data divided by the grading feature interval are from the same source. These data from the same source are then aggregated. If they are not from the same source, it means that there are some anomalies when dividing the data. It is necessary to check and roll back the corresponding transactions to complete the check and analysis of all seedlings.
[0108] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention, which are still covered within the protection scope of the present invention.
Claims
1. A machine vision-based method for grading and detecting seedlings of different ages in seedling trays, characterized in that, include: S1. Acquire images of seedlings in plug trays using a preset angle and determine the detection points corresponding to each seedling in the plug tray; S2, by using the coordinates of the detection points in the image, the target areas corresponding to the stems and leaves are determined by growing the detection points in the image; S3. Based on the segmented target region, extract the morphological features corresponding to the target region, and determine the growth difference features and classification label of the target region by the differences in morphological features in continuous time series. S31. Extract stem diameter, plant height, and leaf area from any target region in the plug seedling image. Use stem diameter, plant height, and the ratio of leaf area to plant height as the output morphological features to construct a feature subset corresponding to each target region. S32. Construct a time series vector from the feature subset according to the values under multiple seedling ages. Determine the difference features corresponding to the time series vector based on the differences between adjacent seedling ages. S33. Match and identify the difference features of each time series vector to determine the target regions under the same difference dimension. S34. For the target regions under the same difference dimension, set classification labels for the difference features based on the Euclidean distance between the difference features and the healthy seedling growth feature benchmark library. Use the classified data as the output growth difference features. S4. Based on the growth difference characteristics of the target area, establish the correlation between morphological characteristics and seedling age, and combine the average morphological characteristics of the seedlings to perform trend fitting on the growth difference characteristics to obtain the corresponding seedling age grading feature intervals. S5 uses the grading characteristic intervals and classification labels of each seedling to perform grading detection, determines the grading result under each grading characteristic interval, and when the grading result belongs to the corresponding seedling age, the corresponding data is used as the output tray grading report.
2. The method for grading and detecting the age of seedlings in plug trays based on machine vision according to claim 1, characterized in that, The implementation methods for step S1 include: S11, using the chessboard calibration method, establish the mapping relationship between the seedling tray image and physical coordinates; S12, Based on the physical structure of the acupuncture plate, delineate the rectangular area of each acupuncture hole and set the center pixel of the acupuncture hole as the basic detection point; S13, Based on the basic detection points, perform initial grayscale threshold selection on the hole area, and output the detection points corresponding to the leaves and stems in the hole area as supplementary detection points; S14, perform range verification on the acquired detection points, and store the verified detection points in a standardized manner.
3. The method for grading and detecting the age of seedlings in plug trays based on machine vision according to claim 2, characterized in that, The implementation methods for step S13 include: S131, based on the RGB format of the seedling images, extract the green channel components, and extract seedling candidate regions based on the green channel pixel value distribution output by the YOLOv8 segmentation model; S132, within the leaf mask of the seedling candidate area, calculate the center coordinates of the pixel grayscale mean and determine the supplementary detection point corresponding to the leaf; S133, based on the perspective of the seedling candidate area, extract the feature points corresponding to the local texture and determine the classification label corresponding to the feature points; S134 will integrate all supplementary detection points, basic detection points, and feature points, and use these points as output detection points.
4. The machine vision-based method for grading and detecting the age of seedlings in plug trays according to claim 1, characterized in that, Step S2 can be implemented in the following ways: S21, the detection point is regarded as a seed point, and adjacent pixels are gradually merged according to the similarity of pixels; S22, determine the growth criteria and stopping conditions of the current detection point in different regions, and determine the target areas of stems and leaves after regional growth; S23 performs morphological operations on the grown region, and the processed region is regarded as the output target region.
5. The machine vision-based method for grading and detecting the age of seedlings in plug trays according to claim 1, characterized in that, The implementation of step S32 also includes: S321, calculate the average slope of plant height, average slope of stem diameter, and standard deviation of stem diameter difference of all seedlings in the target area at adjacent time points, and use them as the difference factor of the corresponding time series vector; S322, treat the original value of each feature in the feature subset as a static feature, and perform weighted fusion of the difference factor and the static feature, and use the fused feature value as the output difference feature.
6. The method for grading and detecting the age of seedlings in plug trays based on machine vision according to claim 1, characterized in that, The implementation methods of step S33 include: Retrieve the target region corresponding to each difference feature value, and connect the target regions to form the connection relationship between them; After completing the connection relationship of the target regions, determine the type and connection conditions of any two target regions. If the connection conditions meet the distance threshold, determine that they are under the same difference dimension.
7. The machine vision-based method for grading and detecting the age of seedlings in plug trays according to claim 1, characterized in that, Step S4 can be implemented in the following ways: S41. Based on the data corresponding to the growth difference characteristics, cluster all seedlings using the classification labels corresponding to the growth difference characteristics to determine the optimal number of clusters for each seedling age. S42, construct a mapping relationship between the clusters under each seedling age according to the classification labels of growth difference characteristics, calculate the average morphological characteristics under the corresponding seedling age, and determine the mapping relationship between the average morphological characteristic value of each cluster and the corresponding seedling age. S43. Based on the mapping relationship between the average morphological feature value of each cluster and the corresponding seedling age, a seedling age-morphological feature correlation model is established with seedling age as the independent variable and the average morphological feature obtained from clustering as the dependent variable. S44: Retrieve the transplanting standard constraints for the corresponding seedling age from the database, perform trend fitting between the predicted value output by the seedling age-morphological feature association model and the average morphological feature value, and set the graded feature interval using the fitted value that meets the transplanting standard constraints.
8. The method for grading and detecting the age of seedlings in plug trays based on machine vision according to claim 7, characterized in that, The implementation methods of step S43 include: Using the average morphological characteristics of seedlings of any age as input samples, a decision tree is constructed, and the gradient and second derivative of the input samples are determined. Calculate the split gain using the second derivative and gradient of the input sample, and use the data with the largest split gain as the root node split point of the decision tree. The process is recursively applied to the split points to complete the recursive processing of the leaf nodes. The predicted values of the seedling age-morphological feature association model are updated with the weights corresponding to each leaf node until the predicted values meet the minimum mean square error, at which point the iteration stops.
9. The machine vision-based method for grading and detecting the age of seedlings in plug trays according to claim 1, characterized in that, Step S5 can be implemented in the following ways: Extract the data corresponding to the classification labels and grading feature intervals in sequence, determine whether the data mapped to the classification labels and grading feature intervals are the same set of data, and output the corresponding data as a grading report when they are the same set of data.
Citation Information
Patent Citations
Plug seedling classification method and system
CN114998656A
Tomato plug seedling grading detection and data transmission method based on deep learning
CN116630707A