Fruit and vegetable sugar degree detection model construction and sugar degree detection method based on hyperspectral imaging

Through hyperspectral imaging technology, combined with stoichiometry and cross-validation method, an accurate blueberry sugar content detection model was constructed, solving the problems of damage and inefficiency of traditional detection methods, and achieving lossless and accurate sugar content detection.

CN119274698APending Publication Date: 2025-01-07VEGETABLE RES INST GUANGDONG ACAD OF AGRI SERVICES +2

Patent Information

Application Number
CN202411422762.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

Traditional blueberry sugar content detection methods damage blueberries and are inefficient. The network model has inaccurate prediction results due to insufficient data.

Method used

Using a fruit and vegetable sugar content detection model based on hyperspectral imaging, a sugar content detection model is constructed by obtaining near-infrared spectral data and sugar content measurement data, using stoichiometric algorithms and cross-validation method to determine the number of characteristic wavelengths and the number of latent variables, and establishing accurate sugar content Detect the model.

Benefits of technology

Lossless and accurate blueberry sugar content detection is achieved, which improves the accuracy and robustness of the model and improves the detection efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119274698A_ABST
    Figure CN119274698A_ABST
Patent Text Reader

Abstract

The invention discloses a fruit and vegetable sugar degree detection model construction and sugar degree detection method based on hyperspectral imaging. The method comprises the following steps: acquiring a correction sample set of target fruits and vegetables; acquiring near infrared spectrum data and first sugar degree actual measurement data of each correction sample in the correction sample set; according to the near infrared spectrum data and the first sugar degree actual measurement data of all the correction samples, modeling by adopting a chemometrics algorithm to obtain a sugar degree detection model; constructing a first relation curve between the cross validation root-mean-square error of the sugar degree detection model and the number of characteristic wavelengths and a second relation curve between the cross validation root-mean-square error and the number of latent variables by adopting a cross validation method; respectively determining the number of target characteristic wavelengths and the number of target latent variables according to the first relation curve and the second relation curve; and obtaining a fruit and vegetable sugar degree detection model according to the number of the target characteristic wavelengths and the number of the target latent variables. And the sugar degree can be accurately and nondestructively detected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of fruit and vegetable detection, and in particular relates to the construction of a fruit and vegetable sugar content detection model based on hyperspectral imaging and a sugar content detection method. Background Art

[0002] Blueberry sugar content is an important indicator for evaluating blueberry quality.

[0003] In traditional technology, the sugar content of blueberries is generally measured by refractometer or digital refractometer. These traditional detection methods not only damage blueberries but also are cumbersome to operate and have low detection efficiency.

[0004] Although there are currently related research plans to use network models to predict the sugar content of fruits, which can be used for non-destructive testing of blueberries, the network model requires a large amount of training data to achieve good generalization, and the amount of training data for blueberries is insufficient, the model is prone to overfitting, resulting in inaccurate prediction results of the blueberry sugar content. Summary of the invention

[0005] The object of the present invention is to provide a method for constructing a fruit and vegetable sugar content detection model based on hyperspectral imaging, a fruit and vegetable sugar content detection method, device, equipment and storage medium, which can accurately and non-destructively detect the sugar content of blueberries.

[0006] The first aspect of the present invention discloses a method for constructing a fruit and vegetable sugar content detection model based on hyperspectral imaging, comprising:

[0007] Obtain a calibration sample set of target fruits and vegetables;

[0008] Acquire near infrared spectrum data and first sugar content measured data of each calibration sample in the calibration sample set;

[0009] According to the near infrared spectral data of all the calibration samples and the first sugar content measured data, a chemometric algorithm is used to build a model to obtain a sugar content detection model;

[0010] Using a cross-validation method, construct a first relationship curve between the cross-validation root mean square error of the sugar content detection model and the number of characteristic wavelengths, and construct a second relationship curve between the cross-validation root mean square error of the sugar content detection model and the number of latent variables;

[0011] Determine the number of target characteristic wavelengths according to the first relationship curve, and determine the number of target latent variables according to the second relationship curve;

[0012] A fruit and vegetable sugar content detection model is obtained according to the number of target characteristic wavelengths and the number of target latent variables.

[0013] In some embodiments, after obtaining the fruit and vegetable sugar content detection model, the method further includes:

