Hawthorn water content nondestructive testing method and device based on hyperspectral imaging

By combining hyperspectral imaging technology with the WT-SR algorithm and the SVR model, non-destructive detection of hawthorn moisture content was achieved, solving the time-consuming and labor-intensive detection problems of traditional methods and improving the accuracy and efficiency of detection.

CN120801207APending Publication Date: 2025-10-17JIANGXI PROVINCE AUTHENTIC MEDICINAL MATERIALS QUALITY EVALUATION RESEARCH CENTER
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510907752.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-02
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

The existing method for detecting the moisture content of hawthorn requires drying the hawthorn, which cannot achieve non-destructive testing, has low efficiency, and cannot meet the requirements of rapid testing.

Method used

A non-destructive testing method based on hyperspectral imaging was adopted. The original spectral data of hawthorn samples were collected, FD processing was performed, and dimensionality reduction was performed using the WT-SR algorithm. Finally, the key feature variables were input into the pre-trained SVR model to realize non-destructive detection of the moisture content of hawthorn.

Benefits of technology

The non-destructive detection of the moisture content of hawthorn is realized, the accuracy and efficiency of the detection are improved, the damage to the hawthorn sample is avoided, and time and labor are saved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120801207A_ABST
    Figure CN120801207A_ABST
Patent Text Reader

Abstract

The invention discloses a nondestructive testing method and device for the water content of hawthorn based on hyperspectral imaging, and relates to the technical field of detection and analysis of the water content of the hawthorn, and the method comprises the following steps: collecting original spectral data of a hawthorn sample; performing FD processing on the original spectral data to obtain spectral data after FD processing; a WT-SR algorithm is adopted, dimension reduction processing is carried out on the spectrum data after FD processing, and key characteristic variables are obtained; and inputting the key characteristic variables into a pre-trained SVR model to obtain a hawthorn water content prediction result of the hawthorn sample. According to the invention, nondestructive detection of the water content of hawthorn can be realized, and the detection precision and efficiency are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of detection and analysis of the water content of hawthorn, and particularly relates to a method and device for nondestructive detection of the water content of hawthorn based on hyperspectral imaging. BACKGROUND

[0002] Hawthorn is a kind of medicinal and edible plant, and has a long planting history and rich germplasm resources in China. Hawthorn has a sweet and sour taste and is rich in nutrients, and has various beneficial effects such as antioxidant, anticancer, antibacterial, anti-inflammatory, hypoglycemic, hypolipidemic, digestion promotion and intestinal flora regulation. Due to its significant health effects and high nutritional value, hawthorn has been an important raw material for food, health products and medicines for a long time. However, fresh hawthorn has a very short shelf life, and the texture will change during storage, and will gradually lose water and the internal tissue will become soft. During the storage and transportation of hawthorn, too high water content may cause the hawthorn to become very sticky during transportation, leading to the growth of mold and bacteria, while too low water content may cause the flesh to become dry, affecting the taste and appearance. Therefore, it is very important to use different storage and transportation methods to transport hawthorn with different water contents. Therefore, it is particularly important to detect the water content of hawthorn.

[0003] However, the current traditional method for detecting the water content of hawthorn is the drying weight loss method. Although this method is relatively accurate, it requires drying treatment of hawthorn, cannot realize nondestructive detection, and is time-consuming and laborious, low in efficiency, and cannot meet the requirements of rapid detection. Therefore, how to provide a hawthorn water content detection method that takes into account accuracy, efficiency and nondestructiveness has become a technical problem to be solved. SUMMARY

[0004] The purpose of the present application is to provide a method and device for nondestructive detection of the water content of hawthorn based on hyperspectral imaging, which can realize nondestructive detection of the water content of hawthorn and ensure detection accuracy and efficiency.

[0005] To achieve the above-mentioned purpose, the present application provides the following solutions:

[0006] In a first aspect, the present application provides a method for nondestructive detection of the water content of hawthorn based on hyperspectral imaging, which specifically comprises the following steps:

[0007] Collecting the original spectral data of the hawthorn sample.

[0008] FD processing the original spectral data to obtain FD-processed spectral data.

[0009] Using a WT-SR algorithm to perform dimensionality reduction processing on the FD-processed spectral data to obtain key feature variables.

[0010] Input the key feature variable into a pre-trained SVR model to obtain a prediction result of the water content of the hawthorn sample.

[0011] In a second aspect, the present application provides a non-destructive detection system for water content of hawthorn based on hyperspectral imaging, comprising:

[0012] The acquisition module is configured to acquire original spectral data of the hawthorn sample.

[0013] The FD processing module is configured to perform FD processing on the original spectral data to obtain FD-processed spectral data.

[0014] The dimension reduction processing module is configured to perform dimension reduction processing on the FD-processed spectral data by using a WT-SR algorithm to obtain a key feature variable.

[0015] The water content prediction module is configured to input the key feature variable into a pre-trained SVR model to obtain a prediction result of the water content of the hawthorn sample.

[0016] In a third aspect, the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the non-destructive detection method for water content of hawthorn based on hyperspectral imaging.

[0017] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executable by a processor to implement the steps of the non-destructive detection method for water content of hawthorn based on hyperspectral imaging.

[0018] In a fifth aspect, the present application provides a computer program product comprising a computer program, wherein the computer program is executable by a processor to implement the steps of the non-destructive detection method for water content of hawthorn based on hyperspectral imaging.

