Blueberry acidity detection method based on hyperspectral imaging

CN119985342APending Publication Date: 2025-05-13泰州学院
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202510056604.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-14
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

Traditional blueberry acidity detection methods have problems such as destructive, time-consuming and low efficiency, and environmental pollution. The existing detection methods based on hyperspectral imaging also face the problems of complex data processing and scattering interference.

Method used

Using a detection method based on hyperspectral imaging, an acidity detection model is constructed through sample preparation, hyperspectral imaging acquisition, spectral preprocessing, feature band extraction and partial least squares regression algorithms, eliminating scattering interference and extracting the final feature band set.

Benefits of technology

It realizes efficient and non-destructive detection of blueberry acidity, improves the accuracy and consistency of spectral data, reduces data dimensions and calculation complexity, and adapts to large-scale sample detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119985342A_ABST
    Figure CN119985342A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of fruit detection, in particular to a blueberry acidity detection method based on hyperspectral imaging, which comprises the following steps: randomly selecting blueberry samples to be detected, and constructing a reference sample database; acquiring full-band hyperspectral image data of the to-be-detected blueberry sample by using hyperspectral imaging equipment; performing spectrum preprocessing on the hyperspectral image data; eliminating redundant information of redundant wave bands by combining a continuous projection algorithm to obtain a final characteristic wave band set, and extracting a spectral intensity matrix corresponding to the final characteristic wave band set from the hyperspectral image data based on the final characteristic wave band set; constructing a blueberry acidity detection model; and outputting the acidity predicted value of the blueberries. According to the method, the data dimension is greatly reduced, the sensitivity and modeling efficiency of the characteristic wave band are improved, and compared with a traditional destructive detection method, the method has the advantages of being high in speed, free of damage and suitable for large-scale sample detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of fruit detection, and in particular to a blueberry acidity detection method based on hyperspectral imaging. Background Art

[0002] Blueberry acidity not only affects the taste of blueberries and consumer acceptance, but is also closely related to their maturity, storage performance and processing characteristics. Therefore, accurate determination of blueberry acidity is of great significance for optimizing blueberry planting, processing and quality control. Traditional blueberry acidity detection methods mainly include chemical titration and pH meter measurement. Although these methods can provide relatively accurate acidity values, they have some obvious limitations:

[0003] Destructive testing: The testing process requires destroying the integrity of the blueberry sample, which is difficult to use for high-value blueberries or samples that cannot be measured repeatedly.

[0004] Time-consuming and inefficient: Traditional testing requires more pre-processing steps and is less efficient when the sample batch is large, making it difficult to meet the needs of modern production.

[0005] Environmental pollution issues: The use of chemical reagents may have adverse effects on the environment and does not meet the requirements of green development.

[0006] With the rise of hyperspectral imaging technology, non-destructive detection methods based on spectral analysis have gradually become a research hotspot. Hyperspectral imaging can simultaneously obtain the spectral information and spatial distribution characteristics of blueberry samples, providing a new technical approach for non-destructive detection of blueberry acidity. However, the existing acidity detection methods based on hyperspectral imaging still have the following technical bottlenecks:

[0007] Complex data processing: Hyperspectral data has high dimensions and much redundant information. Directly using the full band for analysis not only consumes computing resources, but also easily leads to model overfitting, affecting prediction accuracy.

[0008] Scattering interference: The scattering effect caused by differences in the surface structure and optical properties of blueberries will significantly reduce the stability of the spectral data and the accuracy of the test results. Summary of the invention

[0009] The invention provides a blueberry acidity detection method based on hyperspectral imaging.

[0010] The blueberry acidity detection method based on hyperspectral imaging includes the following steps:

[0011] S1, sample preparation: randomly select blueberry samples to be tested, remove surface impurities, ensure the surface cleanliness of the samples, obtain blueberry samples to be tested, and set blueberry samples with known acidity values ​​as reference samples to build a reference sample database;

[0012] S2, hyperspectral imaging acquisition: using hyperspectral imaging equipment to obtain full-band hyperspectral image data of the blueberry sample to be tested;

