Three-white melon quality detection method, system and medium based on hyperspectral imaging
Through a detection method based on hyperspectral images, combined with physiological and appearance feature parameters, a sample detection library was established, and similarity and offset indexes were calculated, which solved the accuracy and consistency problems of traditional three-white melon detection and achieved efficient and objective quality evaluation.
Patent Information
- Application Number
- CN202510912574.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-03
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2045-07-03
AI Technical Summary
The traditional quality detection method of Sanbai melon relies on manual evaluation, which is time-consuming and labor-intensive, highly subjective, and cannot fully reflect the physiological and appearance characteristics, resulting in insufficient detection accuracy and consistency, and inability to achieve real-time monitoring.
A detection method based on hyperspectral imaging was adopted. By obtaining the physiological and appearance characteristic parameters of Sanbai melon, a sample detection library was established, and the similarity index and offset index were calculated. Combined with hyperspectral imaging technology and data analysis, a scientific evaluation of the quality of Sanbai melon was achieved.
It improves the accuracy and reliability of detection, realizes the comprehensive evaluation of the quality of Sanbai melon, overcomes the subjective bias in traditional methods, and provides scientific quality control support.
Smart Images

Figure CN120404618B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of melon quality detection, and in particular to a method, system and medium for detecting the quality of three-white melons based on hyperspectral images. Background Art
[0002] In modern agriculture, the quality testing of Sanbai melon (Sweet Melon) has always been a crucial step in ensuring market competitiveness and consumer satisfaction as it is a popular, high-quality agricultural product. Traditional quality testing methods typically rely on manual evaluation and sensory testing, which is not only time-consuming and labor-intensive but also susceptible to subjective factors, resulting in inaccurate and inconsistent test results. Furthermore, there is no specific definition for the quality of Sanbai melon. Furthermore, traditional methods cannot fully reflect the physiological and appearance characteristics of the fruit, making it impossible to monitor quality changes in real time. Therefore, there is an urgent need for an efficient, objective, and accurate testing method to address these technical issues.
[0003] The hyperspectral image-based quality detection method for Sanbai melons, by combining hyperspectral imaging technology with data analysis, can effectively extract and analyze the physiological and appearance characteristic parameters of Sanbai melons. This method not only improves the accuracy and reliability of detection, but also enables rapid testing of large batches of samples, meeting the needs of modern agriculture for intelligent and automated testing. Furthermore, by comparing the similarity of the sample to be tested with high-quality samples in the sample library, this method can assess quality across a wider range of characteristic dimensions, providing more scientific data support for Sanbai melon quality control.
[0004] In the prior art, publication number CN119147480A discloses a bamboo shoot quality detection method, system and medium based on hyperspectral images, the method comprising: obtaining a first hyperspectral image collected from 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 determining the reflectance matrices of the K first spectral images respectively; determining the spectral deviation of the corresponding first spectral image based on the reflectance matrix, and determining the quality of the target bamboo shoot based on the spectral deviation of each first spectral image. However, this scheme does not explain the specific basis for how the target bamboo shoot reflects the quality through the spectral image, and the quality of the target bamboo shoot is judged differently only from the difference in the spectral images. Therefore, the hyperspectral image detection method has defects, and directly acts on the three-white melon detection, thereby reducing the accuracy and effectiveness of the target three-white melon quality detection.
[0005] 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 form the prior art that is already known to a person of ordinary skill in the art. Summary of the Invention
[0006] The object of the present invention is to provide a method, system and medium for detecting the quality of three white melons based on hyperspectral images to solve the problems raised in the above background technology.
[0007] To achieve the above object, the present invention provides the following technical solutions:
[0008] A method for detecting the quality of three white melons based on hyperspectral images, comprising the following steps:
[0009] S1: Screen out three-white melon samples that meet quality requirements, obtain physiological characteristic parameters representing the nutritional data of the three-white melon and appearance characteristic parameters representing the appearance data of the three-white melon in the samples, collect hyperspectral images of the samples and extract 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;
[0010] S2: Collect a hyperspectral image of the three-white melon to be tested and extract reflectance data, compare the reflectance data of the three-white melon to be tested with the reflectance data of each sample in the sample detection library, and calculate the similarity index between the three-white melon to be tested and each sample;
[0011] S3: Determine whether the three-white melon to be tested meets the first-level classification requirements based on the similarity index. If so, use the three groups of samples with the largest similarity index as fitting samples, use the mean of the physiological characteristic parameters of the fitting samples as the predicted characteristic parameters of the three-white melon to be tested, and derive the physiological deviation index based on the deviation of the predicted characteristic parameters from the mean of the physiological characteristic parameters in the sample detection library;
[0012] S4: Obtain the appearance characteristic parameters of the three-white melon to be tested, and compare them with the average value of the appearance characteristic parameters in the sample detection library to obtain the appearance deviation index. By analyzing the physiological deviation index and the appearance deviation index, it is determined whether the quality of the three-white melon to be tested meets the requirements.
[0013] Furthermore, the appearance shape characteristic parameters include roundness and surface roughness of the three white melons; the physiological characteristic parameters include sugar content, vitamin content and water content, and the physiological characteristic parameters are preprocessed, specifically normalized preprocessing;
[0014] The specific scheme for screening out the three white melon samples that meet the quality requirements is as follows: scoring the quality of all three white melon samples by an expert scoring method, and screening out the three white melon samples that meet the quality requirements from all three white melon samples according to the scoring results;
[0015] The method for collecting the hyperspectral image of the three-white melon sample is as follows: determine the longitudinal and transverse curves of the three-white melon sample, record the intersection 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 adjust the image size of the hyperspectral image to 214*214 pixels with the image acquisition center point as the center;
[0016] The collected hyperspectral image is corrected to obtain a corrected hyperspectral image. The correction is specifically a black-white correction. The formula for obtaining the corrected hyperspectral image is:
[0017] ;
[0018] Where, is the corrected hyperspectral image, is the original hyperspectral image, The calibration image is obtained by scanning a standard PTFE white plate. is the calibration image obtained by scanning the black calibration plate, is the maximum value of the light intensity of the hyperspectral system;
[0019] The method for generating the sample detection library is as follows: the reflectance data of the same sample is associated with the physiological characteristic parameters and the appearance characteristic parameters to form a corresponding grid, and the formed grid data is recorded as the sample detection library.
[0020] Furthermore, the method for obtaining the similarity index is as follows: based on the hyperspectral image of the three white melons to be detected, the reflectance data of the entire band in the image is extracted, and the entire band is divided into several sub-bands according to the characterization band range corresponding to different physiological characteristic parameters, and the average distance and reflectance area difference of the reflectance in each sub-band are analyzed, and the similarity index is characterized according to the average distance and reflectance area difference;
[0021] The average distance of the selected points in the i-th sub-band is The calculation is based on the formula:
[0022] ;
[0023] Where, is the reflectivity corresponding to the wavelength of the jth point randomly selected in the i-th sub-band of the sample data, is the reflectance corresponding to the wavelength of the jth point selected in the i-th sub-band of the three white melons to be detected, where i is the index of the selected band, , m is the total number of selected bands, is the index of the selected point in the sub-band, ,in is the total number of selected points in the sub-band;
[0024] The overall reflectivity area difference within the i-th sub-band The specific calculation is based on the formula:
[0025] ;
[0026] Where, is the reflectance of the sample data at wavelength x, is the reflectivity of the white melon to be tested at wavelength x, is the lower limit of wavelength x in band i, is the upper limit of wavelength x in band i.
[0027] Furthermore, the similarity index between the three white melons to be tested and each sample is calculated, wherein the similarity index is characterized by the difference in reflectivity between the three white melons to be tested and each sample in the same band and at the same wavelength. The specific calculation formula is:
[0028] ;
[0029] Where, is the similarity index within the selected i-th sub-band, is the average distance between the reflectance of the tested three white melon and the sample data at the selected wavelength in the i-th sub-band, which is used to represent the difference in reflectance. is the overall reflectivity area difference within the i-th sub-band, and are the weight coefficients of average distance and reflectivity area, respectively, where , and are greater than 0, and .
[0030] Furthermore, the specific formula for calculating the similarity index between the three white melons to be tested and the sample according to the similarity index within the selected i-th sub-band is:
[0031] ;
[0032] Where, is the similarity index between the tested three white melons and the sample;
[0033] Based on the similarity index, the three-white melon to be tested is classified into a first-level classification, wherein the specific logic of the first-level classification is: setting a minimum similarity threshold, 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 subsequently classified;
[0034] 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.
[0035] Furthermore, 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:
[0036] ;
[0037] 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 They are the average sugar content, average vitamin content and average water content in the sample test library;
[0038] Obtain the appearance characteristic parameters of the three white melons to be tested, 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:
[0039] ;
[0040] Where, is the shape deviation index, is the roundness of the three white melons to be tested, is the surface roughness of the three white melons to be tested, and They are the average values of circularity and surface roughness in the sample detection library respectively.
[0041] Furthermore, by analyzing the physiological deviation index and the appearance deviation index, the specific logic for judging whether the quality of the three white melons to be tested meets the requirements is as follows:
[0042] when When the appearance quality of the three-white melon is judged to be excellent, it means that the appearance quality of the three-white melon is suitable for sale in high-end gift boxes in large supermarkets;
[0043] when When the appearance quality of the three-white melon is judged to be good, it means that the three-white melon is used for secondary processing to make animal feed for sale;
[0044] in, To obtain a comprehensive excursion index, the physiological excursion index and the external excursion index are characterized. The specific formula is as follows:
[0045] ;
[0046] in is the quality judgment threshold.
[0047] The present invention also provides a three-white melon quality detection system based on hyperspectral imagery, wherein the three-white melon quality detection system based on hyperspectral imagery is used to execute the three-white melon quality detection method based on hyperspectral imagery, comprising:
[0048] The training data processing module is used to screen out three-white melon samples that meet quality requirements, obtain physiological characteristic parameters representing the nutritional data of the three-white melon and appearance characteristic parameters representing the appearance data of the three-white melon in the samples, collect hyperspectral images of the samples and extract reflectance data, and associate the reflectance data of the same samples with the physiological characteristic parameters and appearance characteristic parameters to generate a sample detection library;
[0049] The relevant data comparison module is used to collect the hyperspectral image of the three white melons to be tested and extract the reflectance data, compare the reflectance data of the screened three white melons to be tested with the reflectance data of each sample in the sample detection library, and calculate the similarity index between the three white melons to be tested and each sample;
[0050] The physiological deviation analysis module is used to determine whether the three-white melon to be tested meets the primary classification requirements based on the similarity index. If so, the three groups of samples with the largest similarity index are used as fitting samples, and the mean of the physiological characteristic parameters of the fitting samples is used as the predicted characteristic parameter of the three-white melon to be tested. The physiological deviation index is obtained based on the deviation of the predicted characteristic parameter from the mean value of the physiological characteristic parameters in the sample detection library;
[0051] The comprehensive quality judgment module is used to obtain the appearance characteristic parameters of the three-white melon to be tested, and compare them with the average value of the appearance characteristic parameters in the sample detection library to obtain the appearance deviation index. By analyzing the physiological deviation index and the appearance deviation index, it is judged whether the quality of the three-white melon to be tested meets the requirements.
[0052] 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 method for detecting the quality of three white melons based on hyperspectral images.
[0053] Compared with the prior art, the present invention has the following beneficial effects:
[0054] First, a hyperspectral image-based quality detection method for Sanbai melons was developed. By combining hyperspectral imaging technology with a data analysis system, a comprehensive assessment of the physiological and appearance characteristics of Sanbai melons was achieved. This method systematically compiles the physiological and appearance characteristic parameters of Sanbai melon samples that meet quality requirements by establishing a sample detection library, and then combines this 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 testing. During the processing of the samples to be tested, a similarity index is calculated by comparing them with the sample detection library, thereby selecting the most representative fitting samples. This greatly enhances the scientific nature and accuracy of the test and can effectively overcome the subjective bias problem in traditional methods.
[0055] In addition, the physiological characteristic parameters of the fitted sample are used to predict the physiological characteristics of the three-white melon to be tested, thereby obtaining the predicted characteristic parameters, and the deviation is calculated to obtain the physiological deviation index. This index can intuitively reflect the difference between the physiological characteristics of the three-white melon to be tested and the high-quality samples in the sample library, thus providing a quantitative basis for quality assessment. At the same time, by obtaining the appearance characteristic parameters of the three-white melon to be tested and comparing them with the appearance characteristic parameters in the sample testing library, the appearance deviation index is obtained. This dual evaluation mechanism not only improves the comprehensiveness of quality testing, but also ensures the reliability of the results. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 Schematic diagram of the overall method flow of the present invention;
[0057] Figure 2 is the average distance-similarity index fitting curve;
[0058] Figure 3 is the area difference-similarity index fitting curve graph;
[0059] Figure 4 To detect the distribution scatter plot of physiological characteristic parameters of three white melon samples;
[0060] Figure 5 This is the vitamin content-physiological deviation index fitting curve;
[0061] Figure 6 is a scatter plot of the shape deviation index and circularity deviation;
[0062] Figure 7 is a scatter plot of the shape deviation index and surface roughness deviation;
[0063] Figure 8 This is a statistical chart comparing the quality of three white melons;
[0064] Figure 9 Schematic diagram of the overall system structure of the present invention. DETAILED DESCRIPTION
[0065] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to specific embodiments.
[0066] It should be noted that, unless otherwise defined, the technical or scientific terms used in the present invention should have the usual meanings understood by people with ordinary skills in the field to which the present invention belongs. The "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative position relationships. When the absolute position of the object being described changes, the relative position relationship may also change accordingly.
[0067] Example:
[0068] See also Figures 1-8 , the present invention provides a technical solution:
[0069] A method for detecting the quality of three white melons based on hyperspectral images, comprising the following steps:
[0070] Step 1: Screen out three-white melon samples that meet the quality requirements, obtain the physiological characteristic parameters that characterize the nutritional data of the three-white melon and the appearance characteristic parameters that characterize the appearance data of the three-white melon in the samples, collect hyperspectral images of the samples and extract 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.
[0071] The physiological characteristic parameters include sugar content, vitamin content, and water content. Sugar content is determined using high-performance liquid chromatography (HPLC) or an enzymatic method. The steps include: Sample preparation: Extracting pulp from different parts of the three-white melon, cutting it into small pieces, and evenly mixing them. Extraction: Using a suitable solvent to extract the sugars from the pulp. Analytical measurement: The extract is separated and quantified using an HPLC instrument, or the sugar content is determined using an enzymatic method.
[0072] The vitamin content is also determined using high performance liquid chromatography or enzymatic methods.
[0073] The moisture content is determined by oven drying or Kjeldahl method.
[0074] At the same time, the physiological characteristic parameters are preprocessed, specifically normalization preprocessing;
[0075] The formula for normalization preprocessing calculation of sugar content is as follows: The sugar content data of the collected three white melon samples are preprocessed, wherein the preprocessing is specifically normalization preprocessing, and the formula for normalization preprocessing is as follows:
[0076] ;
[0077] Where, is the normalized data of the sugar content of the t-th Sanbai melon sample, is the sugar content data of the t-th Sanbaigua sample, and They represent the minimum sugar content data and the maximum sugar content data of all the collected three-white melon samples, respectively, where t is the index of the three-white melon sample, ,in is the total number of three white melon samples.
[0078] The formula for normalization preprocessing calculation of vitamin content is as follows: The vitamin content data of the collected three white melon samples are preprocessed, wherein the preprocessing is specifically normalization preprocessing, and the formula for normalization preprocessing is as follows:
[0079] ;
[0080] Where, is the normalized data of the vitamin content of the t-th three-white melon sample, is the vitamin content data of the t-th three-white melon sample, and They respectively represent the minimum vitamin content data and the maximum vitamin content data among all the vitamin content data collected from the three white melon samples.
[0081] The formula for calculating the water content normalization preprocessing is: the water content data of the collected three white melon samples are preprocessed, wherein the preprocessing is specifically normalized preprocessing, and the formula for normalized preprocessing is:
[0082] ;
[0083] Where, is the normalized data of the water content of the t-th three-white melon sample, is the water content data of the tth three-white melon sample, and They respectively represent the minimum moisture content data and the maximum moisture content data of all the water content data of the three white melon samples collected.
[0084] The specific plan for screening out the three-white melon samples that meet the quality requirements is: scoring the quality of all three-white melon samples by an expert scoring method, and screening out the three-white melon samples that meet the quality requirements from all three-white melon samples based on the scoring results.
[0085] The specific logic for selecting the three white melon samples that meet the quality requirements is as follows:
[0086] Several experts scored the same three-white melon, giving a comprehensive score based on its shape, texture and taste, with a full score of 10. The scores given by the experts were averaged. If the average score of the three-white melon was greater than or equal to 8, the three-white melon sample was screened out as a three-white melon sample.
[0087] The method for collecting hyperspectral images of three-white melon samples is as follows: determine the longitudinal and transverse curves of the three-white melon samples, record the intersection 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 adjust the image size of the collected hyperspectral image to 214*214 pixels with the image acquisition center point as the center.
[0088] The method for collecting a hyperspectral image of a three-white melon sample is as follows: determining the length center of the three-white melon sample, determining the cross-sectional profile of the length center, adjusting the shooting position of the hyperspectral instrument until the midpoint of the image collected by the hyperspectral instrument is on the cross-sectional profile of the length center of the three-white melon sample, and collecting the hyperspectral image at this position;
[0089] The collected hyperspectral image is corrected to obtain a corrected hyperspectral image. The correction is specifically a black-white correction. The formula for obtaining the corrected hyperspectral image is:
[0090] ;
[0091] Where, is the corrected hyperspectral image, is the original hyperspectral image, The calibration image is obtained by scanning a standard PTFE white plate. is the calibration image obtained by scanning the black calibration plate, This is the maximum value of the hyperspectral system's light intensity. This value typically depends on the specific sensor model and its design specifications. Generally speaking, this value can range from 0 to a certain maximum value. The most common maximum digital value (DN value) ranges are as follows: 8-bit system: Maximum value is 255 (i.e., a range of 0 to 255). 12-bit system: Maximum value is 4095 (i.e., a range of 0 to 4095). 14-bit system: Maximum value is 16383 (i.e., a range of 0 to 16383). 16-bit system: Maximum value is 65535 (i.e., a range of 0 to 65535).
[0092] The method for generating the sample detection library is as follows: the reflectance data of the same sample is associated with the physiological characteristic parameters and the appearance characteristic parameters to form a corresponding grid, and the formed grid data is recorded as the sample detection library.
[0093] Step 2: Collect the hyperspectral image of the three-white melon to be tested and extract the reflectance data. Compare the reflectance data of the screened three-white melon to be tested with the reflectance data of each sample in the sample detection library, and calculate the similarity index between the three-white melon to be tested and each sample.
[0094] The method for obtaining the similarity index is as follows: based on the hyperspectral image of the three white melons to be detected, the reflectance data of the full band in the image is extracted, and the full band is divided into several sub-bands according to the characterization band range corresponding to different physiological characteristic parameters, and the average distance and reflectance area difference of the reflectance in each sub-band are analyzed, and the similarity index is characterized according to the average distance and reflectance area difference;
[0095] The average distance of the selected points in the i-th sub-band is The calculation is based on the formula:
[0096] ;
[0097] Where, is the reflectivity corresponding to the wavelength of the jth point randomly selected in the i-th sub-band of the sample data, is the reflectance corresponding to the wavelength of the jth point selected in the i-th sub-band of the three white melons to be detected, where i is the index of the selected band, , m is the total number of selected bands, is the index of the selected point in the sub-band, ,in is the total number of selected points in the sub-band;
[0098] The overall reflectivity area difference within the i-th sub-band The specific calculation is based on the formula:
[0099] ;
[0100] Where, is the reflectance of the sample data at wavelength x, is the reflectivity of the white melon to be tested at wavelength x, is the lower limit of wavelength x in band i, is the upper limit of wavelength x in band i.
[0101] Calculate the similarity index between the tested three-white melon and each sample. The similarity index is characterized by the difference in reflectivity between the tested three-white melon and each sample in the same band and at the same wavelength, that is, the average distance and reflectivity area difference in each sub-band. The specific calculation formula is:
[0102] ;
[0103] Where, is the similarity index within the selected i-th sub-band, is the average distance between the reflectance of the tested three white melon and the sample data at the selected wavelength in the i-th sub-band, which is used to represent the difference in reflectance. is the overall reflectivity area difference within the i-th sub-band, where i is the index of the selected band, , m is the total number of selected bands, and are the weight coefficients of average distance and reflectivity area, respectively, where , and are greater than 0, and .
[0104] It should be noted that the similarity index within the selected i-th sub-band is Used to indicate the similarity between the three white melons to be tested and each sample spectral data, the similarity index in the selected i-th sub-band The higher the value, the closer the physiological characteristic parameters of the tested three-white melon are to those of the sample, and it can be used to estimate the physiological characteristic parameters of the tested three-white melon.
[0105] Since the average distance of the selected points may have extreme cases, 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 reflectivity area difference is introduced to comprehensively represent the similarity index, and the , and are greater than 0, and . It is used to reduce the influence of the average distance and make the similarity index more accurate.
[0106] The specific formula for calculating the similarity index between the three white melons to be tested and the sample according to the similarity index within the selected i-th sub-band is:
[0107] ;
[0108] Where, is the similarity index between the tested three-white melon and the sample; Table 1 shows the changes in the similarity index between the tested three-white melon and different samples.
[0109] Table 1: Similarity index calculation statistics
[0110]
[0111] The similarity index shows a negative correlation with the average distance across 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 as the distance between samples increases, their similarity decreases, reflecting the increasing diversity of sample characteristics.
[0112] 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.
[0113] 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.
[0114] 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.
[0115] 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.
[0116] 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.
[0117] 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:
[0118] ;
[0119] 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 They are the average sugar content, average vitamin content and average water content in the sample test library.
[0120] in In this embodiment, 8.0% is taken. In this embodiment, 1.5% is taken. In this embodiment, it is taken as 92%.
[0121] 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 sugar content prediction value Average sugar content The absolute value of the difference between the physiological deviation index Proportional, through the exponential function This indicates that sugar content has a nonlinear effect on the edible value of Sanbaigua. The higher the sugar content, the greater the effect on the physiological deviation index. The contribution increased significantly.
[0122] Vitamin content is considered an important indicator of health benefits and is expressed in logarithmic form When the difference in vitamin content increases, its physiological deviation index The contribution shows a marginal increasing effect.
[0123] Water content is an important factor affecting the freshness and taste of fruit. The more water it contains, the fresher it is. Adjusting water content has a positive impact on fruit quality. The increase in water content difference will significantly increase the physiological deviation index. , reflecting the freshness and taste quality of the fruit. Higher water content generally indicates a juicier fruit with a better taste. Table 2 shows the changes in physiological characteristic parameters and physiological deviation index of the three-white melon samples determined by similarity.
[0124] Table 2: Partial statistics of physiological deviation index calculation
[0125]
[0126] The predicted sugar content ranged from 6.6% to 8.2%, showing some variability. We observed that samples with higher sugar content (such as 8.2% in Sanbaigua No. 7) were often associated with higher predicted vitamin content (such as 1.7% in Sanbaigua No. 7) and water content (94%). This suggests that higher sugar content may be associated with higher vitamin and water content.
[0127] At the same time, the greater the difference between the predicted sugar content, vitamin content and water content and the corresponding reference value, the greater the physiological deviation index. For example, the predicted sugar content value of the three white melons No. 4 is 8.0%, which is the same as the average sugar content. The corresponding physiological deviation index is 0.7568, which is smaller than the data of the other groups.
[0128] Step 4: Obtain the appearance characteristic parameters of the three-white melon to be tested, and compare them with the average value of the appearance characteristic parameters in the sample detection library to obtain the appearance deviation index. By analyzing the physiological deviation index and the appearance deviation index, it is determined whether the quality of the three-white melon to be tested meets the requirements.
[0129] Obtain the appearance characteristic parameters of the three white melons to be tested, 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:
[0130] ;
[0131] Where, is the shape deviation index, is the roundness of the three white melons to be tested, is the surface roughness of the three white melons to be tested, and are the average values of circularity and surface roughness in the sample detection library, respectively. In this embodiment, 0.85 is taken. In this embodiment, it is set to 2.0.
[0132] One of the measurement methods of surface roughness is to represent the microscopic unevenness of the surface. The smaller the roughness, the smoother the surface, which usually means a better appearance. Therefore, the difference in surface roughness of the three white melons is related to the shape deviation index. Proportional, use Instead of using directly This is mainly because the effect of surface roughness is usually nonlinear, and the square root form can slow down the effect of increased roughness on SCI and improve the stability of the calculation. Table 3 shows the effect of the difference in circularity and surface roughness on the change of the shape deviation index.
[0133] Table 3: Statistical table of shape deviation index calculation
[0134]
[0135] Similar to the physiological deviation index, for example, the roundness of the three-white melon No. 10 was 0.85 and the surface roughness was 1.95. The difference from the average circularity and surface roughness values was small, and the corresponding shape deviation index was smaller than the remaining values, at 0.018. In other words, the smaller the difference from the average circularity and surface roughness values, the smaller the shape deviation index.
[0136] 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. Therefore, the difference in roundness and the appearance quality standard coefficient are closely related. Directly proportional.
[0137] By analyzing the physiological deviation index and the appearance deviation index, the specific logic for judging whether the quality of the tested three-white melon meets the requirements is as follows:
[0138] when When the appearance quality of the three-white melon is judged to be good, it means that the three-white melon is used for secondary processing to be made into animal feed for sale;
[0139] when When the appearance quality of the three-white melon is judged to be excellent, it is indicated that the appearance quality of the three-white melon is suitable for sale in high-end gift boxes in large supermarkets.
[0140] in, To obtain a comprehensive excursion index, the physiological excursion index and the external excursion index are characterized. The specific formula is as follows:
[0141] ;
[0142] in is the quality judgment threshold.
[0143] It should be noted that the physiological deviation index directly affects the nutritional value and taste of the three white melons, which are the main parameters affecting the quality. The physiological deviation index indicates the significant impact of the three-white melon quality. Since the physiological characteristics of the three-white melon have a very significant impact on its quality, the index form can better express the relative impact of physiological deviation on quality. In particular, when there is a significant deviation in physiological parameters, the quality decline is significant.
[0144] pass The relative quality of the three white melon varieties is shown, highlighting the effect of the shape deviation index on The square function has an amplifying effect. Using the square form to process the shape deviation index can significantly improve its effect when the shape deviation is large. This indicates that if the appearance of a Sanbai melon deviates from the normal standard, the negative impact on its overall quality will be amplified. This is especially true in production and sales, where appearance is crucial to consumer purchasing decisions. Table 4 shows how the quality of Sanbai melons was judged using the comprehensive deviation index and compares the judgment results with the actual quality results.
[0145] Table 4: Partial statistics of quality judgment of three white melons
[0146]
[0147] Across all 10 groups, expert assessments of health status and health status judgments were 100% consistent. This indicates that the expert assessments were fully consistent with health status judgments based on the indicators, increasing the reliability and validity of the data.
[0148] At the same time, it shows that the larger the health status assessment index is, the worse the health status of the three-white melon is, which means the quality of the three-white melon is worse.
[0149] See also Figure 9 The present invention also provides a three-white melon quality detection system based on hyperspectral imagery, wherein the three-white melon quality detection system based on hyperspectral imagery is used to execute the three-white melon quality detection method based on hyperspectral imagery, comprising:
[0150] The training data processing module is used to screen out three-white melon samples that meet quality requirements, obtain physiological characteristic parameters representing the nutritional data of the three-white melon and appearance characteristic parameters representing the appearance data of the three-white melon in the samples, collect hyperspectral images of the samples and extract reflectance data, and associate the reflectance data of the same samples with the physiological characteristic parameters and appearance characteristic parameters to generate a sample detection library;
[0151] The relevant data comparison module is used to collect the hyperspectral image of the three white melons to be tested and extract the reflectance data, compare the reflectance data of the screened three white melons to be tested with the reflectance data of each sample in the sample detection library, and calculate the similarity index between the three white melons to be tested and each sample;
[0152] The physiological deviation analysis module is used to determine whether the three-white melon to be tested meets the primary classification requirements based on the similarity index. If so, the three groups of samples with the largest similarity index are used as fitting samples, and the mean of the physiological characteristic parameters of the fitting samples is used as the predicted characteristic parameter of the three-white melon to be tested. The physiological deviation index is obtained based on the deviation of the predicted characteristic parameter from the mean value of the physiological characteristic parameters in the sample detection library;
[0153] The comprehensive quality judgment module is used to obtain the appearance characteristic parameters of the three-white melon to be tested, and compare them with the average value of the appearance characteristic parameters in the sample detection library to obtain the appearance deviation index. By analyzing the physiological deviation index and the appearance deviation index, it is judged whether the quality of the three-white melon to be tested meets the requirements.
[0154] 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 method for detecting the quality of three white melons based on hyperspectral images.
[0155] The above formulas are all dimensionless and numerical calculations. The formulas are obtained by collecting a large amount of data and performing software simulation to obtain the most recent real situation. The preset parameters in the formulas are set by technicians in this field according to actual conditions.
[0156] The above embodiments can be implemented in whole or in part by software, hardware, firmware, or any other 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 appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed by hardware or software depends on the specific application and design constraints of the technical solution.
[0157] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, and may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment as needed.
[0158] The above is only a specific implementation method of the present application, but the scope of protection of the present application is not limited thereto. Any technician familiar with this technical field can easily think of changes or replacements within the technical scope disclosed in this application, which should be covered by the scope of protection of the present application.
Claims
1. A method for detecting the quality of three white melons based on hyperspectral images, characterized in that: The specific steps include: S1: Screen out three-white melon samples that meet quality requirements, obtain physiological characteristic parameters representing the nutritional data of the three-white melon and appearance characteristic parameters representing the appearance data of the three-white melon in the samples, collect hyperspectral images of the samples and extract 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 a hyperspectral image of the three-white melon to be tested and extract reflectance data, compare the reflectance data of the three-white melon to be tested with the reflectance data of each sample in the sample detection library, and calculate the similarity index between the three-white melon to be tested and each sample; S3: Determine whether the three-white melon to be tested meets the first-level classification requirements based on the similarity index. If so, use the three groups of samples with the largest similarity index as fitting samples, use the mean of the physiological characteristic parameters of the fitting samples as the predicted characteristic parameters of the three-white melon to be tested, and derive the physiological deviation index based on the deviation of the predicted characteristic parameters from the mean of the physiological characteristic parameters in the sample detection library; S4: Obtaining appearance characteristic parameters of the three-white melon to be tested, and comparing them with the average value of the appearance characteristic parameters in the sample test library to obtain an appearance deviation index, and determining whether the quality of the three-white melon to be tested meets the requirements by analyzing the physiological deviation index and the appearance deviation index; 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 SPY is the physiological excursion index, TF for is the predicted value of sugar content, SW for is the predicted value of vitamin content, HS for is the predicted value of water content, TF mean , SW mean and HS mean They are the average sugar content, average vitamin content and average water content in the sample test library; Obtain the appearance characteristic parameters of the three white melons to be tested, 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: Where SCI is the shape deviation index, YR for is the roundness of the three white melons to be tested, Ra for is the surface roughness of the three white melons to be tested, YR mean and Ra mean They are the average values of circularity and surface roughness in the sample detection library respectively.
2. A method for detecting the quality of three white melons based on hyperspectral images according to claim 1, characterized in that: The appearance shape characteristic parameters include the roundness and surface roughness of the three-white 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 three white melon samples that meet the quality requirements is as follows: scoring the quality of all three white melon samples by an expert scoring method, and screening out the three white melon samples that meet the quality requirements from all three white melon samples according to the scoring results; The method for collecting the hyperspectral image of the three-white melon sample is as follows: determine the longitudinal and transverse curves of the three-white melon sample, record the intersection 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 adjust the image size of the hyperspectral image to 214*214 pixels with the image acquisition center point as the center; The collected hyperspectral image is corrected to obtain a corrected hyperspectral image. The correction is specifically a black-white correction. The formula for obtaining the corrected hyperspectral image is: Where I is the corrected hyperspectral image, R C is the original hyperspectral image, W C is the calibration image obtained by scanning a standard polytetrafluoroethylene white plate, B is the calibration image obtained by scanning a black calibration plate, and DN is the maximum value of the light intensity of the hyperspectral system; The method for generating the sample detection library is as follows: the reflectance data of the same sample is associated with the physiological characteristic parameters and the appearance characteristic parameters to form a corresponding grid, and the formed grid data is recorded as the sample detection library.
3. A method for detecting the quality of three white melons based on hyperspectral images according to claim 2, characterized in that: The method for obtaining the similarity index is as follows: based on the hyperspectral image of the three white melons to be detected, the reflectance data of the full band in the image is extracted, and the full band is divided into several sub-bands according to the characterization band range corresponding to different physiological characteristic parameters, and the average distance and reflectance area difference of the reflectance in each sub-band are analyzed, and the similarity index is characterized according to the average distance and reflectance area difference; The average distance d of the selected points in the i-th sub-band is i The calculation is based on the formula: Where, is the reflectivity corresponding to the wavelength of the jth point randomly selected in the i-th sub-band of the sample data, is the reflectance corresponding to the wavelength of the jth point selected in the i-th sub-band of the three white melons to be detected, where i is the index of the selected band, i∈[1,m], m is the total number of selected bands, j is the index of the selected point in the sub-band, j∈[1,n], n is the total number of selected points in the sub-band; The overall reflectivity area difference f in the i-th sub-band i The specific calculation formula is: Where y 1 (x) is the reflectance of the sample data at wavelength x, y 2 (x) is the reflectivity of the white melon to be tested at wavelength x, ia is the lower limit of wavelength x in band i, x ib is the upper limit of wavelength x in band i.
4. A method for detecting the quality of three white melons based on hyperspectral images according to claim 3, characterized in that: Calculate the similarity index between the tested three-white melon and each sample. The similarity index is characterized by the difference in reflectivity between the tested three-white melon and each sample in the same band and at the same wavelength, that is, the average distance and reflectivity area difference in each sub-band. The specific calculation formula is: Where ZC i is the similarity index within the selected i-th sub-band, d i is the average distance between the reflectance of the three white melons to be tested and the sample data at the selected wavelength in the i-th sub-band, which is used to represent the difference in reflectance, f i is the overall reflectivity area difference in the i-th sub-band, ω1 and ω2 are the weight coefficients of the average distance and reflectivity area, respectively, where ω2 ≥ ω1, ω1 and ω2 are both greater than 0, and ω1 + ω2 = 1.
5. A method for detecting the quality of three white melons based on hyperspectral images according to claim 4, characterized in that: The specific formula for calculating the similarity index between the three white melons to be tested and the sample according to the similarity index within the selected i-th sub-band is: Where ZH is the similarity index between the tested three white melons and the sample; Based on the similarity index, the three-white melon to be tested is classified into a first-level classification, wherein the specific logic of the first-level classification is: setting a minimum similarity threshold, 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 subsequently classified; The similarity index of 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 R = {ZH1, ZH2, ..., ZH K }, where ZH1 is the maximum similarity index between the three white melons to be tested and the samples, ZH K is the minimum similarity index, and K is the total number of three white melon samples that meet the quality requirements.
6. A method for detecting the quality of three white melons based on hyperspectral images according to claim 5, characterized in that: By analyzing the physiological deviation index and the appearance deviation index, the specific logic for judging whether the quality of the tested three-white melon meets the requirements is as follows: When 0≤ECI<1.0*yz, the appearance quality of the Sanbai melon is judged to be excellent, indicating that the appearance quality of the Sanbai melon is suitable for sale in high-end gift boxes in large supermarkets; When ECI≥1.0*yz, the appearance quality of the Sanbai melon is judged to be good, indicating that the Sanbai melon can be used for secondary processing to make animal feed for sale; Among them, ECI is the comprehensive excursion index, which is characterized by the physiological excursion index and the appearance excursion index. The specific formula is: ECI=SCI 2 +e SPY Where yz is the quality judgment threshold.
7. A three-white melon quality detection system based on hyperspectral imaging, characterized by: The three-white melon quality detection system based on hyperspectral imagery is used to execute the three-white melon quality detection method based on hyperspectral imagery according to any one of claims 1 to 6, comprising: The training data processing module is used to screen out three-white melon samples that meet quality requirements, obtain physiological characteristic parameters representing the nutritional data of the three-white melon and appearance characteristic parameters representing the appearance data of the three-white melon in the samples, collect hyperspectral images of the samples and extract reflectance data, and associate the reflectance data of the same samples with the physiological characteristic parameters and appearance characteristic parameters to generate a sample detection library; The relevant data comparison module is used to collect the hyperspectral image of the three white melons to be tested and extract the reflectance data, compare the reflectance data of the screened three white melons to be tested with the reflectance data of each sample in the sample detection library, and calculate the similarity index between the three white melons to be tested and each sample; The physiological deviation analysis module is used to determine whether the three-white melon to be tested meets the primary classification requirements based on the similarity index. If so, the three groups of samples with the largest similarity index are used as fitting samples, and the mean of the physiological characteristic parameters of the fitting samples is used as the predicted characteristic parameter of the three-white melon to be tested. The physiological deviation index is obtained based on the deviation of the predicted characteristic parameter from the mean value of the physiological characteristic parameters in the sample detection library; The comprehensive quality judgment module is used to obtain the appearance characteristic parameters of the three-white melon to be tested, and compare them with the average value of the appearance characteristic parameters in the sample detection library to obtain the appearance deviation index. By analyzing the physiological deviation index and the appearance deviation index, it is judged whether the quality of the three-white melon to be tested meets the requirements.
8. 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 enabled to execute the method for detecting the quality of three white melons based on hyperspectral images according to any one of claims 1 to 6.
Citation Information
Patent Citations
Bamboo shoot quality detection method and system based on hyperspectral image and medium
CN119147480A
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