[0019] According to the embodiments provided in the present application, the present application has the following technical effects:

[0020] The present application provides a method and device for non-destructive detection of hawthorn moisture content based on hyperspectral imaging. First, the original spectral data of the hawthorn sample is collected; then, FD processing is performed on the original spectral data to obtain FD-processed spectral data; then, the WT-SR algorithm is used to perform dimensionality reduction processing on the FD-processed spectral data to obtain key feature variables; finally, the key feature variables are input into a pre-trained SVR model to obtain the hawthorn moisture content prediction result of the hawthorn sample. It can be seen that the present application combines multiple technologies such as FD processing technology, WT-SR algorithm, SVR network, etc., and uses the spectral data after FD processing and dimensionality reduction processing based on the WT-SR algorithm as the input of the pre-trained SVR model, and can directly output the corresponding hawthorn moisture content prediction result. Compared with the traditional drying loss method, the present application only needs to collect the spectral data of the hawthorn sample and process it through FD processing, dimensionality reduction processing and model processing to predict the hawthorn moisture content. It not only does not cause damage to the hawthorn sample, but also realizes non-destructive detection of hawthorn moisture content, and is more time-saving and labor-saving, with higher accuracy and higher detection efficiency. While realizing non-destructive detection, it also ensures the accuracy and efficiency of hawthorn moisture content detection. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0022] Figure 1 A diagram illustrating the application environment of a nondestructive detection method for hawthorn moisture content based on hyperspectral imaging provided in one embodiment of the present application.

[0023] Figure 2 A schematic flow chart of a nondestructive detection method for hawthorn moisture content based on hyperspectral imaging provided in one embodiment of the present application.

[0024] Figure 3 This is an average spectrum curve diagram of hawthorn placement position 1 provided in an embodiment of the present application.

[0025] Figure 4 This is an average spectrum curve diagram of hawthorn placement position 2 provided in an embodiment of the present application.

[0026] Figure 5 This is an average spectrum curve diagram of hawthorn placement position 3 provided in one embodiment of the present application.

[0027] Figure 6 This is a comparison curve of the average spectra of hawthorns at different placement positions provided in one embodiment of the present application.

[0028] Figure 7 A hawthorn original spectrum curve chart provided by an embodiment of the present application.

[0029] Figure 8 An SG processing spectrum curve chart provided by an embodiment of the present application.

[0030] Figure 9 An SNV processing spectrum curve chart provided by an embodiment of the present application.

[0031] Figure 10 An MSC processing spectrum curve chart provided by an embodiment of the present application.

[0032] Figure 11 An FD processing spectrum curve chart provided by an embodiment of the present application.

[0033] Figure 12 An SD processing spectrum curve chart provided by an embodiment of the present application.

[0034] Figure 13 A hawthorn water content prediction characteristic wavelength curve chart provided by an embodiment of the present application.

[0035] Figure 14 A hawthorn water content prediction result schematic diagram provided by an embodiment of the present application. DETAILED DESCRIPTION

[0036] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of the present application.

[0037] Hyper Spectral Imaging (HSI) is an advanced detection technology that integrates spectral and image information, with high spatial resolution and high spectral resolution, which can provide spatial images at each wavelength, thus realizing the spatial distribution analysis of sample surface molecular vibration information for non-destructive quality evaluation. In addition, this advanced imaging technology can simultaneously scan and analyze many samples. In recent years, HSI technology has been widely used in the prediction of water content in various fruits. For example, Di et al. used an enhanced near-infrared hyper spectral camera (900-1750 nm) combined with multiple linear regression (MLR) and partial least squares regression (PLSR) methods to realize the rapid prediction of water content in winter jujube. Yang et al. combined a hyper spectral imaging system (400-1000 nm) with machine learning algorithms to build an MSC-CARS-RBF (multiple scatter correction combined with competitive adaptive reweighted sampling algorithm and radial basis function) model, which achieved good results in sweet potato water prediction (RMSE = 0.066%, R 2= 0.97). Song et al. built a PLSR model based on a compact lightpipe hyperspectral imaging system (400-1000 nm) with 28 spectral channels, and realized the quantitative prediction and visual distribution analysis of water in apple slices. Chen et al. carried out nondestructive detection of water in loquat based on HSI, and realized the freshness discrimination of loquat with different storage times through PLS-DA (Partial Least Squares-Discrimination Analysis), MLogR (Logistic Regression), and BPNN (Back Propagation Neural Network) and other classification models. However, so far, there are few studies on the prediction of the water content of hawthorn. The nondestructive detection of the water content of hawthorn, which has important economic and medicinal value, is still relatively rare. Therefore, it is necessary to carry out research on the nondestructive detection method of hawthorn water based on HSI technology, and to provide technical support for the quality grading and processing of hawthorn. Due to the high dimensionality of hyperspectral images and the limitations of computer performance, it is necessary to reduce the dimensionality of the original hyperspectral data to simplify the modeling process and improve the modeling efficiency. The present application aims to take hawthorn as the research object, systematically analyze the influence of the placement position of the hawthorn sample, the spectral range, the pretreatment method, the feature waveband extraction method, and the regression model on the prediction performance of the water content of hawthorn, and innovatively propose a feature data extraction method based on discrete wavelet transform and stepwise regression (Discrete Wavelet Transform-based Super Resolution, DWT-SR), to establish a hawthorn water content prediction model based on hyperspectral imaging technology with the best performance, to provide a new technical path for nondestructive detection of the quality of specialty agricultural products, and to have important practical value for the development of intelligent sorting equipment based on spectral sensing, and to meet the urgent needs of smart agriculture for precise detection technology.