[0013] S3, spectral preprocessing: spectral preprocessing is performed on the hyperspectral image data, and the standard normal transformation method is used to eliminate the interference of the hyperspectral image data caused by sample surface scattering, so as to improve the accuracy and stability of the characteristic bands;

[0014] S4, feature band extraction: based on the preprocessed hyperspectral image data, extract the preliminary feature band set related to the acidity of blueberries, combine the continuous projection algorithm to eliminate the redundant information of the redundant bands, and obtain the final feature band set. Based on the final feature band set, extract the spectral intensity matrix corresponding to the final feature band set from the hyperspectral image data;

[0015] S5, using partial least squares regression algorithm, based on the spectral intensity matrix corresponding to the final feature band set and reference samples with known acidity values, a blueberry acidity detection model was constructed;

[0016] S6, acidity prediction: input the spectral intensity matrix corresponding to the final characteristic band set of the blueberry sample to be tested into the calibrated blueberry acidity detection model, and output the acidity prediction value of the blueberry.

[0017] Optionally, the reference sample setting in S1 specifically includes:

[0018] S11, selecting a batch of blueberries with the same or similar source as the blueberry sample to be tested, and determining the acidity value thereof by titration;

[0019] S12, according to the principle of uniform distribution of acidity range, at least 10 groups of samples with typical acidity values ​​are selected from the reference samples, and their acidity values ​​are recorded as a reference sample database.

[0020] Optionally, the hyperspectral imaging device in S2 has a spectral band range set to 400-1000 nm and a spectral resolution adjusted to within 5 nm;

[0021] The S2 also includes the arrangement of the blueberry samples to be tested: the blueberry samples to be tested are evenly arranged on the sample tray, the sample spacing is adjusted to 5 mm to avoid mutual occlusion between the samples, the sample tray is gradually scanned by line scanning, the spectral image data of the blueberries to be tested is generated, and the acquisition parameters, including the sample arrangement position, light source intensity and imaging time, are recorded for subsequent analysis and result traceability.

[0022] Optionally, the S3 specifically includes:

[0023] S31, the collected hyperspectral image data is processed pixel by pixel, and the spectral intensity data of each pixel is converted into a standard normal distribution with a mean of zero and a standard deviation of 1; including inputting the original spectral data matrix X, each row represents the spectral data of a sample, and each column represents the spectral intensity of a certain band. For each sample (i.e., each row of the matrix X), the spectral mean μ is calculated. i , the spectral mean reflects the average spectral intensity of the sample in all bands. For each sample, the spectral standard deviation σ is calculated i , measures the fluctuation range of spectral data, and the spectral intensity X of each band of each sample ij According to the standard normal transformation formula, the standardized matrix Z is obtained, and the dimension is the same as the original matrix X. ij Represents the spectral intensity value of the i-th sample in the j-th band;

[0024] S32, identifying high-fluctuation areas of blueberry surface scattering interference through dynamic partitioning processing, including processing in the near-infrared band (700-900nm);

[0025] S33, constructs a scattering correction matrix based on the spectral feature vectors in the high-fluctuation region, removes the scattering components, and generates dissipated spectral data to ensure that the spectral signal reflects the true physical and chemical properties of the blueberry sample.

[0026] Optionally, the S32 specifically includes:

[0027] S321, spectral gradient calculation: Calculate the spectral gradient for each band to identify the band area where the spectral intensity changes significantly: G ij =X ij+1 -X ij , where G ij is the gradient value of the i-th sample in band j, X ij+1 is the original spectral intensity of the i-th sample in band j+1;

[0028] S322, calculation of fluctuation standard deviation: Calculate the fluctuation standard deviation of each sample in the near-infrared band of 700-900nm to determine the strength of the band fluctuation: Among them, σ b,i Indicates the standard deviation of the band fluctuation of the i-th sample, n b is the number of near-infrared bands;

[0029] S323, high fluctuation area determination: If a certain band gradient G ij The absolute value of is greater than θ·σ b,i (the threshold is a multiple of the standard deviation of fluctuation), it is judged as a high volatility area:

