Grain inspection device and method based on vibration seed scattering and anti-blocking algorithm
Patent Information
- Application Number
- CN202611096014.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-23
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2046-07-23
AI Technical Summary
[0003]1.静态像素标定误差:现有技术多依赖人工放置特定尺寸的标定卡片获取像素转化比值,每次放置的位置、角度差异以及摄像头模块高度微调,极易引入装配与透视畸变误差,导致真实尺寸计算不准
1、采用嵌装式标定卡配合动态标定模块,无需人工反复放置标定卡片,通过掩膜法提取阵列图案并实时计算横、纵向像素当量与面积当量,可减少人工放置偏差、设备高度微调和局部透视畸变带来的测量误差,提高不同批次之间尺寸测量的一致性。
Smart Images

Figure CN122612608B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of crop breeding technology, and in particular to a grain testing device employing vibration seed dispersal and anti-adhesion image processing technology. Background Technology
[0002] Seed phenotypic parameters (length, width, area, etc.) and thousand-seed weight are core indicators for crop breeding, genetic analysis, and quality assessment. Traditional manual seed assessment methods are labor-intensive and resource-intensive, and have low measurement accuracy. Currently, automated seed assessment systems based on computer vision mostly adopt the method of "static overhead image segmentation + weighing," but in practical applications, the following problems exist:
[0003] 1. Static pixel calibration error: Existing technologies mostly rely on manually placing calibration cards of specific sizes to obtain pixel conversion ratios. The differences in the position and angle of each placement, as well as the fine-tuning of the camera module height, can easily introduce assembly and perspective distortion errors, resulting in inaccurate calculation of the actual size.
[0004] 2. Limitations of seed segmentation for adhered seeds: Existing systems generally use the traditional watershed algorithm to separate adhered seeds. However, when the seeds are highly dense or there are noise points at the edges, the watershed algorithm is prone to "oversegmentation" or "undersegmentation", resulting in failure of single seed extraction.
[0005] 3. Counting failure under extreme dense conditions: When too many seeds are dumped, resulting in heavy random stacking and large-area adhesion, forcibly using image contour segmentation will cause the algorithm to take a very long time and be prone to errors. The system lacks a fallback mechanism for rapid statistics.
[0006] 4. Randomly scattered seeds with inconsistent postures: Currently, the system directly scatters non-circular seeds (such as rice and wheat) onto the light-emitting plate. The seeds have random postures and are stacked in three dimensions, which brings great computational difficulty and measurement error to the subsequent extraction of major and minor axes using the principal component keel method.
[0007] 5. Limited testing dimensions and lack of quality assessment: Existing testing equipment only focuses on contour extraction and geometric parameter measurement, lacking the ability to screen for seed quality defects such as empty, shriveled, moldy, and insect-damaged seeds, and cannot directly output higher-level indicators such as "seed setting rate" or "healthy thousand-seed weight". Summary of the Invention
[0008] This application provides a grain seed testing device and method based on vibration seed dispersal and anti-adhesion algorithms to solve the problems in the prior art.
[0009] On the one hand, this application provides a grain seed testing device based on vibration seed dispersal and anti-adhesion algorithms, including a backlight emitting plate, a light-transmitting seed dispersal box, a non-directional vibration motor, a calibration card, a camera module, an electronic balance, and a computer; A light-transmitting seed box is placed above the light-emitting side of the backlit panel. A non-directional vibration motor is located on the side wall or bottom of the seed box and is connected to it for transmission, enabling the seed box to generate non-directional vibration. The driving intensity and vibration duration of the non-directional vibration motor are adjusted according to the type, quantity, and spreading state of the seeds to be tested, so that the seeds gradually break up their stacking under the action of vibration and gravity, forming a single layer that tends to lie flat. A calibration card is placed at the bottom of the seed box or on the supporting surface of the backlit panel, and the calibration card has a regular array pattern with known physical dimensions. A camera module is mounted directly above the seed box, with the acquisition direction facing the inside of the seed box, to acquire images of the seeds under backlight and the calibration card. An electronic balance is used to weigh the total weight of the seeds to be tested. A computer is connected to both the camera module and the electronic balance. The computer integrates a dynamic calibration module, an image analysis module, a multiple anti-adhesion module, a dense population counting module, a quality detection module, and a data fusion module. The dynamic calibration module extracts the array pattern from the calibration card image, calculates the length pixel equivalent and area pixel equivalent, establishes the conversion relationship between image pixels and real physical size, and completes pixel calibration. The conversion relationship is used for the phenotypic parameter size conversion of seed images. The image analysis module performs grayscale, background correction, and binarization processing on the seed image and extracts connected regions in the image. The multi-anti-adhesion module determines the adhered seed regions from the connected regions based on area, perimeter, and convexity defects, and performs segmentation processing on the adhered seed regions to obtain independent single seed contours. The dense population counting module estimates the total number of seeds based on the median area of candidate isolated single seed regions or the pre-stored single seed reference area when seeds are stacked or the multi-anti-adhesion module cannot complete the segmentation. The quality detection module identifies defects in the seeds in the single seed contours, filters empty and shriveled seeds, and identifies moldy, insect-eaten, and broken defective seeds, and counts the number of healthy seeds and the seed setting rate. The data fusion module combines the number of healthy seeds, total weight, and single seed visual area weight to calculate the healthy thousand-seed weight.
[0010] On the other hand, embodiments of this application also provide a grain seed evaluation method based on vibration-based seed dispersal and anti-agglomeration algorithms, including the following steps: A calibration card with a regular array pattern of known physical dimensions is placed on the bearing surface of the backlight emitting plate. The image of the calibration card is acquired, the array pattern in the image is extracted, and the length pixel equivalent and area pixel equivalent are calculated to complete the dynamic pixel calibration. The seeds to be tested are poured into a light-transmitting seed box placed above the light-emitting side of the backlight panel, and a non-directional vibration motor is driven to generate vibration, so that the seeds are laid out in a single layer and in a uniform flat position. Acquire seed images, perform grayscale conversion, background correction and binarization on the images and extract connected regions, and determine the adhered seed regions by joint constraints of area, perimeter and convexity defects; An improved concave point matching method is used to segment the region of adhered seeds to obtain the outline of an independent single seed. When seeds are stacked or segmentation fails, candidate isolated single seed regions are selected from the connected regions and their median area is extracted as the reference area of the isolated single seed. If there are not enough candidate isolated single seed regions, the pre-stored single seed reference area is called and the total number of seeds is estimated by accumulating the area multiple intervals. Quality inspection is performed on individual seeds. Empty and shriveled seeds are identified based on end notch features, and defective seeds such as moldy, insect-eaten, and broken seeds are identified based on lightweight convolutional neural network classification units. The number of valid healthy seeds is counted. The total weight of all seeds is weighed, and the weight of healthy thousand seeds is calculated by combining the number of healthy seeds and the visual area weight of each seed.
[0011] The grain seed testing device and method based on vibration seed dispersal and anti-adhesion algorithm disclosed in this application have the following advantages: 1. The embedded calibration card is used in conjunction with the dynamic calibration module, eliminating the need for repeated manual placement of the calibration card. The array pattern is extracted by masking and the horizontal and vertical pixel equivalents and area equivalents are calculated in real time. This reduces measurement errors caused by manual placement deviations, equipment height fine-tuning, and local perspective distortion, and improves the consistency of dimensional measurements between different batches.
[0012] 2. The multi-anti-adhesion module filters adhesion regions by combining area, perimeter and convexity defects. It uses an improved concave point matching method with candidate concave point screening and pairing cost function to perform segmentation processing, which can reduce the risk of over-segmentation and under-segmentation of the traditional watershed algorithm in noisy edges and narrow contact areas. It is suitable for various adhesion forms such as end-to-end series, side-by-side contact and local intersection.
[0013] 3. The dense population counting module is designed for extreme dense working conditions where seeds are heavily stacked and conventional segmentation algorithms cannot be effectively executed. It uses the median area of candidate isolated single grains or the pre-stored reference area of single grains as a benchmark, and estimates the total number of grains by accumulating the area multiples. It can complete the counting in seconds without complex iterative calculations, thereby improving the device's working condition resistance and operating efficiency.
[0014] 4. The non-directional vibration motor, in conjunction with the light-transmitting seed box, reduces the internal friction of the seed population through micro-amplitude vibration, allowing non-circular seeds such as rice to lie flat naturally under gravity, achieving uniform single-layer spreading, unifying the seed posture during image acquisition, and reducing the calculation error of the major and minor axes in the subsequent principal component method for extracting the principal axes.
[0015] 5. The quality inspection module identifies empty and shriveled seeds by combining the notch features of the seed end contour and calculates the seed setting rate. It extracts texture and color features through a lightweight convolutional neural network to screen for defective seeds such as mold, insect damage, and breakage. It also outputs a healthy thousand-seed weight index by combining weighing data and single-seed visual area weight. This expands the seed evaluation dimensions and enhances the practical value of the device without increasing hardware costs. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a schematic diagram of the composition of a grain testing device based on vibration seed dispersal and anti-adhesion algorithms, provided in an embodiment of this application.
[0018] Figure 2 A diagram of the software interface installed on a computer as provided in an embodiment of this application.
[0019] Figure 3 An example of seed phenotypic parameters exported by the data output module provided in the embodiments of this application.
[0020] Figure 4 An example of a visualization result image exported by the data output module provided in an embodiment of this application.
[0021] Figure 5 The flowchart illustrates a grain seed evaluation method based on vibration-based seed distribution and anti-adhesion algorithms, provided in this application embodiment.
[0022] Figure 6 A comparison diagram of seed distribution before and after non-directional vibration attitude adjustment provided in the embodiments of this application.
[0023] Figure 7 The diagram shows the overall structure of the lightweight convolutional neural network SeedQC-Net and the internal structure of the DSConv convolutional module group provided in the embodiments of this application. Detailed Implementation
[0024] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0025] Figure 1 This is a schematic diagram illustrating the composition of a grain seed testing device based on a vibration-based seed dispersal and anti-adhesion algorithm, as provided in an embodiment of this application. The device includes a backlit light-emitting plate, a light-transmitting seed dispersal box, a non-directional vibration motor, a calibration card, a camera module, an electronic balance, and a computer. A light-transmitting seed box is placed above the light-emitting side of the backlit panel. A non-directional vibration motor is located on the side wall or bottom of the seed box and is connected to it for transmission, enabling the seed box to generate non-directional vibration. The driving intensity and vibration duration of the non-directional vibration motor are adjusted according to the type, quantity, and spreading state of the seeds to be tested, so that the seeds gradually break up their stacking under the action of vibration and gravity, forming a single layer that tends to lie flat. A calibration card is placed at the bottom of the seed box or on the supporting surface of the backlit panel, and the calibration card has a regular array pattern with known physical dimensions. A camera module is mounted directly above the seed box, with the acquisition direction facing the inside of the seed box, to acquire images of the seeds under backlight and the calibration card. An electronic balance is used to weigh the total weight of the seeds to be tested. A computer is connected to both the camera module and the electronic balance. The computer integrates a dynamic calibration module, an image analysis module, a multiple anti-adhesion module, a dense population counting module, a quality detection module, and a data fusion module. The dynamic calibration module extracts the array pattern from the calibration card image, calculates the length pixel equivalent and area pixel equivalent, establishes the conversion relationship between image pixels and real physical size, and completes pixel calibration. The conversion relationship is used for the phenotypic parameter size conversion of seed images. The image analysis module performs grayscale, background correction, and binarization processing on the seed image and extracts connected regions in the image. The multi-anti-adhesion module determines the adhered seed regions from the connected regions based on area, perimeter, and convexity defects, and performs segmentation processing on the adhered seed regions to obtain independent single seed contours. The dense population counting module estimates the total number of seeds based on the median area of candidate isolated single seed regions or the pre-stored single seed reference area when seeds are stacked or the multi-anti-adhesion module cannot complete the segmentation. The quality detection module identifies defects in the seeds in the single seed contours, filters empty and shriveled seeds, and identifies moldy, insect-eaten, and broken defective seeds, and counts the number of healthy seeds and the seed setting rate. The data fusion module combines the number of healthy seeds, total weight, and single seed visual area weight to calculate the healthy thousand-seed weight.
[0026] For example, the light-transmitting seed distribution box is made of a transparent rigid material and is placed above the light-emitting side of the backlight panel, forming a seed-containing space inside the box. A non-directional vibration motor is fixedly installed on the side wall or bottom of the light-transmitting seed distribution box and is connected to the box for transmission. After the motor starts, it transmits a non-directional, micro-amplitude excitation force to the box. The driving intensity, single vibration duration, and number of starts and stops of the non-directional vibration motor can be preset or adjusted according to the type, shape, quantity, and current spreading state of the seeds to be tested. Continuous vibration, intermittent vibration, or a combination of both can be used to gradually loosen and disperse the concentrated stacked seeds, allowing them to naturally lie flat under gravity. After vibration stops, an image is captured by the camera module after a preset stabilization time to reduce motion blur caused by residual vibration of the box. For non-circular grains such as rice and wheat, the decision to continue vibration can be determined based on the degree of stacking, single-layer coverage, or uniform distribution in the image; the non-directional vibration motor is turned off after the condition of no obvious stacking and single-layer flat spreading is met. Figure 6 As shown, before vibration attitude adjustment (i.e. Figure 6 (Left image) Seeds tend to cluster or aggregate locally, and after vibration and orientation adjustment (i.e. Figure 6 (See the right image) The seeds are clearly dispersed in the light-transmitting seed box and tend to be evenly spread in a single layer, thus unifying the seed posture during image acquisition and reducing the error in subsequent phenotypic parameter extraction.
[0027] The calibration card is embedded in the bottom inner surface of the light-transmitting seed box, or it can be directly laid on the supporting surface of the backlight emitting plate. The calibration card has a regular array pattern with known physical dimensions. In this embodiment, a square array with a side length of 10mm is used. The dimensional accuracy of the array pattern is pre-calibrated as a physical reference for pixel conversion. Compared with manually placed calibration cards, the embedded calibration card has a fixed position and will not have deviations in placement angle or position due to each measurement, which can reduce the source of calibration error from the hardware level.
[0028] The camera module is mounted directly above the light-transmitting seed box via a bracket, with the lens pointing vertically towards the inside of the seed box. When the backlight panel is activated, light passes through the seed box and calibration card, creating a high-contrast backlit image on the camera module's imaging surface. The camera module can capture images of the calibration card without seeds and images of the seeds after they have been placed in it; both types of images are transmitted to a computer for further processing.
[0029] The electronic balance, a precision electronic balance, is placed next to the light-transmitting seed box to collect all the seeds to be tested poured out of the box and weigh them to obtain the total weight of the seeds. The balance establishes a signal connection with the computer via a serial port, and the weighing data can be directly uploaded to the computer without manual entry.
[0030] The computer, serving as the processing core of the device, is connected to the camera module and the electronic balance signal. Internally, it runs SeedAnalyzer, a test analysis software that integrates dynamic calibration, image analysis, multiple anti-adhesion, dense population counting, quality detection, and data fusion modules. These modules work together to complete the entire processing flow from image acquisition to result output. The software interface is as follows: Figure 2 As shown.
[0031] The dynamic calibration module is responsible for calibrating the conversion between pixels and physical dimensions. It receives the calibration card image from the camera module, separates the array pattern in the image using a masking method, extracts the corner coordinates of all square patterns in the array, calculates the pixel spacing between adjacent corners in the horizontal and vertical directions, and, combined with the known physical side length of 10mm, obtains the horizontal and vertical length pixel equivalents. Simultaneously, it calculates the area equivalent per unit pixel. This calibration process is performed automatically before each measurement, adaptively compensating for errors caused by minor adjustments to the camera module height and slight lens distortion, ensuring the accuracy of subsequent seed size conversions. After calibration, the pixel conversion relationship is temporarily locked for use in the size conversion of all seed phenotypic parameters during this measurement.
[0032] The image analysis module is responsible for preprocessing and connected component extraction of the seed image. The module receives the seed backlight image captured by the camera module, first converts it to grayscale, and then performs background correction using an unlit backlight image or the result of large-scale Gaussian filtering. Next, it uses an adaptive threshold binarization algorithm to generate a binary image to reduce the impact of backlight source edge attenuation, local shadows, and uneven brightness on contour extraction. After binarization, the module extracts all connected regions in the image and calculates the area, perimeter, convex hull area, roundness, and convexity defect parameters of each connected region, serving as the basis for subsequent adhesion determination.
[0033] A multi-layer anti-adhesion module is used to separate mutually contacting, adhered seeds. The module incorporates a dual-constraint judgment unit and an improved concave point segmentation unit. The improvements of this application compared to conventional concave point segmentation algorithms are as follows: First, adhesion judgment does not rely solely on area or perimeter, but combines area, perimeter, convex hull area difference, and convexity defect depth to reduce the probability of large, normal seeds being misjudged as adhered. Second, depth, opening angle, and local curvature screening conditions are set for concave points in convex hull defects to filter out false concave points caused by edge burrs and threshold noise. Third, background extension lines, defect depth matching, and post-segmentation sub-region morphology verification are added when pairing candidate concave points to avoid invalid cuts along the seed's outer edge or long axis. Fourth, the segmentation results are iteratively verified until the sub-region meets the single-seed morphology threshold or no valid concave point pairs exist. The dual-constraint judgment unit pre-stores single-seed area and perimeter thresholds for the corresponding crop variety, and these thresholds can be manually adjusted in the software interface according to the crop variety being tested. The judgment unit compares each extracted connected region one by one. Only when the area of the connected region exceeds the upper limit of the area threshold of a single seed, the perimeter exceeds the upper limit of the perimeter threshold of a single seed, and the depth of the convex defect reaches the set threshold, is the connected region judged as an adhered seed region, thereby reducing the probability of misjudgment.
[0034] Regions identified as adhered are sent to an improved concave point segmentation unit for segmentation. The segmentation unit first smooths the contour of the binary mask of the adhered region, generating a convex hull contour and calculating convex hull defects. For the concave locations corresponding to the convex hull defects, features such as concave depth, defect opening angle, and local curvature are extracted, and candidate concave points are retained based on preset screening conditions. These preset screening conditions can be determined according to crop variety, sample annotation results, or software-preset templates. Candidate concave points are traversed for pairing and evaluation. A comprehensive judgment is made based on the length of the candidate segmentation line, background crossing relationship, the morphology of the sub-region after segmentation, and the degree of matching between the concave points on both sides. Concave point pairs that meet the constraints are selected as cutting points. After segmenting the original connected region along the segmentation line formed by connecting the cutting points, the morphological parameters of the sub-region are recalculated. If the sub-region still meets the adhesion criteria, iterative segmentation continues; if the segmentation result does not meet the single-grain morphological constraints, the segmentation is canceled. This segmentation method can effectively handle adhered seeds of different forms, such as end-to-end connection and side-by-side contact, avoiding the over-segmentation and under-segmentation problems that are prone to occur in traditional watershed algorithms.
[0035] The dense population counting module serves as a fallback counting method, activated when seeds exhibit severe dense stacking, multiple anti-adhesion modules fail to effectively segment them, or segmentation calculations are excessively time-consuming. The module prioritizes selecting candidate isolated single-seed regions from all connected regions whose area, perimeter, aspect ratio, and solidity fall within the range of a single seed. These candidate isolated single-seed regions are sorted by area, and a representative area is used as the isolated single-seed reference area. When the number of candidate isolated single-seed regions is insufficient, the module retrieves the pre-stored single-seed reference area for the current crop variety or the representative single-seed area value obtained from the most recent effective segmentation. It iterates through all connected regions, accumulating the seed count based on the multiple relationship between the connected region area and the single-seed reference area (i.e., isolated single-seed reference area, pre-stored single-seed reference area, or representative single-seed area value), ultimately obtaining the total seed count. This counting method eliminates the need for complex contour segmentation and iterative calculations, enabling sub-second-level ultra-dense population counting and ensuring the device can still output counting results normally under extreme operating conditions.
[0036] The quality inspection module is used to identify seed quality defects. The module includes an empty / shriveled seed identification unit and a lightweight convolutional neural network classification unit. The empty / shriveled seed identification unit preferably uses an end-notch feature discrimination model, rather than relying solely on a deep network. This unit performs principal component analysis on a binary mask of a single seed to obtain the long axis direction and rotates the ROI (region of interest) to a horizontal plane. End windows are extracted at both ends of the long axis, and features such as abrupt changes in end contour curvature, notch depth, notch width, notch area ratio, convex hull solidity, and end grayscale uniformity are extracted to form an empty / shriveled seed discrimination vector. The discrimination model outputs an empty / shriveled seed discrimination score based on the discrimination vector. When the score or key notch features meet preset conditions, the seed is classified as an empty / shriveled seed. These preset conditions can be determined by manually labeled samples and saved separately for each crop variety.
[0037] The lightweight convolutional neural network classification unit preferably adopts SeedQC-Net (Seed Quality Detection Network). SeedQC-Net first performs pose normalization preprocessing on individual seed ROIs, including major axis extraction and rotation correction; then, the ROI is normalized to a 48×48×3 input sample. The main body of the network consists of multiple DSConv (Depthwise Separable Convolution) convolutional modules. Each DSConv module sequentially includes an input feature map, a 3×3 channel-wise convolution, batch normalization, a ReLU6 (Rectified Linear Unit 6) activation function, and an output feature map, used to extract the texture, color, and morphological features of the seed surface. The convolutional features output by the DSConv modules are compressed by a global average pooling layer (GAP) and then input into a fully connected layer (FC). A Softmax classifier then outputs four probabilities: healthy, moldy, insect-damaged, and broken. When the highest class probability is lower than a preset confidence threshold, the sample is marked as requiring manual review. Its network structure is as follows: Figure 7 As shown.
[0038] The training process of the lightweight convolutional neural network classification unit includes: collecting images of grain samples from different batches, varieties, and defect types; manually labeling the samples used for SeedQC-Net training with four categories: healthy, moldy, insect-damaged, and broken; and independently labeling empty and shriveled grains for threshold determination in the end-notch feature discrimination model. Samples are grouped by batch or variety to form training, validation, and test sets; background zeroing, size normalization, color normalization, and standard image enhancement are performed on the training samples; a classification loss function and an adaptive optimizer are used during training, and the comprehensive classification index of the validation set is used as the basis for model saving. During inference, if the highest class probability is lower than a preset confidence threshold, the seed is marked as a sample requiring manual review. The confidence threshold can be determined based on the classification accuracy of the validation set and the workload of manual review.
[0039] The data fusion module receives the number of healthy seeds, defect categories, and calibrated area of each seed from the quality inspection module, while simultaneously reading the total seed weight uploaded by the electronic balance. The module outputs the total thousand-seed weight and the area-corrected estimated healthy thousand-seed weight. The total thousand-seed weight is calculated based on the total weight and total number of seeds, while the area-corrected estimated healthy thousand-seed weight is estimated based on the number of healthy seeds, the total weight, and the visual area weight of each healthy seed. The area-weighted estimated healthy thousand-seed weight is suitable for scenarios where the thickness and density differences of seeds in the same batch are small, and the visual area can approximately reflect the weight ratio. When the user does not enable area weighting or cannot obtain the area of all individual seeds in dense estimation mode, the healthy thousand-seed weight can degenerate into a direct estimate based on the number of healthy seeds, and this estimate is marked in the exported results. In addition to the thousand-seed weight, the data fusion module can also combine pixel equivalents to calculate phenotypic parameters such as seed length, seed width, and area for each seed, and statistically analyze the average parameter values of the batch of seeds. The data is as follows: Figure 3 As shown.
[0040] The output module can export phenotypic parameters, quality inspection statistics, classification confidence levels, and healthy thousand-seed weight of individual seeds as CSV (comma-separated) or Excel files. It can also save result files such as binarized images, segmentation marker images, defect marker visualization images, and low-confidence sample images requiring manual verification. It supports the summary and statistical analysis of batch measurement data, including segmentation marker images such as... Figure 4 As shown.
[0041] like Figure 5 As shown in the embodiments of this application, a grain seed evaluation method based on vibration seed dispersal and anti-adhesion algorithms is also provided. The method includes the following steps: A calibration card with a regular array pattern of known physical dimensions is placed on the bearing surface of the backlight emitting plate. The image of the calibration card is acquired, the array pattern in the image is extracted, and the length pixel equivalent and area pixel equivalent are calculated to complete the dynamic pixel calibration. The seeds to be tested are poured into a light-transmitting seed box placed above the light-emitting side of the backlight panel, and a non-directional vibration motor is driven to generate vibration, so that the seeds are laid out in a single layer and in a uniform flat position. Acquire seed images, perform grayscale conversion, background correction and binarization on the images and extract connected regions, and determine the adhered seed regions by joint constraints of area, perimeter and convexity defects; An improved concave point matching method is used to segment the region of adhered seeds to obtain the outline of an independent single seed. When seeds are stacked or segmentation fails, candidate isolated single seed regions are selected from the connected regions and their median area is extracted as the reference area of the isolated single seed. If there are not enough candidate isolated single seed regions, the pre-stored single seed reference area is called and the total number of seeds is estimated by accumulating the area multiple intervals. Quality inspection is performed on individual seeds. Empty and shriveled seeds are identified based on end notch features, and defective seeds such as moldy, insect-eaten, and broken seeds are identified based on lightweight convolutional neural network classification units. The number of valid healthy seeds is counted. The total weight of all seeds is weighed, and the weight of healthy thousand seeds is calculated by combining the number of healthy seeds and the visual area weight of each seed.
[0042] Specifically, the usage process of the device proposed in this application is as follows: The first step is hardware initialization and dynamic pixel calibration. The calibration card is embedded in the bottom of the light-transmitting seed box, and the backlight is turned on. The seed analysis software on the computer is started, and the serial connections of the computer, camera module, and electronic balance are completed sequentially. The device connection status is displayed on the software interface. The calibration command is executed, and the camera module acquires the current image of the calibration card and transmits it to the computer. The dynamic calibration module separates the square array pattern in the image using a mask method, extracts the coordinates of all corner points, calculates the horizontal and vertical length pixel equivalents and area pixel equivalents, establishes the conversion relationship between image pixels and actual physical dimensions, and completes pixel calibration. After calibration, the software interface displays the current conversion ratio value, and the conversion relationship is locked for this measurement.
[0043] The second step involves vibration adjustment of the seed distribution box. The seeds to be tested are poured into the seed distribution box, and the non-directional vibration motor is activated. Non-directional micro-vibration reduces static friction and jamming between seeds. The drive intensity, duration of each vibration cycle, and number of starts and stops are set or adjusted according to the type, shape, and quantity of the seeds. Continuous vibration or multiple short vibrations can be used to gradually loosen and disperse the stacked seeds, allowing them to lie flat naturally under gravity. After each vibration cycle, the vibration is paused to assess the degree of seed stacking, single-layer coverage, and uniformity of distribution. The non-directional vibration motor is turned off when the condition of no obvious stacking and a flat single layer is met. After the non-directional vibration motor stops, the seed distribution box is allowed to stabilize before image acquisition to avoid image blurring caused by residual vibration. The seed distribution before and after vibration adjustment is shown in the figure. Figure 6 As shown.
[0044] The third step is image acquisition and adhesion determination. With the backlight panel on, click the "Photo Analysis" command in the software, and the camera module acquires the current seed image. The image analysis module performs grayscale conversion, background correction, and adaptive threshold binarization on the image, extracting all connected regions and calculating the area, perimeter, convex hull area, roundness, and convexity defect of each connected region. The dual-constraint determination unit calls the pre-stored single-grain area and perimeter thresholds to determine each connected region, filtering out adhered seed regions that simultaneously exceed the area and perimeter thresholds and possess valid convexity defects.
[0045] Step 4: Adhesion Segmentation and Dense Counting. For regions identified as adhered, the improved concave point matching method is preferentially used for segmentation to obtain independent single-seed outlines. After segmentation, all single-seed outlines are used for accurate counting and subsequent phenotypic parameter extraction. If a large connected region is detected in the image, or the number of concave point segmentation iterations or the time consumed exceeds the preset limit, it is determined to be a heavily densely stacked condition, and the area estimation mode is automatically switched at this time. The trigger threshold for large connected regions can be preset or adjusted according to the single-seed area distribution of the crop variety. The area estimation mode preferentially uses the representative area of the candidate isolated single-seed region as the isolated single-seed reference area; when the number of candidates is insufficient, the pre-stored single-seed reference area of the current crop variety or the representative value of the single-seed area obtained from the previous batch of effective segmentation is called, and the total number of seeds is estimated by accumulating the connected regions relative to the single-seed reference area. The two counting modes can be switched automatically, or the operator can manually select to enable the area estimation method in the software interface.
[0046] Step 5: Quality Inspection and Data Fusion. The segmented individual seeds are fed into the quality inspection module. The empty / shriveled seed identification unit uses an end-notch feature discrimination model to screen for empty / shriveled seeds and calculates the seed setting rate of the batch. A lightweight convolutional neural network classification unit classifies the individual seed images, marking moldy, insect-damaged, and broken seeds, and counting the number of valid healthy seeds and low-confidence samples requiring verification. After visual analysis, all seeds in the translucent seed box are poured into the weighing pan of an electronic balance. Once the balance reading stabilizes, the weighing command is clicked on the software interface, and the computer reads the total weight data from the balance via a serial port. The data fusion module combines the number of healthy seeds, total weight, and individual seed visual area weights to calculate the healthy thousand-seed weight, and simultaneously calculates the average seed length, average seed width, average area, and other phenotypic parameters of the batch.
[0047] Step 6: Result Output and Storage. After confirming that the total number of particles, phenotypic parameters, thousand-particle weight, and other data displayed on the software interface are correct, perform the save and export operation. The system will export the test data of the current batch as an Excel report, and simultaneously save the binarized image, segmentation visualization image, and defect marker image. The measurement data can be automatically updated to the summary table, supporting continuous measurement and summarization of multiple batches of data.
[0048] The technical details of this application will be further explained below through two specific embodiments.
[0049] Example 1: A complex adhesion segmentation method based on dual constraints and improved concave point matching.
[0050] This embodiment provides a high-precision segmentation method for seeds that remain connected end-to-end or side-by-side after vibration and orientation adjustment, overcoming the oversegmentation defect of traditional watershed algorithms. The specific process is as follows: For each connected region in the binarized image, calculate its area S, perimeter L, convex hull area H, solidity Sol=S / H, and convexity defect depth d. Based on the crop variety to be tested, pre-set thresholds for the area, perimeter, and convexity defect depth of a normal single seed. If the S and L of a connected region simultaneously exceed the upper limit threshold for a single seed, and at least one convexity defect depth exceeds the set threshold, it is determined to be an adhered region and sent to the segmentation branch.
[0051] A convex hull is constructed on the outer contour of the adhesion region to generate a convex hull contour image. The difference between the convex hull contour image and the original contour image is calculated to obtain a convex hull defect image, with the convex hull defect corresponding to the depression position between the adhesion seeds. At each defect position, an initial depression point is determined based on the geometric relationship between the convex hull and the original contour. Subsequently, the initial depression points are filtered, retaining only candidate depression points that meet preset defect depth, defect opening angle, and local curvature conditions to exclude false depressions formed by binarized noise.
[0052] All candidate concave points are traversed and paired, with the following mandatory constraints applied: First, the line connecting the two points must be extended to both ends, and the extension line must first pass through the background region to ensure that the line cuts along the concave position of the adhesion; Second, the concavity degree of the two concave points should meet the preset matching conditions to avoid false pairings with excessive differences; Third, both sub-regions after being cut along the candidate segmentation line should fall within the allowable range of area, aspect ratio, or solidity of a single seed. Candidate pairings that meet the constraints are comprehensively evaluated, and the set with the best evaluation result is selected as the final segmentation path. After cutting the original connected region along the segmentation line, adhesion judgment is re-performed on the sub-regions, and iterative segmentation is continued if necessary.
[0053] This method has a good segmentation effect on tandem, side-by-side, and mixed-type adhered seeds. The segmented individual seeds have complete outline edges and can be directly used for subsequent phenotypic parameter extraction and quality detection.
[0054] Example 2: A rapid quality assessment method based on median area estimation, end gap discrimination, and lightweight convolutional neural networks.
[0055] This embodiment provides a rapid counting solution for severe stacking caused by excessive seed dropping, while also enabling batch screening of seed quality defects.
[0056] The rapid counting step involves extracting the pixel area, perimeter, aspect ratio, and solidity of all connected components in the entire seed image. Candidate isolated single-seed regions falling within the single-seed range are prioritized, and a representative value of the candidate region area is used as the reference area for isolated single seeds. If there are insufficient candidate isolated single-seed regions, the pre-stored reference area for the current crop variety or the representative area of a single seed obtained from the previous batch of effective segmentation is used. All connected components are traversed, and the seed count is accumulated according to the multiple relationship between the connected component area and the reference area. This method eliminates the need for contour segmentation and iterative calculations, serving as a second-level fallback counting mechanism when conventional segmentation fails.
[0057] In the quality inspection stage, empty and shriveled seeds are first identified by an end-notch feature discrimination model. This model performs principal component analysis and rotation correction on the binary mask of each seed, extracting features such as notch depth, notch width, notch area ratio, convex hull solidity, and end gray-scale uniformity from the end windows at both ends of the long axis, and outputs the empty and shriveled seed results according to the discrimination conditions corresponding to the crop variety. Subsequently, the ROI regions of non-empty and shriveled seeds or those requiring further classification are input into a pre-trained lightweight convolutional neural network, SeedQC-Net. SeedQC-Net first performs pose normalization preprocessing and size normalization, and then extracts features through DSConv convolutional modules. Each DSConv convolutional module includes an input feature map, a 3×3 channel-wise convolution, batch normalization, a ReLU6 activation function, and an output feature map. After the network features are processed by a global average pooling layer (GAP), a fully connected layer (FC), and a softmax classifier, the output outputs the classification probabilities of four categories: healthy, moldy, insect-damaged, and broken. The overall structure of SeedQC-Net and the internal structure of the DSConv convolutional module are shown below. Figure 7 As shown.
[0058] The model training process is as follows: images of grains from different batches, varieties, and defect types are collected. SeedQC-Net training samples are manually labeled with four categories: healthy, moldy, insect-damaged, and broken. Empty / shriveled grains are also independently labeled to train or calibrate the end-notch feature discrimination model. Labeled samples are grouped by batch or variety to form training, validation, and test sets, avoiding the same batch of samples appearing in both sets. Before training, the ROI undergoes background zeroing, size normalization, color normalization, and standard image enhancement. During training, a classification loss function and an adaptive optimizer are used, and the validation set's comprehensive classification index is used as the basis for model saving. Training is stopped early if the validation set index does not improve after several consecutive rounds. The criteria for judging empty / shriveled grains are determined by manually labeled samples on the validation set. Combining the counting and classification results, the system can output parameters such as the total number of seeds in a batch, the proportion of diseased seeds, the proportion of empty / shriveled seeds, and the seed setting rate. It also combines weighing data, the number of healthy seeds, and the visual area weight of a single seed to calculate an area-corrected estimate of the healthy thousand-grain weight, expanding the dimensions and application scenarios of seed evaluation.
[0059] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.
[0060] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A grain seed testing device based on vibration seed dispersal and anti-adhesion algorithms, characterized in that, Includes a backlit light-emitting panel, a light-transmitting seed box, a non-directional vibration motor, a calibration card, a camera module, an electronic balance, and a computer; The light-transmitting seed box is placed above the light-emitting side of the backlight-emitting plate. The non-directional vibration motor is located on the side wall or bottom of the light-transmitting seed box and is connected to it for transmission, enabling the light-transmitting seed box to generate non-directional vibration. The driving intensity and vibration duration of the non-directional vibration motor are adjusted according to the type, quantity, and spreading state of the seeds to be tested, so that the seeds gradually loosen their stacking under the action of vibration and gravity, forming a single layer that tends to lie flat. The calibration card is located at the bottom of the light-transmitting seed box or on the support of the backlight-emitting plate. On the cross-section, the calibration card has a regular array pattern of known physical dimensions; the camera module is mounted directly above the light-transmitting seed box, with the acquisition direction facing the inside of the light-transmitting seed box, and is used to acquire seed images and calibration card images under backlight illumination; the electronic balance is used to weigh the total weight of the seeds to be tested; the computer is connected to the camera module and the electronic balance respectively, and the computer integrates a dynamic calibration module, an image analysis module, a multiple anti-adhesion module, a dense population counting module, a quality detection module, and a data fusion module; The dynamic calibration module is used to extract the array pattern from the calibration card image, calculate the length pixel equivalent and area pixel equivalent, establish the conversion relationship between image pixels and real physical size, and complete pixel calibration. The conversion relationship is used for the phenotypic parameter size conversion of the seed image. The image analysis module is used to perform grayscale, background correction, and binarization processing on the seed image and extract connected regions in the image. The multiple anti-adhesion module is used to determine the adhered seed regions from the connected regions based on area, perimeter, and convexity defects, and perform segmentation processing on the adhered seed regions to obtain independent single seed contours. The dense population counting module is used to estimate the total number of seeds based on the median area of candidate isolated single seed regions or the pre-stored single seed reference area when seeds are stacked or the multiple anti-adhesion module cannot complete the segmentation. The quality detection module is used to identify defects in the seeds within the single seed contour, filtering out empty and shriveled seeds and identifying moldy, insect-damaged, and broken seeds, and to count the number of healthy seeds and the seed setting rate. The data fusion module is used to combine the number of healthy seeds, the total weight, and the visual area weight of a single seed to calculate the weight of 1,000 healthy seeds. The quality detection module includes an empty and shriveled seed identification unit and a lightweight convolutional neural network classification unit. The empty and shriveled seed identification unit calculates an empty and shriveled discrimination score based on the long axis direction, end curvature abrupt change, end notch depth, notch width, and notch area ratio of the single seed contour, which is used to filter out empty and shriveled seeds. The lightweight convolutional neural network classification unit receives the image of the seeds in the segmented single seed contour and outputs the classification results of the seeds as healthy, moldy, insect-damaged, and broken using SeedQC-Net.
2. The grain seed testing device based on vibration seed dispersal and anti-adhesion algorithm according to claim 1, characterized in that, The dynamic calibration module separates the array pattern in the calibration card image using a mask method, then extracts all corner points of the array pattern, and calculates the horizontal and vertical length pixel equivalents of the calibration card image, as well as the area equivalent per unit pixel.
3. The grain seed testing device based on vibration seed dispersal and anti-adhesion algorithm according to claim 1, characterized in that, The multi-layer anti-adhesion module has a built-in dual constraint determination unit. The dual constraint determination unit pre-stores the single seed area threshold and perimeter threshold for the corresponding crop variety, and performs verification based on the convexity defect depth of the candidate connected region. When the area of the connected region exceeds the single seed area threshold, the perimeter exceeds the single seed perimeter threshold, and there is a convex defect reaching a set depth, the current connected region is determined to be an adhered seed region.
4. The grain seed testing device based on vibration seed dispersal and anti-adhesion algorithm according to claim 3, characterized in that, The multi-anti-adhesion module uses an improved concave point matching method to segment the adhesion seed region, generates a convex hull profile for the adhesion seed region and calculates convex defects, and filters candidate concave points according to defect depth, defect opening angle and local curvature; the candidate concave points are paired and evaluated, and a segmentation line is generated by combining the length of the candidate segmentation line, background crossing relationship, morphology of the sub-region after cutting and the degree of matching of the concave on both sides, and the separation of adhesion seeds is completed iteratively.
5. The grain seed testing device based on vibration seed dispersal and anti-adhesion algorithm according to claim 1, characterized in that, The dense population counting module filters out candidate isolated single-seed regions whose area, perimeter, aspect ratio, and solidity fall within the range of a single seed from all the connected regions, and takes the median area of the candidate isolated single-seed regions as the reference area of the isolated single seed. When the number of candidate isolated single-seed regions is insufficient, the pre-stored single-seed reference area is invoked; the number of seeds is accumulated according to the area of the connected region and the multiple range of the isolated single-seed reference area or the pre-stored single-seed reference area to complete the estimation of the total number of seeds.
6. The grain seed testing device based on vibration seed dispersal and anti-adhesion algorithm according to claim 1, characterized in that, The SeedQC-Net includes a pose normalization preprocessing unit, DSConv convolutional module groups, a global average pooling layer, a fully connected layer, and a Softmax classifier. Each DSConv convolutional module group includes an input feature map, a 3×3 channel-wise convolution, batch normalization, and ReLU6 activation processing.
7. The grain seed testing device based on vibration seed dispersal and anti-adhesion algorithm according to claim 1, characterized in that, The computer is also connected to a data output module, which is used to export the phenotypic parameters of a single seed, the statistical results of quality detection, and the weight of a thousand healthy seeds. It also saves the binarized image, the segmentation marker image, and the visualization result image.
8. A method for applying the grain seed testing device based on vibration seed dispersal and anti-adhesion algorithm as described in any one of claims 1-7, characterized in that, Includes the following steps: A calibration card with a regular array pattern of known physical size is placed on the bearing surface of the backlight emitting plate. The image of the calibration card is acquired, the array pattern in the image is extracted, and the length pixel equivalent and area pixel equivalent are calculated to complete the dynamic pixel calibration. The seeds to be tested are poured into a light-transmitting seed box placed above the light-emitting side of the backlight emitting plate, and a non-directional vibration motor is driven to generate vibration, so that the seeds are laid out in a single layer and in a uniform flat position. Acquire seed images, perform grayscale conversion, background correction and binarization on the images and extract connected regions, and determine the adhered seed regions by joint constraints of area, perimeter and convexity defects; The region of adhered seeds is segmented using an improved concave point matching method to obtain independent single-seed outlines; When seeds stack or fail to be split, candidate isolated single-seed regions are selected from the connected regions and their median area is extracted as the reference area of isolated single seeds. If the candidate isolated single-seed regions are insufficient, the pre-stored single-seed reference areas are called and the total number of seeds is estimated by accumulating the area multiple intervals. Quality inspection is performed on individual seeds. Empty and shriveled seeds are identified based on end notch features, and defective seeds such as moldy, insect-eaten, and broken seeds are identified based on lightweight convolutional neural network classification units. The number of valid healthy seeds is counted. The total weight of all seeds is weighed, and the weight of healthy thousand seeds is calculated by combining the number of healthy seeds and the visual area weight of each seed.
Citation Information
Patent Citations
Red, green and blue (RGB) image and weight information fusion-based test method and system
CN121877663A
Crop grain intelligent counting and internal quality multidimensional measurement system based on multistage fall discretization and side cloud collaboration
CN122218258A