[0038] In order to make the above objectives, features and advantages of the present application more obvious and easy to understand, the present application will be further described in detail below in combination with the drawings and specific embodiments.

[0039] The nondestructive detection method of hawthorn water content based on hyperspectral imaging provided by the embodiments of the present application can be applied to Figure 1The application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data required by the server 104 to process. The data storage system can be set up separately, or integrated on the server 104, or placed on the cloud or other servers. The terminal 102 can send the original spectral data of the hawthorn sample to the server 104, and after the server 104 receives the original spectral data of the hawthorn sample, the server 104 processes the original spectral data of the hawthorn sample. First derivative (FD) processing, get the FD processed spectral data; adopt WT-SR (wavelet transform combined with stepwise regression) algorithm, dimension reduction processing is carried out on the FD processed spectral data, and the key characteristic variable is obtained; the key characteristic variable is input into the pre-trained SVR (Support Vector Regression) model, and the hawthorn moisture content prediction result of the hawthorn sample is obtained. The server 104 can feed back the obtained hawthorn moisture content prediction result to the terminal 102. In addition, in some embodiments, the hawthorn moisture content nondestructive detection method based on hyperspectral imaging can also be realized by the server 104 or the terminal 102 alone, such as the terminal 102 can directly perform hawthorn moisture content nondestructive detection processing on the original spectral data of the hawthorn sample, or the server 104 can obtain the original spectral data of the hawthorn sample from the data storage system and perform hawthorn moisture content nondestructive detection processing on the original spectral data of the hawthorn sample.

[0040] Among them, the terminal 102 can be but not limited to various desktop computers, notebook computers, smart phones, tablet computers and Internet of Things devices. The server 104 can be realized by an independent server or a server cluster composed of multiple servers, and can also be a cloud server.

[0041] In an exemplary embodiment, as Figure 2 shown, a hawthorn moisture content nondestructive detection method based on hyperspectral imaging is provided, which is executed by a computer device, specifically can be executed by a terminal or a server alone, or can be executed by a terminal and a server together. In the embodiment of the present application, the method is applied to Figure 1 the server 104 in the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data required by the server 104 to process. The data storage system can be set up separately, or integrated on the server 104, or placed on the cloud or other servers. The terminal 102 can send the original spectral data of the hawthorn sample to the server 104, and after the server 104 receives the original spectral data of the hawthorn sample, the server 104 processes the original spectral data of the hawthorn sample. First derivative (FD) processing, get the FD processed spectral data; adopt WT-SR (wavelet transform combined with stepwise regression) algorithm, dimension reduction processing is carried out on the FD processed spectral data, and the key characteristic variable is obtained; the key characteristic variable is input into the pre-trained SVR (Support Vector Regression) model, and the hawthorn moisture content prediction result of the hawthorn sample is obtained. The server 104 can feed back the obtained hawthorn moisture content prediction result to the terminal 102. In addition, in some embodiments, the hawthorn moisture content nondestructive detection method based on hyperspectral imaging can also be realized by the server 104 or the terminal 102 alone, such as the terminal 102 can directly perform hawthorn moisture content nondestructive detection processing on the original spectral data of the hawthorn sample, or the server 104 can obtain the original spectral data of the hawthorn sample from the data storage system and perform hawthorn moisture content nondestructive detection processing on the original spectral data of the hawthorn sample.

[0042] S1: Collect the original spectral data of the hawthorn sample.

[0043] S2: FD processing is performed on the original spectral data to obtain FD processed spectral data.

[0044] S3: WT-SR algorithm is adopted to perform dimension reduction processing on the FD processed spectral data to obtain the key characteristic variable.

[0045] S4: inputting the key feature variable into a pre-trained SVR model to obtain a prediction result of the water content of the hawthorn sample.

[0046] In this embodiment, step S1 collects original spectral data of the hawthorn sample, specifically including the following steps:

[0047] S11: place the hawthorn sample in the high-spectral imaging system with the fruit stem facing downward.

[0048] S12: use the high-spectral imaging system to collect spectral data of the hawthorn sample in the current pose state to obtain original spectral data.

[0049] In this embodiment, step S3 uses the WT-SR algorithm to perform dimensionality reduction processing on the FD-processed spectral data to obtain a key feature variable, specifically including the following steps:

[0050] S31: use a db6 wavelet basis function to perform first-layer discrete wavelet decomposition processing on the FD-processed spectral data to extract a low-frequency component.

[0051] S32: use an SR (stepwise regression) algorithm to screen a key feature variable from the low-frequency component.

[0052] In this embodiment, the number of the key feature variable is 17, and the corresponding wavelengths include: 1075.55 nm, 1117.83 nm, 1191.81 nm, 1255.23 nm, 1318.64 nm, 1329.21 nm, 1434.91 nm, 1572.31 nm, 1604.01 nm, 1825.97 nm, 2047.92 nm, 2174.76 nm, 2227.60 nm, 2238.17 nm, 2280.45 nm, 2301.59 nm, and 2512.97 nm.

[0053] In one exemplary embodiment, the high-spectral imaging-based nondestructive detection method for the water content of hawthorn further includes the following steps:

[0054] According to the wavelengths corresponding to the key feature variable, the high-spectral imaging system is optimized to determine an optimization measure. The optimization measure includes improving the original waveband range of the high-spectral imaging system or preparing a high-spectral imaging system with a preset waveband.