[0030] High Variance Region={j||G ij |>θ·σ b,i}.

[0031] Optionally, the characteristic band extraction in S4 includes calculating the Pearson correlation coefficient r between the spectral intensity of each band and the acidity value of blueberries based on the preprocessed hyperspectral image data using a band correlation analysis method. j , screening correlation coefficient r j The absolute value is greater than the set threshold r threshold The band is taken as the preliminary feature band set B initial .

[0032] Optionally, the continuous projection algorithm eliminates redundant information of redundant bands including: initial The continuous projection algorithm is used to eliminate the linear redundancy between bands by step-by-step projection, which can be expressed as:

[0033] Among them, P j is the projection residual of the j-th band, Represents the projection of the j-th band on the space of other bands, according to the projection residual P j The size of , removes the bands with high redundancy, retains the bands with strong independence, and outputs the final feature band set B final .

[0034] Optionally, S5 includes constructing a partial least squares regression model: the final feature band set B final The corresponding spectral intensity matrix X final The known acidity value Y of the reference sample is used as the model input to calculate the principal component score vector T and regression coefficient B between the spectral intensity matrix and the acidity value:

[0035] T=X final W;

[0036]

[0037] Where W is the projection matrix, which is used to transform the spectral intensity matrix X final Projected to the low-dimensional principal component space, P is the regression matrix, which is used to fit the relationship between the principal component score vector T and the target value Y. B is the final regression coefficient of the model. The cross-validation method is used to select the optimal number of principal components k of the model to maximize the goodness of fit and minimize the root mean square error of the prediction residual.

[0038] Optionally, according to the optimal number of principal components k, the model parameters T, W, P, and B are recalculated to obtain a final blueberry acidity detection model. The blueberry acidity detection model is expressed as: in, is the predicted acidity value of blueberries.

[0039] Beneficial effects of the present invention:

[0040] The present invention realizes efficient and non-destructive detection of blueberry acidity. The full-band spectral information of the blueberry sample is obtained through the hyperspectral imaging technology, and the scattering interference is effectively eliminated by combining the standard normal transformation and dynamic partitioning processing, thereby improving the accuracy and consistency of the spectral data. The redundant information of the redundant bands is further eliminated through the feature band extraction and the continuous projection algorithm (SPA), thereby greatly reducing the data dimension and improving the sensitivity and modeling efficiency of the feature bands. Compared with the traditional destructive detection method, the present invention has the advantages of fast speed, no damage, and adaptability to large-scale sample detection.

[0041] The present invention introduces a band correlation analysis method in the characteristic band extraction stage, calculates the correlation coefficient between the spectral intensity of each band and the acidity value, screens out a band set that is highly correlated with the acidity of blueberries, eliminates linear redundancy between bands through a continuous projection algorithm, and accurately locates the characteristic band combination that is most sensitive to acidity. In the model construction stage, a partial least squares regression algorithm is used, and the number of principal components is optimized through cross-validation to ensure that the detection model has both high precision and good generalization ability. Compared with traditional methods, the present invention not only significantly reduces data dimension and calculation complexity, but also effectively solves the problem of multicollinearity of hyperspectral data, and greatly improves the stability and adaptability of the detection model.

[0042] The present invention identifies high-fluctuation areas through dynamic partitioning processing and constructs a scattering correction matrix using principal component analysis, thereby effectively eliminating the dominant component of scattering interference and ensuring the authenticity of the spectral signal. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only for the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0044] Figure 1 A schematic diagram of a method flow chart of an embodiment of the present invention;

[0045] Figure 2 Schematic diagram of high fluctuation area determination according to an embodiment of the present invention. DETAILED DESCRIPTION

[0046] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. At the same time, it is explained here that in order to make the embodiments more detailed, the following embodiments are the best and preferred embodiments, and those skilled in the art may also adopt other alternatives to implement some known technologies; and the accompanying drawings are only for more specific description of the embodiments, and are not intended to specifically limit the present invention.