[0014] Obtain a prediction sample set of target fruits and vegetables;

[0015] Acquire the second sugar content measured data of each prediction sample in the prediction sample set;

[0016] Inputting the predicted sample set into the fruit and vegetable sugar content detection model to obtain sugar content prediction data of each predicted sample in the predicted sample set;

[0017] Establishing a linear relationship between the second sugar content measured data and the sugar content predicted data, and calculating a determination coefficient according to the linear relationship;

[0018] When the determination coefficient is greater than a preset threshold, the fruit and vegetable sugar content detection model is determined to be valid; otherwise, the fruit and vegetable sugar content detection model is reconstructed.

[0019] In some embodiments, after obtaining the near infrared spectrum data of the calibration sample, the method further includes:

[0020] Preprocessing the near infrared spectrum data by wavelet transform to obtain preprocessed spectrum data;

[0021] The pre-processed spectral data is subjected to characteristic wavelength screening using a competitive adaptive re-weighting algorithm, and the screening result is set as the near-infrared spectral data.

[0022] In some embodiments, according to the near infrared spectral data of all the calibration samples and the first measured sugar content data, a chemometric algorithm is used to build a sugar content detection model, which includes:

[0023] The near-infrared spectral data of all the calibration samples are used as independent variables, and the first sugar content measured data of all the calibration samples are used as dependent variables, and a partial least squares regression algorithm is used to perform modeling to obtain the sugar content detection model.

[0024] In some embodiments, the step of obtaining the near infrared spectrum data and the first sugar content measured data of each calibration sample in the calibration sample set includes:

[0025] Determining a detection area for each calibration sample in the calibration sample set;

[0026] Based on the detection area, the near infrared spectrum data and the first sugar content measured data of each calibration sample are obtained.

[0027] The second aspect of the present invention discloses a method for detecting the sugar content of fruits and vegetables based on hyperspectral imaging, comprising:

[0028] Preliminarily construct a fruit and vegetable sugar content detection model using any of the above-mentioned fruit and vegetable sugar content detection model construction methods;

[0029] Collect near infrared spectral data of target fruit and vegetable samples to be tested;

[0030] The near infrared spectrum data is input into the fruit and vegetable sugar content detection model to obtain and output sugar content data.

[0031] In some embodiments, there are multiple samples to be tested. After obtaining the sugar content data corresponding to each sample to be tested, a local distribution heat map of sugar content is generated based on all the sugar content data.

[0032] The third aspect of the present invention discloses a device for constructing a fruit and vegetable sugar content detection model based on hyperspectral imaging, comprising:

[0033] A sample set acquisition module, used to acquire a calibration sample set of target fruits and vegetables;

[0034] A data acquisition module, used for acquiring near infrared spectrum data and first sugar content measured data of each calibration sample in the calibration sample set;

[0035] A model building module, used to build a model using a chemometric algorithm based on the near infrared spectral data of all the calibration samples and the first sugar content measured data to obtain a sugar content detection model;

[0036] The model optimization module is used to construct a first relationship curve between the cross-validation root mean square error of the sugar content detection model and the number of characteristic wavelengths by using a cross-validation method, and to construct a second relationship curve between the cross-validation root mean square error of the sugar content detection model and the number of latent variables; determine the target number of characteristic wavelengths according to the first relationship curve, and determine the target number of latent variables according to the second relationship curve; and obtain a fruit and vegetable sugar content detection model according to the target number of characteristic wavelengths and the target number of latent variables.

[0037] The fourth aspect of the present invention discloses an electronic device, comprising a memory storing executable program code and a processor coupled to the memory; the processor calls the executable program code stored in the memory to execute the fruit and vegetable sugar content detection model construction method disclosed in the first aspect or the fruit and vegetable sugar content detection method disclosed in the second aspect.

[0038] The fifth aspect of the present invention discloses a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the fruit and vegetable sugar content detection model construction method disclosed in the first aspect or the fruit and vegetable sugar content detection method disclosed in the second aspect.