[0055] In an exemplary embodiment, a new miniaturized and light-weighted multi-spectral instrument can be developed and prepared according to the wavelengths corresponding to the above-mentioned 17 key characteristic variables, for example, using 17 narrow-band filters (bandwidth ± 5 nm) to accurately match and screen wavelengths (such as 1075.55 nm, 1117.83 nm, 1191.81 nm, 1255.23 nm, 1318.64 nm, 1329.21 nm, 1434.91 nm, 1572.31 nm, 1604.01 nm, 1825.97 nm, 2047.92 nm, 2174.76 nm, 2227.60 nm, 2238.17 nm, 2280.45 nm, 2301.59 nm, and 2512.97 nm, etc.) to replace wide-spectrum spectroscopy. The number of wave bands of this multi-spectral instrument is significantly reduced, thereby reducing the cost of equipment and improving the detection efficiency.

[0056] In the embodiment, the water content prediction model of hawthorn is preferably an SVR model, specifically a pre-trained SVR model, wherein the hyperparameters of the pre-trained SVR model are optimized by grid search (GridSearch), the kernel function is RBF (Radial Basis Function), the search range of the penalty coefficient C is 0.1, 1, 10, and 100, and the search range of the kernel function bandwidth gamma is 0.01, 0.001, and 0.0001.

[0057] In order to make the technical scheme of the embodiment clearer, the specific implementation process of the technical scheme of the embodiment will be described in the form of examples.

[0058] In the embodiment, 458 fresh hawthorn samples representing different varieties were collected from five provinces, i.e., Hebei, Liaoning, Henan, Shandong, and Shanxi, and the specific origins and varieties are as follows: Hebei Qinghe "Dajinxing" (HB_DJX), Hebei Shijiazhuang "Yanzhanghong" (HB_YRH), Hebei Xinglong "Tieshanzha" (HB_TSZ), Henan Jiyuan "Dawuleng" (HN_DWL), Shandong Feixian "Jinruyi" (SD_JRY), Shandong Xintai "Yuganhong" (SD_YGH), Shanxi Yuncheng "Dajinxing" (SX_DJX), Shanxi Yuncheng "Dawuleng" (SX_DWL), Shanxi "Shuiguo Shawanzha" (SX_SG), Liaoning Benxi "Benxi No. 4" (LN_BX), and Liaoning Shenyang "Liaohong" (LN_LH). After all the fresh hawthorn samples were picked, they were quickly sent to the laboratory to ensure that each hawthorn sample was not damaged.

[0059] In this embodiment, the hyperspectral imaging system adopts HySpex series hyperspectral imaging spectrometer (Norsk Elektro Optikk A / S, Norway). The hyperspectral imaging system includes VNIR (visible-near infrared band) lens (410-990 nm, resolution 5.4 nm, a total of 108 wavelengths) and SWIR (short wave near infrared) lens (950-2500 nm, resolution 5.45 nm, a total of 288 wavelengths), two 150W and 45° incident angle halogen lamps (for illumination), a moving object platform (for clamping hawthorn samples) and a self-contained computer and software. Among them, the exposure time of VNIR lens and SWIR lens is 0.0035s and 0.0045s respectively, the distance between hawthorn sample and lens is 30cm, and the speed of the conveyor belt is 2.5mm / s.

[0060] In this embodiment, considering the shape of hawthorn fruit and the spectral changes caused by different orientations due to uneven surface reflectivity, hyperspectral images are collected from three different positions, namely position 1, position 2 and position 3. Among them, position 1 means that the fruit is placed horizontally with the stem to the side; position 2 means that the stem is downward; and position 3 means that the stem is upward.

[0061] In this embodiment, the threshold segmentation method is used to extract the region of interest (ROI). First, the original hyperspectral image is processed by mask to obtain the fluorescence hyperspectral image without background information. Then, principal component analysis (PCA) is used to decompose the principal components of the hyperspectral image. Among them, the PC1 (first principal component) image is segmented by threshold, and morphological operations such as closing operation and dilation operation are used. Finally, the average reflectivity of all pixels in the corresponding ROI is calculated to obtain the spectrum of each sample.

[0062] In order to verify the accuracy of the experimental results, after the spectral data collection is completed, the traditional drying loss method is used to immediately determine the moisture index of hawthorn samples to avoid data distortion caused by water loss. According to the drying loss method in the national standard (GB / T5009.3-2016), each hawthorn sample is placed in an electric heating air drying oven and dried at 75℃ for 36h.

[0063]

[0064] Among them, w is the water content of the sample; m1 is the mass of the sample before drying; m2 is the mass of the sample after drying.

[0065] In the pretreatment stage, the convolution smoothing method (Savizky-Golay, SG), multiplicative scatter correction (MSC), standard normal variate (SNV), FD and second derivative (SD) were used to pretreat the hawthorn sample spectrum respectively to eliminate the noise caused by environmental factors, instruments and other factors and highlight the useful information in the spectrum. PLSR algorithm was used to build the model, and by comparing the accuracy of the hawthorn moisture content prediction model based on the pretreated spectral data, the best pretreatment method was determined for subsequent research and analysis.