[0047] It should be noted that the references to "one embodiment", "an embodiment", "an exemplary embodiment", "some embodiments" and the like in the specification indicate that the embodiments described may include specific features, structures or characteristics, but not every embodiment may include the specific features, structures or characteristics. In addition, when a specific feature, structure or characteristic is described in conjunction with an embodiment, it should be within the knowledge of a person skilled in the art to implement such feature, structure or characteristic in conjunction with other embodiments (whether or not explicitly described).

[0048] In general, a term can be understood, at least in part, from its use in context. For example, depending, at least in part, on the context, the term "one or more" as used herein can be used to describe any feature, structure, or characteristic in the singular sense, or can be used to describe a combination of features, structures, or characteristics in the plural sense. Additionally, the term "based on" can be understood as not necessarily intended to convey an exclusive set of factors, but can instead, depending, at least in part, on the context, allow for the presence of other factors that are not necessarily explicitly described.

[0049] like Figure 1-Figure 2 As shown, the blueberry acidity detection method based on hyperspectral imaging includes the following steps:

[0050] S1, sample preparation: randomly select blueberry samples to be tested, remove surface impurities, ensure the surface cleanliness of the samples, obtain blueberry samples to be tested, and set blueberry samples with known acidity values ​​as reference samples to build a reference sample database;

[0051] The blueberry samples to be tested were selected and cleaned as follows:

[0052] a) Randomly select the samples to be tested from the target blueberry batch, using the manual random sampling method to ensure that the samples are representative;

[0053] b), placing the selected blueberry samples into a cleaning device and treating them with an ultrasonic-assisted cleaning method to remove soil, plant fibers and other impurities remaining on the surface;

[0054] c) After washing, the surface of the blueberries is dried naturally or air-dried at low temperature using non-woven fabric or drying equipment to prevent residual moisture from affecting the accuracy of subsequent spectral imaging;

[0055] S2, hyperspectral imaging acquisition: using hyperspectral imaging equipment to obtain full-band hyperspectral image data of the blueberry sample to be tested;

[0056] S3, spectral preprocessing: spectral preprocessing is performed on the hyperspectral image data, and the standard normal transformation method is used to eliminate the interference of the hyperspectral image data caused by sample surface scattering, so as to improve the accuracy and stability of the characteristic bands;

[0057] S4, feature band extraction: based on the preprocessed hyperspectral image data, extract the preliminary feature band set related to the acidity of blueberries, combine the continuous projection algorithm to eliminate the redundant information of the redundant bands, and obtain the final feature band set. Based on the final feature band set, extract the spectral intensity matrix corresponding to the final feature band set from the hyperspectral image data;

[0058] S5, using partial least squares regression algorithm, based on the spectral intensity matrix corresponding to the final feature band set and reference samples with known acidity values, a blueberry acidity detection model was constructed;

[0059] S6, acidity prediction: input the spectral intensity matrix corresponding to the final characteristic band set of the blueberry sample to be tested into the calibrated blueberry acidity detection model, and output the acidity prediction value of the blueberry.

[0060] The reference sample settings in S1 specifically include:

[0061] S11, selecting a batch of blueberries with the same or similar source as the blueberry sample to be tested, and determining the acidity value thereof by titration;

[0062] S12, according to the principle of uniform distribution of acidity range, at least 10 groups of samples with typical acidity values ​​are selected from the reference samples, and their acidity values ​​are recorded as a reference sample database.

[0063] The hyperspectral imaging device in S2 has a spectral band range set to 400-1000nm, and the spectral resolution is adjusted to within 5nm to ensure that the band covers the characteristic band related to blueberry acidity. The imaging device is fixed on a stable bracket to ensure that the position of the light source and the imaging device is relatively fixed during the spectrum acquisition process to avoid image deviation. A standard light source is set with the light intensity controlled at 2000-3000Lux. Non-polarized light is used to reduce surface reflection interference. Imaging acquisition is performed in a light-shielding box or dark room to avoid interference of ambient light on the spectral image.

