Three-white melon quality detection method and system based on hyperspectral image and medium
Through the three white melon quality detection method based on hyperspectral images, combining physiological and appearance feature parameters, a sample detection library is established, and similarity and offset index is calculated, the time-consuming, labor-consuming and subjective problems of traditional detection methods are solved, and efficient and accurate quality evaluation is achieved.
Patent Information
- Application Number
- CN202510912574.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-03
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2045-07-03
AI Technical Summary
The traditional three-white melon quality detection method relies on manual evaluation, which is time-consuming, labor-intensive, and has strong subjectivity and cannot fully reflect the physiological and appearance characteristics of the fruits and melons, resulting in insufficient accuracy and consistency of the detection results, and real-time monitoring cannot be achieved.
Using a detection method based on hyperspectral images, we can filter samples that meet quality requirements, obtain physiological and appearance characteristic parameters, establish a sample detection library, calculate the similarity index and offset index, and conduct the quality evaluation of the three white melons.
It improves the scientificity and accuracy of the detection, overcomes subjective deviations, and achieves a comprehensive assessment of the physiological and appearance characteristics of the three white melons, ensuring the reliability and comprehensiveness of the results.
Smart Images

Figure CN120404618A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of melon quality detection, and particularly to a method, a system and a medium for detecting the quality of Sanbai melons based on hyperspectral images. Background Art
[0002] In modern agriculture, as a popular high-quality agricultural product, the quality detection of Sanbai melons has always been an important link to ensure market competitiveness and consumer satisfaction. Traditional quality detection methods usually rely on manual evaluation and sensory detection, which are not only time-consuming and laborious, but also easily affected by subjective factors, resulting in insufficient accuracy and consistency of detection results. At the same time, there is no specific definition for judging the quality of Sanbai melons. In addition, traditional methods cannot comprehensively reflect the physiological and appearance characteristics of melons and fruits, and cannot realize real-time monitoring of quality changes. Therefore, there is an urgent need for an efficient, objective and accurate detection method to solve these technical problems.
[0003] The method for detecting the quality of Sanbai melons based on hyperspectral images can effectively extract and analyze the physiological and appearance characteristic parameters of Sanbai melons by combining hyperspectral imaging technology and data analysis. This method not only improves the accuracy and reliability of detection, but also realizes the rapid detection of a large number of samples, meeting the requirements of modern agriculture for intelligence and automation. At the same time, by comparing the similarity between the sample to be detected and the high-quality samples in the sample library, this method can conduct quality evaluation on a wider feature dimension, thus providing more scientific data support for the quality control of Sanbai melons.
[0004] In the prior art, the publication number CN119147480A discloses a method, a system and a medium for detecting the quality of bamboo shoots based on hyperspectral images. The method includes: obtaining a first hyperspectral image collected for a target bamboo shoot; obtaining K characteristic bands of the target bamboo shoot, extracting K first spectral images corresponding to the K characteristic bands from the first hyperspectral image, and respectively determining the reflectance matrices of the K first spectral images; determining the spectral deviation degree corresponding to the first spectral image based on the reflectance matrix, and determining the quality of the target bamboo shoot based on the spectral deviation degree of each first spectral image. However, in this solution, there is no specific basis for how the target bamboo shoot reflects the quality through the spectral image, and different judgments on the quality of the target bamboo shoot are only made based on the differences in the spectral images. Therefore, this hyperspectral image detection method has defects, and directly applying it to the detection of Sanbai melons reduces the accuracy and effectiveness of the quality detection of the target Sanbai melons.
[0005] The above information disclosed in the background art section is only used to enhance the understanding of the background of the present disclosure, and thus it may include information that does not constitute the prior art known to those of ordinary skill in the art. Summary of the Invention
[0006] The purpose of the present invention is to provide a method, system and medium for detecting the quality of Sanbai melons based on hyperspectral images, so as to solve the problems raised in the above-mentioned background technology.
[0007] To achieve the above object, the present invention provides the following technical solutions: A method for detecting the quality of Sanbai melons based on hyperspectral images, the specific steps include: S1: Screen out Sanbai melon samples that meet the quality requirements, obtain the physiological characteristic parameters representing the nutritional data of Sanbai melons and the appearance shape characteristic parameters representing the external shape data of Sanbai melons, collect the hyperspectral images of the samples and extract the reflectance data, and associate the reflectance data of the same sample with the physiological characteristic parameters and appearance characteristic parameters to generate a sample detection library; S2: Collect the hyperspectral image of the Sanbai melon to be detected and extract the reflectance data, compare the reflectance data of the Sanbai melon to be detected with the reflectance data of each sample in the sample detection library, and calculate the similarity index between the Sanbai melon to be detected and each sample; S3: Based on the similarity index, determine whether the Sanbai melon to be detected meets the first-level classification requirements. If it meets, take the three groups of samples with the largest similarity index as the fitting samples, take the average value of the physiological characteristic parameters of the fitting samples as the predicted characteristic parameters of the Sanbai melon to be detected, and obtain the physiological deviation index according to the deviation degree of the predicted characteristic parameters from the average value of the physiological characteristic parameters in the sample detection library; S4: Obtain the appearance characteristic parameters of the Sanbai melon to be detected, compare them with the average value of the appearance characteristic parameters in the sample detection library, obtain the shape deviation index, and judge whether the quality of the Sanbai melon to be detected meets the requirements by analyzing the physiological deviation index and the shape deviation index.
[0008] Further, the appearance shape characteristic parameters include the roundness and surface roughness of the Sanbai melon; the physiological characteristic parameters include sugar content, vitamin content and water content, and the physiological characteristic parameters are preprocessed, specifically normalized preprocessing; The specific scheme for screening out the Sanbai melon samples that meet the quality requirements is: score the quality of all Sanbai melon samples by the expert scoring method, and screen out the Sanbai melon samples that meet the quality requirements from all Sanbai melon samples according to the scoring results; The method for collecting the hyperspectral image of the Sanbai melon sample is: determine the longitudinal and transverse curves of the Sanbai melon sample, record the intersection point of the two curves as the image acquisition center point, adjust the shooting position of the hyperspectral instrument until the midpoint of the image collected by the hyperspectral instrument is at the image acquisition center point, collect the hyperspectral image at this position, and take the image acquisition center point as the center, and adjust the image size of the hyperspectral image to 214*214 pixels; The collected hyperspectral image is corrected to obtain a corrected hyperspectral image. The correction is specifically black and white correction. The formula for obtaining the corrected hyperspectral image is as follows: ; In the formula, is the corrected hyperspectral image, is the original hyperspectral image, is the calibration image obtained by scanning a standard polytetrafluoroethylene whiteboard, is the calibration image obtained by scanning a black correction plate, is the maximum value of the illumination intensity of the hyperspectral system; The method for generating the sample detection library is as follows: The reflectivity data of the same sample is associated with physiological characteristic parameters and appearance characteristic parameters to form corresponding grids, and the formed grid data is recorded as the sample detection library.
[0009] Furthermore, the method for obtaining the similarity index is as follows: Based on the hyperspectral image of the to-be-detected Sanbai melon, the reflectivity data of the entire band in the image is extracted, and according to the characteristic band ranges corresponding to different physiological characteristic parameters, the entire band is divided into several sub-bands. The average distance and reflectivity area difference within each sub-band are analyzed, and the similarity index is characterized based on the average distance and reflectivity area difference; Among them, the average distance of the selected points in the i-th sub-band is calculated according to the formula: ; In the formula, is the reflectivity corresponding to the wavelength of the j-th point randomly selected in the i-th sub-band of the sample data, is the reflectivity corresponding to the wavelength of the j-th point selected in the i-th sub-band of the to-be-detected Sanbai melon, where i is the index of the selected band, and , m is the total number of selected bands, is the index of the selected points within the sub-band, , where is the total number of selected points within the sub-band; Among them, the overall reflectivity area difference in the i-th sub-band is specifically calculated according to the formula: ; In the formula, is the reflectivity of the sample data at the wavelength of x, is the reflectivity of the to-be-detected Sanbai melon at the wavelength of x, is the lower limit of the wavelength x within the i bands, is the upper limit of the wavelength x within the i bands.
[0010] Further, calculate the similarity index between the to-be-detected Sanbai melons and each sample, where the similarity index is characterized by the difference in reflectance between the to-be-detected Sanbai melons and each sample at the same wavelength within the same waveband. The specific calculation formula is as follows: ; In the formula, is the similarity index within the selected i-th sub-waveband, is the average distance between the reflectance of the to-be-detected Sanbai melons and the sample data at the selected wavelength within the i-th sub-waveband, used to represent the difference in reflectance, is the overall reflectance area difference within the i-th sub-waveband, and are the weight coefficients of the average distance and the reflectance area respectively, where , and are both greater than 0, and .
[0011] Further, the formula for calculating the similarity index between the to-be-detected Sanbai melons and the sample based on the similarity index within the selected i-th sub-waveband is as follows: ; In the formula, is the similarity index between the to-be-detected Sanbai melons and the sample; Perform primary classification on the to-be-detected Sanbai melons based on the similarity index. The specific logic for primary classification is as follows: Set the minimum similarity threshold. When the similarity index between the to-be-detected Sanbai melons and the sample is less than the minimum similarity threshold, mark the quality of the to-be-detected Sanbai melons as poor. If the similarity index between the to-be-detected Sanbai melons and the sample is greater than or equal to the minimum similarity threshold, it indicates that the to-be-detected Sanbai melons meet the requirements of primary classification and subsequent classification should be carried out; Calculate the similarity index between the to-be-detected Sanbai melons and each sample according to the above formula, and generate a sequence of similarity indices in descending order, specifically , where is the largest similarity index between the to-be-detected Sanbai melons and the sample, is the smallest similarity index, is the total number of Sanbai melon samples that meet the quality requirements.
[0012] Further, the predicted characteristic parameters include the predicted sugar content value, the predicted vitamin content value, and the predicted water content value. According to the deviation degree of the predicted characteristic parameters from the average value of the physiological characteristic parameters in the sample detection library, the physiological deviation index is obtained. The formula for calculating the physiological deviation index is as follows: ; In the formula, is the physiological deviation index, is the predicted sugar content value, is the predicted vitamin content value, is the predicted water content value, , and are respectively the average sugar content, average vitamin content and average water content in the sample detection library; Obtain the appearance characteristic parameters of the to-be-detected Sanbai melon, and compare them with the average value of the appearance characteristic parameters in the sample detection library to obtain the shape deviation index. The specific formula based on which the shape deviation index is calculated is: ; In the formula, is the shape deviation index, is the roundness of the to-be-detected Sanbai melon, is the surface roughness of the to-be-detected Sanbai melon, and are respectively the average values of roundness and surface roughness in the sample detection library.
[0013] Furthermore, by analyzing the physiological deviation index and the shape deviation index, the specific logic for judging whether the quality of the to-be-detected Sanbai melon meets the requirements is: When , it is judged that the appearance quality of the Sanbai melon is excellent, indicating that the appearance quality of the Sanbai melon is used for high-end gift boxes in large shopping malls for sale; When , it is judged that the appearance quality of the Sanbai melon is good, indicating that the Sanbai melon is used for secondary processing to make animal feed for sale; Among them, is the comprehensive deviation index, which is characterized by the physiological deviation index and the shape deviation index. The specific formula based on which is: ; Among them is the quality judgment threshold.
[0014] The present invention also provides a Sanbai melon quality detection system based on hyperspectral images. The Sanbai melon quality detection system based on hyperspectral images is used to execute the above-mentioned Sanbai melon quality detection method based on hyperspectral images, and includes: A training data processing module, which is used to screen out the Sanbai melon samples that meet the quality requirements, obtain the physiological characteristic parameters representing the nutritional data of the Sanbai melons and the appearance shape characteristic parameters representing the appearance data of the Sanbai melons in the samples, collect the hyperspectral images of the samples and extract the reflectance data, and associate the reflectance data of the same sample with the physiological characteristic parameters and the appearance characteristic parameters to generate a sample detection library; A relevant data comparison module, which is used to collect the hyperspectral images of the Sanbai melons to be detected and extract the reflectance data, compare the reflectance data of the selected Sanbai melons to be detected with the reflectance data of each sample in the sample detection library, and calculate the similarity index between the Sanbai melons to be detected and each sample; A physiological deviation analysis module, which is used to determine whether the Sanbai melons to be detected meet the primary classification requirements based on the similarity index. If so, it takes the three groups of samples with the largest similarity index as the fitting samples, takes the average value of the physiological characteristic parameters of the fitting samples as the predicted characteristic parameters of the Sanbai melons to be detected, and obtains the physiological deviation index according to the deviation degree of the predicted characteristic parameters from the average value of the physiological characteristic parameters in the sample detection library; A quality comprehensive judgment module, which is used to obtain the appearance characteristic parameters of the Sanbai melons to be detected, compare them with the average value of the appearance characteristic parameters in the sample detection library, obtain the shape deviation index, and judge whether the quality of the Sanbai melons to be detected meets the requirements by analyzing the physiological deviation index and the shape deviation index.
[0015] The present invention also provides a non-volatile computer-readable storage medium containing computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the processors are caused to execute the method for detecting the quality of Sanbai melons based on hyperspectral images.
[0016] Compared with the prior art, the beneficial effects of the present invention are as follows: First of all, the method for detecting the quality of Sanbai melons based on hyperspectral images realizes a comprehensive evaluation of the physiological characteristics and appearance characteristics of Sanbai melons by combining hyperspectral imaging technology and a data analysis system. By establishing a sample detection library, this method systematically collects the physiological characteristic parameters and appearance characteristic parameters of Sanbai melon samples that meet the quality requirements, and combines these data with the corresponding hyperspectral reflectance data. This not only improves the reliability of the sample data, but also provides a high-quality reference basis for subsequent detections. During the processing of the samples to be detected, by comparing with the sample detection library, the similarity index is calculated, so as to select the most representative fitting samples. This greatly enhances the scientific nature and accuracy of the detection and can effectively overcome the subjective deviation problem in traditional methods.
[0017] In addition, the physiological characteristics of the Sanbai melons to be detected are predicted using the physiological characteristic parameters of the fitting samples, so as to obtain the predicted characteristic parameters, calculate the deviation degree, and obtain the physiological deviation index. This index can intuitively reflect the differences between the physiological characteristics of the Sanbai melons to be detected and the high-quality samples in the sample library, thus providing a quantitative basis for quality evaluation. At the same time, by obtaining the appearance characteristic parameters of the Sanbai melons to be detected and comparing them with the appearance characteristic parameters in the sample detection library, the shape deviation index is obtained. This dual evaluation mechanism not only improves the comprehensiveness of quality detection but also ensures the reliability of the results. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 is a schematic diagram of the overall method flow of the present invention; Figure 2 is a fitting curve graph of average distance - similarity index; Figure 3 is a fitting curve graph of area difference - similarity index; Figure 4 is a scatter plot of the distribution of physiological characteristic parameters of Sanbai melon samples for detection; Figure 5 is a fitting curve graph of vitamin content - physiological deviation index; Figure 6 is a scatter plot of the distribution of shape deviation index with respect to circularity deviation; Figure 7 is a scatter plot of the distribution of shape deviation index with respect to surface roughness deviation; Figure 8 is a statistical chart for comparing the quality of Sanbai melons; Figure 9 is a schematic diagram of the overall system structure of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0019] To make the objectives, technical solutions, and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below with reference to specific embodiments.
[0020] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the present invention should have the ordinary meanings understood by those with ordinary skills in the field to which the present invention pertains. The "first", "second" and similar terms used in the present invention do not denote any order, quantity or importance, but are only used to distinguish different components. The terms such as "comprising" or "including" mean that the elements or objects appearing before this word cover the elements or objects listed after this word and their equivalents, without excluding other elements or objects. The terms such as "connected" or "linked" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The terms such as "upper", "lower", "left" and "right" are only used to represent relative positional relationships, and when the absolute position of the object being described changes, the relative positional relationship may also change accordingly.
[0021] Embodiment: Please refer to Figures 1-8 , the present invention provides a technical solution: A method for detecting the quality of Sanbai melons based on hyperspectral images, the specific steps include: Step 1: Screen Sanbai melon samples that meet the quality requirements, obtain the physiological characteristic parameters representing the nutritional data of Sanbai melons and the appearance shape characteristic parameters representing the external shape data of Sanbai melons, collect the hyperspectral images of the samples and extract the reflectance data, and associate the reflectance data of the same sample with the physiological characteristic parameters and the appearance characteristic parameters to generate a sample detection library.
[0022] Wherein the physiological characteristic parameters include sugar content, vitamin content and water content. For the sugar content, the high performance liquid chromatography method or the enzymatic method is used, and the steps include: Sample preparation: Extract the pulp from different parts of the Sanbai melon, cut it into small pieces and mix evenly. Extraction process: Use a suitable solvent to extract the sugar in the pulp. Analysis and measurement: Separate and quantify the extract through an HPLC instrument, or use the enzymatic method to determine the sugar content.
[0023] The detection method of vitamin content is also obtained by using the high performance liquid chromatography method or the enzymatic method.
[0024] The water content is determined by the drying method or the Kjeldahl method.
[0025] At the same time, preprocess the physiological characteristic parameters, specifically normalization preprocessing; Among them, the formula for calculating the normalization preprocessing of the sugar content is: Preprocess the sugar content data of the collected Sanbai melon samples, where the preprocessing is specifically normalization preprocessing, and the formula specifically based on the normalization preprocessing is: ; In the formula, is the normalized data of the sugar content of the t-th Sanbai melon sample, is the sugar content data of the t-th Sanbai melon sample, and respectively represent the minimum sugar content data and the maximum sugar content data in the sugar content data of all collected Sanbai melon samples, where t is the index of the Sanbai melon sample, , where is the total number of Sanbai melon samples.
[0026] The formula for calculating the normalization preprocessing of vitamin content is: preprocess the vitamin content data of the collected Sanbai melon samples, where the preprocessing is specifically normalization preprocessing, and the formula specifically based on for normalization preprocessing is: ; In the formula, is the normalized data of the vitamin content of the t-th Sanbai melon sample, is the vitamin content data of the t-th Sanbai melon sample, and respectively represent the minimum vitamin content data and the maximum vitamin content data in the vitamin content data of all collected Sanbai melon samples.
[0027] The formula for calculating the normalization preprocessing of water content is: preprocess the water content data of the collected Sanbai melon samples, where the preprocessing is specifically normalization preprocessing, and the formula specifically based on for normalization preprocessing is: ; In the formula, is the normalized data of the water content of the t-th Sanbai melon sample, is the water content data of the t-th Sanbai melon sample, and respectively represent the minimum water content data and the maximum water content data in the water content data of all collected Sanbai melon samples.
[0028] The specific scheme for screening Sanbai melon samples that meet the quality requirements is: score the quality of all Sanbai melon samples by the expert scoring method, and screen out Sanbai melon samples that meet the quality requirements from all Sanbai melon samples according to the scoring results.
[0029] Among them, the specific logic for screening Sanbai melon samples that meet the quality requirements is: A number of experts score the same Sanbai melon. The comprehensive score is based on the shape, taste and flavor of the Sanbai melon, with a full score of 10. Calculate the average of the scores given by several experts. If the average score of the Sanbai melon is greater than or equal to 8, then the Sanbai melon sample is selected as the Sanbai melon sample.
[0030] The method for collecting the hyperspectral image of the Sanbai melon sample is as follows: Determine the longitudinal and transverse curves of the Sanbai melon sample, mark the intersection point of the two curves as the image acquisition center point, adjust the shooting position of the hyperspectral instrument until the midpoint of the image collected by the hyperspectral instrument is at the image acquisition center point, and collect the hyperspectral image at this position. Then, adjust the image size of the collected hyperspectral image to 214 * 214 pixels with the image acquisition center point as the center.
[0031] The method for collecting the hyperspectral image of the Sanbai melon sample is as follows: Determine the length center of the Sanbai melon sample, determine the cross-sectional contour of the length center, adjust the shooting position of the hyperspectral instrument until the midpoint of the image collected by the hyperspectral instrument is on the cross-sectional contour of the length center of the Sanbai melon sample, and collect the hyperspectral image at this position. Perform calibration on the collected hyperspectral image to obtain the calibrated hyperspectral image. The calibration is specifically black-and-white calibration. The formula for obtaining the calibrated hyperspectral image is as follows: ; In the formula, is the calibrated hyperspectral image, is the original hyperspectral image, is the calibration image obtained by scanning a standard polytetrafluoroethylene whiteboard, is the calibration image obtained by scanning a black calibration plate, is the maximum value of the illumination intensity of the hyperspectral system. The maximum value of the illumination intensity of the hyperspectral system usually depends on the specific sensor model and its design specifications. Generally speaking, this value can be between 0 and a certain maximum value. The most common range of the maximum digital value (DN value) is as follows: 8-bit system: The maximum value is 255 (i.e., the digital range from 0 to 255). 12-bit system: The maximum value is 4095 (i.e., the digital range from 0 to 4095). 14-bit system: The maximum value is 16383 (i.e., the digital range from 0 to 16383). 16-bit system: The maximum value is 65535 (i.e., the digital range from 0 to 65535).
[0032] The method for generating the sample detection library is as follows: Associate the reflectivity data of the same sample with physiological characteristic parameters and appearance characteristic parameters to form corresponding grids, and record the formed grid data as the sample detection library.
[0033] Step 2: Collect the hyperspectral images of the Sanbai melons to be detected and extract the reflectance data. Compare the reflectance data of the Sanbai melons to be detected with the reflectance data of each sample in the sample detection library, and calculate the similarity index between the Sanbai melons to be detected and each sample.
[0034] The method for obtaining the similarity index is as follows: Based on the hyperspectral image of the Sanbai melon to be detected, extract the reflectance data of the entire band in the image, and divide the entire band into several sub-bands according to the characterization band ranges corresponding to different physiological characteristic parameters. Analyze the average distance and reflectance area difference of the reflectance within each sub-band, and characterize the similarity index according to the average distance and reflectance area difference. Among them, the average distance of the selected points in the i-th sub-band The formula for calculation is: ; In the formula, is the reflectance corresponding to the wavelength of the j-th point randomly selected in the i-th sub-band of the sample data, is the reflectance corresponding to the wavelength of the j-th point selected in the i-th sub-band of the Sanbai melon to be detected, where i is the index of the selected band, and , m is the total number of selected bands, is the index of the selected points within the sub-band, , where is the total number of selected points within the sub-band; Among them, the overall reflectance area difference within the i-th sub-band The specific formula for calculation is: ; In the formula, is the reflectance of the sample data at the wavelength of x, is the reflectance of the Sanbai melon to be detected at the wavelength of x, is the lower limit of the wavelength of x within the i bands, is the upper limit of the wavelength of x within the i bands.
[0035] Calculate the similarity index between the Sanbai melon to be detected and each sample. The similarity index is characterized by the difference in reflectance between the Sanbai melon to be detected and each sample at the same wavelength within the same band, that is, the average distance and reflectance area difference of the reflectance within each sub-band. The specific formula for calculation is: ; In the formula, is the similarity index within the selected i-th sub-band, At the selected wavelength within the i-th sub-band, it is the average distance between the reflectance of the three-white melon to be detected and the corresponding reflectance of the sample data, which is used to represent the difference in reflectance. It is the overall reflectance area difference within the i-th sub-band, where i is the index of the selected band, and , m is the total number of selected bands, and are the weight coefficients of the average distance and the reflectance area respectively, where , and are both greater than 0, and .
[0036] It should be noted that the similarity index within the selected i-th sub-band is used to represent the similarity between the three-white melon to be detected and each sample spectral data. The higher the value of the similarity index within the selected i-th sub-band, the closer the physiological characteristic parameters of the three-white melon to be detected are to those of the sample, and it can be used to estimate the physiological characteristic parameters of the three-white melon to be detected.
[0037] Among them, due to the possible extreme situations of the average distance of the selected points, such as large differences at the beginning and end and small differences in the middle, which may lead to small differences in the average distance, the reflectance area difference is introduced to comprehensively characterize the similarity index. At the same time, , and are both greater than 0, and . It is used to reduce the influence degree of the average distance and make the similarity index more accurate.
[0038] The specific formula for calculating the similarity index between the three-white melon to be detected and the sample based on the similarity index within the selected i-th sub-band is: ; In the formula, is the similarity index between the three-white melon to be detected and the sample; where Table 1 shows the change situation of the similarity index between the three-white melon to be detected and different samples.
[0039] Table 1: Statistical Table of Similarity Index Calculation Part
[0040] There is a negative correlation between the similarity index and the average distance within all bands. As the sample number increases, the average distance increases from 0.10 to 0.55, indicating that the distance between samples gradually increases, while the similarity index decreases from 10.00 to 3.57. This means that when the distance between samples becomes larger, the similarity of the samples decreases, reflecting the enhancement of the difference in sample characteristics.
[0041] Secondly, the similarity index also shows a negative correlation with the reflectivity area difference across all bands. As the reflectivity area difference increases from 0.10 to 0.32, the similarity index decreases, from 10.00 to 3.57. This indicates that as the reflectivity differences between samples increase across bands, the similarity between samples decreases.
[0042] Step 3: Based on the similarity index, determine whether the three white melons to be tested meet the first-level classification requirements. If so, use the three groups of samples with the largest similarity index as fitting samples, and use the mean value of the physiological characteristic parameters of the fitting samples as the predicted characteristic parameters of the three white melons to be tested. According to the deviation of the predicted characteristic parameters from the mean value of the physiological characteristic parameters in the sample detection library, the physiological deviation index is obtained.
[0043] The three-white melons to be tested are classified into a first-level classification based on the similarity index. The specific logic of the first-level classification is as follows: a minimum similarity threshold is set. When the similarity index between the three-white melon to be tested and the sample is less than the minimum similarity threshold, the quality of the three-white melon to be tested is marked as poor. If the similarity index between the three-white melon to be tested and the sample is greater than or equal to the minimum similarity threshold, it indicates that the three-white melon to be tested meets the first-level classification requirements and should be further classified. The minimum similarity threshold is generally set between 4 and 5. This is used to screen out the three-white melons to be tested that are significantly different from the three-white melon samples that meet the quality requirements and mark their quality as poor.
[0044] The similarity index between the three white melons to be tested and each sample is calculated according to the formula, and the similarity index sequence is generated in descending order, specifically: ,in is the maximum similarity index between the three white melons to be tested and the samples, is the minimum similarity index, The total number of three-white melon samples that meet the quality requirements.
[0045] The physiological characteristic parameters of the three white melons to be tested are predicted according to the physiological characteristic parameters of the fitting samples to obtain the predicted characteristic parameters. The specific logic is: the average value of each physiological characteristic parameter of the three groups of fitting samples is used as the predicted value of the physiological characteristic parameters of the three white melons to be tested.
[0046] The predicted characteristic parameters include a predicted value of sugar content, a predicted value of vitamin content, and a predicted value of water content. A physiological deviation index is obtained based on the deviation of the predicted characteristic parameters from the average value of the physiological characteristic parameters in the sample detection library. The formula for calculating the physiological deviation index is: ; Where, is the physiological excursion index, is the predicted value of sugar content, is the predicted value of vitamin content, is the predicted value of water content, , and are the average sugar content, average vitamin content, and average water content in the sample detection library, respectively.
[0047] Among them takes 8.0% in this embodiment, takes 1.5% in this embodiment, takes 92% in this embodiment.
[0048] Among them, sugar is an important factor affecting the sweetness and taste of fruits. A higher sugar content will significantly improve the taste of the fruit. Therefore, the absolute value of the difference between the predicted value of sugar content and the average sugar content is proportional to the physiological deviation index , indicating that the sugar content has a non-linear effect on improving the edible value of Sanbai melons through the exponential function . The higher the sugar content, the more significant its contribution to the physiological deviation index .
[0049] The vitamin content is regarded as an important indicator of health benefits. Using the logarithmic form makes the contribution of the vitamin content to the physiological deviation index show a marginal increasing effect when the vitamin content difference increases.
[0050] The water content is an important factor affecting the freshness and taste of fruits. The more water content, the fresher it is. Using to adjust the positive effect of water content on fruit quality, the increase in water content difference will significantly improve the physiological deviation index , reflecting the freshness and taste quality of the fruit. A higher water content usually means the fruit is more juicy and has a better taste. Table 2 shows the physiological characteristic parameters determined by the similarity of Sanbai melon samples and the changes in their physiological deviation indices.
[0051] Table 2: Statistical table of physiological deviation index calculation part
[0052] The range of the predicted value of sugar content is between 6.6% and 8.2%, showing a certain degree of variability. It is found through observation that samples with a higher sugar content (such as 8.2% of Sanbai melon No. 7 in the test) are usually accompanied by a higher predicted value of vitamin content (such as 1.7% of Sanbai melon No. 7 in the test) and a predicted value of water content (94%). This indicates that a higher sugar content may be associated with higher vitamin and water content.
[0053] Meanwhile, when the predicted values of sugar content, vitamin content, and water content deviate more from the corresponding reference values, the physiological deviation index is larger. For example, the predicted sugar content of the Sanbai melon numbered 4 is 8.0%, which is the same as the average sugar content, and the corresponding physiological deviation index is 0.7568, which is relatively small compared to the other groups of data.
[0054] Step 4: Obtain the appearance feature parameters of the Sanbai melon to be detected, compare them with the average values of the appearance feature parameters in the sample detection library, obtain the shape deviation index, and judge whether the quality of the Sanbai melon to be detected meets the requirements by analyzing the physiological deviation index and the shape deviation index.
[0055] Obtain the appearance feature parameters of the Sanbai melon to be detected, compare them with the average values of the appearance feature parameters in the sample detection library, and obtain the shape deviation index. The specific formula based on which the shape deviation index is calculated is as follows: ; In the formula, is the shape deviation index, is the roundness of the Sanbai melon to be detected, is the surface roughness of the Sanbai melon to be detected, and are respectively the average values of roundness and surface roughness in the sample detection library, where takes 0.85 in this embodiment, takes 2.0 in this embodiment.
[0056] One measurement method of surface roughness represents the microscopic unevenness of the surface. The smaller the roughness, the smoother the surface, usually indicating a better appearance. Therefore, the difference in the surface roughness of the Sanbai melon is proportional to the shape deviation index , and using instead of directly using is mainly because the influence of surface roughness is usually non-linear, and the square root form can slow down the influence of the increase in roughness on the SCI and improve the stability of the calculation. Table 3 shows the influence of the differences in roundness and surface roughness on the change of the shape deviation index.
[0057] Table 3: Partial statistical table for calculating the shape deviation index
[0058] Similarly to the physiological deviation index, for example, when detecting the Sanbai melon numbered 10, the roundness is 0.85 and the surface roughness is 1.95. The differences from the average values of roundness and surface roughness are small, and the corresponding shape deviation index is relatively small compared to the remaining group values, being 0.018. That is, the smaller the difference from the average values of roundness and surface roughness, the smaller the shape deviation index.
[0059] Roundness refers to the uniformity of the fruit shape and is usually used to evaluate whether the fruit is close to the ideal round shape. The higher the roundness, the better the appearance quality of the fruit is usually. Therefore, the difference in roundness is proportional to the appearance quality standard coefficient is directly proportional.
[0060] By analyzing the physiological deviation index and the shape deviation index, the specific logic for judging whether the quality of the to-be-detected Sanbai melons meets the requirements is as follows: When it is judged that the appearance quality of this Sanbai melon is good, indicating that this Sanbai melon is used for secondary processing to make animal feed for sale; When it is judged that the appearance quality of this Sanbai melon is excellent, indicating that the appearance quality of this Sanbai melon is used for high-end gift boxes in large supermarkets for sale.
[0061] Among them, is the comprehensive deviation index, which is characterized by the physiological deviation index and the shape deviation index. The specific formula is: ; Among them is the quality judgment threshold.
[0062] It should be noted that since the physiological deviation index directly affects the nutritional value and taste of Sanbai melons and is the main parameter affecting quality, the exponential function is used to represent the significant impact of the physiological deviation index on the quality of Sanbai melons. Due to the significant impact of the physiological characteristics of Sanbai melons on their quality, the exponential form can better express the relative impact of physiological deviation on quality. Especially when there are obvious deviations in physiological parameters, the decline in quality is significant.
[0063] By represents the impact of the Sanbai melon appearance on quality, highlighting the influence degree of the shape deviation index on . The square function has an amplification effect. Using the square form to process the shape deviation index can significantly enhance its contribution to when the shape deviation is large. It means that if the shape of the Sanbai melon deviates from the normal standard, its negative impact on the overall quality will be amplified. Especially in production and sales, appearance is crucial for consumers' purchase decisions. Table 4 shows the situation of judging the quality of Sanbai melons through the comprehensive deviation index and represents the comparison result between the judgment result and the actual quality result.
[0064] Table 4: Partial statistical table of Sanbai melon quality judgment
[0065] Among the 10 groups of samples, the consistency between the expert evaluation of the health status and the health status judgment reached 100% in all groups. This indicates that the expert evaluation results are completely consistent with the health status judgment based on the indicators, increasing the reliability and validity of the data.
[0066] At the same time, it reflects the situation that the larger the health status evaluation index, the worse the health status of the Sanbai melon, that is, it indicates the worse the quality of the Sanbai melon.
[0067] Please refer to Figure 9 , the present invention also provides a Sanbai melon quality detection system based on hyperspectral images. The Sanbai melon quality detection system based on hyperspectral images is used to execute the above-mentioned Sanbai melon quality detection method based on hyperspectral images, including: A training data processing module, which is used to screen out Sanbai melon samples that meet the quality requirements, obtain the physiological characteristic parameters representing the nutritional data of the Sanbai melon and the appearance shape characteristic parameters representing the external shape data of the Sanbai melon in the samples, collect the hyperspectral images of the samples and extract the reflectance data, and associate the reflectance data of the same sample with the physiological characteristic parameters and the appearance characteristic parameters to generate a sample detection library; A relevant data comparison module, which is used to collect the hyperspectral images of the Sanbai melon to be detected and extract the reflectance data, compare the reflectance data of the Sanbai melon to be detected screened out with the reflectance data of each sample inside the sample detection library, and calculate the similarity index between the Sanbai melon to be detected and each sample; A physiological deviation analysis module, which is used to determine whether the Sanbai melon to be detected meets the first-level classification requirements based on the similarity index. If it meets, the three groups of samples with the largest similarity index are used as the fitting samples, the average value of the physiological characteristic parameters of the fitting samples is used as the predicted characteristic parameters of the Sanbai melon to be detected, and the physiological deviation index is obtained according to the deviation degree of the predicted characteristic parameters relative to the average value of the physiological characteristic parameters in the sample detection library; A quality comprehensive judgment module, which is used to obtain the appearance characteristic parameters of the Sanbai melon to be detected, compare them with the average value of the appearance characteristic parameters in the sample detection library, obtain the shape deviation index, and judge whether the quality of the Sanbai melon to be detected meets the requirements by analyzing the physiological deviation index and the shape deviation index.
[0068] The present invention also provides a non-volatile computer-readable storage medium containing computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the processors execute the above-mentioned Sanbai melon quality detection method based on hyperspectral images.
[0069] The above formulas are all dimensionless and take their numerical values for calculation. The formulas are obtained by collecting a large amount of data for software simulation to obtain a formula closest to the actual situation. The preset parameters in the formulas are set by those skilled in the art according to the actual situation.
[0070] The above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. Those skilled in the art will realize that the units and algorithm steps of the examples described in connection with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software methods depends on the specific application and design constraints of the technical solution.
[0071] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units. They may be located in one place or distributed over multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0072] As described above, the above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed in the present application can easily think of changes or substitutions, which should all be covered within the protection scope of the present application.
Claims
1. A method for detecting the quality of Sanbai melons based on hyperspectral images, characterized in that, The specific steps include: S1: Screen out the Sanbai melon samples that meet the quality requirements, obtain the physiological characteristic parameters representing the nutritional data of the Sanbai melons and the appearance shape characteristic parameters representing the external shape data of the Sanbai melons in the samples, collect the hyperspectral images of the samples and extract the reflectance data, and associate the reflectance data of the same sample with the physiological characteristic parameters and the appearance characteristic parameters to generate a sample detection library; S2: Collect the hyperspectral image of the Sanbai melon to be detected and extract the reflectance data, compare the reflectance data of the Sanbai melon to be detected with the reflectance data of each sample in the sample detection library, and calculate the similarity index between the Sanbai melon to be detected and each sample; S3: Based on the similarity index, determine whether the Sanbai melon to be detected meets the first-level classification requirements. If it meets, take the three groups of samples with the largest similarity index as the fitting samples, take the mean value of the physiological characteristic parameters of the fitting samples as the predicted characteristic parameters of the Sanbai melon to be detected, and obtain the physiological deviation index according to the deviation degree of the predicted characteristic parameters from the average value of the physiological characteristic parameters in the sample detection library; S4: Obtain the appearance characteristic parameters of the Sanbai melon to be detected, compare them with the average value of the appearance characteristic parameters in the sample detection library, obtain the shape deviation index, and judge whether the quality of the Sanbai melon to be detected meets the requirements by analyzing the physiological deviation index and the shape deviation index.
2. The method for detecting the quality of Sanbai melons based on hyperspectral images according to claim 1, wherein: The appearance shape characteristic parameters include the roundness and surface roughness of the Sanbai melon; the physiological characteristic parameters include sugar content, vitamin content and water content, and the physiological characteristic parameters are preprocessed, specifically normalization preprocessing; The specific scheme for screening out the Sanbai melon samples that meet the quality requirements is: score the quality of all Sanbai melon samples by the expert scoring method, and screen out the Sanbai melon samples that meet the quality requirements from all Sanbai melon samples according to the scoring results; The method for collecting the hyperspectral image of the Sanbai melon sample is: determine the longitudinal and transverse curves of the Sanbai melon sample, record the intersection point of the two curves as the image acquisition center point, adjust the shooting position of the hyperspectral instrument until the midpoint of the image collected by the hyperspectral instrument is at the image acquisition center point, collect the hyperspectral image at this position, and take the image acquisition center point as the center, and adjust the image size of the hyperspectral image to 214*214 pixels; Calibrate the collected hyperspectral image to obtain the calibrated hyperspectral image. The calibration is specifically black and white calibration. The formula specifically based on which the calibrated hyperspectral image is obtained is: ; In the formula, is the corrected hyperspectral image, is the original hyperspectral image, is the calibration image obtained by scanning the standard polytetrafluoroethylene whiteboard, is the calibration image obtained by scanning the black correction plate, is the maximum value of the illumination intensity of the hyperspectral system; The method for generating the sample detection library is: associate the reflectance data of the same sample with the physiological characteristic parameters and the appearance characteristic parameters to form a corresponding grid, and record the formed grid data as the sample detection library.
3. The method for detecting the quality of Sanbai melons based on hyperspectral images according to claim 2, wherein: The method for obtaining the similarity index is as follows: Based on the hyperspectral image of the Sanbai melon to be detected, extract the reflectance data of the full band in the image, and divide the full band into several sub-bands according to the representation band ranges corresponding to different physiological characteristic parameters, analyze the average distance and the reflectance area difference of the reflectance in each sub-band, and characterize the similarity index according to the average distance and the reflectance area difference; The average distance of the selected points within the i-th sub-band The formula based on the calculation is as follows: ; Wherein, is the reflectance corresponding to the wavelength of the j-th point randomly selected within the i-th sub-band of the sample data, is the reflectance corresponding to the wavelength of the j-th point selected within the i-th sub-band of the Sanbai melon to be detected, where i is the index of the selected band, and and m is the total number of selected bands, is the index of the selected point within the sub-band, where is the total number of selected points within the sub-band; The overall reflectance area difference within the i-th sub-band The specific calculation is based on the following formula: ; In the formula, is the reflectance of the sample data at wavelength x, is the reflectance of the Sanbai melon to be detected at wavelength x, is the lower limit of wavelength x in the i-th band, is the upper limit of wavelength x in the i-th band.
4. The method for detecting the quality of Sanbai melons based on hyperspectral images according to claim 3, wherein: Calculate the similarity index between the Sanbai melon to be detected and each sample. The similarity index is characterized by the difference in reflectance between the Sanbai melon to be detected and each sample within the same wavelength band at the same wavelength, that is, the average distance of reflectance and the difference in reflectance area within each sub-band. The specific formula for calculation is as follows: ; Wherein, is the similarity index within the selected i-th sub-band, is the average distance between the reflectance of the to-be-detected Sanbai melon and the corresponding reflectance of the sample data at the selected wavelength within the i-th sub-band, which is used to represent the difference in reflectance, is the overall reflectance area difference within the i-th sub-band, and are the weight coefficients of the average distance and the reflectance area respectively, where , and are both greater than 0, and .
5. The method for detecting the quality of Sanbai melons based on hyperspectral images according to claim 4, characterized in that: The specific formula for calculating the similarity index between the Sanbai melon to be detected and the sample based on the similarity index within the selected i-th sub-band is as follows: ; In the formula, is the similarity index of the Sanbai melon to be detected and the sample; Perform primary classification on the Sanbai melon to be detected based on the similarity index. The specific logic for primary classification is as follows: Set the minimum similarity threshold. When the similarity index between the Sanbai melon to be detected and the sample is less than the minimum similarity threshold, mark the quality of the Sanbai melon to be detected as poor. If the similarity index between the Sanbai melon to be detected and the sample is greater than or equal to the minimum similarity threshold, it indicates that the Sanbai melon to be detected meets the requirements of primary classification and subsequent classification should be carried out; Calculate the similarity index of the to-be-detected Sanbai melon and each sample according to the formula, and generate a sequence of similarity indices in descending order, specifically as , where is the maximum similarity index between the to-be-detected Sanbai melon and the samples, is the minimum similarity index, is the total number of Sanbai melon samples that meet the quality requirements.
6. The method for detecting the quality of Sanbai melons based on hyperspectral images according to claim 5, wherein: The predicted characteristic parameters include the predicted sugar content value, the predicted vitamin content value, and the predicted water content value. According to the deviation degree of the predicted characteristic parameters from the average value of the physiological characteristic parameters in the sample detection library, a physiological deviation index is obtained. The specific formula for calculating the physiological deviation index is as follows: ; In the formula, is the physiological deviation index, is the predicted sugar content value, is the predicted vitamin content value, is the predicted water content value, , and are the average sugar content, the average vitamin content, and the average water content in the sample detection library, respectively; Obtain the appearance characteristic parameters of the Sanbai melon to be detected and compare them with the average value of the appearance characteristic parameters in the sample detection library to obtain the shape deviation index. The specific formula for calculating the shape deviation index is as follows: ; In the formula, is the shape deviation index, is the roundness of the Sanbai melon to be detected, is the surface roughness of the Sanbai melon to be detected, and are the average values of roundness and surface roughness in the sample detection library, respectively.
7. A method for detecting the quality of Sanbai melons based on hyperspectral images according to claim 6, characterized in that: The specific logic for determining whether the quality of the Sanbai melon to be detected meets the requirements by analyzing the physiological deviation index and the shape deviation index is as follows: When it is judged that the appearance quality of the Sanbai melon is excellent, indicating that the appearance quality of the Sanbai melon is used for high-end gift boxes in large supermarkets for sale; When it is determined that the appearance quality of the Sanbai melon is good, indicating that the Sanbai melon is used for secondary processing to make animal feed for sale; Among them, is the comprehensive offset index, which characterizes the physiological offset index and the appearance offset index. The specific formula is as follows: ; Among them is the quality judgment threshold value.
8. A quality detection system for Sanbai melons based on hyperspectral images, characterized in that: The Sanbai melon quality detection system based on hyperspectral images is used to execute the Sanbai melon quality detection method according to any one of claims 1-7, including: A training data processing module, which is used to screen out Sanbai melon samples that meet the quality requirements, obtain the physiological characteristic parameters representing the nutritional data of the Sanbai melon and the appearance shape characteristic parameters representing the shape data of the Sanbai melon in the samples, collect the hyperspectral images of the samples and extract the reflectance data, and associate the reflectance data of the same sample with the physiological characteristic parameters and the appearance characteristic parameters to generate a sample detection library; A relevant data comparison module, which is used to collect the hyperspectral images of the Sanbai melon to be detected and extract the reflectance data, compare the extracted reflectance data of the Sanbai melon to be detected with the reflectance data of each sample in the sample detection library, and calculate the similarity index between the Sanbai melon to be detected and each sample; A physiological deviation analysis module, which is used to determine whether the Sanbai melon to be detected meets the requirements of primary classification based on the similarity index. If it meets the requirements, select the three groups of samples with the largest similarity index as the fitting samples, use the average value of the physiological characteristic parameters of the fitting samples as the predicted characteristic parameters of the Sanbai melon to be detected, and obtain the physiological deviation index according to the deviation degree of the predicted characteristic parameters from the average value of the physiological characteristic parameters in the sample detection library; The quality comprehensive judgment module is used to obtain the appearance characteristic parameters of the to-be-detected Sanbai melons, compare them with the average value of the appearance characteristic parameters in the sample detection library, obtain the shape deviation index, and judge whether the quality of the to-be-detected Sanbai melons meets the requirements by analyzing the physiological deviation index and the shape deviation index.
9. A non - volatile computer - readable storage medium containing computer - executable instructions, characterized in that: When the computer-executable instructions are executed by one or more processors, the processors are caused to execute a method for detecting the quality of Sanbai melons based on hyperspectral images according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method for detecting internal and external quality of Fengcheng peaches based on hyperspectrum and deep learning
CN111968080A
Method and device for detecting content of astaxanthin in haematococcus pluvialis, medium and product
CN118671011A
Bamboo shoot quality detection method and system based on hyperspectral image and medium
CN119147480A
Pea seed quality detection method and device based on infrared spectrum
CN119666779A
Plant species determination device, plant species determination method and program
JP2017133966A