[0066] In order to extract important features from the best pretreated spectral data, the continuous projection algorithm (SPA), the competitive adaptive reweighted sampling algorithm (CARS) and the variable iterative space shrinkage method (VISSA) and the discrete wavelet transform combined with stepwise regression (DWT-SR) algorithm were used to reduce the dimension of the spectral data. Finally, based on the pretreated and dimensionally reduced spectral data, a machine learning algorithm was used to build a hawthorn moisture content prediction model.

[0067] Among them, the DWT-SR algorithm aims to realize the multi-scale transformation of data and reduce the dimension of data. The DWT-SR algorithm contains a two-step dimension reduction algorithm, in which the DWT (discrete wavelet transform) algorithm performs multi-scale transformation on the original spectral data to obtain the optimal prediction data set, and the SR algorithm further realizes data dimension reduction under the optimal wavelet decomposition layer. Wavelet transform is composed of many sub-functions, each of which is derived from a mother wavelet. In addition, wavelet basis functions (WBF) can be generated by scaling and translating the mother wavelet. In order to facilitate data processing, the DWT algorithm is used to discretize the original signal. In this embodiment, the hyperspectral data of the ROI region of the hawthorn sample is decomposed into low-frequency components and high-frequency components, and the low-frequency components and high-frequency components obtained by wavelet decomposition are placed in matrix Ai and matrix Di respectively, where i represents the wavelet decomposition layer. Then, the SR algorithm is used to further process the low-frequency component matrix Ai. The effectiveness of the data characteristics in matrix Ai is evaluated using the backward elimination method in factor analysis. The characteristic data selected by the SR algorithm is placed in matrix Bi (ci x di), where ci is the number of characteristic data after SR processing under the i-th wavelet decomposition layer, and di is the number of samples under the i-th wavelet decomposition layer.

[0068] To build the prediction model of the water content of hawthorn based on the hyperspectral data of hawthorn and its water content, the present embodiment compares four typical machine learning regression methods, including partial least squares regression (PLSR), SVR, random forest regression (RF) and multilayer perceptron (MLP). The data set is randomly divided into calibration set (Calibration Set), validation set (Validation Set) and prediction set (Prediction Set) according to the ratio of 7:1:2, in order to ensure the generalization ability of the model. For PLSR, SVR and RF models, the grid search method is used to optimize the key hyperparameters, and the target is to maximize the determination coefficient (R 2 ) on the validation set. The number of principal components (n_components) is the main parameter for PLSR model, and the search range is set to 1-30. The RBF function is used as the kernel function of the SVR model, and the penalty coefficient C (0.1, 1, 10, 100) and the kernel function bandwidth gamma (0.01, 0.001, 0.0001) are adjusted. RF is combined and optimized from the aspects of integrated scale (n_estimators: 100 and 300), maximum tree depth (max_depth: 5, 10 and 15), minimum split sample number (min_samples_split: 5 and 10), leaf node minimum sample number (min_samples_leaf: 2 and 5) and feature selection strategy (max_features: sqrt or log2). The MLP model is adjusted by structure search and training hyperparameters, and a two-layer hidden layer network is constructed, and the number of neurons in each layer is optimized. Finally, the network structure containing 256 and 128 neurons is determined, Dropout (0.1) and L2 regularization (weight decay coefficient 1e-4) are introduced to suppress overfitting, Adam optimizer (learning rate set to 1e-3) is used, and the activation function is ReLU function.

[0069] In the model optimization process of the present embodiment, the R 2 is used as the evaluation index, and the optimal configuration in each algorithm parameter combination is selected. Finally, all models are evaluated on the independent prediction set by R 2 , correlation coefficient (R), root mean square error (RMSE) and relative analysis error (RPD) to evaluate their prediction performance.

[0070] Figure 3 is the average spectrum curve of hawthorn in position 1, Figure 4 is the average spectrum curve of hawthorn in position 2, Figure 5 is the average spectrum curve of hawthorn in position 3,Figure 6 The average spectrum contrast curve of different positions of hawthorn, wherein the curve of each color represents a hawthorn variety. It can be seen that the overall spectral trends of hawthorn of different origins and different varieties are consistent, but the reflectivity of the samples has certain differences. The absorption near 600-620 nm is related to the color pigments of hawthorn. Among them, the hawthorn variety Shandong Jinruyi (SD_JRY) shows a clear absorption peak near 600 nm. The trough near 670 nm belongs to the absorption spectrum of carotenoids and chlorophyll in plants. The absorption at 970 nm corresponds to the first order frequency multiplication of O-H bond stretching vibration; the absorption band near 1200 nm is derived from the combination mode of O-H bond stretching vibration and bending vibration; the characteristic peak at 1450 nm is the first order frequency multiplication of O-H bond bending vibration; the absorptions at 1640 nm and 1800 nm correspond to C-H bond stretching vibration and O-H bond stretching vibration, respectively; and the strong absorption band of water molecules at 1930 nm reflects the combination mode of O-H bond stretching vibration. In addition, the reflectivity of the spectrum is different due to the different positions of hawthorn, which is caused by the heterogeneity of the distribution of chemical components in different surface directions.