[0064] S2 also includes the arrangement of blueberry samples to be tested: the blueberry samples to be tested are evenly arranged on the sample tray, the sample spacing is adjusted to 5 mm to avoid mutual occlusion between samples, the sample tray is scanned step by step through line scanning, the spectral image data of the blueberries to be tested is generated, and the acquisition parameters, including the sample arrangement position, light source intensity and imaging time, are recorded for subsequent analysis and result traceability.

[0065] S3 specifically includes:

[0066] S31, the collected hyperspectral image data is processed pixel by pixel, and the spectral intensity data of each pixel is converted into a standard normal distribution with a mean of zero and a standard deviation of 1; including inputting the original spectral data matrix X, each row represents the spectral data of a sample, and each column represents the spectral intensity of a certain band. For each sample (i.e., each row of the matrix X), the spectral mean μ is calculated. i , the spectral mean reflects the average spectral intensity of the sample in all bands. For each sample, the spectral standard deviation σ is calculated i , measures the fluctuation range of spectral data, and the spectral intensity X of each band of each sample ij According to the standard normal transformation formula, the standardized matrix Z is obtained, and the dimension is the same as the original matrix X. ij Represents the spectral intensity value of the i-th sample in the j-th band;

[0067] For each collected spectral intensity data point X ij , the standard normal transformation formula is calculated as follows:

[0068] Among them, Z ij is the standardized spectral intensity value, the intensity value of the i-th sample in the j-th band, X ij is the original input spectral intensity value, μ i is the spectral mean of the ith sample, defined as:

[0069] Where n is the number of bands, σ i is the spectral standard deviation of the ith sample, defined as:

[0070]

[0071] The standard normal transformation provides a unified and standardized spectral data basis so that subsequent operations can be more efficient and accurate. For dynamic partitioning to identify high-fluctuation areas of scattering interference, the standard normal transformation unifies the spectral intensity ranges of all samples in different bands, making the calculation of the fluctuation standard deviation σb,i consistent, avoiding misjudgment of high-fluctuation areas due to initial intensity differences between samples.

[0072] For constructing the scatter correction matrix, the data processed by the standard normal transformation has a mean of zero and a standard deviation of 1, so that the extracted principal components can more directly reflect the dominant direction of the scatter interference, which helps to construct a more accurate scatter correction matrix.

[0073] S32, identifying high-fluctuation areas of blueberry surface scattering interference through dynamic partitioning processing, including processing in the near-infrared band (700-900nm);

[0074] The near-infrared band (700-900nm) covers the characteristic absorption peaks of various chemical components in blueberries (such as organic acids, sugars, water, etc.). These chemical components are directly related to the acidity of blueberries, and the spectral changes in the near-infrared band can reflect the differences in their chemical composition. Therefore, processing this band helps to extract spectral features related to the acidity of blueberries; in hyperspectral analysis, the 700-900nm band is often considered an important area for acidity detection.

[0075] S33, constructs a scattering correction matrix based on the spectral feature vectors in the high-fluctuation region, removes the scattering components, generates dissipated spectral data, and ensures that the spectral signal reflects the true physical and chemical properties of the blueberry sample, as follows:

[0076] The principal component analysis is used to extract the principal eigenvectors of the spectral data in the high fluctuation region to construct the scatter correction matrix: V = [v1, v2, ..., v k ], where V is the eigenvector matrix, v k is the kth eigenvector, obtained by eigendecomposition of the covariance matrix of the spectral data in the high-fluctuation region;

[0077] Scatter correction matrix calculation: Use the eigenvector matrix to construct the scatter correction matrix C: C = X·V·V T , where X is the original spectral data matrix, V·V T represents the reconstruction operation of the eigenvector matrix, which is used to extract the principal components, and C describes the scattering interference characteristics;

[0078] Corrected spectrum calculation: Use the scatter correction matrix to adjust the original spectral data to obtain the corrected spectral data: Z = XC, where Z is the corrected spectral data matrix, and C here is the part removed from the original data, which directly represents the component of scatter interference, and is functionally expressed as the contribution of scatter interference.

[0079] The output is the hyperspectral image data processed by the standard normal transformation method, which provides optimized input for subsequent feature band extraction and retains and records the parameters and matrices used in the scatter correction process so as to perform consistent correction on different batches of samples.

