A kiwifruit quality deterioration detection method based on hyperspectral and deep learning
By combining hyperspectral image acquisition with deep learning, a one-dimensional convolutional neural network model was constructed, which solved the problems of subjectivity and low efficiency in the detection of kiwifruit quality deterioration. This model enables non-destructive, rapid, and accurate detection of kiwifruit quality, and is suitable for industrial-scale batch testing and cold chain monitoring.
Patent Information
- Application Number
- CN202610356878.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-23
- Publication Date
- 2026-07-14
Smart Images

Figure CN122385493A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of non-destructive testing technology for fruit and vegetable quality, specifically a method for detecting quality deterioration in kiwifruit based on hyperspectral imaging and deep learning. Background Technology
[0002] Kiwifruit, a berry rich in various nutrients, is a highly valuable category in the fruit and vegetable industry. However, its high water content and weak peel protection make it prone to softening, mold, and other quality deterioration during post-harvest storage and transportation, resulting in significant industry losses. Therefore, accurate detection of kiwifruit quality deterioration is a crucial step in post-harvest fruit and vegetable processing. With the development of non-destructive testing technologies for agricultural products, hyperspectral imaging technology, which can simultaneously capture the spectral and spatial information of samples, has become an important technical means for non-contact detection of fruit internal quality. Meanwhile, deep learning technology has demonstrated excellent performance in feature extraction and pattern classification. Combining hyperspectral technology with deep learning has become an important research direction in the field of agricultural product quality deterioration detection. The fruit and vegetable industry's demand for non-destructive, efficient, and accurate kiwifruit quality deterioration detection technology is becoming increasingly urgent, driving the research and optimization of related detection methods.
[0003] Traditional methods for detecting kiwifruit quality deterioration mainly fall into two categories: manual sensory evaluation and physicochemical index testing. Both methods have significant limitations. Manual sensory evaluation relies entirely on the experience of the inspectors, lacks a unified standard for judging the degree of fruit deterioration, is highly subjective, prone to bias, and has extremely low efficiency. It cannot meet the needs of large-scale, batch-based industrial testing and the requirements for rapid post-harvest processing of kiwifruit. While physicochemical index testing can obtain precise quantitative data such as fruit firmness and nutrient content, it requires destructive sampling of the kiwifruit. The tested fruit cannot continue into the distribution process, resulting in significant sample loss. Furthermore, this method is cumbersome and time-consuming, and cannot achieve real-time online detection. Existing spectroscopic detection technologies... The "feature selection + machine learning" approach has significant drawbacks: the feature selection process relies on manual experience to select spectral bands, which is highly subjective and prone to losing subtle feature information related to deterioration. The machine learning model lacks the ability to mine features from full-band spectral data, and can only learn limited features selected manually. It is weak in extracting and distinguishing subtle features of kiwifruit deterioration. In addition, some existing spectral detection methods do not perform fine preprocessing and validity screening of the collected spectral data, making them susceptible to environmental interference, equipment errors, and other factors, resulting in invalid information in the spectral data. Furthermore, the models used are not good at extracting subtle features of kiwifruit deterioration, and the accuracy and stability of deterioration level classification are poor, making it difficult to meet the needs of practical applications. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of existing technologies and provide a method for detecting the quality deterioration of kiwifruit based on hyperspectral imaging and deep learning. This method includes: acquiring hyperspectral images of kiwifruit and extracting raw reflectance spectral data across the entire band; performing optimized preprocessing using weighted convolutional smoothing preprocessing based on polynomial fitting; labeling the spectral data with four levels of deterioration and dividing it into training, validation, and test sets; constructing a one-dimensional convolutional neural network classification model that embeds raw spectral features and deep convolutional features for hierarchical judgment operations; obtaining the optimal detection model through training and optimization; and finally inputting the spectral data of the sample to be tested into the model and outputting the deterioration level result.
[0005] To solve the above-mentioned technical problems, this invention provides the following technical solution: a method for detecting quality deterioration in kiwifruit based on hyperspectral imaging and deep learning, the specific steps of which are as follows:
[0006] S100. Spectral data acquisition: Acquire hyperspectral images of kiwifruit samples, extract raw reflectance spectral data of the full band corresponding to the kiwifruit samples, complete the validity screening of raw spectral data, and simultaneously construct a standard sample set of kiwifruit quality deterioration grades.
[0007] S200, Smoothing Preprocessing: Weighted convolution smoothing preprocessing based on polynomial fitting is used to process the original reflectance spectral data of the entire band to obtain a standardized optimized spectral dataset;
[0008] S300, Labeling and Division: Label the quality deterioration levels of kiwifruit in the standardized optimized spectral dataset, and divide the labeled dataset into training set, validation set and test set;
[0009] S400, Model Training: Construct a one-dimensional convolutional neural network classification model that integrates embedded original spectral features with deep convolutional features for hierarchical judgment operations. Use training and validation sets to complete supervised training and parameter optimization of the model, and use test sets to complete model performance verification to obtain the optimal detection model.
[0010] S500 Sample Grade Detection: The preprocessed full-band reflectance spectrum data of the kiwifruit sample to be tested is input into the trained optimal detection model. The calculation is completed by fusing the original spectral features and deep convolution features to determine the grade, and the result of the kiwifruit quality deterioration grade is output, thus completing the non-destructive detection.
[0011] Furthermore, the hyperspectral image is an image that integrates the spatial information of the kiwifruit sample with continuous spectral information in the 400nm-1000nm visible-near-infrared band. It is acquired using a hyperspectral spectrometer, a CCD camera with an area array, a linear halogen cold light source, a high-precision motorized stage, a dark chamber, and a main control computer. Before acquisition, the kiwifruit samples are dusted and placed in an environment with a temperature of 23-27℃ and a relative humidity of 55-65% for 20-30 minutes. After system black-and-white correction, the samples are fixed on the stage, and hyperspectral image acquisition is performed according to preset parameters: spectral resolution ≤3nm, spatial resolution ≤0.2mm, motorized stage moving speed 1.0-1.5mm / s, and camera... The exposure time is 10-20ms, and the vertical irradiation distance between the linear halogen cold light source and the sample is 25-35cm. In the acquired hyperspectral image, the main body of the kiwifruit flesh is selected as the region of interest, and the peel, core, stem, and background interference areas are removed. The average spectral reflectance of all pixels in the region is extracted in the full band to obtain the full band raw reflectance spectrum data corresponding to the kiwifruit sample. Finally, the validity of the full band raw reflectance spectrum data is screened. The standard sample set of kiwifruit quality deterioration grades is based on kiwifruit samples with different storage periods and different deterioration states, and is constructed with the corresponding full band raw reflectance spectrum data, physicochemical test data and grade labeling results to provide standardized benchmark data for model training.
[0012] Furthermore, the screening of the raw spectral data involves the following steps: First, a comprehensive screening is conducted on the extracted raw reflectance spectral data of the kiwifruit samples, sample by sample and band by band. This involves verifying whether the number of spectral bands for a single sample matches the number of bands acquired by the hyperspectral imaging system, removing spectral data with missing band data or misaligned band values. Next, the reflectance value range corresponding to each wavelength is verified, removing abnormal data with reflectance values exceeding the 0-1 range. Then, the overall contour of the spectral curve is checked, removing invalid data with severe baseline drift, complete disappearance of characteristic peaks, or signal overflow. Finally, the screened valid spectral data is uniquely bound to the corresponding kiwifruit sample number and archived to form a valid raw reflectance spectral dataset.
[0013] Furthermore, the mathematical expression for the weighted convolution smoothing preprocessing operation based on polynomial fitting is:
[0014] ;
[0015] in, The optimized reflectance spectrum value of the i-th kiwi fruit sample at wavelength λ after weighted feature retention smoothing; The weighting factor for the degradation characteristic band corresponding to wavelength λ, with a value range of [0.6, 1.0], is calculated using the Pearson correlation coefficient method. The correlation coefficients between the spectral reflectance of each wavelength in the 400nm-1000nm band and core physiological indicators of degradation, such as kiwifruit flesh firmness, soluble solids content, and titratable acid content, are used. The absolute value of the correlation coefficient is taken as the contribution rate of that band to the degradation characteristics. Weighting is then performed based on the contribution rate: the stronger the correlation with degradation and the higher the contribution rate of the corresponding band, the higher the weighting factor is assigned. The closer the value is to 1, the weaker the characteristic and the lower the contribution rate of the band. The value is biased towards the 0.6 range; N is the number of effective bands within the smoothing window of the algorithm, N=2m+1, m is the half width of the smoothing window, and the value is 5-15; k is the band offset of the smoothing window, and the value is from −m to m, which is an integer, representing the position offset by m bands to the left and right of the wavelength λ as the center. The convolution coefficients are fitted to the Savitzky-Golay polynomial and are determined by the polynomial order and the width of the smoothing window. For the i-th kiwi fruit sample at wavelength The original full-band reflectance spectrum value at the location; Let λ be the original full-band reflectance spectrum value of the i-th kiwi fruit sample at wavelength λ.
[0016] Furthermore, the standardized optimized spectral dataset is a set of full-band reflectance spectral data of kiwifruit samples that has undergone weighted convolution smoothing preprocessing based on polynomial fitting, after removing outliers and meeting the requirements of a unified format and numerical range. Its formation process is as follows: Weighted convolution smoothing preprocessing based on polynomial fitting is performed on each sample and each band of the original full-band reflectance spectral data to obtain optimized reflectance spectral values for each wavelength of each sample; the processed data is verified to check the matching degree between the characteristic peak positions of the spectral curves, the baseline trend, and the original effective spectrum; outliers with characteristic distortion, excessive baseline smoothing, or excessive deviation from the original spectral trend are removed; the verified optimized reflectance spectral data are organized into a matrix format according to sample number and band order, with rows corresponding to sample numbers and columns corresponding to band wavelengths, forming the standardized optimized spectral dataset.
[0017] Furthermore, the specific operation of the quality deterioration level labeling includes: taking the physiological changes of the fruit's post-harvest deterioration process as the core logic, and combining the sample storage characteristics, fruit softening degree, nutrient loss, and mold status, a four-level deterioration level labeling rule is formulated, where the fresh level is labeled F, the slightly deteriorated level is labeled L, the moderately deteriorated level is labeled M, and the severely deteriorated level is labeled S; the fresh level is the initial state of the fruit with no softening, no mold, and no significant loss of core nutrient indicators; the slightly deteriorated level is the early deterioration state of the fruit with slight softening, no mold, and slight loss of core nutrient indicators; the moderately deteriorated level is the mid-term deterioration state of the fruit with obvious softening, no visible mold, and significant loss of core nutrient indicators; and the severely deteriorated level is the late deterioration state of the fruit with severe softening, visible mold, rot, and severe loss of core nutrient indicators. A two-person cross-checking system is used to determine the level of each sample, and the determined level label is bound one-to-one with the standardized optimized spectral data of the corresponding sample to complete the deterioration level labeling of the dataset.
[0018] Furthermore, the training set, validation set, and test set are all randomly partitioned from a standardized optimized spectral dataset with completed degradation level labeling. The partitioning process strictly maintains the same sample ratio for the four degradation levels as the original labeled dataset to avoid excessive concentration of samples of a single level, which could lead to model training bias. The dataset is divided into training, validation, and test sets in a 7:2:1 ratio. The training set is used to input the one-dimensional convolutional neural network classification model, providing the sample data required for model training and supporting the model's feature learning and parameter iterative updates. The validation set is used to evaluate model performance in real time during model training, providing feedback on training effects and providing a basis for model parameter optimization to avoid overfitting or underfitting. The test set is used to independently verify the final performance of the optimal detection model after model training is completed. Its sample data does not participate in any model training or parameter adjustment process to ensure the objectivity and accuracy of the verification results. After partitioning, the three datasets are organized in a unified matrix format, adapted to the model input requirements, and archived separately.
[0019] Furthermore, the mathematical expression for the hierarchical judgment operation of fusing the original spectral features and deep convolutional features is as follows:
[0020] ;
[0021] Among them, S t Let be the fusion judgment score of the t-th deterioration level corresponding to the i-th kiwi fruit sample, and n be the total number of hyperspectral bands; The optimized reflectance spectrum value of the i-th kiwi fruit sample at wavelength λ after weighted convolution smoothing preprocessing based on polynomial fitting. The deep convolutional feature weights, corresponding to wavelength λ, are extracted by a one-dimensional convolutional neural network for the t-th deterioration level. t represents the quality deterioration level identifier of the kiwifruit: t=1 corresponds to freshness level F, t=2 to mild deterioration level L, t=3 to moderate deterioration level M, and t=4 to severe deterioration level S. Each level identifier corresponds to a unique deep convolutional feature value. During algorithm operation, the optimized reflectance spectrum value and the corresponding deep convolutional feature value are simultaneously called to complete the fusion judgment score calculation for each sample and each level, providing a quantitative basis for the model's output of the deterioration level result.
[0022] Furthermore, the one-dimensional convolutional neural network classification model adopts an end-to-end network architecture, consisting of an input layer, convolutional layers, batch normalization layers, ReLU activation function layers, pooling layers, global average pooling layers, fully connected layers, spectral-convolutional fusion decision layers, and an output layer. The input layer has the same input dimension as the number of bands in the standardized optimized spectral dataset and is used to receive the preprocessed spectral data. The convolutional layers use convolutional kernels of size 3-7, with the number of kernels increasing with network depth to 16, 32, and 64, used to extract degradation features from the spectral data. The batch normalization layer and ReLU activation function layer... The activation function layer is used in conjunction to accelerate the model training convergence speed and avoid gradient vanishing; the pooling layer adopts max pooling with a size of 2 and a stride of 2 to retain key features and reduce data dimensionality; the global average pooling layer transforms convolutional features into fixed-dimensional feature vectors; the fully connected layer has 32 neurons and is configured with a Dropout layer with a Dropout rate of 0.3-0.5 to prevent model overfitting; the spectral-convolutional fusion judgment layer embeds the fusion and hierarchical judgment operation of the original spectral features and deep convolutional features, and the output layer corresponds to four levels of deterioration level labels, outputting the fusion judgment score for each level.
[0023] Furthermore, the optimal detection model is the final application model selected after multiple rounds of iterative training, parameter tuning, and independent testing and verification. This model is based on a one-dimensional convolutional neural network architecture that integrates embedded original spectral features and deep convolutional features for hierarchical judgment operations. The training set is used to iteratively update the network weights and convolutional kernel parameters. The Adam optimizer and cross-entropy loss function are used to promote training convergence. An adaptive learning rate is set to achieve stable gradient descent. During training, the validation set is used to monitor the fitting effect in real time, and an early stopping strategy is implemented to avoid the risk of overfitting. Key parameters such as the number of neurons, dropout rate, and convolutional receptive field are optimized simultaneously. Finally, an independent test set is used to verify the generalization performance. The classification accuracy, precision, recall, and F1 score are comprehensively evaluated. The parameter version with the highest consistency in classification of the four levels of deterioration, the lowest misclassification rate, and the strongest operational stability is selected as the optimal detection model. This model can stably establish an accurate mapping between spectral features and the deterioration state of the fruit, meeting the accuracy and reliability requirements of practical non-destructive testing.
[0024] Furthermore, the kiwifruit quality deterioration grade result refers to the complete deterioration evaluation result of the kiwifruit sample to be tested, output by the optimal detection model after performing a grading and judgment operation by fusing spectral raw features and deep convolutional features. This result includes three parts: grade identifier, grade description, and quantitative basis. The grade identifier corresponds to four deterioration grades: Fresh (F), Slightly Deteriorated (L), Moderately Deteriorated (M), and Severely Deteriorated (S). The grade description corresponds to the fruit state of each grade, specifying the degree of fruit softening, mold, and the corresponding range of flesh firmness. The quantitative basis is the fusion judgment score of each grade calculated by the grading and judgment operation of fusing spectral raw features and deep convolutional features, indicating the specific score of the sample to be tested for each deterioration grade and the corresponding grade. This result is output in text form and simultaneously saved to the main control computer, clearly presenting the quality state of the sample to be tested. This provides a clear judgment basis for kiwifruit quality grading, storage, and subsequent processing, ensuring the accuracy and practicality of the non-destructive testing results.
[0025] Compared with existing technologies, this method for detecting quality deterioration in kiwifruit based on hyperspectral imaging and deep learning has the following advantages:
[0026] I. This invention achieves accurate extraction and standardized optimization of full-band reflectance spectral data of kiwifruit samples through hyperspectral image acquisition and targeted spectral data preprocessing system. It effectively avoids detection deviations caused by environmental interference and invalid data in the acquisition process, and fully preserves the core spectral feature information related to fruit quality deterioration. Through full-process spectral data validity screening and smoothing optimization, a standardized and unified spectral dataset construction process is established, solving problems such as insufficient data validity, loss of feature information, and baseline drift interference in traditional spectral detection. This provides a stable and reliable data foundation for the accurate determination of subsequent fruit deterioration levels. At the same time, the entire process adopts a non-contact detection method, which does not require destructive treatment of the fruit. It avoids sample loss while ensuring detection accuracy and is suitable for the application scenario of quality screening of kiwifruit throughout the post-harvest process.
[0027] II. This invention constructs a convolutional neural network classification model adapted to one-dimensional spectral data features and embeds a fusion and grading judgment operation of exclusive original spectral features and deep convolutional features. This achieves deep fusion of original spectral features and features extracted from deep layers of the network, significantly enhancing the model's ability to identify and distinguish subtle features at different stages of kiwifruit deterioration. Through standardized and unified deterioration level labeling, reasonable dataset partitioning, and a robust model training and optimization mechanism, it effectively improves the model's generalization ability and detection stability, avoiding judgment bias caused by uneven sample distribution or feature interference. This method fundamentally solves the problems of strong subjectivity, poor grading consistency, and low detection efficiency in traditional manual detection. It can quickly output clear deterioration level results and quantitative judgment criteria, greatly improving the objectivity, standardization, and practical applicability of kiwifruit quality detection, making it more suitable for industrial batch detection and cold chain dynamic monitoring applications.
[0028] Other advantages, objectives and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination or study, or may be learned from the practice of the invention. Attached Figure Description
[0029] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.
[0030] Figure 1 This is a flowchart of a method for detecting quality deterioration in kiwifruit based on hyperspectral imaging and deep learning.
[0031] Figure 2 This is a schematic diagram of data transmission for a method for detecting quality deterioration in kiwifruit based on hyperspectral and deep learning.
[0032] Figure 3 This is a schematic diagram illustrating the process of forming the standardized and optimized spectral dataset of this invention. Detailed Implementation
[0033] To further illustrate the technical means and effects of the present invention in achieving its intended purpose, the following detailed description of the specific implementation methods, structures, features, and effects of the present invention, in conjunction with the accompanying drawings and preferred embodiments, is provided below.
[0034] Example 1:
[0035] This embodiment is applied to a batch non-destructive grading and testing scenario for kiwifruit after large-scale harvesting and before entering commercial storage. It fully implements the entire process of the kiwifruit quality deterioration detection method based on hyperspectral imaging and deep learning, adapting to the batch and standardized testing needs of commercial processing centers at production sites. Figure 1 As shown.
[0036] In the spectral data acquisition stage, for batches of kiwifruit samples that have been harvested in the field and whose mechanically damaged fruits have been initially removed, all samples are first subjected to uniform dust removal treatment to remove dust, field debris, and other impurities that may interfere with spectral acquisition. The samples are then placed in a constant temperature and humidity environment of 23-27℃ and 55-65% for 20-30 minutes to eliminate spectral signal deviations caused by temperature and humidity fluctuations from the field to the acquisition environment, ensuring the stability and repeatability of the acquired data. Before acquisition, black and white calibration of the hyperspectral imaging system is performed to eliminate system errors caused by system dark current and light source inhomogeneity. The system consists of a hyperspectral spectrometer, an area array CCD camera, a linear halogen cold light source, a high-precision motorized displacement stage, a light-proof dark box, and a main control computer. After calibration, kiwi fruit samples are fixed one by one on the motorized displacement stage, and hyperspectral image acquisition is completed according to preset parameters to obtain images that fuse the spatial information of the kiwi fruit samples with continuous spectral information in the 400nm-1000nm visible-near-infrared band. The preset parameters are: spectral resolution ≤3nm, spatial resolution ≤0.2mm, motorized displacement stage moving speed 1.0-1.5mm / s, camera exposure time 10-20ms, and vertical illumination distance between the linear halogen cold light source and the sample 25-35cm. In the acquired hyperspectral images, the main body of the kiwifruit flesh was selected as the region of interest. The peel, core, stem, and background interference areas were removed, and the spectral signal interference from non-flesh tissues was eliminated. The flesh area directly related to the deterioration of fruit quality was accurately located, and the average spectral reflectance of all pixels in the region was extracted in the full band to obtain the original full band reflectance spectrum data of the kiwifruit sample. Finally, the validity of the full-band raw reflectance spectral data was screened. A comprehensive screening was conducted on each sample and each band of the extracted kiwifruit sample's full-band raw reflectance spectral data. First, the number of bands in the spectral data of a single sample was verified to be consistent with the number of full bands acquired by the hyperspectral imaging system. Spectral data with missing band data or misaligned band values were removed. Next, the reflectance value range corresponding to each wavelength was verified, and abnormal data with reflectance values exceeding the 0-1 range were removed. Subsequently, the overall contour of the spectral curve was checked, and invalid data with severe baseline drift, complete disappearance of characteristic peaks, or signal overflow were removed. Finally, the screened valid spectral data were uniquely bound to the corresponding kiwifruit sample number and archived to form a valid full-band raw reflectance spectral dataset. Simultaneously, a standard sample set for kiwifruit quality deterioration grades was constructed. Based on kiwifruit samples in different deterioration states, corresponding spectral data, physicochemical test data, and grade labeling results were provided to offer a standardized benchmark for subsequent model training, ensuring the integrity, validity, and traceability of the data used in subsequent analyses from the source.
[0037] In the smoothing preprocessing stage, a weighted convolutional smoothing preprocessing operation based on polynomial fitting is used to process the raw reflectance spectral data across the entire band. This operation is performed sample-by-sample and band-by-band. The mathematical expression for this polynomial-fit-based weighted convolutional smoothing preprocessing operation is as follows:
[0038] ;
[0039] in, The optimized reflectance spectrum value of the i-th kiwi fruit sample at wavelength λ after weighted feature retention smoothing; λ is the weighting factor for the degradation characteristic band corresponding to wavelength λ; N is the number of effective bands within the smoothing window; m is the half-width of the smoothing window; k is the band offset of the smoothing window. The convolution coefficients are the fits to the Savitzky-Golay polynomial; For the i-th kiwi fruit sample at wavelength The original full-band reflectance spectrum value at the location; To obtain the original full-band reflectance spectrum value of the i-th kiwifruit sample at wavelength λ, while reducing random noise and smoothing baseline fluctuations during spectral acquisition, the optimized reflectance spectrum values for each sample at each wavelength are obtained. This process aims to fully preserve the spectral characteristic peak information related to kiwifruit quality deterioration and avoid the loss of key feature information during smoothing. The calculated data is then validated by checking the matching degree between the spectral curve characteristic peak positions, baseline trends, and the original effective spectrum. Abnormal data with feature distortion, excessive baseline smoothing, and significant deviations from the original spectral trends are removed. The validated optimized reflectance spectrum data is then organized into a matrix format according to sample number and band order, with rows corresponding to sample numbers and columns corresponding to band wavelengths. This results in a standardized optimized spectral dataset, forming a spectral data set with uniform format, complete features, and controllable noise. This dataset is suitable for the input requirements of subsequent deep learning models, providing a high-quality data foundation for model feature learning. Figure 3 As shown.
[0040] In the labeling and partitioning phase, the standardized and optimized spectral dataset was used to label the quality deterioration levels of kiwifruit. First, the physicochemical indicators of the kiwifruit samples—flesh firmness, soluble solids content, and titratable acid content—were measured. Combined with the sample storage time, fruit softening degree, and mold status, a four-level deterioration labeling rule was established: F for freshness, L for slight deterioration, M for moderate deterioration, and S for severe deterioration. The judgment boundaries for each level were clearly defined to eliminate subjective bias in level determination. A two-person cross-checking system was used to determine the level of each sample. The determined level label was then bound one-to-one with the corresponding standardized and optimized spectral data of the sample, completing the deterioration level labeling of the dataset and ensuring the accuracy and consistency of the labeling results. The labeled dataset was randomly divided into training, validation, and test sets in a 7:2:1 ratio. The partitioning process strictly maintained the sample ratio of the four deterioration levels consistent with the original labeled dataset to avoid excessive concentration of samples of a single level, which could lead to model training bias. After partitioning, the three datasets were organized into a unified matrix format, adapted to model input requirements, and archived separately. The training set is used as input to the one-dimensional convolutional neural network classification model, providing the sample data required for model training and supporting the model in feature learning and parameter iterative updates. The validation set is used to evaluate the model performance in real time during model training, provide feedback on the training effect, provide a basis for model parameter optimization, and avoid overfitting or underfitting. The test set is used to independently verify the final performance of the optimal detection model after model training is completed. Its sample data does not participate in any model training or parameter adjustment process, ensuring the objectivity and accuracy of the verification results.
[0041] In the model training phase, a one-dimensional convolutional neural network classification model was constructed, embedding original spectral features and deep convolutional features for hierarchical judgment operations. This model consists of an input layer, convolutional layers, batch normalization layers, ReLU activation function layers, pooling layers, global average pooling layers, fully connected layers, a spectral-convolutional fusion judgment layer, and an output layer. The input layer has the same input dimension as the number of bands in the standardized optimized spectral dataset, used to receive the preprocessed spectral data. The convolutional layers use kernels of sizes 3-7, with the number of kernels increasing with network depth to 16, 32, and 64, accurately extracting deep features related to the deterioration of kiwifruit quality from the spectral data. The batch normalization layer and ReLU activation function layers... The eLU activation function layer is used in conjunction with other layers to accelerate model training convergence and avoid gradient vanishing. The pooling layer uses a 2-size pooling window and a 2-step pooling method to retain key features and reduce data dimensionality, thus reducing model computation. The global average pooling layer transforms convolutional features into fixed-dimensional feature vectors, adapting to the input requirements of the fully connected layer. The fully connected layer has 32 neurons and a Dropout layer with a Dropout rate of 0.3-0.5 to prevent overfitting. The spectral-convolutional fusion decision layer embeds a hierarchical decision operation that fuses original spectral features with deep convolutional features. The mathematical expression for this hierarchical decision operation is as follows:
[0042] ;
[0043] Among them, S t Let be the fusion judgment score for the t-th deterioration level corresponding to the i-th kiwi fruit sample; n is the total number of hyperspectral bands. The optimized reflectance spectrum value of the i-th kiwi fruit sample at wavelength λ after weighted convolution smoothing preprocessing based on polynomial fitting. is the deep convolutional feature weight extracted by a one-dimensional convolutional neural network for the t-th deterioration level, and corresponding to the wavelength λ; t is the quality deterioration level identifier of the kiwifruit, the output layer corresponds to the four-level deterioration level identifier, and outputs the fusion judgment score of each level. Supervised training and parameter optimization of the model were completed using training and validation sets. The Adam optimizer and cross-entropy loss function were selected to promote training convergence. An adaptive learning rate was set to achieve stable gradient descent. During training, the fitting effect was monitored in real time using the validation set, and an early stopping strategy was implemented to avoid the risk of overfitting. Key parameters such as the number of neurons, dropout rate, and receptive field of convolution were optimized simultaneously. Finally, an independent test set was used to verify the generalization performance. The classification accuracy, precision, recall, and F1 score were comprehensively evaluated. The parameter version with the highest consistency in classifying the fourth level of deterioration was selected as the optimal detection model. This model achieved a classification accuracy of over 98.5% in the batch detection scenario of this embodiment. The parameter version with the highest consistency in classifying the fourth level of deterioration, the lowest false positive rate, and the strongest operational stability was selected as the optimal detection model, achieving accurate mapping between spectral features and the deterioration state of the fruit. After testing, the optimal model in this embodiment achieved a classification accuracy of 98.5%, a precision of 97.9%, a recall of 98.1%, and an F1 score of 98.0%.
[0044] In the sample grading stage, for the batch of kiwifruit samples to be tested before storage, the same process as described above is followed to complete hyperspectral image acquisition, raw spectral data extraction and validity screening, and preprocessing based on multinomial fitting weighted convolutional smoothing. This yields preprocessed full-band reflectance spectral data of the samples, which is then input into the trained optimal detection model. The model performs a grading calculation by fusing raw spectral features with deep convolutional features, outputting the kiwifruit quality deterioration grade result. This result includes three parts: grade label, grade description, and quantitative basis. The grade label corresponds to four deterioration grades: Fresh (F), Slightly Deteriorated (L), Moderately Deteriorated (M), and Severely Deteriorated (S). The grade description corresponds to the fruit state of each grade, specifying the degree of softening, mold, and corresponding flesh firmness range. The quantitative basis is the fusion judgment score calculated by fusing raw spectral features with deep convolutional features, indicating the specific score and corresponding grade for each deterioration grade of the tested sample. The results are output in text form and simultaneously saved to the main control computer to complete the non-destructive testing of all samples. Finally, based on the output grade results, the quality grading and classification of kiwifruit are completed and stored in warehouses. This enables rapid, standardized, and non-destructive grading of batch samples after harvest, improves the efficiency and accuracy of commercial processing at the production site, and reduces the ineffective loss of fruits after harvest.
[0045] This embodiment focuses on the batch grading scenario of kiwifruit before its commercial storage after harvest. It fully implements the entire process detection method of this invention. Through standardized spectral acquisition, multi-dimensional data screening, and preprocessing operations based on multinomial fitting and weighted convolutional smoothing, a high-quality standardized spectral dataset is constructed. Combined with training a one-dimensional convolutional neural network model that integrates embedded original spectral features and deep convolutional features for grading judgment, rapid, non-destructive, and standardized quality degradation grading of batch kiwifruit samples is achieved. This embodiment effectively solves the industry pain points of traditional manual grading, such as high subjectivity, low efficiency, and high loss due to destructive testing. It provides a feasible standardized detection solution for the commercial processing of kiwifruit at the production site, possessing excellent industry adaptability and promotional value.
[0046] Example 2:
[0047] This embodiment is applied to a scenario of dynamic tracking and monitoring of quality deterioration in kiwifruit throughout the entire cold chain storage cycle. It fully implements the entire process of the kiwifruit quality deterioration detection method based on hyperspectral imaging and deep learning, as described in this invention. This allows for real-time monitoring of the quality change trends of stored fruit, optimization of storage and preservation strategies, and adaptation to the full-cycle quality control needs of large-scale cold chain storage. Figure 2 As shown.
[0048] In the spectral data acquisition stage, for a fixed batch of kiwifruit that has completed pre-cooling treatment and entered the standardized cold chain storage, a fixed number of representative kiwifruit samples are selected and uniquely numbered. At the pre-set monitoring time points of the storage cycle, the marked kiwifruit samples are taken out of the cold chain storage, and after surface dust removal treatment, they are placed in a constant temperature and humidity environment of 23-27℃ and 55-65% for 20-30 minutes to eliminate spectral signal drift caused by the temperature difference between the low storage environment and the acquisition environment, and to ensure the consistency and comparability of the data collected at different time points throughout the entire storage cycle. At each monitoring time point, black and white calibration of the hyperspectral imaging system was performed to eliminate systematic errors such as light source attenuation and dark current fluctuations that may occur during long-term system operation. The system consists of a hyperspectral spectrometer, an area array CCD camera, a linear halogen cold light source, a high-precision motorized displacement stage, a light-proof dark box, and a main control computer. After calibration, the numbered kiwi fruit samples were fixed one by one on the motorized displacement stage, and hyperspectral image acquisition was completed according to preset parameters to obtain images that fuse the spatial information of the kiwi fruit samples with continuous spectral information in the 400nm-1000nm visible-near-infrared band. The preset parameters are: spectral resolution ≤3nm, spatial resolution ≤0.2mm, motorized displacement stage moving speed 1.0-1.5mm / s, camera exposure time 10-20ms, and vertical illumination distance between the linear halogen cold light source and the sample 25-35cm. In the hyperspectral images collected at each monitoring time point, the main body of the kiwifruit flesh was selected as the region of interest. The peel, core, stem, and background interference areas were removed to eliminate spectral signal interference from non-target tissues. The flesh area directly related to the deterioration process of the fruit during storage was accurately located, and the average spectral reflectance of all pixels in the region was extracted in the full band to obtain the full band raw reflectance spectrum data of the sample with the corresponding monitoring time point number.Subsequently, the validity of the raw full-band reflectance spectral data acquired at each monitoring time point was screened. A comprehensive screening was conducted on the extracted raw full-band reflectance spectral data of the kiwifruit samples, sample by sample and band by band. First, the number of spectral bands in a single sample was verified to be consistent with the number of full bands acquired by the hyperspectral imaging system. Spectral data with missing bands or misaligned band values were removed. Next, the reflectance value range corresponding to each wavelength was verified, and abnormal data with reflectance values exceeding the 0-1 range were removed. Then, the overall contour of the spectral curve was checked, and invalid data with severe baseline drift, complete disappearance of characteristic peaks, or signal overflow were removed. Finally, the... The screened valid spectral data are uniquely bound to the corresponding kiwifruit sample number and monitoring time point and archived to form a valid full-band original reflectance spectrum dataset for the entire monitoring cycle of the storage batch. Simultaneously, a standard sample set of kiwifruit quality deterioration grades covering the entire storage cycle is constructed. The spectral data, physicochemical indicators and grade labeling results of samples at different storage stages are matched to the standard sample set of kiwifruit quality deterioration grades. Based on kiwifruit samples in different deterioration states, the corresponding spectral data, physicochemical test data and grade labeling results are matched to provide a standardized benchmark for subsequent model training, ensuring the integrity, continuity and traceability of the data throughout the entire cycle.
[0049] In the smoothing preprocessing stage, for the valid full-band raw reflectance spectrum dataset archived at each monitoring time point throughout the entire storage cycle, a weighted convolutional smoothing preprocessing operation based on polynomial fitting is uniformly applied. The weighted convolutional smoothing preprocessing operation based on polynomial fitting is performed on each sample, each monitoring time point, and each band of the full-band raw reflectance spectrum data. While reducing random noise generated during the acquisition process at different monitoring time points and smoothing baseline fluctuations, the operation fully preserves the spectral characteristic peak information of kiwifruit deterioration over time during storage, avoiding the loss of subtle characteristic information of gradual deterioration during the smoothing process, and obtaining the optimized reflectance spectrum values of each numbered sample at the corresponding monitoring time point and wavelength. The processed data is verified by checking the matching degree between the characteristic peak positions and baseline trends of the spectral curves of the same sample at different monitoring time points and the corresponding original effective spectra. Abnormal data with feature distortion, excessively smoothed baselines, and excessive deviations from the original spectral trends are removed. The verified optimized reflectance spectral data are organized into a unified matrix format according to sample number, monitoring time point, and wavelength. The rows correspond to the sample number and monitoring time point, and the columns correspond to the wavelength of the wavelength band, forming a standardized optimized spectral dataset that meets the input requirements of the model. This ensures that the data format is uniform and the features are comparable for different monitoring time points throughout the storage period, providing high-quality data support for the model to learn the progressive characteristics of deterioration during the storage period.
[0050] In the labeling and classification phase, the standardized and optimized spectral dataset was used to label the quality deterioration levels of kiwifruit. For each monitored time point, the samples were numbered and labeled, and physicochemical indicators such as flesh firmness, soluble solids content, and titratable acid content were simultaneously tested. Combining the cumulative storage time, fruit softening degree, and mold status, a four-level deterioration rating system was implemented: F for freshness, L for slight deterioration, M for moderate deterioration, and S for severe deterioration. This clearly defined the boundaries for deterioration levels at different storage stages, accurately capturing the gradual changes in fruit deterioration. A two-person cross-checking system was used to determine the level of each sample at different monitoring time points. The determined level labels were then linked to the corresponding sample number and the standardized and optimized spectral data from the monitored time points, completing the deterioration level labeling for the entire dataset and ensuring the accuracy and consistency of the labeling results throughout the entire period. The labeled full-lifecycle dataset was randomly divided into training, validation, and test sets in a 7:2:1 ratio. The partitioning process strictly maintained the same sample ratio for each of the four degradation levels as the original labeled dataset, avoiding excessive concentration of samples from a single degradation stage or level that could lead to model training bias. After partitioning, the three datasets were organized into a unified matrix format, adapted to model input requirements, and archived separately. The training set is used to input the one-dimensional convolutional neural network classification model, providing the full-lifecycle degradation feature sample data required for model training, supporting the model's learning of degradation features at different degradation stages and iterative parameter updates. The validation set is used to evaluate the model's recognition performance of degradation features at different degradation stages in real time during model training, providing feedback on training effectiveness and providing a basis for model parameter optimization, avoiding overfitting or underfitting. The test set is used to independently validate the final performance of the optimal detection model after model training is complete. Its sample data does not participate in any model training or parameter adjustment process, ensuring the objectivity and accuracy of the validation results.
[0051] In the model training phase, a one-dimensional convolutional neural network classification model was constructed, embedding original spectral features and deep convolutional features to perform hierarchical judgment operations. This model consists of an input layer, convolutional layers, batch normalization layers, ReLU activation function layers, pooling layers, global average pooling layers, fully connected layers, a spectral-convolutional fusion judgment layer, and an output layer. The input layer has the same input dimension as the number of bands in the standardized optimized spectral dataset, used to receive preprocessed spectral data from different monitoring time points throughout the entire storage period. The convolutional layers use kernels of sizes 3-7, with the number of kernels increasing with network depth to 16, 32, and 64, accurately extracting the progressive degradation features of different storage stages from the spectral data. The normalization layer works in conjunction with the ReLU activation function layer to accelerate model training convergence and avoid gradient vanishing. The pooling layer uses a 2-size pooling window and a 2-step pooling method to retain key degradation features and reduce data dimensionality, thereby reducing the computational cost of the model. The global average pooling layer transforms convolutional features into fixed-dimensional feature vectors to meet the input requirements of the fully connected layer. The fully connected layer has 32 neurons and a Dropout layer with a Dropout rate of 0.3-0.5 to prevent overfitting. The spectral-convolutional fusion decision layer embeds the fusion and hierarchical decision operation of the original spectral features and deep convolutional features. The output layer corresponds to four levels of degradation level labels and outputs the fusion decision score for each level. Supervised training and parameter optimization of the model were performed using training and validation sets. The Adam optimizer and cross-entropy loss function were selected to promote training convergence. An adaptive learning rate was set to achieve stable gradient descent. During training, the validation set was used to monitor the model's fit to the deterioration characteristics of different storage stages in real time. An early stopping strategy was implemented to avoid the risk of overfitting. Key parameters such as the number of neurons, dropout rate, and receptive field of convolution were optimized simultaneously to enhance the model's ability to identify subtle deterioration characteristics of kiwifruit during storage. Finally, an independent test set was used to verify the generalization performance, and the classification accuracy, precision, and generalization performance were comprehensively evaluated. The optimal detection model for dynamic monitoring of cold chain storage was selected based on the highest consistency of the four-level deterioration classification throughout the entire storage period, considering both recall rate and F1 score. The optimal model also achieved the highest consistency, lowest misclassification rate, and strongest operational stability among the four-level deterioration classifications throughout the entire storage period. This ensured accurate mapping between changes in spectral characteristics during storage and the fruit deterioration process. Testing showed that the optimal model in this embodiment achieved a classification accuracy of 98.2%, a precision of 97.6%, a recall rate of 97.8%, and an F1 score of 97.7%.
[0052] In the sample grading stage, for the batches of kiwifruit to be tested under the same cold chain storage environment, at each pre-set monitoring time point, the same process as described above is followed to complete the acquisition of hyperspectral images, extraction and validity screening of raw spectral data, and preprocessing based on weighted convolutional smoothing operation based on polynomial fitting. This yields the preprocessed full-band reflectance spectral data of the samples to be tested at the corresponding monitoring time point. This data is then input into the trained optimal detection model, and the grading judgment operation is completed by fusing raw spectral features with deep convolutional features. The result of the kiwifruit quality deterioration grade of each sample to be tested at the monitoring time point is output. The results comprise three parts: grade identification, grade description, and quantitative basis. The grade identification corresponds to four levels of deterioration: Fresh (F), Slightly Deteriorated (L), Moderately Deteriorated (M), and Severely Deteriorated (S). The grade description corresponds to the fruit state of each level, specifying the degree of softening, mold, and corresponding flesh firmness range. The quantitative basis is the fusion judgment score calculated by combining the original spectral features and deep convolutional features for each level, indicating the specific score and corresponding grade for each deterioration level of the tested sample. The results are output in text format and simultaneously saved to the main control computer. Through continuous monitoring at multiple time points throughout the entire storage cycle, the dynamic tracking of the quality deterioration process of kiwifruit during storage is completed, allowing real-time monitoring of the overall quality change trend of stored batches of fruit. This provides accurate judgment basis for adjusting environmental parameters in cold chain storage, optimizing preservation schemes, and planning the timing of fruit sales, achieving non-destructive dynamic monitoring and quality control throughout the entire cold chain storage cycle of kiwifruit, effectively reducing fruit loss during storage.
[0053] This embodiment focuses on the dynamic monitoring of kiwifruit throughout its cold chain storage cycle. It fully implements the entire detection method of this invention, employing multi-timepoint continuous spectral acquisition, full-cycle data standardization, and optimization through weighted convolutional smoothing preprocessing based on polynomial fitting. This constructs a dataset of deterioration characteristics covering the entire storage cycle. Combined with a one-dimensional convolutional neural network model that integrates embedded original spectral features with deep convolutional features for hierarchical judgment, it achieves non-destructive dynamic tracking of the kiwifruit deterioration process during storage. This embodiment accurately captures the progressive deterioration characteristics of the fruit, providing scientific support for cold chain storage environment control and preservation scheme optimization, effectively reducing storage losses, and meeting the full-process quality control needs of large-scale cold chain warehousing.
[0054] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A method for detecting quality deterioration in kiwifruit based on hyperspectral imaging and deep learning, characterized in that, The specific steps of this method are as follows: S100. Spectral data acquisition: Acquire hyperspectral images of kiwifruit samples, extract raw reflectance spectral data of the full band corresponding to the kiwifruit samples, complete raw spectral data screening, and simultaneously construct a standard sample set of kiwifruit quality deterioration grades. S200, Smoothing Preprocessing: Weighted convolution smoothing preprocessing based on polynomial fitting is used to process the original reflectance spectral data of the entire band to obtain a standardized optimized spectral dataset; S300, Labeling and Division: Label the quality deterioration levels of kiwifruit in the standardized optimized spectral dataset, and divide the labeled dataset into training set, validation set and test set; S400, Model Training: Construct a one-dimensional convolutional neural network classification model that integrates embedded original spectral features with deep convolutional features for hierarchical judgment operations. Use training and validation sets to complete supervised training and parameter optimization of the model, and use test sets to complete model performance verification to obtain the optimal detection model. S500 Sample Grade Detection: The preprocessed full-band reflectance spectrum data of the kiwifruit sample to be tested is input into the trained optimal detection model. The calculation is completed by fusing the original spectral features and deep convolution features to determine the grade, and the result of the kiwifruit quality deterioration grade is output, thus completing the non-destructive detection.
2. The method for detecting quality deterioration of kiwifruit based on hyperspectral imaging and deep learning according to claim 1, characterized in that, In step S100, the hyperspectral image is an image that fuses the spatial information of the kiwifruit sample with continuous spectral information in the 400nm-1000nm visible-near-infrared band. It is acquired using a hyperspectral spectrometer, a CCD camera with an area array, a linear halogen cold light source, a high-precision electric displacement stage, a darkroom, and a main control computer. Before acquisition, the kiwifruit sample is dusted and placed in a constant temperature and humidity environment. System black-and-white correction is then performed, and the sample is fixed on the displacement stage to complete the hyperspectral image acquisition. In the acquired hyperspectral image, the main body of the kiwifruit flesh is selected as the region of interest. The peel, core, stem, and background interference areas are removed. The average spectral reflectance of all pixels within the region of interest across the entire band is extracted to obtain the original full-band reflectance spectral data corresponding to the kiwifruit sample. Finally, the original full-band reflectance spectral data is screened.
3. The method for detecting quality deterioration of kiwifruit based on hyperspectral imaging and deep learning according to claim 1, characterized in that, In step S100, the screening of the raw spectral data is specifically performed as follows: A comprehensive screening is conducted on the extracted raw reflectance spectral data of the kiwifruit samples, sample by sample and band by band. First, the number of spectral bands in a single sample is verified to be consistent with the number of full bands acquired by the hyperspectral imaging system. Spectral data with missing band data or misaligned band values are removed. Then, the reflectance value range corresponding to each wavelength is verified, and abnormal data with reflectance values exceeding the 0-1 range are removed. Subsequently, the overall contour of the spectral curve is checked, and invalid data with severe baseline drift, complete disappearance of characteristic peaks, or signal overflow are removed. Finally, the screened valid spectral data is uniquely bound to the corresponding kiwifruit sample number and archived to form a valid raw reflectance spectral dataset.
4. The method for detecting quality deterioration of kiwifruit based on hyperspectral imaging and deep learning according to claim 1, characterized in that, In step S200, the mathematical expression for the weighted convolution smoothing preprocessing operation based on polynomial fitting is: ; in, The optimized reflectance spectrum value of the i-th kiwi fruit sample at wavelength λ after weighted feature retention smoothing; λ is the weighting factor for the degradation characteristic band corresponding to wavelength λ; N is the number of effective bands within the smoothing window; m is the half-width of the smoothing window; k is the band offset of the smoothing window. The convolution coefficients are the fits to the Savitzky-Golay polynomial; For the i-th kiwi fruit sample at wavelength The original full-band reflectance spectrum value at the location; Let λ be the original full-band reflectance spectrum value of the i-th kiwi fruit sample at wavelength λ.
5. The method for detecting quality deterioration of kiwifruit based on hyperspectral imaging and deep learning according to claim 1, characterized in that, In step S200, the standardized optimized spectral dataset is a set of full-band reflectance spectral data of kiwifruit samples that has been processed by weighted convolution smoothing preprocessing based on polynomial fitting, and after removing outlier data and meeting the requirements of uniform format and numerical range. The formation process is as follows: performing weighted convolution smoothing preprocessing based on polynomial fitting on each sample and each band of the original full-band reflectance spectral data to obtain the optimized reflectance spectral values of each sample at each wavelength; verifying the processed data and checking the matching degree between the characteristic peak position of the spectral curve, the baseline trend and the original effective spectrum. Remove outlier data such as those with feature distortion, excessively smoothed baselines, and those that deviate too much from the original spectral trend. Then, organize the validated optimized reflectance spectral data into a matrix format according to sample number and band order, with rows corresponding to sample numbers and columns corresponding to band wavelengths, to form a standardized optimized spectral dataset.
6. The method for detecting quality deterioration of kiwifruit based on hyperspectral imaging and deep learning according to claim 1, characterized in that, In step S300, the specific operation of marking the quality deterioration level includes: taking the physiological changes of the fruit's post-harvest deterioration process as the core logic, and combining the sample storage characteristics, fruit softening degree, nutrient loss, and mold status, a four-level deterioration level marking rule is formulated, where the fresh level is marked as F, the slightly deteriorated level as L, the moderately deteriorated level as M, and the severely deteriorated level as S; the fresh level is the initial state where the fruit has no softening, no mold, and no significant loss of core nutrient indicators; the slightly deteriorated level is the early deterioration state where the fruit shows slight softening, no mold, and slight loss of core nutrient indicators; the moderately deteriorated level is the mid-term deterioration state where the fruit shows obvious softening, no visible mold, and obvious loss of core nutrient indicators; and the severely deteriorated level is the late deterioration state where the fruit is severely softened, has visible mold, is rotten, and has severe loss of core nutrient indicators.
7. The method for detecting quality deterioration of kiwifruit based on hyperspectral imaging and deep learning according to claim 1, characterized in that, In step S300, the training set, validation set, and test set are all randomly partitioned from the standardized optimized spectral dataset with completed degradation level labeling. The partitioning process strictly maintains the sample ratio of the four degradation levels consistent with the original labeled dataset to avoid excessive concentration of samples of a single level leading to model training bias. The dataset is divided into training set, validation set, and test set in a 7:2:1 ratio. The training set is used to input the one-dimensional convolutional neural network classification model, providing the sample data required for model training and supporting the model in feature learning and parameter iterative updates. The validation set is used to evaluate the model performance in real time during model training, providing feedback on the training effect and providing a basis for model parameter optimization. The test set is used to independently verify the final performance of the optimal detection model after model training is completed, and its sample data does not participate in any model training or parameter adjustment process.
8. The method for detecting quality deterioration of kiwifruit based on hyperspectral and deep learning according to claim 1, characterized in that, In step S400, the mathematical expression for the hierarchical determination operation of fusing the original spectral features and deep convolutional features is: ; Among them, S t Let be the fusion judgment score for the t-th deterioration level corresponding to the i-th kiwi fruit sample; n is the total number of hyperspectral bands. The optimized reflectance spectrum value of the i-th kiwi fruit sample at wavelength λ after weighted convolution smoothing preprocessing based on polynomial fitting. λ represents the deep convolutional feature weights extracted by a one-dimensional convolutional neural network for the t-th degradation level, corresponding to the wavelength λ; t is the degradation level identifier for kiwifruit quality.
9. The method for detecting quality deterioration of kiwifruit based on hyperspectral and deep learning according to claim 1, characterized in that, In step S400, the one-dimensional convolutional neural network classification model adopts an end-to-end network architecture, consisting of an input layer, a convolutional layer, a batch normalization layer, a ReLU activation function layer, a pooling layer, a global average pooling layer, a fully connected layer, a spectral-convolutional fusion decision layer, and an output layer. The input layer has the same input dimension as the number of bands in the standardized optimized spectral dataset and is used to receive the preprocessed spectral data. The convolutional layer extracts the degradation features from the spectral data. The batch normalization layer and the ReLU activation function layer jointly optimize the network training process. The pooling layer and the global average pooling layer sequentially complete the feature dimensionality reduction and fixed-dimensional feature vector transformation. The fully connected layer is paired with a Dropout layer to suppress model overfitting. The spectral-convolutional fusion decision layer completes the fusion operation of spectral features and deep convolutional features of the network. The output layer outputs the fusion decision score for each of the four degradation levels of kiwifruit.
10. The method for detecting quality deterioration of kiwifruit based on hyperspectral and deep learning according to claim 1, characterized in that, In step S500, the kiwifruit quality deterioration grade result refers to the complete deterioration evaluation result of the kiwifruit sample to be tested, output by the optimal detection model after performing a grading and judgment operation by fusing spectral original features and deep convolutional features. It includes three parts: grade identifier, grade description, and quantitative basis. The grade identifier corresponds to four deterioration grades; the grade description corresponds to the fruit state of each grade, and determines the degree of fruit softening, mold, and the corresponding range of fruit firmness; the quantitative basis is the fusion judgment score of each grade calculated by the grading and judgment operation of fusing spectral original features and deep convolutional features, and marks the specific score of each deterioration grade of the sample to be tested and the grade corresponding to the score.