[0039] The beneficial effects of the present invention are that, according to the near-infrared spectrum data of the calibration sample and the first sugar content measured data, a chemometric algorithm is used to build a model, which can improve the accuracy and robustness of the model; and a cross-validation method is used to construct a curve between the cross-validation root mean square error and the number of characteristic wavelengths, and a curve between the cross-validation root mean square error and the number of latent variables, so as to determine the target number of characteristic wavelengths and the target number of latent variables, and obtain the final fruit and vegetable sugar content detection model. By using the cross-validation method for optimization, the detection results of the fruit and vegetable sugar content detection model are more accurate. The sugar content of blueberries can be accurately and non-destructively detected. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings herein show specific examples of the technical solutions described in the present invention, and together with the specific implementation methods, constitute a part of the specification, and are used to explain the technical solutions, principles and effects of the present invention.

[0041] Unless otherwise specified or defined, the same reference numerals in different drawings represent the same or similar technical features, and the same or similar technical features may also be represented by different reference numerals.

[0042] Figure 1 It is a flow chart of a method for constructing a fruit and vegetable sugar content detection model based on hyperspectral imaging disclosed in an embodiment of the present invention;

[0043] Figure 2 is a flow chart of model validity verification of an embodiment of the present invention;

[0044] Figure 3 is a hyperspectral image of a plurality of samples to be detected according to an embodiment of the present invention;

[0045] Figure 4 is a local distribution heat map of sugar content in an embodiment of the present invention;

[0046] Figure 5 is a structural schematic diagram of a device for constructing a fruit and vegetable sugar content detection model based on hyperspectral imaging according to an embodiment of the present invention;

[0047] Figure 6 It is a structural schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0048] Unless otherwise specified or defined, all technical and scientific terms used herein have the same meaning as those generally understood by those skilled in the art. In the case of combining the technical solution of the present invention with realistic scenarios, all technical and scientific terms used herein may also have meanings corresponding to the purpose of implementing the technical solution of the present invention. The "first, second..." used herein is only used to distinguish the names and does not represent a specific quantity or order. The term "and / or" used herein includes any and all combinations of one or more related listed items.

[0049] It should be noted that when a component is considered to be "fixed to" another component, it can be directly fixed to the other component or there can be a central component; when an component is considered to be "connected to" another component, it can be directly connected to the other component or there can be a central component at the same time; when an component is considered to be "installed on" another component, it can be directly installed on the other component or there can be a central component at the same time. When an component is considered to be "set on" another component, it can be directly set on the other component or there can be a central component at the same time.

[0050] Unless otherwise specified or defined, the "said" and "the" used in this document refer to the technical features or technical contents mentioned or described before the corresponding position, and the technical features or technical contents may be the same as or similar to the technical features or technical contents mentioned therein. In addition, the terms "including" and "having" and any variations thereof used in this document are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices.

[0051] In order to accurately and non-destructively detect the sugar content of blueberries, the present invention uses a chemometric algorithm to build a model based on the near-infrared spectrum data of the calibration sample and the measured sugar content data, wherein the chemometric algorithm is suitable for occasions with a small number of samples, many variables, and multiple correlations between the variables, and can improve the accuracy and robustness of the model; and a cross-validation method is used to construct a curve between the cross-validation root mean square error and the number of characteristic wavelengths, and a curve between the cross-validation root mean square error and the number of latent variables, thereby determining the target number of characteristic wavelengths and the target number of latent variables, selecting a cross-validation model corresponding to the target number of characteristic wavelengths and the target number of latent variables, and obtaining the final fruit and vegetable sugar content detection model. After optimization using the cross-validation method, the detection results of the fruit and vegetable sugar content detection model are more accurate.

[0052] The method for constructing a fruit and vegetable sugar content detection model based on hyperspectral imaging disclosed in an embodiment of the present invention can be implemented by computer programming and is used to detect the sugar content of blueberries. The execution subject of the method can be an electronic device such as a computer, a laptop, a tablet computer, or a control chip embedded in an electronic device, and the present invention is not limited to this. It should be noted that it is not limited to constructing a sugar content detection model for blueberries, and can also be used to construct a sugar content detection model for other fruits or vegetables.

[0053] In order to facilitate the understanding of the present invention, specific embodiments of the present invention will be described in more detail below with reference to the accompanying drawings.

[0054] like Figure 1 As shown, the method comprises the following steps:

[0055] Step S100: obtaining a calibration sample set of target fruits and vegetables.

[0056] The target fruit and vegetable is blueberry. In the process of sample collection, the sample is preferably a mature blueberry without damage and insect pests. The number of samples is as sufficient as possible. According to experiments, the number of samples is preferably greater than 260. In this embodiment, 360 blueberries are selected. Each blueberry is a calibration sample, and all blueberries form a calibration sample set.