[0080] S32 specifically includes:

[0081] S321, spectral gradient calculation: Calculate the spectral gradient for each band to identify the band area where the spectral intensity changes significantly: G ij =X ij+1 -X ij , where Gij is the gradient value of the i-th sample in band j, X ij+1 is the original spectral intensity of the i-th sample in band j+1;

[0082] S322, calculation of fluctuation standard deviation: Calculate the fluctuation standard deviation of each sample in the near-infrared band of 700-900nm to determine the strength of the band fluctuation: Among them, σ b,i Indicates the standard deviation of the band fluctuation of the i-th sample, n b is the number of near-infrared bands;

[0083] S323, high fluctuation area determination: If a certain band gradient G ij The absolute value of is greater than θ·σ b,i (the threshold is a multiple of the standard deviation of fluctuation), it is judged as a high volatility area:

[0084] High Variance Region={j||G ij |>θ·σ b,i}.

[0085] The characteristic band extraction in S4 includes calculating the Pearson correlation coefficient r between the spectral intensity of each band and the acidity value of blueberries based on the preprocessed hyperspectral image data using the band correlation analysis method. j , screening correlation coefficient r j The absolute value is greater than the set threshold r threshold The band is taken as the preliminary feature band set B initial , Pearson correlation coefficient r j Calculated as:

[0086] Among them, r j represents the correlation between the jth band and the acidity value, X ij represents the spectral intensity of the i-th sample in the j-th band, represents the spectral mean of the jth band, U i represents the acidity value of the i-th sample, represents the mean of acidity value, m represents the number of samples;

[0087] The correlation coefficient is a significant correlation between the band characteristics of the spectral data and the changing trend of the acidity value. If the correlation coefficient (positive or negative) between the spectral intensity of a band and the acidity value is high, it indicates that the band may carry characteristic information related to acidity. Through correlation analysis, only the bands that are highly correlated with acidity are retained.

[0088] The continuous projection algorithm eliminates redundant information of redundant bands, including the initial feature band set B initialThe continuous projection algorithm is used to eliminate the linear redundancy between bands by step-by-step projection, which can be expressed as:

[0089] Among them, P j is the projection residual of the j-th band, Represents the projection of the j-th band on the space of other bands, according to the projection residual P j The size of , removes the bands with high redundancy, retains the bands with strong independence, and outputs the final feature band set B final .

[0090] S5 includes constructing a partial least squares regression model: the final feature band set B final The corresponding spectral intensity matrix X final The known acidity value Y of the reference sample is used as the model input to calculate the principal component score vector T and regression coefficient B between the spectral intensity matrix and the acidity value:

[0091] T=X final W;

[0092]

[0093] Where W is the projection matrix, which is used to transform the spectral intensity matrix X final Projected to the low-dimensional principal component space, P is the regression matrix, which is used to fit the relationship between the principal component score vector T and the target value Y. B is the final regression coefficient of the model. The cross-validation method is used to select the optimal number of principal components k of the model to maximize the goodness of fit and minimize the root mean square error of the prediction residual.

[0094] The steps to select the optimal number of principal components k are as follows:

[0095] 1. Divide the data set: divide the reference samples with known acidity values ​​and the corresponding spectral intensity matrix X Bfinal Divided into training set and validation set, use the leave-one-out method: each time select one sample from the reference sample as the validation set, and the remaining samples as the training set;

[0096] 2. Gradually increase the number of principal components k: During the model construction process, gradually increase the number of principal components k (for example, from 1 to the maximum value min(m, n), where m is the number of samples and n is the number of bands), and calculate the following indicators for each k value:

[0097] Goodness of fit R 2 : Measures the model's ability to explain the training data;

[0098] Root mean square error of prediction (RMSEP): measures the prediction error of the model for the validation data, and the formula is as follows:

[0099] Among them, p is the number of samples in the validation set, is the predicted value, Y i is the true value.

