A kind of method and system for identifying species based on fusion of RGB image and weight information
By simultaneously acquiring RGB images and weight information, and combining deep learning and adaptive occlusion correction, the problem of large counting deviations under conditions of seed adhesion, overlap, or stacking is solved, achieving efficient and accurate multi-parameter seed detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INST OF QUALITY STANDARD & DETECTION TECH YUNNAN ACAD OF AGRI SCI
- Filing Date
- 2026-03-18
- Publication Date
- 2026-06-23
AI Technical Summary
Existing technologies rely solely on image counting in special scenarios such as seed adhesion, overlap, or stacking, leading to large deviations in the derivation of 100-seed weight/1000-seed weight, making it difficult to achieve efficient automation and accuracy in seed detection.
By synchronously acquiring RGB images and weight information, and combining deep learning instance segmentation and occlusion adaptive weight consistency counting correction, the correction and parameter calculation of the seed instance segmentation mask are realized, including single grain weight, hundred-grain weight and thousand-grain weight.
In scenarios involving grain adhesion/overlap/stacking, it significantly improves the robustness and usability of seed evaluation results, enables simultaneous output and correction of multiple parameters, and reduces manual intervention and cumbersome processes.
Smart Images

Figure CN121877663B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of agricultural testing technology, specifically to a method and system for seed testing based on the fusion of RGB images and weight information. Background Technology
[0002] Seed testing refers to the examination of seed-related traits. It is an important part of the DUS (Specificity, Uniformity, and Stability) test and a crucial step for breeders in the selection of new varieties. Traditional seed testing usually requires multiple steps, such as counting, weighing, size measurement, and color identification. The process relies on manual operation, which leads to problems such as low efficiency, high labor intensity, insufficient representativeness, and difficulty in controlling subjective errors.
[0003] In recent years, seed detection technology based on machine vision has developed, but most solutions focus only on image analysis, such as counting or measuring size from images, making it difficult to simultaneously acquire weight information. To obtain weight parameters, the image analysis system and weighing equipment usually need to be operated separately, resulting in data asynchrony and cumbersome processes, making it difficult to achieve simultaneous acquisition and output of multiple parameters such as quantity, weight, size, and color. Furthermore, in practical applications, seed samples often exhibit special conditions such as adhesion, overlap, or stacking. For these special conditions, relying solely on instance segmentation and counting on the image side is prone to missed detections and undercounts, causing systematic deviations in key parameters such as the weight of 100 and 1000 seeds derived from the counting results. Existing technologies often circumvent these problems by requiring manual placement of samples in a single, non-overlapping layer, limiting the feasibility of high-throughput, on-site, or automated production line scenarios.
[0004] Therefore, how to obtain reliable and consistent counting and weight-derived parameters in special scenarios such as grain adhesion / overlap / stacking while ensuring synchronous fusion of images and weights has become a technical problem that automated seed evaluation methods urgently need to solve. Summary of the Invention
[0005] The purpose of this invention is to provide a seed evaluation method based on the fusion of RGB images and weight information, so as to at least solve the problem that the existing technology has large deviations in the derivation of the weight of 100 grains / 1000 grains due to relying solely on image counting in special scenarios such as grain adhesion, overlap or stacking.
[0006] To achieve the above objectives, the first aspect of the present invention provides a method for testing based on the fusion of RGB images and weight information, the method comprising:
[0007] Acquire synchronous RGB image data of the seed sample to be tested and raw weight data time-aligned with the RGB image data, and calculate the net weight based on the preset hull weight.
[0008] The RGB image data is subjected to illumination normalization and background separation processing to obtain a standardized image and a set of candidate seed regions;
[0009] The standardized image is input into the deep learning instance segmentation model, which outputs a set of seed instance segmentation masks and a corresponding set of confidence scores, and calculates an initial count based on the set of confidence scores.
[0010] Based on the net weight, the initial count, and the occlusion metric calculated from the set of seed instance segmentation masks, an occlusion-adaptive weight consistency count correction process is performed to output a correction count and a set of correction instance segmentation masks that correspond one-to-one with the correction count. Based on the correction count, the single-grain weight, the weight of 100 grains, and the weight of 1000 grains are calculated.
[0011] Based on the set of correction instance segmentation masks, morphological and size features and back color features are extracted for each grain instance, and seed evaluation result data including grain quantity, weight parameters, size parameters and color parameters are generated.
[0012] Optionally, the synchronous RGB image data of the seed sample to be tested and the raw weight data time-aligned with the RGB image data are acquired, and the net weight is calculated based on a preset tare weight, including:
[0013] The sensor output value is obtained when the weighing container is empty, and the tare weight data is generated and used as the preset tare weight.
[0014] The sensor output value is obtained when the seed sample and the weighing container are both under load, forming the original weight data, and a weight timestamp is generated for the original weight data.
[0015] The RGB image data of the seed sample under constant illumination conditions is obtained, and an image timestamp is generated for the RGB image data. The original weight data is then peeled based on the preset peel weight to obtain the net weight.
[0016] Optionally, illumination normalization and background separation processing are performed on the RGB image data to obtain a standardized image and a set of candidate seed regions, including:
[0017] Acquire a flat-field corrected image and a dark-field image that match the light source configuration of the shooting box, and perform flat-field normalization processing on the RGB image data based on the flat-field corrected image and the dark-field image to obtain an illumination normalized image;
[0018] A background probability map is generated based on the illumination normalized image, and threshold segmentation is performed on the background probability map to obtain a foreground binary mask;
[0019] A morphological opening operation and hole filling process are performed on the foreground binary mask to obtain a cleaned foreground mask, and the normalized image is obtained by cropping it from the illumination normalized image.
[0020] Connectivity analysis is performed on the purified foreground mask to form a set of candidate seed regions, where each candidate seed region corresponds to a candidate region box in the normalized image.
[0021] Optionally, the standardized image is input into a deep learning instance segmentation model, which outputs a set of seed instance segmentation masks and a corresponding set of confidence scores. An initial count is then calculated based on the confidence score set, including:
[0022] Each candidate region in the candidate seed region set is cropped from the standardized image into a candidate image patch set, and the candidate image patch set is input into the deep learning instance segmentation model to output an instance segmentation probability map set corresponding to each candidate image patch;
[0023] Based on the instance segmentation probability map set, post-processing of instance segmentation is performed on each candidate image block to obtain a candidate instance mask set, and cross-region merging is performed on the candidate instance mask set to form the seed instance segmentation mask set.
[0024] Based on the set of instance segmentation probability maps, calculate a set of confidence levels that correspond one-to-one with the set of seed instance segmentation masks, and calculate an initial count based on the confidence level threshold.
[0025] Optionally, based on the net weight, the initial count, and the occlusion metric calculated from the set of seed instance segmentation masks, an occlusion-adaptive weight consistency count correction process is performed to output a corrected count and a set of corrected instance segmentation masks corresponding one-to-one with the corrected count, including:
[0026] The occlusion metric is calculated based on the set of seed instance segmentation masks; wherein the occlusion metric is used to characterize the uncertainty in instance segmentation caused by seed adhesion, overlap or stacking;
[0027] When the occlusion metric is not less than the occlusion threshold, the morphological size features and color features of visible grains are extracted based on the grain instance segmentation mask set, and the morphological size features and color features are input into the single grain quality estimation model to obtain the set of quality estimates of visible grains, and then the single grain quality statistical parameters are calculated.
[0028] Based on the net weight, the initial count, and the single-grain mass statistical parameters, a count correction objective function is constructed and solved to obtain the corrected count. The expression is:
[0029] ;
[0030] in: Indicates the correction count; Represents the count variable to be solved; Represents the set of positive integers; Indicates net weight; This represents the average weight of a single grain; This indicates the standard deviation of noise in weight measurement; This represents the image counting uncertainty parameter; Indicates the balance weighting coefficient; Indicates the initial count;
[0031] Perform mask splitting and reconstruction processing based on weight consistency constraints on the adhesion masks that satisfy the adhesion criterion in the set of seed instance segmentation masks to obtain a set of corrected instance segmentation masks that correspond one-to-one with the correction count.
[0032] The weight consistency residual is calculated based on the net weight and the correction count, and a re-acquisition instruction is output when the weight consistency residual is not less than the residual threshold, so as to trigger the synchronous re-acquisition of the RGB image data and the original weight data.
[0033] Optionally, calculating the weight of a single grain, the weight of 100 grains, and the weight of 1000 grains based on the corrected count includes:
[0034] The average weight of a single grain is calculated based on the net weight and the correction count, expressed as follows:
[0035] ;
[0036] The weight of 100 and 1000 grains is calculated based on the average weight of a single grain, using the following expression:
[0037] ;
[0038] ;
[0039] In the formula, Indicates the average weight of a single grain; Indicates net weight; Indicates the correction count; Indicates the weight of 100 grains; Indicates the weight of a thousand grains.
[0040] Optionally, morphological and size features are extracted, including:
[0041] For each seed instance mask in the set of correction instance segmentation masks, calculate the minimum outer circle radius and the maximum inscribed circle radius of the seed instance mask;
[0042] The seed length is calculated based on the minimum circumscribed circle radius, and the seed width is calculated based on the maximum inscribed circle radius.
[0043] Optionally, the backside color features are extracted, including:
[0044] In the standardized image, the pixel set of each seed instance is extracted based on the mask of each seed instance, and color space transformation is performed on the pixel set to obtain the color vector of the seed instance;
[0045] Construct a set of standard color vectors and calculate the color difference value between each seed instance and each standard color vector based on the color difference metric;
[0046] The color category of the seed instance is calculated based on the color difference value.
[0047] Optionally, the test result data, including seed quantity, weight parameters, size parameters, and color parameters, is generated, including:
[0048] The calibration count, net weight, weight per 100 grains, weight per 1000 grains, dimensional characteristics, and color category are structured and encapsulated to form a test result data package;
[0049] Generate a data index identifier corresponding to the RGB image data for the test result data packet, and associate and store the data index identifier with the weight timestamp and the image timestamp;
[0050] The test result data packet is output to the display terminal or exported as an electronic report file to complete the data output of the test results.
[0051] A second aspect of the present invention provides a testing system based on the fusion of RGB images and weight information, the system being used to execute the above-described testing method based on the fusion of RGB images and weight information, the system comprising:
[0052] The acquisition unit is used to acquire synchronous RGB image data of the seed sample to be tested and raw weight data that is time-aligned with the RGB image data, and calculate the net weight based on the preset tare weight.
[0053] The processing unit is used to perform illumination normalization and background separation processing on the RGB image data to obtain a standardized image and a set of candidate seed regions;
[0054] The input unit is used to input the standardized image into the deep learning instance segmentation model, output the seed instance segmentation mask set and the corresponding confidence set, and calculate the initial count based on the confidence set;
[0055] The calculation unit is used to perform occlusion adaptive weight consistency count correction processing based on the net weight, the initial count and the occlusion metric value calculated by the set of seed instance segmentation masks, so as to output the correction count and the set of correction instance segmentation masks corresponding one-to-one with the correction count, and calculate the single grain weight, hundred grain weight and thousand grain weight based on the correction count.
[0056] The generation unit is used to extract morphological and size features and back color features of each seed instance based on the set of correction instance segmentation masks, and generate seed evaluation result data including seed quantity, weight parameters, size parameters and color parameters.
[0057] The beneficial effects of this invention are as follows: Through the above technical solution, this invention proposes a seed evaluation method and system based on the fusion of RGB images and weight information. By acquiring seed image information and weight information at the same acquisition time, it outputs multi-dimensional parameters such as quantity, single seed weight, weight of 100 seeds, weight of 1000 seeds, size, and color at once. At the same time, in special scenarios of seed adhesion / overlap / stacking, this invention introduces an improved algorithm process of occlusion adaptive weight consistency counting correction and mask splitting reconstruction. This process does not need to be enabled in ordinary scenarios, but in special scenarios, it can use weight information to constrain and correct image counting, and then use the correction result to reverse the mask structure reconstruction, thereby significantly improving the robustness and usability of the seed evaluation results.
[0058] Other features and advantages of the embodiments of the present invention will be described in detail in the following detailed description section. Attached Figure Description
[0059] The accompanying drawings are provided to further illustrate embodiments of the present invention and form part of the specification. They are used together with the following detailed description to explain the embodiments of the present invention, but do not constitute a limitation thereof. In the drawings:
[0060] Figure 1 This is a flowchart of the steps of a test method based on the fusion of RGB image and weight information provided by one embodiment of the present invention.
[0061] Figure 2 This is a system structure diagram of a test system based on the fusion of RGB images and weight information provided in one embodiment of the present invention. Detailed Implementation
[0062] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.
[0063] In this embodiment of the invention, to achieve integrated automatic assessment that simultaneously acquires and fuses images and weight data, the invention can be implemented as a multi-parameter automatic detection device. Specifically, in one executable implementation, the device includes at least: a closed imaging enclosure, an image acquisition module, a weight sensing module, and a data processing and control module.
[0064] Specifically, the enclosed imaging chamber provides a stable and controllable optical acquisition environment. The chamber houses the image acquisition module and lighting unit to ensure uniform lighting during acquisition and reduce interference from ambient light. The chamber can employ a light-shielding structure and inner wall matte treatment to minimize the impact of stray light and reflections on grain edge and color discrimination.
[0065] Furthermore, in one feasible implementation, a fixed mounting position can be set inside the housing to stably arrange the camera and lighting unit, so that the camera optical axis and the object carrying area form a fixed geometric relationship, thereby ensuring the consistency of acquisitions at different batches and times.
[0066] It should be noted that the image acquisition module can consist of an RGB camera and a matching constant light source. Specifically, the RGB camera is used to acquire clear images of the grains under standard lighting conditions; the illumination unit is used to provide stable illumination and a surface light source effect that is as uniform as possible.
[0067] Furthermore, in one feasible implementation, the illumination unit can employ constant current drive to suppress brightness fluctuations and can be configured with a diffusion structure to reduce high-spot brightness caused by reflections from the vessel. Without limiting the specific implementation, the illumination unit can also employ a combination of ring light, strip light, or top-diffuse light, as long as it meets the requirements for illumination stability for image recognition, morphology measurement, and color analysis. It should be noted that the spectral characteristics, color temperature, and brightness settings of the illumination unit are not limited to a single fixed parameter, but their purpose is to provide a repeatable and comparable data acquisition basis for the color analysis of the back of the grain.
[0068] In this embodiment of the invention, the weight sensing module is used to acquire the weight of the grain sample at the same time as image acquisition, so as to support the calculation of weight-derived parameters. Specifically, in one executable implementation, the weight sensing module is composed of a high-precision gravity sensor with an accuracy of 0.01 grams and a measuring range of up to 3 kilograms, to meet the weight range of common test sample varieties.
[0069] Furthermore, in one feasible implementation, a detachable platform is provided at the bottom of the chamber, with a gravity sensor installed below it. The operator simply places a container holding the sample seeds onto the platform to complete the integrated weighing and imaging setup. It should be noted that the detachable platform structure is not limited to a specific mechanical connection method; in practical applications, snap-fit, sliding rail, or magnetic structures can be used, as long as they ensure stability and ease of cleaning and maintenance.
[0070] In essence, the data processing and control module coordinates the collaborative work of various hardware components and executes key algorithms. Specifically, in one executable implementation, both the RGB camera and the gravity sensor are connected to the control board (also known as the data processing and control module) via data cables. The control board has built-in control software or algorithm programs. During operation, after the operator places the container on the stage, the control board simultaneously issues a data acquisition command: the gravity sensor measures the total weight and uploads it, while the RGB camera takes a picture under stable lighting and uploads it, thus achieving simultaneous acquisition of the weight and image of the same sample. It should be noted that the implementation of the control board is not limited to a microcontroller or embedded board; in another executable implementation, it can also be an industrial computer or an edge computing box, as long as it can perform synchronous triggering, data caching, algorithm inference, and result output.
[0071] Furthermore, in practical applications, to enhance the feasibility of high-throughput or field scenarios, the device can be optionally equipped with a display and interaction unit to display counting, weight, size, and color results, and prompt for re-acquisition or guide sample adjustment when necessary. It can also be optionally equipped with a vibration spreading or mechanical sample separation structure coupled to the stage to automatically trigger sample rearrangement when severe adhesion and stacking are detected, thereby improving the controllability of acquisition in special scenarios. It should be noted that the above-mentioned additional mechanisms are not necessary limitations on the implementation of this invention; they are merely optional enhancements to meet the differentiated automation requirements of different application scenarios.
[0072] like Figure 1 As shown, this invention provides a test method based on the fusion of RGB images and weight information, the method comprising:
[0073] S10: Acquire the synchronous RGB image data of the seed sample to be tested and the original weight data that is time-aligned with the RGB image data, and calculate the net weight based on the preset tare weight.
[0074] Specifically, the sensor output value when the weighing container is in an unloaded state is obtained to form tare weight data and serve as the preset tare weight; the sensor output value when the seed sample and the weighing container are both under load is obtained to form the original weight data, and a weight timestamp is generated for the original weight data; the RGB image data of the seed sample under constant illumination conditions is obtained, and an image timestamp is generated for the RGB image data; the original weight data is tare processed based on the preset tare weight to obtain the net weight.
[0075] In this embodiment of the invention, to ensure complete consistency between the counting results and the weight derivation parameters at the sample level, this step introduces data constraints for synchronous acquisition and time alignment. Specifically, in one executable implementation, relying on the integrated arrangement of the aforementioned enclosed imaging box, RGB camera, lighting unit, stage, and gravity sensor, after the operator places the container holding the grain sample on the stage, the data processing and control module executes a synchronous triggering process: on the one hand, it reads the output of the gravity sensor to form raw weight data, and on the other hand, it drives the RGB camera to complete the shooting to form RGB image data, and generates image timestamps and weight timestamps respectively.
[0076] In practical applications, timestamps can be millisecond-level time identifiers under the same system clock, or logical time identifiers that increment according to the acquisition sequence number, as long as they can express the correspondence between the same moment or approximately the same moment. Furthermore, in one executable implementation, the data processing and control module performs alignment checks on the image timestamp and weight timestamp to ensure they satisfy the following synchronization constraints:
[0077] ;
[0078] in, Indicates weight timestamp. Represents the image timestamp. This indicates the allowed time window threshold for synchronous data acquisition;
[0079] This associates weight data and image data as input pairs for the same detection sample. It should be noted that the time alignment allowable window threshold is not limited to a fixed value; in practical applications, it can be set based on the sensor sampling frequency, camera exposure time, and caching strategy to ensure data consistency for the same sample.
[0080] As is easily understood, the tare (zeroing) process in weight acquisition is used to eliminate the influence of container weight on net weight calculation. Specifically, in one executable implementation, the system first performs a tare process on the weighing container before acquiring the seed sample weight, forming a tare weight; then, when the container and sample are placed on the stage, the gravity sensor outputs the raw weight data, and the data processing and control module obtains the net weight based on the tare relationship.
[0081] ;
[0082] in: Indicates the net weight of the seed sample; This represents the raw weight data; This represents the tare weight. It should be noted that the method for obtaining the tare weight described above is not limited to a single sample. In practical applications, the tare weight can be obtained by averaging multiple samples, using a stable value after zero-point drift calibration or temperature drift compensation, to improve the stability and repeatability of the net weight calculation. Furthermore, in one executable implementation, the system can also set a weight stability criterion. For example, the weight value is locked only when the weight reading fluctuates less than a set threshold within a short period, thus reducing errors caused by slight vibrations of the stage or transient placement of the vessel.
[0083] S20: Perform illumination normalization and background separation processing on the RGB image data to obtain a standardized image and a set of candidate seed regions.
[0084] Specifically, a flat-field corrected image and a dark-field image matching the light source configuration of the shooting box are acquired, and flat-field normalization processing is performed on the RGB image data based on the flat-field corrected image and the dark-field image to obtain an illumination-normalized image; a background probability map is generated based on the illumination-normalized image, and threshold segmentation is performed on the background probability map to obtain a foreground binary mask; morphological opening and hole filling processing are performed on the foreground binary mask to obtain a cleaned-up foreground mask, and the normalized image is obtained by cropping from the illumination-normalized image; connected component analysis is performed on the cleaned-up foreground mask to form a set of candidate seed regions, wherein each candidate seed region corresponds to a candidate region box in the normalized image.
[0085] In this embodiment of the invention, the enclosed imaging chamber and constant illumination unit can significantly reduce ambient light variations, but local brightness unevenness may still occur due to material reflections of the vessel, lamp aging, lamp position offset, or differences in surface texture of the stage, thereby affecting the stability of the instance segmentation model and the comparability of color analysis. Therefore, this step further standardizes the image input through illumination normalization and background separation, so that subsequent model inference is based as much as possible on comparable and reproducible image distributions.
[0086] In one executable implementation, the data processing and control module acquires the flat-field corrected image and the dark-field image, and performs flat-field normalization on the RGB image data to obtain the illumination-normalized image:
[0087] ;
[0088] in: Represents RGB image data; Represents a normalized image of illumination; This represents a flat-field corrected image; This refers to the dark field image. It should be noted that the acquisition methods for flat field correction images and dark field images are not limited to a certain implementation. In practical applications, they can be acquired and stored as calibration data during equipment initialization, lamp replacement, or periodic maintenance. Dark field images can be acquired by blocking the light entering the lens or turning off the illumination unit, while flat field correction images can be acquired by placing a standard diffuse white board or a uniform background board on the stage.
[0089] Furthermore, in one executable implementation, the data processing and control module generates a background probability map based on the illumination-normalized image and obtains a foreground binary mask through threshold segmentation. In practical applications, the generation method of the background probability map is not limited to a fixed threshold model; it can be background modeling based on color statistics, probability estimation based on texture differences, or background probability output by a lightweight semantic segmentation network, as long as it can provide an executable probability description for subsequent foreground / background separation.
[0090] Building upon this, in one executable implementation, a morphological opening operation is performed on the foreground binary mask to remove small noisy connected components, and hole filling is performed to repair fractures within the seed region. This is then combined with boundary smoothing to obtain a cleaned foreground mask. It should be noted that the selection of morphological structuring elements and the hole filling strategy are not limited to a fixed form; in practical applications, they can be set according to camera resolution, the field of view of the object region, and the typical seed size range. Subsequently, the data processing and control module crops a standardized image from the illumination-normalized image based on the cleaned foreground mask, enabling subsequent model inference to focus on the foreground region and reduce the influence of background differences.
[0091] Meanwhile, in practical applications, the data processing and control module performs connected component analysis on the cleaned foreground mask to obtain a set of candidate seed regions. Each candidate region can be described using a bounding rectangle, a rotated rectangle, or a polygonal boundary, as long as it can be used to define the inference window of the subsequent segmentation model. It should be noted that, in addition to reducing background interference, the set of candidate seed regions can also reduce unnecessary computation caused by whole-image inference, thereby improving the overall response speed of the system, which is especially suitable for pipelined continuous detection scenarios.
[0092] S30: Input the standardized image into the deep learning instance segmentation model, output the seed instance segmentation mask set and the corresponding confidence set, and calculate the initial count based on the confidence set.
[0093] Specifically, each candidate region in the candidate seed region set is cropped from the standardized image into a candidate image patch set, and the candidate image patch set is input into the deep learning instance segmentation model to output an instance segmentation probability map set corresponding to each candidate image patch; based on the instance segmentation probability map set, instance segmentation post-processing is performed on each candidate image patch to obtain a candidate instance mask set, and cross-region merging is performed on the candidate instance mask set to form the seed instance segmentation mask set; based on the instance segmentation probability map set, a confidence set corresponding one-to-one with the seed instance segmentation mask set is calculated, and an initial count is calculated based on the confidence threshold.
[0094] In this embodiment of the invention, this step is used to obtain a pixel-level mask that corresponds one-to-one with each seed instance, so that subsequent size calculations and color discrimination can be based on the same instance boundary, avoiding parameter deviations caused by inconsistencies between the counting boundary and the measurement boundary. Furthermore, since the enclosed box provides stable shooting geometry and lighting consistency, the generalization effect of the model on different batches of samples is more likely to remain stable, thereby improving the repeatability of the instance mask output.
[0095] Specifically, in one executable implementation, the data processing and control module applies a set of candidate seed regions to a standardized image, cropping each candidate region to obtain a set of candidate image patches. Furthermore, the set of candidate image patches is input into a deep learning instance segmentation model to obtain a set of instance segmentation probability maps corresponding to each candidate image patch. It should be noted that the instance segmentation model is not limited to a specific network structure; in practical applications, a two-stage instance segmentation network or a single-stage instance segmentation network can be used, as long as it can output probability maps or boundary descriptions that can be used to form instance masks.
[0096] It should be noted that the probability map output by the instance segmentation model usually requires post-processing to form a stable instance mask. Specifically, the data processing and control module performs thresholding and connectivity analysis based on the instance segmentation probability map set to form candidate instance regions; and when necessary, it combines strategies such as distance transformation and watershed to perform preliminary separation of contiguous regions, thereby obtaining a set of candidate instance masks. Subsequently, the data processing and control module performs cross-region merging on instances that repeatedly appear across the candidate region boundaries to form a globally consistent set of seed instance segmentation masks. It should be noted that the basis for cross-region merging is not limited to a single overlap ratio threshold. In practical applications, multiple indicators such as mask overlap, boundary similarity, and instance center distance can be combined to form merging criteria to improve merging stability.
[0097] In one executable implementation, the data processing and control module calculates the confidence level corresponding to each instance mask based on the instance segmentation probability graph set, and forms an initial count based on the confidence level threshold:
[0098] ;
[0099] in: Indicates the initial count; Indicates an indicator function; This represents the confidence level of the i-th instance; This represents the confidence threshold. It should be noted that the definition of confidence is not limited to the probability mean. In practical applications, a more robust confidence expression can be formed by combining mask boundary uncertainty, output entropy value, or multi-scale consistency score. However, regardless of the expression used, the purpose is to provide an executable filtering basis for subsequent initial counting.
[0100] S40: Based on the net weight, the initial count, and the occlusion metric calculated from the set of seed instance segmentation masks, perform occlusion adaptive weight consistency count correction processing to output the correction count and the set of correction instance segmentation masks corresponding one-to-one with the correction count, and calculate the single grain weight, hundred-grain weight, and thousand-grain weight based on the correction count.
[0101] Specifically, an occlusion metric is calculated based on the set of seed instance segmentation masks. This occlusion metric characterizes the uncertainty in instance segmentation caused by seed adhesion, overlap, or stacking. If the occlusion metric is not less than an occlusion threshold, the morphological and color features of visible seeds are extracted from the set of seed instance segmentation masks. These features are then input into a single-seed quality estimation model to obtain a set of quality estimates for visible seeds, and single-seed quality statistical parameters are calculated. A count correction objective function is constructed based on the net weight, the initial count, and the single-seed quality statistical parameters, and solved to obtain a corrected count. Adhesion masks in the set of seed instance segmentation masks that satisfy the adhesion criterion are subjected to mask splitting and reconstruction processing based on weight consistency constraints to obtain a corrected instance segmentation mask set corresponding one-to-one with the corrected count. A weight consistency residual is calculated based on the net weight and the corrected count, and if the weight consistency residual is not less than a residual threshold, a re-acquisition command is output to trigger synchronous re-acquisition of the RGB image data and the original weight data.
[0102] In this embodiment of the invention, when grains are adhered, overlapped, or stacked in an image, the instance segmentation count on the image side often carries a systematic risk of undercounting, leading to deviations in the single-grain weight, hundred-grain weight, and thousand-grain weight derived from net weight and count. This invention introduces an occlusion-adaptive correction process for this specific scenario: on one hand, it uses statistical priors on single-grain quality and weight constraints to correct the count; on the other hand, it uses the corrected count results to inversely constrain the mask structure, performing splitting and reconstruction on the adhered mask, thereby ensuring consistency in the count, weight, and mask set at the data level. It should be noted that in ordinary single-layer dispersed grain scenarios, this invention does not require the activation of this correction process, but rather achieves adaptive start and stop through occlusion metric trigger conditions, thereby avoiding unnecessary additional computational overhead.
[0103] Specifically, in one executable implementation, the data processing and control module calculates an occlusion metric based on the set of instance masks. It should be noted that the purpose of constructing the occlusion metric is to convert adhesion / stacking risks into executable numerical triggering conditions; therefore, its calculation method is not limited to a single fixed index. In practical applications, the occlusion metric can be obtained by fusing multiple features such as the topological complexity of the mask's connected components, the number of boundary depressions, the proportion of slender branches, or the ratio of mask area to bounding box area, as long as it can stably distinguish between low and high occlusion risks.
[0104] In one executable implementation, when the occlusion metric is not less than the occlusion threshold, the data processing and control module initiates the occlusion adaptive correction process. Specifically, this involves first constructing the input features of the single-grain quality estimation model based on the morphological and color features of visible instances, and then outputting a set of quality estimates for visible grains. It should be noted that the form of the single-grain quality estimation model is not limited to a particular implementation; it can be a regression model trained using historical calibration samples. In practical applications, the model can be implemented using regression trees, support vector regression, or lightweight multilayer perceptrons, but their common purpose is to provide statistical priors for the quality of missing or under-classified grains in occluded scenarios. Subsequently, the data processing and control module calculates the statistical parameters of single-grain quality based on the set of quality estimates, including the mean and standard deviation of single-grain quality. The mean single-grain quality serves as a prior, while the standard deviation characterizes the degree of dispersion.
[0105] Building upon this, the data processing and control module further constructs a count correction objective function based on net weight, initial count, and single-grain mass statistical parameters, and solves for the corrected count in the positive integer domain:
[0106] ;
[0107] in: Indicates the correction count; Represents the count variable to be solved; Represents the set of positive integers; Indicates net weight; This represents the average weight of a single grain; This indicates the standard deviation of noise in weight measurement; This represents the image counting uncertainty parameter; This represents the balancing weight coefficient.
[0108] It should be noted that the first term in the above equation is used to establish a consistency constraint between the count and weight through the prior of the mean mass of a single grain, and the second term is used to ensure that the corrected count does not deviate from the image evidence without constraint. Furthermore, it should be noted that the method of setting the balance coefficient is not limited to a fixed constant; in one feasible implementation, the balance coefficient can be adaptively adjusted according to the degree of occlusion, so that the more severe the occlusion, the more emphasis is placed on the weight consistency term, thereby obtaining a more stable corrected count.
[0109] After obtaining the correction count, it should be noted that the count correction itself is still insufficient to support subsequent size and color calculations, because size and color extraction requires a set of instance masks that correspond one-to-one with the seeds. Therefore, this invention further introduces mask splitting reconstruction to realize the correction count result into an executable set of instances. In one executable implementation, the data processing and control module performs splitting reconstruction processing on the adhesive masks in the instance mask set that meet the adhesion criteria: first, the skeleton of the adhesive mask is extracted and local extreme points are located to form candidate splitting centers; then, constraint allocation is performed on the candidate splitting centers to match the number of sub-masks after splitting with the increment of the correction count relative to the initial count, and to keep the sub-masks after splitting consistent within the statistical range of the prior models of area, shape, and mass, thereby forming a set of corrected instance segmentation masks that correspond one-to-one with the correction count.
[0110] It should be noted that the above-mentioned split reconstruction method is not limited to the skeleton / watershed route. In another possible implementation, the split can also be completed by multi-ellipse fitting and pixel assignment with minimal overlap. However, regardless of the method used, the split result must be consistent with the correction count, and the split instances must meet the boundary quality requirements that can be used for subsequent size and color calculations.
[0111] Meanwhile, in one feasible implementation, the data processing and control module calculates the weight consistency residual based on the net weight and correction count, and outputs re-acquisition command data when the weight consistency residual is not less than the residual threshold. It should be noted that the re-acquisition command data is not limited to manual execution; in automated equipment, re-acquisition can be performed by the system-controlled vibration spreading or mechanical sampling device to redistribute the grains before re-acquisition, thereby improving feasibility in high-throughput scenarios. Furthermore, the implementation of the re-acquisition command at the equipment level is not limited to a single form: in one implementation, the operator can be prompted to open the chamber and redistribute the sample; in another implementation, the stage can perform short-term vibration or the sampling mechanism can perform automatic spreading, transitioning the grains from a stacked state to a more dispersed state conducive to segmentation before synchronous acquisition.
[0112] After completing the correction count, this embodiment of the invention further calculates weight-derived parameters based on the net weight and the correction count. Specifically, the average weight per grain is first calculated:
[0113] ;
[0114] in: Indicates the average weight of a single grain; Indicates net weight; This indicates a correction count. Then, the weight per 100 grains and the weight per 1000 grains are calculated:
[0115] ;
[0116] ;
[0117] in: Indicates the weight of 100 grains; This represents the weight per thousand grains. It should be noted that the derivation of the above weight-derived parameters is not limited to a single expression, but the basic idea is to output the weight per hundred grains / thousand grains parameter consistent with traditional test indicators, while ensuring that the corrected count is consistent with the net weight, so as to compare with existing standard procedures.
[0118] S50: Based on the set of correction instance segmentation masks, extract the morphological size features and back color features of each seed instance, and generate seed evaluation result data containing seed quantity, weight parameters, size parameters and color parameters.
[0119] Specifically, extracting morphological and size features includes: for each seed instance mask in the set of correction instance segmentation masks, calculating the minimum outer radius and the maximum inscribed radius of the seed instance mask; calculating the seed length based on the minimum outer radius and the seed width based on the maximum inscribed radius. Extracting backside color features includes: in the normalized image, extracting the pixel set of each seed instance based on the seed instance mask, and performing a color space transformation on the pixel set to obtain the color vector of the seed instance; constructing a standard color vector set, and calculating the color difference value between each seed instance and each standard color vector based on a color difference metric; and calculating the color category of the seed instance based on the color difference value.
[0120] Following this, the calibration count, net weight, weight per 100 grains, weight per 1000 grains, morphological and dimensional characteristics, and color category are structurally encapsulated to form a test result data package; a data index identifier corresponding to the RGB image data is generated for the test result data package, and the data index identifier is associated with and stored with the weight timestamp and the image timestamp; the test result data package is output to a display terminal or exported as an electronic report file to complete the data output of the test results.
[0121] In this embodiment of the invention, the set of corrected instance segmentation masks is used as the boundary basis to ensure that the count, weight, size, and color are all based on the same instance set, avoiding data conflicts caused by inconsistencies between instances in different algorithm modules. Furthermore, the enclosed shooting box and stable lighting provide the necessary acquisition conditions for the objective quantification of color features, making the matching results between the color vector and the standard color vector set more verifiable.
[0122] For morphological and dimensional feature extraction, specifically, in one executable implementation, the data processing and control module calculates the minimum outer circle radius and the maximum inner circle radius for each seed instance mask, and calculates the seed length and width accordingly:
[0123] ;
[0124] ;
[0125] in: This represents the length of the j-th seed. Indicates the width of the j-th seed; Indicates the minimum circumcircle radius; This represents the maximum inscribed circle radius. It should be noted that in this embodiment, the circumscribed circle diameter and inscribed circle diameter are used to represent length and width respectively, in order to obtain stable dimensional indicators without forcibly normalizing the attitude. In practical applications, supplementary dimensional parameters such as principal axis / minor axis length can also be added, but this does not constitute a limitation of the present invention.
[0126] For backface color feature extraction, specifically, in one executable implementation, the data processing and control module extracts the set of pixels for each instance from the normalized image based on the instance mask, and performs color space transformation to obtain a CIELAB color vector. In practical applications, the purpose of color space conversion is to transform color differences into a distance metric that better reflects perceptual consistency, thereby supporting the use of standard color vector sets. A stable match is achieved. Subsequently, the data processing and control module calculates the color difference value:
[0127] ;
[0128] And determine the color category:
[0129] ;
[0130] in: Represents the color vector of the j-th seed; , , This represents the three-channel CIELAB component of the color vector of the j-th seed. This represents the k-th standard color vector; , , This represents the three-channel components of the k-th standard color vector in the CIELAB color space; Indicates color differences; This represents the color category index corresponding to the smallest difference. It should be noted that the construction method of the standard color vector set is not limited to a fixed standard; in practical applications, it can be established according to the DUS testing guidelines corresponding to different crops. Furthermore, this invention does not limit the use of a specific number of standard color categories, as long as an executable standard vector set can be formed and matching and discrimination can be completed.
[0131] After calculating parameters such as quantity, weight, size, and color, the data processing and control module further encapsulates the correction count, net weight, weight per 100 grains, weight per 1000 grains, morphological and dimensional characteristics, and color category in a structured manner to form a test result data package. A data index identifier corresponding to the RGB image data is then generated for this data package. Subsequently, the data index identifier is associated with and stored along with the weight timestamp and image timestamp to ensure that the results are traceable to the original collected data. It should be noted that the output format of the test result data package is not limited to a specific file format. In practical applications, it can be output as database records, JSON data, or electronic report files to adapt to different business processes such as scientific research statistics, quality inspection, or breeding screening.
[0132] like Figure 2 As shown, this invention provides a testing system based on the fusion of RGB images and weight information. The system is used to execute the aforementioned testing method based on the fusion of RGB images and weight information. The system includes:
[0133] The acquisition unit is used to acquire synchronous RGB image data of the seed sample to be tested and raw weight data that is time-aligned with the RGB image data, and calculate the net weight based on the preset tare weight.
[0134] The processing unit is used to perform illumination normalization and background separation processing on the RGB image data to obtain a standardized image and a set of candidate seed regions;
[0135] The input unit is used to input the standardized image into the deep learning instance segmentation model, output the seed instance segmentation mask set and the corresponding confidence set, and calculate the initial count based on the confidence set;
[0136] The calculation unit is used to perform occlusion adaptive weight consistency count correction processing based on the net weight, the initial count and the occlusion metric value calculated by the set of seed instance segmentation masks, so as to output the correction count and the set of correction instance segmentation masks corresponding one-to-one with the correction count, and calculate the single grain weight, hundred grain weight and thousand grain weight based on the correction count.
[0137] The generation unit is used to extract morphological and size features and back color features of each seed instance based on the set of correction instance segmentation masks, and generate seed evaluation result data including seed quantity, weight parameters, size parameters and color parameters.
[0138] Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. This program is stored in a storage medium and includes several instructions to cause a microcontroller, chip, or processor to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0139] The optional embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the embodiments of the present invention are not limited to the specific details described above. Within the scope of the technical concept of the embodiments of the present invention, various simple modifications can be made to the technical solutions of the embodiments of the present invention, and these simple modifications all fall within the protection scope of the embodiments of the present invention. It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, the embodiments of the present invention will not further describe the various possible combinations.
[0140] Furthermore, various different embodiments of the present invention can be combined in any way, as long as they do not violate the spirit of the embodiments of the present invention, they should also be regarded as the content disclosed by the embodiments of the present invention.
Claims
1. A method for testing based on the fusion of RGB images and weight information, characterized in that, The method includes: Acquire synchronous RGB image data of the seed sample to be tested and raw weight data time-aligned with the RGB image data, and calculate the net weight based on the preset hull weight. The RGB image data is subjected to illumination normalization and background separation processing to obtain a standardized image and a set of candidate seed regions; The standardized image is input into the deep learning instance segmentation model, which outputs a set of seed instance segmentation masks and a corresponding set of confidence scores, and calculates an initial count based on the set of confidence scores. Based on the net weight, the initial count, and the occlusion metric calculated from the set of seed instance segmentation masks, an occlusion-adaptive weight consistency count correction process is performed to output a correction count and a set of correction instance segmentation masks that correspond one-to-one with the correction count. Based on the correction count, the single-grain weight, the weight of 100 grains, and the weight of 1000 grains are calculated. Specifically, based on the net weight, the initial count, and the occlusion metric calculated from the seed instance segmentation mask set, an occlusion-adaptive weight consistency count correction process is performed to output a corrected count and a corrected instance segmentation mask set corresponding one-to-one with the corrected count. This includes: The occlusion metric is calculated based on the set of seed instance segmentation masks; wherein the occlusion metric is used to characterize the uncertainty in instance segmentation caused by seed adhesion, overlap or stacking; When the occlusion metric is not less than the occlusion threshold, the morphological size features and color features of visible grains are extracted based on the grain instance segmentation mask set, and the morphological size features and color features are input into the single grain quality estimation model to obtain the set of quality estimates of visible grains, and then the single grain quality statistical parameters are calculated. Based on the net weight, the initial count, and the single-grain mass statistical parameters, a count correction objective function is constructed and solved to obtain the corrected count. The expression is: ; in: Indicates the correction count; Represents the count variable to be solved; Represents the set of positive integers; Indicates net weight; This represents the average weight of a single grain; This indicates the standard deviation of noise in weight measurement; This represents the image counting uncertainty parameter; Indicates the balance weighting coefficient; Indicates the initial count; Perform mask splitting and reconstruction processing based on weight consistency constraints on the adhesion masks that satisfy the adhesion criterion in the set of seed instance segmentation masks to obtain a set of corrected instance segmentation masks that correspond one-to-one with the correction count. The weight consistency residual is calculated based on the net weight and the correction count, and a re-acquisition instruction data is output if the weight consistency residual is not less than the residual threshold, so as to trigger the synchronous re-acquisition of the RGB image data and the original weight data. Based on the set of correction instance segmentation masks, morphological and size features and back color features are extracted for each grain instance, and seed evaluation result data including grain quantity, weight parameters, size parameters and color parameters are generated.
2. The examination method based on RGB image and weight information fusion according to claim 1, characterized in that, Acquire synchronized RGB image data of the seed sample to be tested and raw weight data time-aligned with the RGB image data, and calculate the net weight based on a preset tare weight, including: The sensor output value is obtained when the weighing container is empty, and the tare weight data is generated and used as the preset tare weight. The sensor output value is obtained when the seed sample and the weighing container are both under load, forming the original weight data, and a weight timestamp is generated for the original weight data. The RGB image data of the seed sample under constant illumination conditions is obtained, and an image timestamp is generated for the RGB image data. The original weight data is then peeled based on the preset peel weight to obtain the net weight.
3. The examination method based on RGB image and weight information fusion according to claim 1, characterized in that, The RGB image data is subjected to illumination normalization and background separation processing to obtain a standardized image and a set of candidate seed regions, including: Acquire a flat-field corrected image and a dark-field image that match the light source configuration of the shooting box, and perform flat-field normalization processing on the RGB image data based on the flat-field corrected image and the dark-field image to obtain an illumination normalized image; A background probability map is generated based on the illumination normalized image, and threshold segmentation is performed on the background probability map to obtain a foreground binary mask; A morphological opening operation and hole filling process are performed on the foreground binary mask to obtain a cleaned foreground mask, and the normalized image is obtained by cropping it from the illumination normalized image. Connectivity analysis is performed on the purified foreground mask to form a set of candidate seed regions, where each candidate seed region corresponds to a candidate region box in the normalized image.
4. The examination method based on RGB image and weight information fusion according to claim 1, characterized in that, The standardized image is input into a deep learning instance segmentation model, which outputs a set of seed instance segmentation masks and a corresponding set of confidence scores. An initial count is then calculated based on the confidence score set, including: Each candidate region in the candidate seed region set is cropped from the standardized image into a candidate image patch set, and the candidate image patch set is input into the deep learning instance segmentation model to output an instance segmentation probability map set corresponding to each candidate image patch; Based on the instance segmentation probability map set, post-processing of instance segmentation is performed on each candidate image block to obtain a candidate instance mask set, and cross-region merging is performed on the candidate instance mask set to form the seed instance segmentation mask set. Based on the set of instance segmentation probability maps, calculate a set of confidence levels that correspond one-to-one with the set of seed instance segmentation masks, and calculate an initial count based on the confidence level threshold.
5. The examination method based on RGB image and weight information fusion according to claim 1, characterized in that, The calculation of single-grain weight, 100-grain weight, and 1000-grain weight based on the corrected count includes: The average weight of a single grain is calculated based on the net weight and the correction count, expressed as follows: ; The weight of 100 and 1000 grains is calculated based on the average weight of a single grain, using the following expression: ; ; In the formula, Indicates the average weight of a single grain; Indicates net weight; Indicates the correction count; Indicates the weight of 100 grains; Indicates the weight of a thousand grains.
6. The examination method based on RGB image and weight information fusion according to claim 1, characterized in that, Extracting morphological and dimensional features, including: For each seed instance mask in the set of correction instance segmentation masks, calculate the minimum outer circle radius and the maximum inscribed circle radius of the seed instance mask; The seed length is calculated based on the minimum circumscribed circle radius, and the seed width is calculated based on the maximum inscribed circle radius.
7. The examination method based on RGB image and weight information fusion according to claim 1, characterized in that, Extracting backside color features, including: In the standardized image, the pixel set of each seed instance is extracted based on the mask of each seed instance, and color space transformation is performed on the pixel set to obtain the color vector of the seed instance; Construct a set of standard color vectors and calculate the color difference value between each seed instance and each standard color vector based on the color difference metric; The color category of the seed instance is calculated based on the color difference value.
8. The examination method based on RGB image and weight information fusion according to claim 2, characterized in that, Generate seed evaluation result data including seed quantity, weight parameters, size parameters, and color parameters, including: The calibration count, net weight, weight per 100 grains, weight per 1000 grains, dimensional characteristics, and color category are structured and encapsulated to form a test result data package; Generate a data index identifier corresponding to the RGB image data for the test result data packet, and associate and store the data index identifier with the weight timestamp and the image timestamp; The test result data packet is output to the display terminal or exported as an electronic report file to complete the data output of the test results.
9. A testing system based on the fusion of RGB images and weight information, characterized in that, The system is used to execute the examination method based on RGB image and weight information fusion as described in any one of claims 1-8, and the system comprises: The acquisition unit is used to acquire synchronous RGB image data of the seed sample to be tested and raw weight data that is time-aligned with the RGB image data, and calculate the net weight based on the preset tare weight. The processing unit is used to perform illumination normalization and background separation processing on the RGB image data to obtain a standardized image and a set of candidate seed regions; The input unit is used to input the standardized image into the deep learning instance segmentation model, output the seed instance segmentation mask set and the corresponding confidence set, and calculate the initial count based on the confidence set; The calculation unit is used to perform occlusion adaptive weight consistency count correction processing based on the net weight, the initial count and the occlusion metric value calculated by the set of seed instance segmentation masks, so as to output the correction count and the set of correction instance segmentation masks corresponding one-to-one with the correction count, and calculate the single grain weight, hundred grain weight and thousand grain weight based on the correction count. The generation unit is used to extract morphological and size features and back color features of each seed instance based on the set of correction instance segmentation masks, and generate seed evaluation result data including seed quantity, weight parameters, size parameters and color parameters.