[0057] Step S200: acquiring near infrared spectrum data and first sugar content measured data of each calibration sample in the calibration sample set;

[0058] First, the detection area of ​​each calibration sample in the calibration sample set is determined, and then based on the detection area, the near-infrared spectrum data and the first sugar content measured data of each calibration sample are obtained.

[0059] Specifically, the detection area is generally selected to be an area that is non-destructive, pest-free, and can fully reflect the effectiveness of blueberry sugar content detection. For blueberry sugar content detection, based on the shape and characteristics of blueberries, selecting the area where the blueberry fruit is located as the detection area is more representative and can better reflect the sugar content inside.

[0060] By using a spectral imaging camera to scan the detection area of ​​the calibration sample, the near-infrared spectral data of each calibration sample can be obtained. The spectral imaging camera of this embodiment uses a Gaia Field N17E near-infrared hyperspectral imaging camera. Specifically, the spectrum collection hole of the near-infrared hyperspectral imaging camera is aligned with the surface of each calibration sample for scanning, and the near-infrared spectral data of each calibration sample is collected by diffuse reflection. The scanning band range is: 900~1700nm, and then the near-infrared spectral data of each pixel in the hyperspectral image is extracted.

[0061] Since different materials have different light reflectances in different wavelengths, for blueberries, scanning in the wavelength range of 900-1700nm can obtain blueberry spectral data more completely and effectively. The spectral data collected by diffuse reflectance can more completely and accurately reflect the sugar content information of blueberries, thereby improving the accuracy of modeling, analysis, and detection.

[0062] The first sugar content measured data refers to the measured sugar content data of the calibration sample in the calibration sample set, which can be obtained by using a conventional sugar content detection method, for example, by measuring soluble solids using a refractometer or a digital refractometer.

[0063] In order to overcome the inefficiency and subjectivity caused by manually selecting the detection area, in one example, the spectral data of the calibration sample is first collected, and then the data of the 1030nm, 1303nm, and 1484nm bands in the spectral data are represented as blue, green, and red data respectively, and synthesized into a preview image. Kmeans is then applied to segment and identify the preview image, and the area where the sample is located is used as the detection area. The spectral data of the detection area is then segmented to obtain the near-infrared spectral data of the calibration sample. The traditional sugar content detection method is then used to obtain the first sugar content measured data.

[0064] Since the original spectrum collected by the instrument contains information related to the composition of the sample, it also contains noise signals generated by various factors. In one example, after obtaining the near-infrared spectrum data of the calibration sample, the near-infrared spectrum data is preprocessed by wavelet transform to obtain preprocessed spectrum data; the preprocessed spectrum data is subjected to characteristic wavelength screening by competitive adaptive reweighting algorithm, and the screening result is set as near-infrared spectrum data. Among them, wavelet transform is a local transformation of space and frequency, which can effectively extract information from the signal. The competitive adaptive reweighting algorithm can screen out characteristic wavelengths from a large amount of redundant information to reduce the data input dimension, and can improve the model accuracy while increasing the calculation speed.

[0065] Step S300: Based on the near infrared spectrum data of all calibration samples and the first sugar content measured data, a chemometric algorithm is used to build a model to obtain a sugar content detection model;

[0066] Chemometric algorithms mainly include support vector machines, multivariate linear regression, principal component regression or partial least squares regression algorithms. Through the chemometric algorithm, a quantitative analysis data model based on near-infrared spectral data and the first sugar content measured data, i.e., a sugar content detection model, can be constructed. The chemometric algorithm of this embodiment is a partial least squares regression algorithm. The sugar content detection model established using the partial least squares regression algorithm is more accurate in predicting the sugar content of blueberries based on near-infrared spectroscopy. Specifically, the near-infrared spectral data of all calibration samples are used as independent variables, and the first sugar content measured data of all calibration samples are used as dependent variables. The partial least squares regression algorithm is used for modeling to obtain a sugar content detection model. Among them, the partial least squares regression algorithm is a conventional algorithm in this field and will not be repeated here.

[0067] By collecting a calibration sample set of blueberries, near-infrared spectrum data and first sugar content measured data of the samples are obtained and a mathematical model is established. The blueberry sugar content can be detected quickly, accurately and efficiently through the mathematical model.

