A method for predicting seed vigor based on RGB images
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHANGCHUN INST OF OPTICS FINE MECHANICS & PHYSICS CHINESE ACAD OF SCI
- Filing Date
- 2026-03-31
- Publication Date
- 2026-08-07
AI Technical Summary
[0006]但上述多光谱和高光谱技术在种子活力检测中,尽管在理论层面具备显著优势,却面临着多重现实应用制约,其一为专业光谱设备的价格高昂,从光谱相机到配套的检测系统需要巨额的资金投入,其高昂的成本体现在精密的光学系统和复杂的配件要求上,比如核心的分光装置、特殊的光谱探测器以及标准光源等,设备成本远超普通RGB设备的普及门槛;其二为操作复杂性突出,光谱成像检测需要严格的环境控制、专业的设备校准和缓慢的样品扫描流程,其中环境控制的核心在于消除一切可能干扰光谱测量的变量,温度波动必须控制在±1°C以内,原因是探测器的灵敏度会随温度发生显著漂移,专业校准则需要用已知反射率的标准白板和黑体建立像素响应曲线,且该校准过程需要每2-4小时重复一次,这是由于光源的衰减和探测器的漂移会持续发生,而扫描流程的缓慢则是由物理原理决定的,推扫式高光谱相机每次仅能获取一条线的光谱数据,需要通过平台精确移动样品才能完成二维扫描
(1)相较于依赖昂贵高光谱成像设备的现有技术,本发明的方法通过从低成本RGB图像到高光谱图像的智能映射,实现了种子活力的高效早期筛选,打破了高光谱检测在设备成本、数据采集速度与操作复杂度上的瓶颈,给生产线实时筛提供了一种实现路径,有利于技术向产业应用的落地转化。
Smart Images