[0100] 3. Select the optimal number of principal components k: When k increases, if RMSEP is minimized and R 2 Close to 1, the corresponding k value is the optimal number of principal components k. If the RMSEP no longer decreases significantly (that is, it enters the stable zone), the smallest k value is selected to prevent overfitting.

[0101] According to the optimal number of principal components k, the model parameters T, W, P, and B are recalculated to obtain the final blueberry acidity detection model. The blue mold acidity detection model is expressed as: in, is the predicted acidity value of blueberries.

[0102] According to the optimal number of principal components k opt Recalculate the model parameters as follows:

[0103] 1. Calculate the principal component score vector T: Use the optimized k to calculate the principal component score vector:

[0104] Where W is the projection matrix, which is used to project high-dimensional spectral data into the k-dimensional principal component space;

[0105] 2. Calculate the regression matrix P: Fit the relationship between the principal component score vector T and the target acidity value Y to obtain the regression matrix P:

[0106] 3. Calculate the final regression coefficient B: Combine the projection matrix W and the regression matrix P to obtain the final regression coefficient matrix: B = W·P.

[0107] The present invention covers any substitution, modification, equivalent method and scheme made on the essence and scope of the present invention. In order to make the public have a thorough understanding of the present invention, specific details are described in detail in the following preferred embodiments of the present invention, but those skilled in the art can fully understand the present invention without the description of these details. In addition, in order to avoid unnecessary confusion about the essence of the present invention, well-known methods, processes, procedures, components and circuits are not described in detail.

[0108] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for detecting blueberry acidity based on hyperspectral imaging, characterized in that: The following steps are involved: S1, randomly selecting blueberry samples to be tested, removing surface impurities, ensuring the surface cleanliness of the samples, obtaining blueberry samples to be tested, and setting blueberry samples with known acidity values ​​as reference samples to construct a reference sample database; S2, using a hyperspectral imaging device to obtain full-band hyperspectral image data of the blueberry sample to be tested; S3, spectral preprocessing is performed on the hyperspectral image data, and the standard normal transformation method is used to eliminate the interference of the hyperspectral image data caused by sample surface scattering; S4, based on the preprocessed hyperspectral image data, extracting a preliminary feature band set related to the acidity of blueberries, combining a continuous projection algorithm to eliminate redundant information of redundant bands, obtaining a final feature band set, and based on the final feature band set, extracting a spectral intensity matrix corresponding to the final feature band set from the hyperspectral image data; S5, using partial least squares regression algorithm, based on the spectral intensity matrix corresponding to the final feature band set and reference samples with known acidity values, a blueberry acidity detection model was constructed; S6, inputting the spectral intensity matrix corresponding to the final characteristic band set of the blueberry sample to be tested into the calibrated blueberry acidity detection model, and outputting the predicted value of the blueberry acidity.

2. The method for detecting blueberry acidity based on hyperspectral imaging according to claim 1, characterized in that: The reference sample setting in S1 specifically includes: S11, selecting a batch of blueberries from the same source as the blueberry sample to be tested, and determining the acidity value thereof by titration; S12, according to the principle of uniform distribution of acidity range, at least 10 groups of samples with typical acidity values ​​are selected from the reference samples, and their acidity values ​​are recorded as a reference sample database.

3. The method for detecting blueberry acidity based on hyperspectral imaging according to claim 1, characterized in that: The hyperspectral imaging device in S2 has a spectral band range set to 400-1000nm and a spectral resolution adjusted to within 5nm; The S2 also includes arranging the blueberry samples to be tested: evenly arranging the blueberry samples to be tested on a sample tray, adjusting the sample spacing to 5 mm, and gradually scanning the sample tray by line scanning to generate spectral image data of the blueberries to be tested.