[0068] Step S400: using a cross-validation method, constructing a first relationship curve between the cross-validation root mean square error of the sugar content detection model and the number of characteristic wavelengths, and constructing a second relationship curve between the cross-validation root mean square error of the sugar content detection model and the number of latent variables;

[0069] Step S500: determining the number of target characteristic wavelengths according to the first relationship curve, and determining the number of target latent variables according to the second relationship curve;

[0070] Step S600: Obtain a fruit and vegetable sugar content detection model according to the number of target characteristic wavelengths and the number of target latent variables.

[0071] The number of characteristic wavelengths refers to the number of wavelength features in the near-infrared spectral data, and the latent variables refer to the variables that are not directly observed in the sugar content detection model.

[0072] In order to improve the accuracy of the sugar content detection model, the cross-validation method was used to analyze the test results of the sugar content detection model established based on the calibration sample set, and the relevant parameters of the model establishment were adjusted based on the test results to determine the model with the best test results and obtain the fruit and vegetable sugar content detection model. The fruit and vegetable sugar content detection model determined based on the optimized model parameters has a higher detection accuracy for blueberries with unknown sugar content in the subsequent actual classification process.

[0073] Specifically, by using the cross-validation method, a relationship curve between the cross-validation root mean square error of the sugar content detection model and the number of characteristic wavelengths is constructed as the first relationship curve, and a relationship curve between the cross-validation root mean square error of the sugar content detection model and the number of latent variables is constructed as the second relationship curve. By analyzing the first relationship curve, the number of characteristic wavelengths when the root mean square error is minimum is determined as the target number of characteristic wavelengths. By analyzing the second relationship curve, the number of latent variables when the root mean square error is minimum is determined as the target number of latent variables. The optimal sugar content detection model is determined by combining the target number of characteristic wavelengths and the target number of latent variables to obtain the fruit and vegetable sugar content detection model. The number of characteristic wavelengths and the number of latent variables of the fruit and vegetable sugar content detection model in this embodiment are 79, and 26.

[0074] Due to the small number of characteristic wavelengths and latent variables, the model calculation speed is faster but underfitting is prone to occur, resulting in reduced model accuracy; when the number of characteristic wavelengths and latent variables is too large, the model calculation speed is slowed down, and the model is prone to overfitting the calibration set data, resulting in reduced accuracy. By constructing a relationship curve between the root mean square error of model detection and the number of characteristic wavelengths and the number of latent variables through cross-validation method, the optimal target number of characteristic wavelengths and target number of latent variables for model construction can be more accurately determined. Therefore, by determining the optimal number of characteristic wavelengths and latent variables to construct a blueberry sugar content detection model, the detection speed can be guaranteed while improving the accuracy of sugar content detection.

[0075] In this embodiment, after obtaining the fruit and vegetable sugar content detection model, the effectiveness of the fruit and vegetable sugar content detection model is also verified. The fruit and vegetable sugar content detection model established based on the calibration sample set is used to predict the sugar content of the prediction samples in the prediction sample set, and the index between the prediction data and the measured data is calculated to verify the accuracy of the fruit and vegetable sugar content detection model, so as to determine whether the fruit and vegetable sugar content detection model is suitable for blueberry sugar content detection. Figure 2 As shown, the specific steps include:

[0076] Step A100: obtaining a prediction sample set of target fruits and vegetables;

[0077] The target fruit and vegetable is blueberry, and the prediction sample set includes multiple prediction samples of blueberry. The selection of prediction samples in the prediction sample set can refer to the selection of calibration samples, and the number of calibration samples is generally less than that of calibration samples. The prediction sample can be a re-selected blueberry sample, or it can be a sample of about 25% selected from the calibration sample set as the prediction sample.

[0078] Step A200: obtaining the second sugar content measured data of each prediction sample in the prediction sample set;

[0079] The method in step S200 is used to obtain the second sugar content measured data of each prediction sample in the prediction sample set.

[0080] Step A300: input the prediction sample set into the fruit and vegetable sugar content detection model to obtain sugar content prediction data of each prediction sample in the prediction sample set;

[0081] Step A400: establishing a linear relationship between the second sugar content measured data and the sugar content predicted data, and calculating a determination coefficient according to the linear relationship;

