Coarse cereal quality evaluation method and system based on characteristic spectrum
By combining the spectral extreme attenuation index and width index with machine learning model, the spectrum changes in the quinoa surface are captured, and the Bayesian optimization algorithm is used to dynamically adjust the light emission time, which solves the problem of insufficient reflection caused by the oxide layer and achieves mildew Accurate detection and efficient evaluation.
Patent Information
- Application Number
- CN202411555994.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-02-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When existing hyperspectral imagers detect quinoa mold, due to insufficient reflection caused by the oxide layer, the detection result accuracy is reduced, especially in the mild mold stage, which is difficult to identify.
The spectral changes in the quinoa surface are captured through the spectral extreme attenuation index and the spectral width index, and combined with the machine learning model to generate spectral characteristic change coefficients to achieve accurate judgments on different degrees of mildew. In response to insufficient reflection caused by the oxide layer, Bayesian optimization algorithm is used to dynamically adjust the light emission time to ensure reliable spectral information is obtained.
Accurate judgment of mildew of varying degrees is achieved, the accuracy and sensitivity of detection is improved, and it can identify and avoid the aggravation of mildew in the early stages of mildew, which improves the timeliness and accuracy of detection.
Smart Images

Figure CN119438097A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of coarse grain quality evaluation, and in particular to a coarse grain quality evaluation method and system based on characteristic spectrum. Background Art
[0002] The quality evaluation of grains based on characteristic spectra is a modern detection method that uses spectral analysis technology to evaluate the quality of grains by extracting characteristic spectral information of grains in specific light bands. This method uses the absorption and reflection characteristics of different grains in different light bands to obtain their characteristic spectra, that is, spectral data at each wavelength. By analyzing these data, the content of grain ingredients (such as protein, starch, moisture, etc.) and potential changes in physical and chemical properties, such as mildew, excessive moisture content, impurities, etc., can be revealed. Spectroscopic technology can achieve rapid and non-destructive grain quality detection.
[0003] Hyperspectral imagers are used in the quality evaluation of grains based on characteristic spectra. A hyperspectral imager is a device that can capture images at multiple wavelengths (usually hundreds of narrow bands). It not only records the spatial information of objects, but also captures the spectral data of each pixel in different spectral bands to generate hyperspectral images. This instrument can reveal the tiny spectral differences in samples in detail, making it suitable for detailed analysis in the quality evaluation of grains, such as detecting the distribution of grain components, surface mildew, the presence of impurities, etc., to help achieve more accurate non-destructive testing and quality grading.
[0004] The prior art has the following deficiencies:
[0005] Existing hyperspectral imagers usually detect whether quinoa is moldy by emitting light in a specific band for a fixed duration, which can meet basic needs in most cases. However, quinoa that has been stored for a long time and in a high humidity or high temperature environment may form an oxide layer on the surface, which reduces the reflectivity and causes insufficient reflection of light in a specific band. In this case, continuing to use fixed-duration illumination may lead to serious consequences. The oxide layer may mask the spectral characteristics of varying degrees of mold, significantly reducing the accuracy of the test results. Especially for slightly moldy quinoa, the oxide layer will cover up the subtle spectral changes of the early mildew, making it difficult to identify early mildew. It is not discovered until the mildew worsens, missing the best time to deal with it.
[0006] The above information disclosed in this Background section is only for enhancement of understanding of the background of the present disclosure and therefore it may contain information that does not constitute the prior art that is already known to one of ordinary skill in the art. Summary of the invention
[0007] The purpose of the present invention is to provide a method and system for evaluating the quality of grains based on characteristic spectra, which captures the spectral changes on the surface of quinoa through the spectral extreme value attenuation index and the spectral width index, and generates the spectral characteristic variation coefficient in combination with the machine learning model to achieve accurate judgment of different degrees of mildew. In view of the insufficient reflection caused by the oxide layer, the light emission duration is dynamically adjusted based on the Bayesian optimization algorithm to ensure the acquisition of reliable spectral information, improve adaptability and detection accuracy. In a complex environment, the system can stably and accurately identify mildew, avoid delays, and provide high-quality data for the evaluation of grain quality to solve the problems in the above-mentioned background technology.
[0008] In order to achieve the above object, the present invention provides the following technical solution: a method for evaluating the quality of grains based on characteristic spectrum, comprising the following steps:
[0009] A hyperspectral imager is used to emit light of a specific wavelength to the surface of quinoa, and collect spectral data reflected from the surface of quinoa;
[0010] Feature extraction is performed on the acquired quinoa surface spectral data to capture the significant spectral features of the quinoa surface in different bands. Based on the extracted feature data, the change state of the quinoa surface is intelligently evaluated through a pre-learned machine learning model;
[0011] Based on the evaluation results of the machine learning model, the surface features of quinoa are divided into normal surface features and abnormal surface features;
[0012] According to the spectral data of normal surface characteristics, the standard emission duration of light in a specific band is set to ensure that the spectral reflectance information of the normal area can be fully collected;
[0013] For abnormal surface features detected, based on the changes in surface reflection, a Bayesian optimization algorithm is used to dynamically adjust the light emission duration in a specific band based on the standard emission duration.
[0014] Preferably, feature extraction is performed on the acquired quinoa surface spectral data, and the extracted features include the reflection intensity attenuation trend and specific spectral peak width of the sample surface to light of a specific wavelength band. After acquisition, the reflection intensity attenuation trend and specific spectral peak width of the sample surface to light of a specific wavelength band are analyzed under the detection window, and a spectral extreme value attenuation index and a spectral width index are generated respectively. The spectral extreme value amplitude index and the spectral width index are input into a pre-learned machine learning model, and a spectral feature variation coefficient is generated by the machine learning model. The spectral variation coefficient is used to perform an intelligent evaluation of the change in the quinoa surface spectral data.
[0015] Preferably, in the detection window, the specific steps of analyzing the attenuation trend of the reflection intensity of the sample surface to the light of a specific wavelength band and generating the spectral extreme value attenuation index are as follows:
[0016] In the detection window, the reflection intensity R(t) of a specific band λ on the sample surface is collected to obtain the reflection intensity sequence at different time points, and the reflection intensity attenuation rate of the specific band λ at different time points is calculated. The calculation expression is as follows:
[0017] ,
[0018] Where D λ is the reflection intensity attenuation rate of a specific band λ, α is the attenuation factor, R(t next ) represents the reflection intensity collected at the next moment, R(t prev ) represents the reflection intensity at the previous time point, t next -t prev Indicates the time interval between two acquisition moments;
[0019] The attenuation trend weighting function is used to describe the cumulative impact of reflection intensity attenuation at different time points on the index. The calculation expression is as follows:
[0020] W λ =Π(1+γ·|R(t next )-R(t prev )| β ),
[0021] Where W λ is the weighted function of the attenuation trend of a specific band λ, γ is the weighting coefficient, and β is the nonlinear adjustment parameter;
[0022] The reflection intensity attenuation rate D of a specific band λ λ and the attenuation trend weighting function W of a specific band λ λ , generate the spectrum extreme value attenuation index, the calculation expression is as follows:
[0023] ,
[0024] Where SPAI is the spectral extreme attenuation index.
[0025] Preferably, in the detection window, the specific spectral peak width is analyzed to generate the spectral width index in the following specific steps:
[0026] Under the detection window, the spectral data of the quinoa surface is obtained by a hyperspectral imager to form a spectral matrix, which is calibrated as S, where S = {P k}={P1, P2, P3,...,P n}, where P k represents the reflectivity of the kth wavelength, and n is the total number of wavelengths;
[0027] Use the peak detection algorithm to identify the spectral peak and determine the peak and its position. The calculation expression is as follows:
[0028] P={(x m , P max ): P max =max(P k )fork∈I}
[0029] , where P is the information set of the spectral peak, x m is the peak wavelength of the spectral peak, that is, the maximum reflectivity P achieved in the spectral peak max The wavelength at the time, I represents the wavelength index set around the peak;
[0030] Calculate the half-height width of the spectral peak width, the calculation expression is as follows: W = x high -x low , where W is the half-height width of the spectral peak width, x high The half-maximum reflectivity P in the spectrum half The highest wavelength position at x low The half-maximum reflectivity P in the spectrum half The lowest wavelength position at half-height reflectivity P half is the maximum reflectance of the spectral peak P max half of , that is:
[0031] In spectral analysis, reflection energy is an important parameter to measure the reflection performance of the material surface. The calculation expression is as follows:
[0032] ,
[0033] Where E is the reflected energy;
[0034] The half-width W of the spectral peak width and the maximum reflectivity P achieved in the spectral peak max And the reflected energy E, generate the spectrum width index, the calculation expression is as follows:
[0035] ,
[0036] Where SBI is the spectral width index.
[0037] Preferably, the spectral feature variation coefficient generated after analyzing the quinoa surface spectral data is compared and analyzed with a preset spectral feature variation coefficient reference threshold, and the quinoa surface features are divided, and the division steps are as follows:
[0038] If the spectral feature variation coefficient is greater than or equal to a preset spectral feature variation coefficient reference threshold, the quinoa surface feature is classified as an abnormal surface feature;
[0039] If the spectral feature variation coefficient is less than a preset spectral feature variation coefficient reference threshold, the quinoa surface feature is classified as a normal surface feature.
[0040] Preferably, for the detected abnormal surface features, based on the surface reflection change, a Bayesian optimization algorithm is used to dynamically adjust the light emission duration of a specific band on the basis of the standard emission duration as follows:
[0041] The emission duration under normal surface features is calibrated as T std , T std That is, the standard launch duration, and around the standard launch duration T std Set the upper and lower range of the transmission duration [T nin , T max ] to allow Bayesian optimization to explore and adjust within this range, T min is the lower limit of the launch duration, T max It is the upper limit of the launch duration;
[0042] Define the objective function. The objective of the objective function is to maximize the quality of the reflected signal. The calculation expression is as follows: f(T) = -(SPAI(T) + SBI(T)), where SPAI(T) represents the attenuation degree of the spectrum peak when the emission time is T, SBI(T) represents the width of the spectrum peak when the emission time is T, and f(T) is the objective function.
[0043] In the range of emission duration [T min , T max ], randomly collect several emission durations within the range, calibrate the collected emission duration as T1, and collect the corresponding spectral extreme attenuation index SPAI and spectral width index SBI under the obtained emission durations to calculate the objective function f(T), where T i ={T1, T2, T3, ..., T n}, n is the total number of emission durations obtained, f(T) = {f(T i )}={f(T1), f(T2),..., f(T n )},f(T i ) is the output result of the objective function under the condition of the i-th launch duration, and records the output result of the objective function under all launch duration conditions f(T i ) to form a data set for building a Bayesian optimization model;
[0044] Using the collected data set f(T i ) train a Gaussian process model, model the relationship between the transmission time T and the objective function f(T) through the Gaussian process model, and obtain the predicted probability distribution of the transmission time on the quality of the reflected signal;
[0045] Based on the Gaussian process model, a collection function is calculated to select the optimal next launch duration. The calculation expression is as follows:
[0046] ,
[0047] Where, T next is the next launch duration selected by Bayesian optimization, that is, the candidate launch duration currently considered to be the best. EI(T) is the expected improvement function, which is an acquisition function in Bayesian optimization.
[0048] At the latest launch time T next Collect data and calculate the latest launch time T selected by the objective function in the Bayesian optimization process next The value below is calculated as follows:
[0049] f(T next )=-(SPAI(T next )+(SBI(T next )),
[0050] In the formula, f(T next ) is the latest launch duration selected by the objective function during the Bayesian optimization process;
[0051] The latest emission duration f(T next ) is added to the data set, and the Gaussian process model is updated. The optimal next launch time selected by Bayesian optimization and the latest launch time selected in the Bayesian optimization process are repeated until the improvement of the acquisition function is lower than the preset threshold. At this time, Topt is the optimized launch time.
[0052] A grain quality evaluation system based on characteristic spectrum includes a spectrum data acquisition module, a feature extraction and intelligent analysis module, a surface feature classification module, a standard duration setting module and a dynamic emission duration optimization module:
[0053] The spectral data acquisition module uses a hyperspectral imager to emit light of a specific wavelength to the surface of quinoa and collect spectral data reflected from the surface of quinoa;
[0054] The feature extraction and intelligent analysis module extracts features from the acquired quinoa surface spectral data, captures the significant spectral features of the quinoa surface in different bands, and intelligently evaluates the surface change state of quinoa through a pre-learned machine learning model based on the extracted feature data;
[0055] The surface feature classification module divides the surface features of quinoa into normal surface features and abnormal surface features based on the evaluation results of the machine learning model;
[0056] The standard duration setting module sets the standard emission duration of light in a specific wavelength band according to the spectral data of normal surface characteristics to ensure that the spectral reflection information of the normal area can be fully collected;
[0057] The dynamic emission duration optimization module uses a Bayesian optimization algorithm to dynamically adjust the light emission duration of a specific band based on the standard emission duration for detected abnormal surface features and based on changes in surface reflection.
[0058] In the above technical solution, the technical effects and advantages provided by the present invention are:
[0059] The present invention comprehensively captures the spectral change characteristics of the quinoa surface through the spectral extreme value attenuation index and the spectral width index. This method can not only reveal the overall spectral feature attenuation caused by the oxide layer, but also generate the spectral feature variation coefficient through the machine learning model to make accurate judgments on different degrees of mildew. Especially in the mildew stage, this scheme enables the machine learning model to keenly detect early mildew by analyzing subtle spectral attenuation and peak width changes. Compared with the traditional fixed-duration illumination scheme, this method greatly improves the accuracy and sensitivity of mildew detection, helps to identify it in the early stage of mildew, avoids the aggravation of mildew, and improves the timeliness and accuracy of detection.
[0060] The present invention aims to address the problem of insufficient spectral reflection that may be caused by the oxide layer, and dynamically adjusts the light emission duration of the abnormal surface feature area. Based on the Bayesian optimization algorithm, the emission duration can be adjusted according to the real-time reflection changes on the basis of the standard emission duration, so that the spectral data can more accurately reflect the characteristics of the abnormal area. This optimization scheme can not only penetrate the oxide layer to ensure the acquisition of reliable spectral information, but also significantly improve the adaptability of the detection. Unlike traditional fixed illumination schemes, this dynamic emission duration optimization process avoids the lack or distortion of spectral information, ensuring high-quality data collection and grain quality evaluation. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0063] Figure 1 The present invention is a method flow chart of a method for evaluating the quality of grains based on characteristic spectrum.
[0064] Figure 2The module diagram of a system for evaluating the quality of grains based on characteristic spectrum of the present invention is shown in FIG. DETAILED DESCRIPTION
[0065] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these example embodiments are provided so that the description of the present disclosure will be more comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art.
[0066] The present invention provides Figure 1 A method for evaluating the quality of grains based on characteristic spectra is shown, comprising the following steps:
[0067] A hyperspectral imager is used to emit light of a specific wavelength to the surface of quinoa, and collect spectral data reflected from the surface of quinoa;
[0068] A hyperspectral imager emits light of a specific wavelength to the surface of quinoa, and uses its reflection, absorption or scattering characteristics of light of different wavelengths to collect spectral data reflected from the surface of quinoa. After the light source of the hyperspectral imager is irradiated on the surface of quinoa, different parts of the surface of quinoa will produce different reflectivities to light of a specific wavelength according to their composition and state, forming unique spectral characteristics. After the detector in the instrument captures these reflected lights, it converts them into spectral data, providing a basis for further analysis of the surface state of quinoa and quality testing.
[0069] Feature extraction is performed on the acquired quinoa surface spectral data to capture the significant spectral features of the quinoa surface in different bands. Based on the extracted feature data, the change state of the quinoa surface is intelligently evaluated through a pre-learned machine learning model;
[0070] The acquired quinoa surface spectral data is subjected to feature extraction, and the extracted features include the reflection intensity attenuation trend and the specific spectral peak width of the sample surface to the light of a specific wavelength band. After acquisition, the reflection intensity attenuation trend and the specific spectral peak width of the sample surface to the light of a specific wavelength band are analyzed under the detection window, and a spectral extreme value attenuation index and a spectral width index are generated respectively. The spectral extreme value amplitude index and the spectral width index are input into a pre-learned machine learning model, and a spectral feature variation coefficient is generated through the machine learning model. The spectral variation coefficient is used to intelligently evaluate the variation of the quinoa surface spectral data;
[0071] When the reflection intensity of the sample surface to light in a specific band shows a weakening trend, it usually indicates that the quinoa surface may be in an abnormal state, such as oxidation or mold. This attenuation trend reflects that the surface characteristics of quinoa have changed, usually due to the formation of an oxide layer or the growth of mold, which causes the reflectivity of light in a specific band to decrease. The oxide layer will make the surface of quinoa rough or form tiny light-absorbing substances, thereby reducing the ability to reflect light; mold will produce metabolites or attachments, further weakening the reflection of light. As a result, the hyperspectral imager cannot obtain sufficient spectral peak intensity, resulting in extreme attenuation of the reflected signal. Because the reduction of the spectral peak is often a direct indication of changes in the chemical or physical properties of the surface, this reflection attenuation is one of the important signs for identifying abnormalities on the quinoa surface.
[0072] Under the detection window, the reflection intensity attenuation trend of the sample surface to the light of a specific wavelength is analyzed, and the specific steps to generate the spectral extreme value attenuation index are as follows:
[0073] In the detection window, the reflection intensity R(t) of a specific band λ on the sample surface is collected to obtain the reflection intensity sequence at different time points, and the reflection intensity attenuation rate of the specific band λ at different time points is calculated. The calculation expression is as follows:
[0074] ,
[0075] Where D λ is the reflection intensity decay rate of a specific band λ, indicating the change trend of the reflection intensity of the sample in this band over time. α is the decay factor, which is used to control the decay speed of the exponential term. R(t next ) represents the reflection intensity collected at the next moment, R(t prev ) represents the reflection intensity at the previous time point, t next -t prev Indicates the time interval between two acquisition moments;
[0076] The attenuation trend weighting function is used to describe the cumulative impact of reflection intensity attenuation at different time points on the index. The calculation expression is as follows:
[0077] W λ =Π(1+γ·|R(t next )-R(t prev )| β ),
[0078] Where W λ is a weighted function of the attenuation trend of a specific band λ, reflecting the cumulative effect of changes in reflection intensity, γ is a weighting coefficient used to control the influence of the attenuation amplitude on the weight, and β is a nonlinear adjustment parameter to adjust the nonlinear effect of changes in reflection intensity;
[0079] The attenuation trend weighting function is used to quantify and adjust the impact of reflection intensity changes at different time points on the final attenuation index in the calculation of the spectral extreme value attenuation index. This weighting function takes into account the reflection intensity change amplitude collected at different times and converts the reflection change trend into a weight, thereby more flexibly reflecting the state of the sample surface.
[0080] Here, the role of the attenuation trend weighting function is mainly in the following aspects:
[0081] 1. Highlight the impact of significant changes: The weighting function gives higher weights to time points where the reflection intensity changes significantly. This helps highlight moments when the reflection intensity drops rapidly, allowing the formula to more sensitively detect surface anomalies, such as reflection attenuation caused by oxidation or mildew.
[0082] 2. Balance the impact of small changes: If the change in reflection intensity is small, the weighting function will reduce the weight of these time points, thereby reducing the impact on the overall attenuation index. This can avoid the interference of small fluctuations on the attenuation index, making the attenuation trend more representative of the actual surface state changes.
[0083] 3. Provide cumulative effect: The attenuation trend weighted function is calculated cumulatively. Over time, it can integrate the changes in reflection intensity at different time points to provide more comprehensive information for the overall attenuation trend. This cumulative effect can help identify patterns of long-term surface changes, rather than just fluctuations at a single moment.
[0084] The attenuation trend weighting function assigns appropriate weights to each time point, so that when calculating the spectral extreme attenuation index, the characteristics of the surface reflectance change can be captured more accurately, thereby more effectively detecting the abnormal state of the surface.
[0085] The reflection intensity attenuation rate D of a specific band λ λ and the attenuation trend weighting function W of a specific band λ λ , generate the spectrum extreme value attenuation index, the calculation expression is as follows:
[0086] ,
[0087] Where, SPAI is the spectral extreme attenuation index;
[0088] Under the detection window, the larger the value of the spectral extreme attenuation index generated after analyzing the attenuation trend of the reflection intensity of light in a specific band on the sample surface, the more abnormal it usually indicates that there is an abnormality on the quinoa surface, such as an oxide layer or mildew. This is because oxidation or mildew will cause the surface reflectivity to decrease, weakening the reflection of light in a specific band, resulting in a significant attenuation of the spectral extreme value, which is manifested as a larger spectral extreme attenuation index value. When the spectral extreme attenuation index value is small, it means that the reflection intensity of light in this band is less attenuated, indicating that the quinoa surface reflectivity is good and there is no significant abnormality, reflecting that it is in a normal state.
[0089] The increase in the width of a specific spectral peak usually indicates that the quinoa surface may be in an abnormal state, such as the formation of an oxide layer or the influence of mold. The width of the spectral peak reflects the distribution of the spectral characteristics of the sample in this band. Under normal circumstances, the spectral peak is sharp, indicating that the reflection and absorption characteristics of light are clear. However, when the surface of quinoa changes, such as the formation of an oxide layer, the chemical composition and structure of the surface material change, which will cause the width of the spectral peak to increase. The increase in width means that the dispersion of the spectral signal is enhanced, which is usually due to the combined effect of multiple factors, such as increased surface roughness, enhanced light scattering effects, and possible interactions between different substances. These changes affect the reflection efficiency of light and reduce the reflectivity of specific bands, which is manifested as an expansion of the peak width in spectral analysis. Therefore, the increase in the width of the spectral peak not only indicates that the physical and chemical properties of the quinoa surface have changed, but also suggests potential quality problems, such as oxidation or mold.
[0090] Under the detection window, the specific steps for analyzing the specific spectral peak width and generating the spectral width index are as follows:
[0091] Under the detection window, the spectral data of the quinoa surface is obtained by a hyperspectral imager to form a spectral matrix, which is calibrated as S, where S = {P k}={P1, P2, P3,...,P n}, where P k represents the reflectivity of the kth wavelength, and n is the total number of wavelengths;
[0092] Use the peak detection algorithm to identify the spectral peak and determine the peak and its position. The calculation expression is as follows:
[0093] P={(x m , P max ): P max =max(P k )fork∈I}
[0094] , where P is the information set of the spectral peak, including the peak position and peak intensity, and x m is the peak wavelength of the spectral peak, that is, the maximum reflectivity P achieved in the spectral peakmax The wavelength at the time, I represents the wavelength index set around the peak value, through which the maximum value detection of the spectral peak in a specific wavelength range can be determined;
[0095] Calculate the half-height width of the spectral peak width, the calculation expression is as follows: W = x high -x low , where W is the half-height width of the spectral peak width, x high The half-maximum reflectivity P in the spectrum half The highest wavelength position at x low The half-maximum reflectivity P in the spectrum half The lowest wavelength position at half-height reflectivity P half is the maximum reflectance of the spectral peak P max half of , that is:
[0096] The Full Width at Half Maximum (FWHM) of the spectral peak width refers to the width of the spectral peak at half of its maximum intensity, indicating the distance between the corresponding wavelengths on both sides of the spectrum when the peak intensity drops from the peak to half. The half-width provides a quantitative way to describe the "width" or "extent" of the spectral peak. In spectral analysis, FWHM is often used to measure the sharpness of the spectral peak: the narrower the peak, the smaller the FWHM; the wider the peak, the larger the FWHM.
[0097] The role of half-width is to help us understand the shape and distribution characteristics of the spectral peak, thereby indirectly reflecting the physical or chemical state of the sample. For example, in quinoa quality testing, if the half-width of the spectral peak increases, it may indicate that there is an oxide layer or mold on the surface, because these changes will cause the diffusion of spectral reflectivity and the dispersion of signals. By observing the changes in half-width, it is possible to quickly determine whether there is an abnormality in the sample, so half-width is a very important indicator in spectral analysis.
[0098] In spectral analysis, reflection energy is an important parameter to measure the reflection performance of the material surface. The calculation expression is as follows:
[0099] ,
[0100] Where E is the reflected energy;
[0101] Reflected energy refers to a quantitative indicator of the ability of a material surface to reflect incident light within a specific wavelength range, usually expressed in the form of reflectivity. It is obtained by calculating the sum of the squares of the reflectivity of each wavelength in the spectral data, and can fully reflect the reflective characteristics of the surface. In the quality inspection of quinoa, the role of reflected energy is crucial, as it helps identify the health status and potential abnormalities of the surface. When the reflected energy is high, it indicates that the surface is smooth and free of oxidation or mold, while lower reflected energy may indicate defects on the surface, thus providing a scientific basis for subsequent quality assessment and processing decisions. Therefore, reflected energy is not only a key parameter for evaluating surface status, but also an important tool for monitoring and maintaining product quality.
[0102] The half-width W of the spectral peak width and the maximum reflectivity P achieved in the spectral peak max And the reflected energy E, generate the spectrum width index, the calculation expression is as follows:
[0103] ,
[0104] Where SBI is the spectral width index;
[0105] Under the detection window, the larger the spectral width index performance value generated after analyzing the width of a specific spectral peak, it usually means that the width of the spectral peak has increased, which indicates that the quinoa surface may be in an abnormal state. When an oxide layer forms on the surface of quinoa or mold occurs, the reflection characteristics of light will be affected, causing the spectral peak in a specific band to become wider. This change means that the characteristics of the spectral signal become blurred, possibly due to increased scattering and absorption of light, making the originally clear spectral characteristics unable to accurately reflect the health of the surface. On the contrary, a smaller spectral width index performance value means that the spectral peak is more concentrated, indicating that the quinoa surface is in good condition and the reflection characteristics remain stable.
[0106] The machine learning model is not limited here, and any machine learning model that can perform a comprehensive analysis on the spectral extreme attenuation index SPAI and the spectral width index SBI to generate the spectral characteristic variation coefficient SCVC is acceptable. To implement the technical solution of the present invention, the present invention provides a specific implementation method;
[0107] The calculation formula for the spectral characteristic variation coefficient SCVC is as follows:
[0108] ,
[0109] Wherein, f1 and f2 are preset proportional coefficients of the spectral extreme attenuation index SPAI and the spectral width index SBI, and both f1 and f2 are greater than 0.
[0110] It can be seen from the calculation expression of the spectral characteristic variation coefficient that, under the detection window, the larger the spectral extreme attenuation index expression generated after analyzing the attenuation trend of the reflection intensity of light in a specific band on the sample surface, the larger the spectral width index expression value generated after analyzing the specific spectral peak width, that is, the larger the spectral characteristic variation coefficient expression value generated under the detection window, indicating that there is an abnormality on the quinoa surface, otherwise, it indicates that there is no abnormality on the quinoa surface.
[0111] Based on the evaluation results of the machine learning model, the surface features of quinoa are divided into normal surface features and abnormal surface features;
[0112] The spectral feature variation coefficient generated after analyzing the quinoa surface spectral data is compared with the preset spectral feature variation coefficient reference threshold, and the quinoa surface features are divided. The division steps are as follows:
[0113] If the spectral feature variation coefficient is greater than or equal to a preset spectral feature variation coefficient reference threshold, the quinoa surface feature is classified as an abnormal surface feature;
[0114] If the spectral feature variation coefficient is less than a preset spectral feature variation coefficient reference threshold, the quinoa surface feature is classified as a normal surface feature;
[0115] Normal surface characteristics represent a surface without an oxide layer or mildew, while abnormal surface characteristics may include an oxide layer, areas of mildew, or surface damage.
[0116] According to the spectral data of normal surface characteristics, the standard emission duration of light in a specific band is set to ensure that the spectral reflectance information of the normal area can be fully collected;
[0117] This standard duration is the benchmark parameter for detection and is used for routine detection of areas without oxidation or mold. Under a fixed standard duration, the quinoa surface is dynamically monitored and spectral data is continuously acquired. If the surface state changes, it is determined whether the emission duration needs to be extended based on the change to ensure the accuracy of detection of abnormal surface features.
[0118] For abnormal surface features detected, based on the change in surface reflection, a Bayesian optimization algorithm is used to dynamically adjust the light emission duration of a specific band on the basis of the standard emission duration;
[0119] For abnormal surface features detected, based on the surface reflection changes, the Bayesian optimization algorithm is used to dynamically adjust the light emission duration of a specific band based on the standard emission duration. The steps are as follows:
[0120] The emission duration under normal surface features is calibrated as T std , T std That is, the standard launch duration, and around the standard launch duration Tstd Set the upper and lower range of the transmission duration [T min , T max ] to allow Bayesian optimization to explore and adjust within this range, T min is the lower limit of the launch duration, T max It is the upper limit of the launch duration;
[0121] Define the objective function. The objective of the objective function is to maximize the quality of the reflected signal, that is, to reduce noise and enhance the ability to detect abnormal features. The calculation expression is as follows: f(T) = -(SPAI(T) + SBI(T)), where SPAI(T) represents the attenuation degree of the spectrum peak when the emission time is T, SBI(T) represents the width of the spectrum peak when the emission time is T, and f(T) is the objective function.
[0122] The launch duration T is obtained by using the Bayesian optimization algorithm within a certain range [T min , T max ] is dynamically adjusted. First, the standard transmission time T std As the initial reference value, an optimization interval is defined. The Bayesian optimization algorithm constructs a Gaussian process model through the initial sampling of several emission duration values and their corresponding spectral signal feedback to predict the spectral signal quality under different emission durations. Then, the algorithm evaluates each possible emission duration based on the acquisition function (such as the expected improvement function) and selects the optimal next T value for the experiment. As the iteration proceeds, the emission duration T will gradually converge to an optimal value to ensure the best spectral signal quality under abnormal surface features.
[0123] The objective function is a mathematical expression used to measure the quality of each candidate solution in the optimization problem, and defines the goal pursued by the optimization algorithm. In spectral detection problems, the objective function is usually used to quantify the relationship between the emission duration T and the quality of the spectral signal. For example, the objective function can be used to evaluate the comprehensive performance of the spectral extreme decay index and the spectral width index under each emission duration to determine whether the emission duration helps to clearly identify abnormal surface features. Bayesian optimization finds the optimal solution by continuously adjusting the emission duration to minimize or maximize the objective function value. Therefore, the objective function plays a guiding role in the optimization process, helping the algorithm converge towards the optimal solution.
[0124] In the range of emission duration [T min , T max ] randomly collects several emission durations within the range, and calibrates the collected emission durations as T i, and collect the corresponding spectral extreme attenuation index SPAI and spectral width index SBI under the obtained emission durations to calculate the objective function f(T), where T i ={T1, T2, T3, ..., T n}, n is the total number of emission durations obtained, f(T) = {f(T i )}={f(T1), f(T2),..., f(T n )},f(T i ) is the output result of the objective function under the condition of the i-th launch duration, and records the output result of the objective function under all launch duration conditions f(T i ) to form a data set for building a Bayesian optimization model;
[0125] Using the collected data set f(T i ) train a Gaussian process model, model the relationship between the transmission time T and the objective function f(T) through the Gaussian process model, and obtain the predicted probability distribution of the transmission time on the quality of the reflected signal;
[0126] The Gaussian model, which usually refers to the Gaussian process (GP) in Bayesian optimization, is a probability model based on normal distribution, which can effectively describe the distribution of functions. The Gaussian process predicts the distribution of function values at each input point, such as the mean and variance of different launch durations T. Here, the role of the Gaussian process is to build a model to estimate the value and uncertainty of the objective function f(T) under different launch durations T. Through this model, Bayesian optimization can effectively select candidate values for the launch duration, balance the exploration of unknown areas with the optimization of known good areas, and gradually find the optimal launch duration.
[0127] Based on the Gaussian process model, a collection function is calculated to select the optimal next launch duration. The calculation expression is as follows:
[0128] ,
[0129] Where, T next is the next launch duration selected by Bayesian optimization, that is, the candidate launch duration currently considered to be the best. EI(T) is the expected improvement function, which is an acquisition function in Bayesian optimization.
[0130] Expected Improvement (EI) is a commonly used acquisition function in Bayesian optimization, which is used to guide the algorithm to balance "exploration" and "exploitation" when selecting the next test point. The core idea of the expected improvement function is to calculate the expected improvement (improvement) of the objective function value relative to the current optimal value at a certain launch duration T. By maximizing this expected improvement value, the algorithm can find the next launch duration that is most likely to bring improvement.
[0131] Here, the role of the expected improvement function is to help Bayesian optimization select the next launch time T next It estimates the potential improvement space for each candidate emission duration by combining the predicted mean and uncertainty of the Gaussian process model. This balancing mechanism allows the algorithm to explore new emission duration areas (to find better solutions) and further optimize the currently known good areas, thereby gradually finding the optimal emission duration to improve detection results.
[0132] At the latest launch time T next Collect data and calculate the latest launch time T selected by the objective function in the Bayesian optimization process next The value below is calculated as follows:
[0133] f(T next )=-(SPAI(T next )+(SBI(T next )),
[0134] In the formula, f(T next ) is the latest launch duration selected by the objective function during the Bayesian optimization process;
[0135] The negative sign is used to convert the minimization problem into a maximization problem, so that Bayesian optimization can achieve the effect of minimizing the spectral extreme attenuation index SPAI and the spectral width index SBI by maximizing the negative value, thereby improving the detection ability of abnormal features.
[0136] The latest emission duration f(T next ) is added to the data set and the Gaussian process model is updated, which can make the model more accurately predict the relationship between the launch time and the objective function, so that the optimal launch time can be selected more effectively in subsequent iterations, and the optimal next launch time selected by Bayesian optimization and the latest launch time selected in the Bayesian optimization process are repeated until the improvement of the acquisition function is lower than the preset threshold. At this time, Topt is the optimized launch time.
[0137] The pre-set threshold is usually set in the optimization initialization phase, and its size is determined according to the detection accuracy requirements and computing resource limitations to ensure that the algorithm terminates the iteration when the improvement is minimal.
[0138] The Topt at this time is obtained through multiple iterative optimizations and is the optimal emission duration, which can provide the best spectral signal quality under the current detection conditions.
[0139] The present invention comprehensively captures the spectral change characteristics of the quinoa surface through the spectral extreme value attenuation index and the spectral width index. This method can not only reveal the overall spectral feature attenuation caused by the oxide layer, but also generate the spectral feature variation coefficient through the machine learning model to make accurate judgments on different degrees of mildew. Especially in the mildew stage, this scheme enables the machine learning model to keenly detect early mildew by analyzing subtle spectral attenuation and peak width changes. Compared with the traditional fixed-duration illumination scheme, this method greatly improves the accuracy and sensitivity of mildew detection, helps to identify it in the early stage of mildew, avoids the aggravation of mildew, and improves the timeliness and accuracy of detection.
[0140] The present invention aims to address the problem of insufficient spectral reflection that may be caused by the oxide layer, and dynamically adjusts the light emission duration of the abnormal surface feature area. Based on the Bayesian optimization algorithm, the emission duration can be adjusted according to the real-time reflection changes on the basis of the standard emission duration, so that the spectral data can more accurately reflect the characteristics of the abnormal area. This optimization scheme can not only penetrate the oxide layer to ensure the acquisition of reliable spectral information, but also significantly improve the adaptability of the detection. Unlike traditional fixed illumination schemes, this dynamic emission duration optimization process avoids the lack or distortion of spectral information, ensuring high-quality data collection and grain quality evaluation.
[0141] The present invention provides Figure 2 The system for evaluating the quality of grains based on characteristic spectrum shown in the figure includes a spectrum data acquisition module, a feature extraction and intelligent analysis module, a surface feature classification module, a standard duration setting module and a dynamic emission duration optimization module:
[0142] The spectral data acquisition module uses a hyperspectral imager to emit light of a specific wavelength to the surface of quinoa and collect spectral data reflected from the surface of quinoa;
[0143] The feature extraction and intelligent analysis module extracts features from the acquired quinoa surface spectral data, captures the significant spectral features of the quinoa surface in different bands, and intelligently evaluates the surface change state of quinoa through a pre-learned machine learning model based on the extracted feature data;
[0144] The surface feature classification module divides the surface features of quinoa into normal surface features and abnormal surface features based on the evaluation results of the machine learning model;
[0145] The standard duration setting module sets the standard emission duration of light in a specific wavelength band according to the spectral data of normal surface characteristics to ensure that the spectral reflection information of the normal area can be fully collected;
[0146] The dynamic emission duration optimization module uses a Bayesian optimization algorithm to dynamically adjust the light emission duration of a specific band based on the standard emission duration for detected abnormal surface features and based on changes in surface reflection.
[0147] A method for evaluating the quality of coarse grains based on characteristic spectrum provided in an embodiment of the present invention is realized by the above-mentioned system for evaluating the quality of coarse grains based on characteristic spectrum. The specific method and process of the system for evaluating the quality of coarse grains based on characteristic spectrum are detailed in the embodiment of the above-mentioned method for evaluating the quality of coarse grains based on characteristic spectrum, which will not be repeated here.
[0148] The above description is only by way of illustration of certain exemplary embodiments of the present invention. It is undoubted that those skilled in the art can modify the described embodiments in various ways without departing from the spirit and scope of the present invention. Therefore, the above drawings and descriptions are illustrative in nature and should not be construed as limiting the scope of protection of the claims of the present invention.
Claims
1. A method for evaluating the quality of grains based on characteristic spectrum, characterized in that: The following steps are involved: A hyperspectral imager is used to emit light of a specific wavelength to the surface of quinoa, and collect spectral data reflected from the surface of quinoa; Feature extraction is performed on the acquired quinoa surface spectral data to capture the significant spectral features of the quinoa surface in different bands. Based on the extracted feature data, the change state of the quinoa surface is intelligently evaluated through a pre-learned machine learning model; Based on the evaluation results of the machine learning model, the surface features of quinoa are divided into normal surface features and abnormal surface features; According to the spectral data of normal surface characteristics, the standard emission duration of light in a specific band is set to ensure that the spectral reflectance information of the normal area can be fully collected; For abnormal surface features detected, based on the changes in surface reflection, a Bayesian optimization algorithm is used to dynamically adjust the light emission duration in a specific band based on the standard emission duration.
2. The method for evaluating the quality of coarse grains based on characteristic spectrum according to claim 1, characterized in that: Feature extraction is performed on the acquired quinoa surface spectral data, and the extracted features include the attenuation trend of the reflection intensity of the sample surface to light in a specific band and the specific spectral peak width. After acquisition, the attenuation trend of the reflection intensity of the sample surface to light in a specific band and the specific spectral peak width are analyzed under the detection window, and the spectral extreme attenuation index and the spectral width index are generated respectively. The spectral extreme amplitude index and the spectral width index are input into a pre-learned machine learning model, and the spectral feature variation coefficient is generated by the machine learning model. The spectral variation coefficient is used to perform an intelligent evaluation of the change of the quinoa surface spectral data.
3. A method for evaluating the quality of grains based on characteristic spectrum according to claim 2, characterized in that: Under the detection window, the reflection intensity attenuation trend of the sample surface to the light of a specific wavelength is analyzed, and the specific steps to generate the spectral extreme value attenuation index are as follows: In the detection window, the reflection intensity R(t) of a specific band λ on the sample surface is collected to obtain the reflection intensity sequence at different time points, and the reflection intensity attenuation rate of the specific band λ at different time points is calculated. The calculation expression is as follows: , where D λ is the reflection intensity attenuation rate of a specific band λ, α is the attenuation factor, R(t next ) represents the reflection intensity collected at the next moment, R(t prev ) represents the reflection intensity at the previous time point, t next -t prev Indicates the time interval between two acquisition moments; The attenuation trend weighting function is used to describe the cumulative impact of reflection intensity attenuation at different time points on the index. The calculation expression is as follows: W λ =Π.1+γ·|R(t next )-R(t prev )| β / , Where W λ is the weighted function of the attenuation trend of a specific band λ, γ is the weighting coefficient, and β is the nonlinear adjustment parameter; The reflection intensity attenuation rate D of a specific band λ λ and the attenuation trend weighting function W of a specific band λ λ , generate the spectrum extreme value attenuation index, the calculation expression is as follows: , Where SPAI is the spectral extreme attenuation index.
4. The method for evaluating the quality of grains based on characteristic spectrum according to claim 2, characterized in that: Under the detection window, the specific steps for analyzing the specific spectral peak width and generating the spectral width index are as follows: Under the detection window, the spectral data of the quinoa surface is obtained by a hyperspectral imager to form a spectral matrix, which is calibrated as S, where S = {P k }={P1, P2, P3,...,P n }, where P k represents the reflectivity of the kth wavelength, and n is the total number of wavelengths; Use the peak detection algorithm to identify the spectral peak and determine the peak and its position. The calculation expression is as follows: P={(x m, P max ):P max =max(P k )fork∈I}, Where P is the information set of the spectral peak, x m is the peak wavelength of the spectral peak, that is, the maximum reflectivity P achieved in the spectral peak max The wavelength at the time, I represents the wavelength index set around the peak; Calculate the half-height width of the spectral peak width, the calculation expression is as follows: W = x high -x low , where W is the half-height width of the spectral peak width, x high The half-maximum reflectivity P in the spectrum half The highest wavelength position at x low The half-maximum reflectivity P in the spectrum half The lowest wavelength position at half-height reflectivity P half is the maximum reflectance of the spectral peak P max half of , that is: In spectral analysis, reflection energy is an important parameter to measure the reflection performance of the material surface. The calculation expression is as follows: , Where E is the reflected energy; The half-width W of the spectral peak width and the maximum reflectivity P achieved in the spectral peak max And the reflected energy E, generate the spectrum width index, the calculation expression is as follows: , Where SBI is the spectral width index.
5. The method for evaluating the quality of coarse grains based on characteristic spectrum according to claim 2, characterized in that: The spectral feature variation coefficient generated after analyzing the quinoa surface spectral data is compared with the preset spectral feature variation coefficient reference threshold, and the quinoa surface features are divided. The division steps are as follows: If the spectral feature variation coefficient is greater than or equal to a preset spectral feature variation coefficient reference threshold, the quinoa surface feature is classified as an abnormal surface feature; If the spectral feature variation coefficient is less than a preset spectral feature variation coefficient reference threshold, the quinoa surface feature is classified as a normal surface feature.
6. The method for evaluating the quality of grains based on characteristic spectrum according to claim 5, characterized in that: For abnormal surface features detected, based on the surface reflection changes, the Bayesian optimization algorithm is used to dynamically adjust the light emission duration of a specific band based on the standard emission duration. The steps are as follows: The emission duration under normal surface features is calibrated as T std , T std That is, the standard launch duration, and around the standard launch duration T std Set the upper and lower range of the transmission duration [T min , T max ] to allow Bayesian optimization to explore and adjust within this range, T min is the lower limit of the launch duration, T max It is the upper limit of the launch duration; Define the objective function. The objective of the objective function is to maximize the quality of the reflected signal. The calculation expression is as follows: f(T) = -(SPAI(T) + SBI(T)), where SPAI(T) represents the attenuation degree of the spectrum peak when the emission time is T, SBI(T) represents the width of the spectrum peak when the emission time is T, and f(T) is the objective function. In the range of emission duration [T min , T max ] randomly collects several emission durations within the range, and calibrates the collected emission durations as T i , and collect the corresponding spectral extreme attenuation index SPAI and spectral width index SBI under the obtained emission durations to calculate the objective function f(T), where T i ={T1, T2, T3, ..., T n }, n is the total number of emission durations obtained, f(T) = {f(T i )}={f(T1), f(T2),..., f(T n )},f(T i ) is the output result of the objective function under the condition of the i-th launch duration, and records the output result of the objective function under all launch duration conditions f(T i ) to form a data set for building a Bayesian optimization model; Using the collected data set f(T i ) train a Gaussian process model, model the relationship between the transmission time T and the objective function f(T) through the Gaussian process model, and obtain the predicted probability distribution of the transmission time on the quality of the reflected signal; Based on the Gaussian process model, a collection function is calculated to select the optimal next launch duration. The calculation expression is as follows: , Where, T next is the next launch duration selected by Bayesian optimization, that is, the candidate launch duration currently considered to be the best. EI(T) is the expected improvement function, which is an acquisition function in Bayesian optimization. At the latest launch time T next Collect data and calculate the latest launch time T selected by the objective function in the Bayesian optimization process next The value below is calculated as follows: f(T next )=-(SPAI(T next )+(SBI(T next )), In the formula, f(T next ) is the latest launch duration selected by the objective function during the Bayesian optimization process; The latest emission duration f(T next ) is added to the data set, and the Gaussian process model is updated. The optimal next launch time selected by Bayesian optimization and the latest launch time selected in the Bayesian optimization process are repeated until the improvement of the acquisition function is lower than the preset threshold. At this time, Topt is the optimized launch time.
7. A system for evaluating the quality of grains based on characteristic spectrum, used to implement the method for evaluating the quality of grains based on characteristic spectrum as described in any one of claims 1 to 6, characterized in that: It includes spectral data acquisition module, feature extraction and intelligent analysis module, surface feature classification module, standard duration setting module and dynamic emission duration optimization module: The spectral data acquisition module uses a hyperspectral imager to emit light of a specific wavelength to the surface of quinoa and collect spectral data reflected from the surface of quinoa; The feature extraction and intelligent analysis module extracts features from the acquired quinoa surface spectral data, captures the significant spectral features of the quinoa surface in different bands, and intelligently evaluates the surface change state of quinoa through a pre-learned machine learning model based on the extracted feature data; The surface feature classification module divides the surface features of quinoa into normal surface features and abnormal surface features based on the evaluation results of the machine learning model; The standard duration setting module sets the standard emission duration of light in a specific wavelength band according to the spectral data of normal surface characteristics to ensure that the spectral reflection information of the normal area can be fully collected; The dynamic emission duration optimization module uses a Bayesian optimization algorithm to dynamically adjust the light emission duration of a specific band based on the standard emission duration for detected abnormal surface features and based on changes in surface reflection.
Citation Information
Cited By
Mulberry leaf mass spectral image recognition device and AI grading decision-making method and system
CN119992225A
Agricultural product quality detection method and system
CN120468080A