4. The method for detecting blueberry acidity based on hyperspectral imaging according to claim 1, characterized in that: The S3 specifically includes: S31, the collected hyperspectral image data is processed pixel by pixel, and the spectral intensity data of each pixel is converted into a standard normal distribution with a mean of zero and a standard deviation of 1; including inputting the original spectral data matrix X, each row represents the spectral data of a sample, and each column represents the spectral intensity of a certain band. For each sample, the spectral mean μ is calculated. i , the spectral mean reflects the average spectral intensity of the sample in all bands. For each sample, the spectral standard deviation σ is calculated i , measures the fluctuation range of spectral data, and the spectral intensity X of each band of each sample ij According to the standard normal transformation formula, the standardized matrix Z is obtained, and the dimension is the same as the original matrix X. ij Represents the spectral intensity value of the i-th sample in the j-th band; S32, identifying high-fluctuation areas of surface scattering interference in blueberries through dynamic partitioning processing, including processing in the near-infrared band; S33, constructs a scattering correction matrix based on the spectral feature vectors in the high-fluctuation region, removes the scattering components, and generates dissipated spectral data to ensure that the spectral signal reflects the true physical and chemical properties of the blueberry sample.

5. The method for detecting blueberry acidity based on hyperspectral imaging according to claim 4, characterized in that: The S32 specifically includes: S321, spectral gradient calculation: Calculate the spectral gradient for each band to identify the band area where the spectral intensity changes: G ij =X ij+1 -X ij , where G ij is the gradient value of the i-th sample in band j, X ij+1 is the original spectral intensity of the i-th sample in band j+1; S322, calculation of fluctuation standard deviation: Calculate the fluctuation standard deviation of each sample in the near-infrared band of 700-900nm to determine the strength of the band fluctuation: Among them, σ b,i Indicates the standard deviation of the band fluctuation of the i-th sample, n b is the number of near-infrared bands; S323, high fluctuation area determination: If a certain band gradient G ij The absolute value of is greater than θ·σ b,i , it is judged as a high volatility area.

6. The method for detecting blueberry acidity based on hyperspectral imaging according to claim 1, characterized in that: The characteristic band extraction in S4 includes calculating the Pearson correlation coefficient r between the spectral intensity of each band and the acidity value of blueberries based on the pre-processed hyperspectral image data using a band correlation analysis method. j , screening correlation coefficient r j The absolute value is greater than the set threshold r threshold The band is taken as the preliminary feature band set B initial .

7. The method for detecting blueberry acidity based on hyperspectral imaging according to claim 6, characterized in that: The continuous projection algorithm eliminates redundant information of redundant bands, including the initial feature band set B initial The continuous projection algorithm is used to eliminate the linear redundancy between bands by step-by-step projection, which can be expressed as: Among them, P j is the projection residual of the j-th band, Represents the projection of the j-th band on the space of other bands, according to the projection residual P j The size of , removes the bands with high redundancy, retains the bands with strong independence, and outputs the final feature band set B final .

8. The method for detecting blueberry acidity based on hyperspectral imaging according to claim 7, characterized in that: S5 includes constructing a partial least squares regression model: the final feature band set B final The corresponding spectral intensity matrix X final The known acidity value Y of the reference sample is used as the model input to calculate the principal component score vector T and regression coefficient B between the spectral intensity matrix and the acidity value: T=X final ·W; Where W is the projection matrix, which is used to transform the spectral intensity matrix X final Projected to the low-dimensional principal component space, P is the regression matrix, which is used to fit the relationship between the principal component score vector T and the target value Y. B is the final regression coefficient of the model. The cross-validation method is used to select the optimal number of principal components k of the model to maximize the goodness of fit and minimize the root mean square error of the prediction residual.

9. The method for detecting blueberry acidity based on hyperspectral imaging according to claim 8, characterized in that: According to the optimal number of principal components k, the model parameters T, W, P, and B are recalculated to obtain the final blueberry acidity detection model. The blueberry acidity detection model is expressed as: in, is the predicted acidity value of blueberries.

Citation Information

Cited By

  • Pet food spectrum detection device and detection method

    CN120668594A

  • Method for multispectral nondestructive testing of sugar degree, acidity and maturity of fruits and vegetables

    CN120890923A

  • Fruit and vegetable quality nondestructive testing method and system based on spectrum technology

    CN121431424A

  • Blueberry SSC content prediction method based on Caputo fractional derivative hyperspectral pretreatment

    CN121917497A

  • Fruit sugar degree prediction method and system based on multispectral image

    CN122347802A