[0082] Step A500: When the determination coefficient is greater than a preset threshold, the fruit and vegetable sugar content detection model is determined to be valid; otherwise, the fruit and vegetable sugar content detection model is reconstructed.

[0083] Specifically, a linear relationship between the sugar content prediction data obtained by inputting the prediction sample into the fruit and vegetable sugar content detection model and the second sugar content measured data is established, and the determination coefficient is calculated based on the linear relationship. Whether the fruit and vegetable sugar content detection model is effective is judged based on whether the determination coefficient meets the expected threshold range. Among them, the determination coefficient is related to the detection accuracy of the fruit and vegetable sugar content detection model. The determination coefficient is usually expressed as R2, which is a statistic that measures the goodness of fit of the regression model. The preset threshold is not less than 0.8, preferably 0.810.

[0084] By further verifying the detection effect of the fruit and vegetable sugar content detection model, the accuracy of blueberry sugar content detection can be ensured.

[0085] After obtaining the final fruit and vegetable sugar content detection model, the specific process of using the constructed fruit and vegetable sugar content detection model to detect the sugar content of blueberry samples with unknown sugar content is as follows: obtain blueberry samples with unknown sugar content, use a spectral camera to collect spectral data of the samples to be detected, input the spectral data into the fruit and vegetable sugar content detection model, and the fruit and vegetable sugar content detection model outputs the sugar content classification of the samples to be detected, thereby realizing rapid and non-destructive detection of blueberry sugar content.

[0086] The complete construction process of the fruit and vegetable sugar content detection model in this embodiment is as follows:

[0087] Take 360 ​​blueberries that are ripe, free of damage and insect defects. The area where the blueberry fruit is located is used as the spectral data collection area. After collecting the spectral data, the whole fruit juice is used to measure the sugar content. The plane of the sample is aligned with the spectral collection hole, and the spectral data of the blueberry is scanned by a near-infrared spectral camera. The data is collected by diffuse reflection, and the scanning band range is: 900-1700nm. Since the original spectral data contains information related to the composition of the sample, it also contains interference signals generated by various factors. Therefore, the samples are firstly subjected to abnormal data removal, and a total of 7 abnormal samples are removed. At this time, the total number of samples is 353. Then, the spectral data is processed by wavelet transform, and the characteristic wavelength spectral data is screened out by competitive adaptive reweighting algorithm. After collecting the spectral data of the blueberry samples, the sugar content of the pulp in the spectral area of ​​the blueberry samples is detected by a handheld digital saccharimeter according to the numbering order of the blueberry samples. The pulp is crushed and squeezed, and the blueberry juice is placed on a digital saccharimeter after filtration to measure its sugar content.

[0088] 75% of the calibration samples were selected from the blueberry samples to form a calibration sample set. The number of samples in the calibration sample set was 265. The sugar content measured by the calibration samples was taken as the Y value, and the characteristic wavelength spectral data was taken as the X value. The sugar content detection model was established based on the spectral data using the partial least squares method. Then, the optimal number of characteristic wavelengths and the number of latent variables were determined by cross-validation to obtain the fruit and vegetable sugar content detection model.

[0089] Then select 25% of the samples as prediction samples for prediction test, the number of prediction set samples is 88, and the sugar content in the prediction samples is analyzed by the sugar content detection model established by the calibration set. Compare the predicted value of sugar content with the true value, obtain the corresponding linear relationship, and calculate the determination coefficient. Finally, the determination coefficient between the predicted value and the true value of blueberry sugar content is 0.810, which verifies that the fruit and vegetable sugar content detection model has a good prediction effect on blueberry sugar content.

[0090] In summary, the fruit and vegetable sugar content detection model constructed in this embodiment is used to detect blueberry samples with unknown sugar content, with high detection accuracy and no damage to the samples, which can meet the needs of rapid and non-destructive detection of blueberry sugar content in large-scale production.

[0091] On the basis of the above-mentioned method for constructing a fruit and vegetable sugar content detection model, the present invention also provides a method for detecting the sugar content of fruits and vegetables based on hyperspectral imaging. First, the above-mentioned method for constructing a fruit and vegetable sugar content detection model is used to pre-construct a fruit and vegetable sugar content detection model, and then near-infrared spectral data of the target fruit and vegetable samples to be detected are collected; the near-infrared spectral data is input into the fruit and vegetable sugar content detection model to obtain and output sugar content data.