Figure CN122530640A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of seed quality testing technology, and in particular to a seed vigor prediction method based on RGB images. Background Technology
[0002] Seed vigor, as an important indicator for evaluating seed quality and predicting crop yield, is closely related to crop yield and quality. High-vigor seeds typically have higher germination rates and stronger growth vigor, contributing to improved crop yield and quality. Measuring seed vigor before sowing can effectively eliminate low-vigor or even inactive seeds, thereby enabling the sorting and efficient utilization of high-quality seeds.
[0003] Currently, commonly used methods for determining seed vigor mainly include germination tests, triphenyltetrazolium chloride (TTC) detection, and conductivity measurement. Among these, the germination test is the most intuitive and traditional method. This method involves cultivating seeds under suitable conditions and observing the germination rate, germination speed, and seedling growth to assess seed viability and physiological potential. The TTC detection method utilizes the reducing power of live cell dehydrogenases. When seed cells are metabolically active, dehydrogenases can reduce colorless TTC to a red triphenyltetrazol precipitate, thus reflecting the seed's vigor level based on the intensity of the precipitate's color. The conductivity measurement method is based on the principle of cell membrane integrity. If the cell membrane is damaged during soaking, internal electrolytes will leak into the soaking solution, leading to an increase in solution conductivity. Therefore, the physiological vigor and membrane system stability of the seed can be indirectly determined by measuring the conductivity of the soaking solution. However, these methods are not only time-consuming and labor-intensive but also often require damaging the seed structure, rendering the tested seeds unusable for agricultural production. This wastes seed resources and increases the cost of experimental testing.
[0004] With the rapid development of image processing and neural network technologies, image analysis-based seed vigor prediction methods are constantly emerging. These methods typically obtain visualized information about the internal physicochemical properties of seeds through special imaging, thereby achieving intelligent assessment of seed vigor. Currently, the mainstream research direction is seed vigor detection based on X-ray, infrared, and hyperspectral imaging, and these methods have shown good performance in seed vigor detection. X-ray imaging can clearly reveal the internal structural features of seeds, such as the integrity of the endosperm and plumule, but this method requires specialized radiation equipment, which is costly and poses radiation safety risks. Infrared imaging mainly relies on differences in thermal radiation to reflect the metabolic activity of seeds. This method is extremely sensitive to environmental conditions such as temperature and humidity, and has stringent requirements for the experimental environment; slight fluctuations in environmental conditions can affect the stability and repeatability of the detection results. Hyperspectral imaging can simultaneously acquire spatial and spectral information of seeds, thus accurately reflecting the chemical composition and physiological state of seeds. It is currently a hot method for precise seed vigor detection, but the required equipment is expensive, the data collected is highly dimensional, data processing is complex, and the image acquisition and processing process is time-consuming.
[0005] Because the aforementioned seed vigor detection methods based on specialized imaging all have strict requirements for dedicated equipment and experimental environments, they are difficult to widely apply in actual large-scale seed sorting scenarios. Currently, the closest implementation to this invention is a seed vigor prediction method based on multispectral or hyperspectral image analysis. This method specifically detects seed vigor by capturing multispectral or hyperspectral images of the seeds and utilizing the more refined spectral information provided by the images. These spectral images typically contain hundreds of continuous narrow bands, forming a complete spectral curve. This continuous spectral information can more accurately identify changes in the chemical composition and physical structure within the seed. During storage, seeds undergo a series of physiological and biochemical changes, such as lipid oxidation, decreased enzyme activity, and altered membrane permeability, all of which are reflected in the seed's spectral characteristics. Multispectral or hyperspectral imaging methods can capture these subtle spectral differences in seeds, thereby predicting seed aging and vigor levels earlier. For example, in specific absorption bands, seeds with decreased vigor may show shifts in characteristic peaks or changes in intensity. These characteristics can serve as important indicators for seed vigor prediction. Finally, by combining the results of standard germination tests, a binary or multi-classification model can be established by integrating the average spectral data of the images with seed vigor, thus achieving non-destructive detection of seed vigor.
[0006] However, while the aforementioned multispectral and hyperspectral technologies have significant theoretical advantages in seed vigor detection, they face multiple practical application constraints. Firstly, the high cost of specialized spectroscopic equipment necessitates substantial investment, from the spectroscopic camera to the accompanying detection system. This high cost is reflected in the sophisticated optical systems and complex component requirements, such as the core spectroscopic device, specialized spectroscopic detectors, and standard light sources. The equipment cost far exceeds the entry barrier for ordinary RGB equipment. Secondly, the operational complexity is significant. Spectral imaging detection requires strict environmental control, professional equipment calibration, and a slow sample scanning process. Environmental control hinges on eliminating all variables that could interfere with spectral measurements; temperature fluctuations must be controlled within ±1°C because detector sensitivity drifts significantly with temperature. Professional calibration requires establishing pixel response curves using standard white plates and black bodies with known reflectivities, and this calibration process needs to be repeated every 2-4 hours due to continuous light source attenuation and detector drift. The slow scanning process is determined by physical principles; pushbroom hyperspectral cameras can only acquire spectral data for one line at a time, requiring precise sample movement via a platform to complete a two-dimensional scan. Summary of the Invention
[0007] To address the aforementioned problems, this invention provides a seed viability prediction method based on RGB images.
[0008] The purpose of this invention is to provide a seed viability prediction method based on RGB images, which specifically includes the following steps: S1. Simultaneously acquire RGB and hyperspectral images of seeds to establish a one-to-one image dataset; conduct a standard germination test on the seeds after image acquisition, classify the vigor level according to germination performance, and label the RGB and hyperspectral images with corresponding seed vigor labels; S2. Convert the hyperspectral data cube of the hyperspectral image into a two-dimensional spectral data matrix to obtain the spectral curve corresponding to each seed sample; use the spectral curve and seed vigor label to establish a classification model and calculate the correlation coefficient of each hyperspectral band with seed vigor classification. S3. Construct a mapping model from RGB images to hyperspectral images to realize the mapping from RGB images to hyperspectral images; S4. Optimize the loss function of the mapping model in step S3 based on the correlation coefficient obtained in step S2, and train until the model converges to obtain the RGB-hyperspectral mapping model; S5. Construct a seed viability binary classification model with fused loss function, and train the model using the hyperspectral image generated by the mapping model optimized in S4 to obtain the seed viability classification model; S6. Input the RGB image of the seed to be detected into the RGB-hyperspectral mapping model and the seed vigor binary classification model in sequence, and output the seed vigor prediction result.
[0009] Preferably, in step S1, RGB images and hyperspectral images of the seeds are acquired simultaneously under the same lighting conditions; Vigor levels include high vigor and low vigor. High vigor seeds reach the germination standard within 24-48 hours, and the germination is uniform. Seedlings with strong radicles that elongate rapidly, upright hypocotyls, and fully unfolded cotyledons with a bright green color are exhibited. Low vigor seeds take more than 3 days to reach the germination standard, and the germination process is uneven. Seedlings with weak radicles, slow growth, deformities or curvature, and incompletely unfolded cotyledons with a yellowish color are exhibited.
[0010] Preferably, in step S2, the first The seed, the first The spectral values for the band are calculated using the following formula: ; in Represents the total number of pixels. It represents the brightness value of a single pixel in a spectral image at a certain wavelength; The classification model can be any one of the following: logistic regression model, random forest model, or one-dimensional convolutional neural network model.
[0011] Preferably, the step S3 of constructing the mapping model from RGB image to hyperspectral image specifically includes: S31. Based on the mathematical relationship between the spectral responses of RGB and hyperspectral images, determine the discretized expression for their mapping: ; in, This represents the pixel value of the Kth color channel in an RGB image. Indicates the hyperspectral image at wavelength Spectral values at that location, This indicates the wavelength of the camera's Kth color channel. spectral response function; S32. Build a neural network mapping model, using the RGB image collected in S11 as input and the corresponding hyperspectral image as output, and train the model using the image dataset so that the model learns the mapping relationship from RGB image to hyperspectral image. S33. After training, the neural network mapping function is obtained: ; in, For a well-trained mapping neural network, Hyperspectral images generated for the model.
[0012] Preferably, the neural network mapping model in step S32 is any one of the U-NET encoder-decoder architecture, the VisionTransformer model, or the generative adversarial network model.
[0013] Preferably, the optimized loss function in step S4 is a full-band weighted loss function: ; Where N is the total number of pixels in the hyperspectral image; Represents the absolute value of the correlation coefficient; This represents the actual hyperspectral image collected. For proportional weighting parameters; This indicates that the hyperspectral image generated by the mapping model is at wavelength Spectral values at; This indicates the wavelength of the camera's Kth color channel. spectral response function; Or the loss function for key wavelength reconstruction: ; Where N is the total number of pixels in the hyperspectral image; Indicates the key hyperspectral wavelengths associated with high seed vigor; This represents the hyperspectral image corresponding to the key wavelength generated by the mapping model. This represents the hyperspectral image corresponding to the key wavelengths actually acquired.
[0014] Preferably, the binary classification model in step S5 adopts any one of the following: residual convolutional neural network, 3D-CNN spatial spectral network, or Vision Transformer model with fused three-dimensional convolutional preprocessing.
[0015] Preferably, the loss function is the focus loss function, expressed as: ; in, This represents the model's predicted probability of the true class. Indicates the weighting coefficient; This represents the modulation factor.
[0016] Preferably, the loss function in step S5 is the binary cross-entropy loss function, with the following expression:
[0017] in, Indicates sample The true labels are marked as 1 for high activity and 0 for low activity; To predict the probability that the sample belongs to the high-activity category for the model; This represents the number of samples in the batch.
[0018] Preferably, the specific process for seed vigor prediction in step S6 is as follows: S61. Under the same lighting conditions as in step S1, acquire the RGB image of the seed to be detected using a common RGB imaging device; S62. Input the RGB image into the RGB-hyperspectral mapping model and output the reconstructed hyperspectral image; S63. Input the reconstructed hyperspectral image into the trained seed viability binary classification model, and output the predicted probability p that the seed to be detected is highly viable; S64. Set a probability threshold. If p ≥ the probability threshold, it is determined to be a high-viability seed. If p < the probability threshold, it is determined to be a low-viability seed.
[0019] Compared with the prior art, the present invention can achieve the following beneficial effects: (1) Compared with existing technologies that rely on expensive hyperspectral imaging equipment, the method of the present invention achieves efficient early screening of seed viability through intelligent mapping from low-cost RGB images to hyperspectral images, breaking the bottleneck of hyperspectral detection in terms of equipment cost, data acquisition speed and operation complexity, providing a path for real-time screening on production lines, and facilitating the transformation of technology into industrial applications.
[0020] (2) Unlike traditional hyperspectral methods that use full-band data, resulting in model redundancy, large computational load and slow inference speed, the method of this invention focuses on key spectral bands that are strongly related to vitality and designs targeted reconstruction loss to guide the model to learn the most discriminative spectral features. This not only greatly reduces the model size and prediction time, but also enhances the interpretability and robustness of the model, making it more suitable for embedded devices or online real-time screening systems.
[0021] (3) To address the problem that existing classification models are not good at identifying high-viability seeds when the categories are imbalanced, FocalLoss and other mechanisms are introduced to make the model focus more on difficult-to-distinguish samples and high-value categories (high-viability seeds), which effectively improves the screening accuracy and recall rate of high-viability seeds. Thus, under the same sowing quantity, higher germination rate and seedling quality can be ensured, which has higher practical value and economy. Attached Figure Description
[0022] Figure 1 This is an overall flowchart of a seed viability prediction method based on RGB images provided by an embodiment of the present invention.
[0023] Figure 2 The figures are actual images of the germination process of high-vitality seeds and low-vitality seeds according to embodiments of the present invention; (A) in the figure represents a high-vitality seed and (B) represents a low-vitality seed. Detailed Implementation
[0024] In the following description, embodiments of the invention will be described with reference to the accompanying drawings. In the description below, the same modules are denoted by the same reference numerals. Where the same reference numerals are used, their names and functions are also the same. Therefore, their detailed description will not be repeated.
[0025] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not constitute a limitation thereof.
[0026] This invention provides a seed viability prediction method based on RGB images. See the flowchart below. Figure 1 Specifically, it includes the following steps: S1. Obtaining image and seed vitality labels, specifically including: S11. Image Acquisition: A data-driven supervised spectral reconstruction method is used to map the RGB image to a hyperspectral image; this process first requires the synchronous acquisition of the seed's RGB image under the same lighting conditions. IRGB ) and the corresponding hyperspectral images acquired by the hyperspectral equipment ( IHSI To establish a one-to-one image dataset, providing a data foundation for subsequent RGB-to-hyperspectral mapping training; Brief Principle Description: Hyperspectral reconstruction from RGB images refers to the hyperspectral imaging process achieved by discovering an inverse response function. A high correlation exists between RGB and hyperspectral images, making it possible to convert RGB images into hyperspectral images. Since RGB images contain far less information than hyperspectral images, theoretically, there may be non-unique combinations of hyperspectral images corresponding to unique RGB images. Therefore, this invention collects a large amount of paired RGB-hyperspectral image data and utilizes a neural network to learn the mapping relationship between the two, effectively constraining the solution space and achieving accurate reconstruction of hyperspectral images.
[0027] S12. Obtaining Seed Viability Tags: After image acquisition, a standard germination test is conducted on the same batch of seeds to obtain seed viability tags. Specifically, filter paper or germination trays are moistened with distilled water until saturated but not waterlogged. Seeds are evenly placed on the germination bed, maintaining appropriate spacing to prevent cross-contamination. The treated germination bed is then placed in an artificial climate chamber. The optimal germination temperature is set according to the seed type, and a suitable light cycle is configured, using a 12-hour light / 12-hour dark cycle, maintaining the humidity of the culture environment between 85% and 95%. Germination is observed and recorded at fixed times daily. The germination standard is when the radicle breaks through the seed coat and reaches half the seed length.
[0028] Vitality Level Classification: (1) High vigorous seeds: They reach the germination standard within 24 to 48 hours and have a high degree of uniformity in germination. Most seeds germinate in a short period of time. Seedlings are characterized by thick radicles that elongate rapidly, upright hypocotyls, and fully unfolded cotyledons with a bright green color. (2) Low vigor seeds: germination starts slowly, usually taking more than 3 days to reach the germination standard, and the germination process is uneven; seedlings are characterized by weak radicles, slow growth, often deformed or bent, and cotyledons that are not fully unfolded and are yellow in color.
[0029] To more intuitively demonstrate the germination performance of seeds with different vigor levels, a schematic diagram of the seed germination process is provided. Figure 2 The figure shows that high-vitality seeds have thick, rapidly elongating radicles, upright hypocotyls, and fully unfolded, bright green cotyledons; low-vitality seeds have thin, weak radicles, slow growth, often deformed or bent, and incompletely unfolded, yellowish cotyledons.
[0030] Based on the above standards, staff members determined the viability level of each seed and labeled its corresponding RGB and hyperspectral images with either high or low viability classification tags.
[0031] S2. Convert the hyperspectral data cube of the hyperspectral image into a two-dimensional spectral data matrix to obtain the spectral curve corresponding to each seed sample; for the ... The seed, the first The spectral values for the band are calculated using the following formula: ; in Represents the total number of pixels. It represents the brightness value of a single pixel in a spectral image at a certain wavelength; A classification model is established by comparing the spectral curves with seed vigor labels, and the correlation coefficients of each hyperspectral band with seed vigor classification are calculated. The classification model can be any of the following: logistic regression, random forest, or one-dimensional convolutional neural network (1DCNN). The correlation coefficients are obtained through the feature importance or weight coefficients of the model. The focus is on wavelengths highly correlated with seed vigor, such as chlorophyll and water content (e.g., 650-750 nm chlorophyll-related wavelengths and near-infrared water-related wavelengths).
[0032] Brief explanation of the principle: The basis for predicting seed vigor using hyperspectral images is that the spectral characteristics of seeds reflect their physicochemical properties. Specifically, the 650–680 nm region is the chlorophyll a absorption peak, reflecting seed metabolic activity; the 680–750 nm region reflects chlorophyll content and cell structural integrity; and the near-infrared region reflects seed water content. Different seed varieties exhibit varying correlations with seed vigor across different frequency bands. Therefore, it is necessary to first identify the frequency bands with strong correlations to seed vigor, allowing subsequent models to focus on reconstructing these spectra.
[0033] S3. Construct a mapping model from RGB images to hyperspectral images to achieve accurate mapping and generation of RGB images to hyperspectral images; the specific operations are as follows: S31. Based on the mathematical relationship between the spectral responses of RGB images and hyperspectral images, determine the discretized expression for their mapping, and clarify the correspondence between each band of the RGB image and the hyperspectral image. The expression is as follows: ; in, Indicates the hyperspectral image at wavelength Spectral values at that location, This represents the Kth color channel (K∈{R,G,B}) of the camera with respect to wavelength. spectral response function; The process of generating an RGB image is as follows: ; Where K represents one of the corresponding items in {R,G,B}, representing the three color channels of the RGB image; Represents wavelength; This represents the wavelength intensity corresponding to the light source. Represents the reflectance of the seed; The response function of a pixel to the spectrum is used to characterize the absorption and reflection characteristics of a pixel to light of different wavelengths. The process of generating a hyperspectral image can be represented as: ; in, Represents wavelength; This represents the wavelength intensity corresponding to the light source. Represents the reflectance of the seed; Represents narrowband wavelength; S32. Build a neural network mapping model using the RGB image acquired in S11 ( IRGB ) as model input, with the corresponding hyperspectral image ( IHSIAs the model output, the collected one-to-one corresponding image dataset is used to train the neural network mapping model, so that the model gradually learns the mapping relationship from RGB image to hyperspectral image, and finally realizes the accurate generation from RGB image to hyperspectral image.
[0034] The neural network mapping model of the present invention can adopt any one of the following: U-NET encoder-decoder architecture, VisionTransformer model, or Generative Adversarial Network (GAN) model. The U-NET encoder-decoder architecture is preferred. It extracts the spatial and color features of the RGB image through the encoder, and gradually restores the resolution of the hyperspectral image through the decoder. Combined with skip connections, it preserves the image detail information and improves the reconstruction accuracy of the hyperspectral image.
[0035] S33. The model is trained using the large dataset of paired RGB-hyperspectral images collected in S11. After training, the neural network can be represented as a trainable mapping function: ; in, For a well-trained mapping neural network, Hyperspectral images generated for the model.
[0036] Brief explanation of the principle: RGB images consist of three broad bands: red, green, and blue, while hyperspectral images consist of hundreds of consecutive narrow bands. The essential relationship between the two is that "a weighted combination of narrow band spectral values corresponds to the color values of the broad bands," and the spectral response function is the quantitative representation of this weighted relationship. The mapping model built in this step essentially learns the inverse process of this weighted relationship through a data-driven (or physical model-constrained) approach. That is, it reverse-engineers the spectral values of each narrow hyperspectral band from the RGB broad band color values, thereby achieving the reconstruction of low-cost RGB images into high-cost hyperspectral images, providing accurate spectral data support for subsequent vitality prediction. It also provides two mapping schemes to adapt to different data conditions, improving the flexibility and practicality of the solution.
[0037] In some embodiments, when paired hyperspectral image training data is unavailable, an alternative solution combining a physical model and regularization is provided, which can achieve the mapping from RGB images to hyperspectral images without relying on a training dataset, as follows: When dealing with RGB image datasets containing only seeds, spectral reconstruction is the inverse problem of solving the aforementioned spectral response equation. Essentially, it is an ill-conditioned problem that can be constrained through regularization and prior knowledge.
[0038] Objective function construction: The objective is to find the most reasonable seed reflectance distribution. This minimizes the difference between the generated simulated RGB image and the real RGB image, while also satisfying the smoothness constraint. Its expression is: ; in, It is an RGB image composed of hyperspectral images generated by the forward model, which can be understood as... , It is the generated hyperspectral image. It is the regularization coefficient. It is a regularization term.
[0039] In the initial data acquisition and model building process, it is necessary to obtain prior conditions and measure the intensity distribution of the light source at different wavelengths. Calibrate the camera's pixel response function to the spectrum. Then, a physics-guided neural network model is constructed for training, or a physics-based Tikhonov regularization method is used.
[0040] S4. Optimize the loss function of the RGB-hyperspectral mapping model based on the correlation coefficient; specifically including: the correlation coefficient between the band and the activity obtained in S2. Two optimized loss functions were designed to guide the model to focus on key wavelengths first, thereby improving reconstruction accuracy and efficiency. (1) Full-band weighted loss function: The absolute value of the correlation coefficient of each hyperspectral band is used as the weight and incorporated into the basic loss function to increase the reconstruction priority of bands highly correlated with seed viability. At the same time, spectral response constraints are added to avoid spectral distortion. The optimized loss function expression is as follows: ; Where N is the total number of pixels in the hyperspectral image; Represents the absolute value of the correlation coefficient; This represents the actual hyperspectral image collected. For proportional weighting parameters; This indicates that the hyperspectral image generated by the mapping model is at wavelength Spectral values at; This indicates the wavelength of the camera's Kth color channel. spectral response function; (2) Loss function for key wavelength reconstruction: Select the key hyperspectral wavelengths with high correlation coefficients in S2 (such as the 650~750nm chlorophyll-related band and the near-infrared water-related band), and only allow the mapping model to predict these key wavelengths. The corresponding hyperspectral image does not require reconstruction of the entire spectral band, significantly reducing the computational load; the loss function then simplifies to: ; Where N is the total number of pixels in the hyperspectral image; Indicates the key hyperspectral wavelengths associated with high seed vigor; This represents the hyperspectral image corresponding to the key wavelength generated by the mapping model. This represents the hyperspectral image corresponding to the key wavelengths actually acquired. The optimized loss function is substituted into the mapping model of S3, and the model is trained again. During the training process, the model continuously adjusts its internal parameters based on the feedback of the loss function until the loss function value tends to stabilize (i.e., the model converges), and finally an RGB-hyperspectral mapping model that can accurately reconstruct key wavelength spectral information is obtained.
[0041] S5. Construct a seed vigor binary classification model that integrates the focus loss function, and use the hyperspectral image generated by the optimized mapping model to achieve accurate prediction of seed vigor; the specific steps are as follows: S51. Input the optimized mapping model from S3 into all the RGB images collected in S11 to generate the corresponding reconstructed hyperspectral images; use the reconstructed hyperspectral images as input data for the classification model, and use the seed viability labels (high viability / low viability) labeled in S12 as output labels to construct the training dataset for the classification model. S52. The binary classification model can employ any of the following: residual convolutional neural network, 3D-CNN spatial spectral network, or Vision Transformer model with fusion of 3D convolutional preprocessing. 3D-CNN spatial spectral network is preferred. Through 3D convolutional kernels, it simultaneously performs convolution operations on the spatial dimension (width, height) and spectral dimension (band) of the reconstructed hyperspectral image, which can directly extract the joint features of spatial and spectral features, and more accurately capture the correlation between seed spectral features and vitality level. The last layer of the model is set as a fully connected layer, which is used to map the extracted abstract features to the original score of the vitality category. To address the challenges of classifying highly viable seeds and the resulting low identification accuracy, this step employs the focus loss function as the training loss function for the classification model. Its expression is as follows: ; in, This represents the model's predicted probability of the true class. This represents the weighting coefficient, used to balance the importance of high and low activity categories; Indicates the modulation factor. Used to improve the loss contribution for hard-to-classify samples; when set When the model predicts a high probability (easily separable samples), this term value is small, and the loss is significantly reduced. For samples with low prediction probabilities (difficult-to-separate samples, i.e., those high-vibration seeds with ambiguous features and difficult to distinguish), the loss will be reduced through... Further amplification will force the model to spend more effort learning those high-viability seeds that are difficult to distinguish, thus potentially improving recall. When the value is greater than 0.5, the model tends to increase the loss weight of the high-vibrancy category, thereby improving the accuracy of high-vibrancy seed prediction.
[0042] Predicted probability The calculation process is as follows: After the binary classification model extracts features layer by layer from the input reconstructed hyperspectral image, it outputs the original score through a fully connected layer. The Sigmoid activation function is then used to map the original score to a prediction probability between 0 and 1. , representing the probability that the sample is a positive class;
[0043] in, Indicates sample The true labels (1 for high activity, 0 for low activity), The closer the value is to 1, the closer the predicted value is to the true label; the closer the value is to 0, the further the predicted value deviates from the true label.
[0044] In some embodiments, the focus loss function is replaced by the binary cross-entropy loss function commonly used in hyperspectral seed viability classification tasks, which is used as the optimization objective for model training. This loss function is suitable for binary classification scenarios involving high and low seed viability, and its mathematical form is defined as:
[0045] in, Indicates sample The true label (1 for high vitality, 0 for low vitality). To predict the probability that the sample belongs to the high-activity category for the model, The number of samples in the batch is denoted as . This loss function drives the model to learn to distinguish the spectral and spatial characteristics of the two seed classes by penalizing the difference between the predicted probability and the true label.
[0046] S6. Predict seed vigor; specific steps are as follows: S61. Acquire RGB image of the seed to be tested: Under the same lighting conditions as S11, use a common RGB imaging device (such as a mobile phone or a regular camera) to capture the RGB image of the seed to be tested, ensuring that the image is clear, unobstructed, and free of reflection, and avoiding the impact of environmental differences on prediction accuracy; S62. Hyperspectral Image Reconstruction: Input the acquired RGB image of the seed to be detected into the RGB-hyperspectral mapping model optimized in S4. The model outputs the corresponding reconstructed hyperspectral image, or outputs the reconstructed hyperspectral image of the key wavelength. S63. Viability Prediction: Input the reconstructed hyperspectral image into the seed viability binary classification model trained in S5. The model outputs the predicted probability p that the seed to be detected is highly viable through forward calculation. S64. Vigor level determination: Set a probability threshold (in some embodiments, the value is 0.5). If p ≥ probability threshold, the seed is determined to be a high-vigor seed; if p < probability threshold, the seed is determined to be a low-vigor seed, thus completing the vigor screening of the seed to be tested.
[0047] Brief explanation of the principle: The core logic of the prediction stage is to reuse the trained model to achieve rapid conversion from low-cost RGB images to viability results. Since the model has established the mapping relationship between RGB and hyperspectral images and the classification rules between hyperspectral images and viability during the training stage, only the RGB image of the seed to be detected needs to be input during prediction, and the model can automatically complete the judgment. No hyperspectral equipment or germination test is required, which realizes rapid, non-destructive, and low-cost detection of seed viability, which meets the needs of large-scale seed sorting in actual agricultural production.
[0048] The key technical points of this invention are: (1) The mapping technology from RGB images to hyperspectral images indirectly realizes the early screening of seed vigor from RGB to spectral images and then to seed vigor in a data-driven manner. This method significantly reduces the cost and time required for hyperspectral detection of seed vigor. (2) By pre-determining the correlation coefficient of hyperspectral frequency bands related to vigor, the correlation coefficient is incorporated into the targeted loss function during training to guide the model to focus on the reconstruction of key spectral regions. This is beneficial for reducing prediction time and simplifying the model, and is more conducive to actual seed screening. (3) The introduction of mechanisms such as the focus loss function into the loss function enhances the model's ability to identify high-vigor seeds and improves the prediction accuracy by adjusting the parameters of the focus loss function. This optimizes the quality of the seed population after screening and is more in line with the actual needs of agricultural production for high germination rate and seedling rate.
[0049] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this invention disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this invention can be achieved, and this is not limited herein.
[0050] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A seed vigor prediction method based on RGB images, characterized in that: Specifically, the steps include the following: S1. Simultaneously acquire RGB and hyperspectral images of seeds to establish a one-to-one image dataset; conduct a standard germination test on the seeds after image acquisition, classify the vigor level according to germination performance, and label the RGB and hyperspectral images with corresponding seed vigor labels; S2. Convert the hyperspectral data cube of the hyperspectral image into a two-dimensional spectral data matrix to obtain the spectral curve corresponding to each seed sample; use the spectral curve and seed vigor label to establish a classification model and calculate the correlation coefficient of each hyperspectral band with seed vigor classification. S3. Construct a mapping model from RGB images to hyperspectral images to realize the mapping from RGB images to hyperspectral images; S4. Optimize the loss function of the mapping model in step S3 based on the correlation coefficient obtained in step S2, and train until the model converges to obtain the RGB-hyperspectral mapping model; S5. Construct a seed viability binary classification model with fused loss function, and train the model using the hyperspectral image generated by the mapping model optimized in S4 to obtain the seed viability classification model; S6. Input the RGB image of the seed to be detected into the RGB-hyperspectral mapping model and the seed vigor binary classification model in sequence, and output the seed vigor prediction result.
2. The seed vigor prediction method based on RGB images according to claim 1, characterized in that: Step S1 involves simultaneously acquiring RGB and hyperspectral images of the seeds under the same lighting conditions. Vigor levels include high vigor and low vigor. High vigor seeds reach the germination standard within 24-48 hours, and the germination is uniform. Seedlings with strong radicles that elongate rapidly, upright hypocotyls, and fully unfolded cotyledons with a bright green color are exhibited. Low vigor seeds take more than 3 days to reach the germination standard, and the germination process is uneven. Seedlings with weak radicles, slow growth, deformities or curvature, and incompletely unfolded cotyledons with a yellowish color are exhibited.
3. The seed vigor prediction method based on RGB images according to claim 1, characterized in that: In step S2, the first The seed, the first The spectral values for the band are calculated using the following formula: ; in Represents the total number of pixels. It represents the brightness value of a single pixel in a spectral image at a certain wavelength; The classification model can be any one of the following: logistic regression model, random forest model, or one-dimensional convolutional neural network model.
4. The seed vigor prediction method based on RGB images according to claim 1, characterized in that: The specific steps in step S3 of constructing the mapping model from RGB image to hyperspectral image include: S31. Based on the mathematical relationship between the spectral responses of RGB and hyperspectral images, determine the discretized expression for their mapping: ; in, This represents the pixel value of the Kth color channel in an RGB image. Indicates the hyperspectral image at wavelength Spectral values at that location, This indicates the wavelength of the camera's Kth color channel. spectral response function; S32. Build a neural network mapping model, using the RGB image collected in S11 as input and the corresponding hyperspectral image as output, and train the model using the image dataset so that the model learns the mapping relationship from RGB image to hyperspectral image. S33. After training, the neural network mapping function is obtained: ; in, For a well-trained mapping neural network, Hyperspectral images generated for the model.
5. The seed vigor prediction method based on RGB images according to claim 4, characterized in that: The neural network mapping model in step S32 can be any one of the U-NET encoder-decoder architecture, the Vision Transformer model, or the generative adversarial network model.
6. The seed vigor prediction method based on RGB images according to claim 1, characterized in that: The optimized loss function in step S4 is a full-band weighted loss function: ; Where N is the total number of pixels in the hyperspectral image; Represents the absolute value of the correlation coefficient; This represents the actual hyperspectral image collected. For proportional weighting parameters; This indicates that the hyperspectral image generated by the mapping model is at wavelength Spectral values at; This indicates the wavelength of the camera's Kth color channel. spectral response function; Or the loss function for key wavelength reconstruction: ; Where N is the total number of pixels in the hyperspectral image; Indicates the key hyperspectral wavelengths associated with high seed vigor; This represents the hyperspectral image corresponding to the key wavelength generated by the mapping model. This represents the hyperspectral image corresponding to the key wavelengths actually acquired.
7. The seed vigor prediction method based on RGB images according to claim 1, characterized in that: The binary classification model in step S5 can be any one of the following: residual convolutional neural network, 3D-CNN spatial spectral network, or Vision Transformer model with fusion three-dimensional convolutional preprocessing.
8. The seed vigor prediction method based on RGB images according to claim 7, characterized in that: The loss function is the focus loss function, and its expression is: ; in, This represents the model's predicted probability of the true class. Indicates the weighting coefficient; This represents the modulation factor.
9. The seed vigor prediction method based on RGB images according to claim 2, characterized in that: The loss function in step S5 is the binary cross-entropy loss function, expressed as follows: in, Indicates sample The true labels are marked as 1 for high activity and 0 for low activity; To predict the probability that the sample belongs to the high-activity category for the model; This represents the number of samples in the batch.
10. The seed vigor prediction method based on RGB images according to claim 1, characterized in that: The specific process for seed vigor prediction in step S6 is as follows: S61. Under the same lighting conditions as in step S1, acquire the RGB image of the seed to be detected using a common RGB imaging device; S62. Input the RGB image into the RGB-hyperspectral mapping model and output the reconstructed hyperspectral image; S63. Input the reconstructed hyperspectral image into the trained seed viability binary classification model, and output the predicted probability p that the seed to be detected is highly viable; S64. Set a probability threshold. If p ≥ the probability threshold, it is determined to be a high-viability seed. If p < the probability threshold, it is determined to be a low-viability seed.