[0071] In this embodiment, the performance of different pretreatment methods is compared. Different pretreatment methods such as SG, MSC, SNV, FD and SD are used to process the hawthorn spectrum, Figure 7 The original spectrum curve of hawthorn is shown in the figure, Figure 8 The SG-processed spectrum curve is shown in the figure, Figure 9 The SNV-processed spectrum curve is shown in the figure, Figure 10 The MSC-processed spectrum curve is shown in the figure, Figure 11 The FD-processed spectrum curve is shown in the figure, Figure 12 The SD-processed spectrum curve is shown in the figure. It can be seen that the spectrum curve of hawthorn changes little before and after SG processing. The change trend of the spectrum curve of hawthorn after SNV and MSC processing is similar, but the reflectivity intensity of hawthorn of different origins and different varieties is obviously different. In addition, the FD algorithm and the SD algorithm can effectively process the overlapping peaks of the spectrum curve, the number of spectral absorption peaks is reduced, and the difference between the spectra is enhanced.

[0072] The present embodiment is to select the best pretreatment algorithm. Taking the position 1 (i.e. the fruit is placed horizontally, and the fruit stem is placed sideways) as an example, the original spectral data and the spectral data after SG, MSC, SNV, FD and SD pretreatment are used as the input of the PLSR model, and the water content is used as the output of the PLSR model. The optimal latent variable is determined by the validation set, and the prediction performance is evaluated by using the test set, and then the optimal spectral pretreatment method is determined. The final result is shown in Table 1. As can be seen from Table 1, after different pretreatment methods are used, the performance of the prediction model of the hawthorn water content established by using the spectrum is different. Among them, the performance of the prediction model of the hawthorn water content established by using the spectrum after FD pretreatment is the best, which is better than the model established by using the original spectrum and the spectrum after other pretreatment methods. 2 p , RMSE P and RPD are 0.7434, 1.2481 and 1.9740 respectively. Therefore, the spectrum after FD pretreatment is used for subsequent analysis.

[0073] Table 1 PLSR model prediction performance of hawthorn water content based on spectral data before and after pretreatment

[0074]

[0075]

[0076] The present embodiment is to compare the prediction performance of different placement positions and spectral ranges for the water content of hawthorn. After the spectral data is pretreated by FD, four regression methods of PLSR, MLP, SVR and RF are used to establish 48 models. The optimal parameters are determined by grid search, and the prediction performance of the model is evaluated by using the test set, and the optimal sample placement position, spectral range and optimal regression method for predicting the water content of hawthorn are determined.

[0077] When the hawthorn is fixed and placed in a single direction, it can be seen that for the four regression methods and different spectral ranges, the performance of the model placed according to position 1 is worse than that of the corresponding model placed according to position 2 and position 3. Moreover, when the data of the three positions is integrated, the prediction performance of the water content cannot be improved.

[0078] For different spectral ranges, the performance of the four regression methods PLSR, MLP, SVR and RF in different placement positions is better in the SWIR spectral range (940-2500nm) than in the VNIR spectral range (410-990nm), because the SWIR spectral range contains more information of compound functional groups. And when the data of the two spectral ranges are fused, the placement of position 2 cannot improve the prediction performance of the water content of hawthorn, but introduces more redundant information, resulting in a certain decrease in the performance of the model. According to the placement of position 3, the performance of the model is improved to a certain extent.

[0079] Table 2 shows the prediction performance of water content in different placement positions, different spectral ranges, and different machine learning algorithms. It can be seen that for the four regression methods and their combinations, the performance of the SVR model is better than that of the PLSR, MLP and RF regression methods regardless of the placement position and spectral range. When the hawthorn samples are placed according to position 2, the prediction performance of the water content is best in the SWIR spectral range using the SVR regression method, with Rp being 0.9288 and PRD being 2.6776, which can accurately and efficiently realize the prediction of the water content of hawthorn. This is also the reason why the original spectral data in the SWIR band range of the hawthorn sample with the fruit stem facing downward is preferred when collecting the original spectral data in the embodiment, and the FD processing, WT-SR algorithm and SVR model are combined. According to the experimental results above, the combination of the optimal algorithm in each algorithm, i.e., placing the hawthorn fruit stem downward, using the SWIR band range, and using the spectral data after FD processing and dimensionality reduction processing based on the WT-SR algorithm as the input of the SVR model, can accurately and efficiently obtain reliable prediction results of the water content of hawthorn.

[0080] Table 2 shows the prediction performance of water content in different placement positions, different spectral ranges, and different machine learning algorithms. It can be seen that for the four regression methods and their combinations, the performance of the SVR model is better than that of the PLSR, MLP and RF regression methods regardless of the placement position and spectral range. When the hawthorn samples are placed according to position 2, the prediction performance of the water content is best in the SWIR spectral range using the SVR regression method, with Rp being 0.9288 and PRD being 2.6776, which can accurately and efficiently realize the prediction of the water content of hawthorn. This is also the reason why the original spectral data in the SWIR band range of the hawthorn sample with the fruit stem facing downward is preferred when collecting the original spectral data in the embodiment, and the FD processing, WT-SR algorithm and SVR model are combined. According to the experimental results above, the combination of the optimal algorithm in each algorithm, i.e., placing the hawthorn fruit stem downward, using the SWIR band range, and using the spectral data after FD processing and dimensionality reduction processing based on the WT-SR algorithm as the input of the SVR model, can accurately and efficiently obtain reliable prediction results of the water content of hawthorn.

[0081]

[0082]

[0083]

[0084] In this embodiment, SPA, CARS, VISSA and WT-SR algorithms are used to reduce the dimensionality of spectral data. The hawthorn water content prediction characteristic wavelength curves extracted by SPA, CARS and VISSA algorithms are as shown in Figure 13 It can be seen from Figure 13 that the number of water content related characteristic spectra in the SWIR spectral range extracted by SPA, CARS and VISSA algorithms after FD processing is 35, 77 and 176 respectively.