[0092] In some embodiments, while Figure 3The sugar content of the multiple samples to be tested is tested, and after obtaining the sugar content data corresponding to each sample to be tested, the following is generated based on all the sugar content data and the image position relationship. Figure 4 The local distribution heat map of the sugar content of blueberry fruit shown realizes the visualization imaging of the sugar content distribution.

[0093] like Figure 5 As shown, based on the above-mentioned method for constructing a fruit and vegetable sugar content detection model based on hyperspectral imaging, an embodiment of the present invention discloses a device for constructing a fruit and vegetable sugar content detection model based on hyperspectral imaging, comprising:

[0094] The sample set acquisition module 600 is used to acquire a calibration sample set of target fruits and vegetables;

[0095] A data acquisition module 610 is used to acquire near infrared spectrum data and first sugar content measured data of each calibration sample in the calibration sample set;

[0096] A model building module 620 is used to build a model using a chemometric algorithm according to the near infrared spectrum data of all the calibration samples and the first sugar content measured data to obtain a sugar content detection model;

[0097] The model optimization module 630 is used to construct a first relationship curve between the cross-validation root mean square error of the sugar content detection model and the number of characteristic wavelengths by using a cross-validation method, and to construct a second relationship curve between the cross-validation root mean square error of the sugar content detection model and the number of latent variables; determine the target number of characteristic wavelengths according to the first relationship curve, and determine the target number of latent variables according to the second relationship curve; and obtain a fruit and vegetable sugar content detection model according to the target number of characteristic wavelengths and the target number of latent variables.

[0098] like Figure 6 As shown, an embodiment of the present invention discloses an electronic device, including a memory 401 storing executable program codes and a processor 402 coupled to the memory 401;

[0099] The processor 402 calls the executable program code stored in the memory 401 to execute the method for constructing a fruit and vegetable sugar content detection model based on hyperspectral imaging or the method for detecting the sugar content of fruits and vegetables described in the above embodiments.

[0100] An embodiment of the present invention further discloses a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the method for constructing a fruit and vegetable sugar content detection model based on hyperspectral imaging or the method for detecting the sugar content of fruits and vegetables described in the above embodiments.

[0101] The purpose of the above embodiments is to exemplarily reproduce and deduce the technical solution of the present invention, and to fully describe the technical solution, purpose and effect of the present invention. Its purpose is to make the public understand the disclosed content of the present invention more thoroughly and comprehensively, and it does not limit the scope of protection of the present invention.

[0102] The above embodiments are not exhaustive enumerations of the present invention, and there may be multiple other implementations not listed. Any replacement and improvement made without violating the concept of the present invention shall fall within the protection scope of the present invention.

Claims

1. A method for constructing a fruit and vegetable sugar content detection model based on hyperspectral imaging, characterized in that: include: Obtain a calibration sample set of target fruits and vegetables; Acquire near infrared spectrum data and first sugar content measured data of each calibration sample in the calibration sample set; According to the near infrared spectral data of all the calibration samples and the first sugar content measured data, a chemometric algorithm is used to build a model to obtain a sugar content detection model; Using a cross-validation method, construct a first relationship curve between the cross-validation root mean square error of the sugar content detection model and the number of characteristic wavelengths, and construct a second relationship curve between the cross-validation root mean square error of the sugar content detection model and the number of latent variables; Determine the number of target characteristic wavelengths according to the first relationship curve, and determine the number of target latent variables according to the second relationship curve; A fruit and vegetable sugar content detection model is obtained according to the number of target characteristic wavelengths and the number of target latent variables.

2. The method for constructing a fruit and vegetable sugar content detection model based on hyperspectral imaging according to claim 1, characterized in that: After obtaining the fruit and vegetable sugar content detection model, it also includes: Obtain a prediction sample set of target fruits and vegetables; Acquire the second sugar content measured data of each prediction sample in the prediction sample set; Inputting the predicted sample set into the fruit and vegetable sugar content detection model to obtain sugar content prediction data of each predicted sample in the predicted sample set; Establishing a linear relationship between the second sugar content measured data and the sugar content predicted data, and calculating a determination coefficient according to the linear relationship; When the determination coefficient is greater than a preset threshold, the fruit and vegetable sugar content detection model is determined to be valid; otherwise, the fruit and vegetable sugar content detection model is reconstructed.

3. The method for constructing a fruit and vegetable sugar content detection model based on hyperspectral imaging according to claim 1, characterized in that: After obtaining the near infrared spectrum data of the calibration sample, it also includes: Preprocessing the near infrared spectrum data by wavelet transform to obtain preprocessed spectrum data; The pre-processed spectral data is subjected to characteristic wavelength screening using a competitive adaptive re-weighting algorithm, and the screening result is set as the near-infrared spectral data.

4. The method for constructing a fruit and vegetable sugar content detection model based on hyperspectral imaging according to claim 1, characterized in that: According to the near infrared spectrum data of all the calibration samples and the first sugar content measured data, a chemometric algorithm is used to build a sugar content detection model, including: The near-infrared spectral data of all the calibration samples are used as independent variables, and the first sugar content measured data of all the calibration samples are used as dependent variables, and a partial least squares regression algorithm is used to perform modeling to obtain the sugar content detection model.

5. The method for constructing a fruit and vegetable sugar content detection model based on hyperspectral imaging according to claim 1, characterized in that: The step of obtaining the near infrared spectrum data and the first sugar content measured data of each calibration sample in the calibration sample set includes: Determining a detection area for each calibration sample in the calibration sample set; Based on the detection area, the near infrared spectrum data and the first sugar content measured data of each calibration sample are obtained.

6. A method for detecting the sugar content of fruits and vegetables based on hyperspectral imaging, characterized in that: include: Pre-constructing a fruit and vegetable sugar content detection model using the fruit and vegetable sugar content detection model construction method according to any one of claims 1 to 5; Collect near infrared spectral data of target fruit and vegetable samples to be tested; The near infrared spectrum data is input into the fruit and vegetable sugar content detection model to obtain sugar content data and output it.

7. The method for detecting the sugar content of fruits and vegetables according to claim 6, characterized in that: There are multiple samples to be tested. After obtaining the sugar content data corresponding to each sample to be tested, a local distribution heat map of sugar content is generated according to all the sugar content data.

8. A device for constructing a fruit and vegetable sugar content detection model based on hyperspectral imaging, characterized in that: include: A sample set acquisition module, used to acquire a calibration sample set of target fruits and vegetables; A data acquisition module, used for acquiring near infrared spectrum data and first sugar content measured data of each calibration sample in the calibration sample set; A model building module, used to build a model using a chemometric algorithm based on the near infrared spectral data of all the calibration samples and the first sugar content measured data to obtain a sugar content detection model; The model optimization module is used to construct a first relationship curve between the cross-validation root mean square error of the sugar content detection model and the number of characteristic wavelengths by using a cross-validation method, and to construct a second relationship curve between the cross-validation root mean square error of the sugar content detection model and the number of latent variables; determine the target number of characteristic wavelengths according to the first relationship curve, and determine the target number of latent variables according to the second relationship curve; and obtain a fruit and vegetable sugar content detection model according to the target number of characteristic wavelengths and the target number of latent variables.

9. An electronic device, characterized in that: It comprises a memory storing executable program code and a processor coupled to the memory; the processor calls the executable program code stored in the memory to execute the fruit and vegetable sugar content detection model construction method according to any one of claims 1 to 5 or the fruit and vegetable sugar content detection method according to any one of claims 6 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program enables a computer to execute the method for constructing a fruit and vegetable sugar content detection model according to any one of claims 1 to 5 or the method for detecting the sugar content of fruits and vegetables according to any one of claims 6 to 7.

Citation Information

Patent Citations

  • Near-infrared detection method for peanut quality and application

    CN105181642A

  • Method and system for establishing non-destructive testing model of fruit internal quality

    CN108956545A

  • Pumpkin fruit quality parameter detection method and device and computer equipment

    CN112525855A

  • Method for detecting sugar content in tobacco processing based on hyperspectrum and CARS algorithm

    CN118587588A

Cited By

  • Transport inspection and sorting equipment and sorting methods

    CN119733687A

  • Strawberry sugar degree efficient nondestructive testing method based on intelligent algorithm

    CN120703080A

  • Efficient nondestructive detection method for sugar content of strawberry based on intelligent algorithm

    CN120703080B

  • Transportation, detection and sorting equipment

    CN223655559U