[0085] Table 3 shows the results of the SVR model established by the spectral features extracted from the SWIR spectral range after FD processing by SPA, CARS and VISSA algorithms. It can be seen that the performance of the hawthorn moisture content prediction model established by using different feature extraction algorithms is different. Among them, the FD-CARS (first derivative combined with competitive adaptive reweighted sampling) algorithm extracted features for modeling data corresponding to the best model performance, and the corresponding R, RMSE and RPD were 0.9223, 0.9515 and 2.5726, respectively. Compared with the modeling results of the pretreated spectrum, the number of spectral data features after feature dimension reduction is reduced, but the accuracy of the established model is also reduced. Therefore, by selecting other appropriate feature selection methods, the number of spectral bands can be reduced, and the detection accuracy of the hawthorn moisture content prediction model can be improved.

[0086] Table 3 Prediction performance of SWIR spectrum based on three dimension reduction algorithms

[0087]

[0088] In this embodiment, the WT-SR algorithm is mainly divided into two stages of wavelet multi-scale transformation and data dimension reduction. In this embodiment, db4 function, db6 function, sym5 function and coif3 function are used as wavelet basis function, and the maximum decomposition layer of wavelet multi-scale transformation is 7. Combined with stepwise regression algorithm analysis, the best decomposition layer corresponding to db4 function, db6 function, sym5 function and coif3 function is 1. It can be seen that the wavelengths with large correlation coefficient of determination related to moisture content are mainly concentrated in 1000-1200, 1500-1600, 1800-1970 and 2200-2300 nm.

[0089] The embodiment utilizes the WT-SR algorithm to reduce the dimension of the spectral data, and establishes a water content prediction SVR model (i.e., an SVR model for predicting the water content of hawthorn) by using the spectral features after dimension reduction, and the results are shown in Table 4. It can be seen that, on the one hand, the number of features extracted by the WT-SR algorithm is lower than that of the SPA, CARS, IRIV (Iteratively Retains Informative Variables) and VISSA algorithms; on the other hand, the performance of the MLR model established by using the features extracted by the WT-SR algorithm is better than that of the SVR model established by using the features extracted by the SPA, CARS and VISSA algorithms. Among them, the wavelet basis function db6 based on the WT-SR algorithm can screen 17 key feature variables (the corresponding wavelengths are 1075.55, 1117.83, 1191.81, 1255.23, 1318.64, 1329.21, 1434.91, 1572.31, 1604.01, 1825.97, 2047.92, 2174.76, 2227.60, 2238.17, 2280.45, 2301.59, 2512.97), and the performance of the water content prediction SVR model corresponding to the establishment is the best, R P , RMSE P and RPD are 0.9262, 0.9252 and 2.6457 respectively, and the performance is equivalent to the prediction performance of the model based on the full wavelength.

[0090] Table 4 Prediction performance of water content based on WT-SR processed SWIR spectrum

[0091]

[0092] In order to more intuitively show the prediction performance of the model, the scatter plot of the regression fitting curve is drawn, as shown in Figure 14 It can be seen that the regression fitting of the best DWT-SR-SVR (discrete wavelet transform combined with stepwise regression and support vector machine regression) model for water content shows a good linear trend. Most of the data points are densely distributed near the 45° diagonal line, indicating that the predicted value is highly consistent with the actual value.

[0093] The present embodiment is with hawthorn as detection object, explores the application of hyperspectral imaging technology in combination with machine learning algorithm in the rapid non-destructive detection scene of hawthorn water content, first collects 458 VNIR and SWIR band hyperspectral data from different production areas and different varieties of hawthorn samples, utilizes image processing technology to build hyperspectral image segmentation algorithm to determine the region of interest, extracts the average reflectance spectrum of the fruit region of interest. Subsequently, five kinds of spectral preprocessing methods (including SG, MSC, SNV, FD, SD) are used to optimize the original spectral data. On this basis, in combination with machine learning methods such as PLSR, SVR, RF and MLP, the system evaluates the influence of different placement methods (fruit stalk towards the side, fruit stalk upward, fruit stalk downward and three fusions) and spectral range (VNIR, SWIR, VNIR+SWIR) on the water content prediction performance of model. Finally, four algorithms of SPA, CARS, VISSA and DWT-SR are used to carry out dimensionality reduction processing on feature variables, further reduce data redundancy, and improve model efficiency. The results showed that the SVR model performed best under the combination of the fruit stalk facing downward, the SWIR band range (940-2500nm) and the FD treatment (R p =0.9288, R2 p =0.8605, RMSEp=0.9142, RPD=2.6776). Under the optimal performance condition, the DWT-SR algorithm was further used to screen the characteristic bands. In the first layer of discrete wavelet decomposition processing of the DWT-SR algorithm, db6 was selected as the wavelet basis function, and finally 17 key characteristic bands (bands corresponding to key characteristic variables) were screened out. The constructed model maintained a high level of prediction performance (R p 0.9262, R 2 p =0.8571, RMSE p =0.9252, RPD=2.6457), which verified the feasibility and effectiveness of the method of this embodiment in the non-destructive detection of hawthorn moisture content, and provided a theoretical basis and technical support for online monitoring and intelligent sorting of fruit moisture.

[0094] Based on the same inventive concept, the present application also provides a nondestructive moisture detection system for hawthorn based on hyperspectral imaging, which is used to implement the aforementioned nondestructive moisture detection method for hawthorn based on hyperspectral imaging. The solution provided by this system is similar to the solution described in the aforementioned method. Therefore, the specific limitations of the embodiment of the nondestructive moisture detection system for hawthorn based on hyperspectral imaging provided below can be found in the above-mentioned limitations of the nondestructive moisture detection method for hawthorn based on hyperspectral imaging, and will not be repeated here.

[0095] In one example embodiment, a hyperspectral imaging-based nondestructive detection system for water content of hawthorn is provided, which specifically comprises the following functional modules:

[0096] A collection module is configured to collect original spectral data of the hawthorn sample.

[0097] An FD processing module is configured to perform FD processing on the original spectral data to obtain FD-processed spectral data.

[0098] A dimension reduction processing module is configured to perform dimension reduction processing on the FD-processed spectral data by using a WT-SR algorithm to obtain key feature variables.

[0099] A water content prediction module is configured to input the key feature variables into a pre-trained SVR model to obtain a water content prediction result of the hawthorn sample.

[0100] In one example embodiment, a computer device is provided, which comprises a memory and a processor, the memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.

[0101] In one example embodiment, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to implement the steps in the above method embodiments.

[0102] In one example embodiment, a computer program product is provided, which comprises a computer program, and the computer program is executed by a processor to implement the steps in the above method embodiments.

[0103] The technical features of the above embodiments can be combined in any manner, and to make the description concise, not all possible combinations of the technical features in the above embodiments are described, however, as long as the combinations of the technical features do not exist contradictions, they should be considered as the scope of the present disclosure.

[0104] The principles and implementation modes of the present application are described by using specific examples in this paper, and the above embodiment descriptions are only used to help understand the method and its core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation modes and application ranges will be changed. In conclusion, the content of the present description should not be understood as a limitation of the present application.

Claims

1. A non-destructive detection method for hawthorn moisture content based on hyperspectral imaging, characterized in that: The non-destructive detection method for hawthorn moisture content based on hyperspectral imaging includes: Collect raw spectral data of hawthorn samples; Performing FD processing on the original spectral data to obtain FD-processed spectral data; Using the WT-SR algorithm, the spectral data after FD processing is subjected to dimension reduction processing to obtain key characteristic variables; The key feature variables are input into the pre-trained SVR model to obtain the hawthorn moisture content prediction result of the hawthorn sample.

2. The nondestructive detection method for hawthorn moisture content based on hyperspectral imaging according to claim 1, characterized in that: Collect the original spectral data of hawthorn samples, including: The hawthorn sample was placed in the hyperspectral imaging system with the fruit stalk facing downward; The hyperspectral imaging system is used to collect original spectral data of the hawthorn sample.

3. The nondestructive detection method for hawthorn moisture content based on hyperspectral imaging according to claim 2, characterized in that: The WT-SR algorithm is used to perform dimension reduction on the spectral data after FD processing to obtain key feature variables, including: Using the db6 wavelet basis function, the spectral data after the FD processing is subjected to the first layer of discrete wavelet decomposition processing to extract the low-frequency component; The SR algorithm is used to screen key characteristic variables from the low-frequency components.

4. The nondestructive detection method for hawthorn moisture content based on hyperspectral imaging according to claim 3, characterized in that: The number of key characteristic variables is 17, and the corresponding wavelengths include: 1075.55nm, 1117.83nm, 1191.81nm, 1255.23nm, 1318.64nm, 1329.21nm, 1434.91nm, 1572.31nm, 1604.01nm, 1825.97nm, 2047.92nm, 2174.76nm, 2227.60nm, 2238.17nm, 2280.45nm, 2301.59nm and 2512.97nm.

5. The nondestructive detection method for hawthorn moisture content based on hyperspectral imaging according to claim 4, characterized in that: The non-destructive detection method for hawthorn moisture content based on hyperspectral imaging also includes: According to the wavelength corresponding to the key characteristic variable, the hyperspectral imaging system is optimized and optimization measures are determined; the optimization measures include improving the original band range of the hyperspectral imaging system or preparing a hyperspectral imaging system with a preset band.

6. The nondestructive detection method for hawthorn moisture content based on hyperspectral imaging according to claim 1, characterized in that: The hyperparameters of the pre-trained SVR model are optimized by grid search. The kernel function is the RBF function. The search range of the penalty coefficient C is 0.1, 1, 10 and 100. The search range of the kernel function bandwidth gamma is 0.01, 0.001 and 0.0001.

7. A non-destructive detection system for hawthorn moisture content based on hyperspectral imaging, characterized in that: The nondestructive detection system for hawthorn moisture content based on hyperspectral imaging includes: Acquisition module, used to collect raw spectral data of hawthorn samples; An FD processing module, configured to perform FD processing on the original spectral data to obtain FD-processed spectral data; A dimensionality reduction processing module is used to perform dimensionality reduction processing on the spectral data after the FD processing using a WT-SR algorithm to obtain key characteristic variables; The moisture content prediction module is used to input the key feature variables into the pre-trained SVR model to obtain the hawthorn moisture content prediction result of the hawthorn sample.

8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the non-destructive detection method for hawthorn moisture content based on hyperspectral imaging according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for non-destructive detection of hawthorn moisture content based on hyperspectral imaging according to any one of claims 1 to 6 is implemented.

10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method for non-destructive detection of hawthorn moisture content based on hyperspectral imaging according to any one of claims 1 to 6 is implemented.