Evaluation method and system for dry longan browning degree based on image segmentation technology and storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AGRI PRODS PROCESSING RES INST CHINESE ACAD OF TROPICAL AGRI SCI
- Filing Date
- 2025-09-18
- Publication Date
- 2026-07-21
Smart Images

Figure CN121190426B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of agricultural product quality evaluation technology, specifically to a method, system, and storage medium for evaluating the degree of browning in dried longan based on image segmentation technology. Background Technology
[0002] With the rapid development of my country's longan industry, the quality control of dried longan, as an important processed product, is particularly crucial. During the storage and distribution of dried longan, browning is a major factor affecting its commercial value and edible quality. Browning not only deteriorates the appearance of dried longan but also causes changes in flavor and loss of nutrients, seriously impacting consumer acceptance and market value. Currently, the evaluation methods for the degree of browning in dried longan mainly include traditional sensory evaluation and physicochemical analysis. Sensory evaluation relies on experts or evaluators to subjectively assess the degree of browning through visual observation and touch. While simple, this method suffers from strong subjectivity, poor consistency, and difficulty in quantification. Physicochemical analysis indirectly evaluates the degree of browning by measuring the content of chemical components affected by browning, such as ascorbic acid, total phenols, and 5-hydroxymethylfurfural. While objective and accurate, this method is cumbersome, time-consuming, costly, and destructive, making it unsuitable for large-scale production. In recent years, with the development of computer vision and artificial intelligence technologies, non-destructive testing methods for agricultural product quality based on image processing and machine learning have been widely applied. Among them, hyperspectral imaging technology has shown great potential in the field of agricultural product quality evaluation because it can simultaneously acquire spatial and spectral information of samples.
[0003] For example, prior art publication CN112183662A discloses a grapefruit granulation classification method based on convolutional neural networks and hyperspectral technology. This method obtains the diffuse transmittance hyperspectral information of grapefruit and combines it with a convolutional neural network model to achieve non-destructive detection and classification of grapefruit granulation degree. Prior art publication CN112287886A proposes a method for estimating the nitrogen content of wheat plants based on hyperspectral image fusion spectral features. This method extracts spectral reflectance, calculates vegetation indices, location and shape features, and uses a convolutional neural network to extract deep features, constructing fused spectral features to achieve high-precision estimation of the nitrogen content of wheat plants.
[0004] However, existing technologies still face several challenges when applied to evaluating the browning degree of dried longan: First, dried longan samples have irregular shapes and complex surface features, making it difficult to accurately extract effective feature information using existing image processing methods. Second, most existing methods evaluate a single indicator, while browning in dried longan is the result of the combined effects of multiple chemical components, making it difficult for a single indicator to comprehensively reflect the degree of browning. Third, existing hyperspectral image processing methods often ignore the spatial heterogeneity of the sample, making it difficult to accurately distinguish between the pulp area and other parts, leading to inaccurate feature extraction. Finally, there is a lack of models that accurately correlate hyperspectral image information with the content of chemical components affecting browning, hindering the objective quantitative evaluation of the browning degree. Therefore, there is an urgent need to develop a method that can objectively, efficiently, and accurately evaluate the browning degree of dried longan to meet the needs of industrial development.
[0005] The information disclosed in the background section is only intended to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0006] The purpose of this invention is to provide a method, system, and storage medium for evaluating the browning degree of dried longan based on image segmentation technology, so as to solve the problems mentioned in the background art.
[0007] To achieve the above objectives, the present invention provides the following technical solution: A method for evaluating the degree of browning in dried longan based on image segmentation technology, comprising the following steps: S1: Perform hyperspectral imaging on dried longan samples to obtain hyperspectral image data of the samples. The hyperspectral image data includes spatial information and spectral information of the samples. At the same time, detect the chemical composition content of each sample and obtain the content of chemical components affected by browning as the true value label. S2: Use a semantic segmentation model to segment the hyperspectral image to obtain the spatial region of longan pulp, and extract the average reflectance value of the pulp region based on the spectral reflectance data of each band in the spatial region to construct the spectral feature vector of the pulp region of each sample. S3: Perform principal component analysis and dimensionality reduction on the spectral feature vector of the pulp region. After pairing the obtained principal component score vector with the true value label of the corresponding sample, train the convolutional neural network model to obtain a predictive model of the chemical composition of dried longan. S4: Perform hyperspectral image acquisition, semantic segmentation, spectral feature vector extraction and principal component analysis on the dried longan to be evaluated, obtain the corresponding principal component score vector of the spectrum, and input it into the trained prediction model to obtain the predicted value of the content of chemical components affecting browning of the sample to be tested. S5: Based on the predicted values of the chemical components affecting browning in the dried longan to be evaluated, a multivariate fusion was performed, and a comprehensive scoring model was used to calculate the comprehensive browning index, which reflects the overall degree of browning. S6: Preset browning assessment threshold, dynamically adjust browning grading threshold range, and output grading evaluation results of the browning degree of the dried longan to be evaluated based on the matching results of the comprehensive browning index and the dynamic browning grading threshold range.
[0008] Furthermore, the spatial information is the positional distribution of each pixel in the hyperspectral image in two-dimensional space; the spectral information is the spectral reflectance data of each pixel in the hyperspectral band, with the wavelength range of the spectral reflectance data being 400-1000nm; the content of browning-affecting chemical components corresponding to each sample is simultaneously measured as the true value label, wherein the browning-affecting chemical components include: ascorbic acid, total phenols and 5-hydroxymethylfurfural.
[0009] Furthermore, when the semantic segmentation model segments the preprocessed hyperspectral image, it inputs the hyperspectral image data into the training... In the completed U-Net semantic segmentation model, the U-Net semantic segmentation model segments according to the spectral reflectance data corresponding to each pixel in the spatial information, marking the pixel value of the pulp region as 1, and the pixel value of the non-pulp region as 1. The label is set to 0, and the annotation result generates a mask image with the same size as the original image; Using this mask image, spectral reflectance data of the fruit pulp region in the hyperspectral band is extracted from the hyperspectral image data to form a spectral feature vector for each sample's fruit pulp region. The spectral reflectance data corresponding to each pixel in the sample's fruit pulp region is extracted, and the average reflectance curve of the sample's spectral reflectance data is calculated as the average reflectance value. The formula used is as follows: in, For the first Bands of each sample Average reflectance curve, For band variables in spectral reflectance data, For the first The pulp region in the sample Spectral reflectance data of each pixel For the first The total number of pixels in the pulp region of each sample: The average reflectance value of all wavelengths is calculated, sampled at equal wavelength intervals, and concatenated into a one-dimensional vector according to wavelength order. in, For the first The spectral feature vector of each sample, This represents the number of bands sampled.
[0010] Furthermore, the steps for performing principal component analysis and dimensionality reduction on the spectral feature vector of the pulp region are as follows: Principal component analysis was used to stack the spectral eigenvectors of all fruit pulp regions in the samples to form a sample matrix. Each column (i.e., each band) of the sample matrix was standardized, and the covariance matrix of the standardized sample matrix was calculated. Eigenvalue decomposition was then performed on the covariance matrix to obtain the eigenvalues and eigenvectors corresponding to each column. The contribution rate of each eigenvalue was calculated using the following formula: in, For band Contribution rate, For band The eigenvalues of the covariance matrix eigenvalues corresponding to the eigenvectors are used to calculate the contribution rate of all sampled bands. The bands are sorted according to their contribution rates and summed until the cumulative contribution rate exceeds 99%. The sampled bands corresponding to all the cumulative contribution rates are extracted as the screening bands after dimensionality reduction. The reflectance of the screening bands in the spectral feature vector of each sample is extracted to form the component score vector of the corresponding sample.
[0011] Furthermore, a convolutional neural network model is constructed, using the principal component score vector of the sample as the feature input and the corresponding true value label of the content of chemical components affecting browning as the feature output to train the convolutional neural network model; The convolutional neural network model includes three one-dimensional convolutional layers with 32, 64, and 128 filters respectively, a kernel size of 3, and ReLU activation function. Feature extraction is performed using a max pooling layer and a global average pooling layer. Finally, three nodes are output through a global average pooling layer and a fully connected layer, which correspond to the predicted values of ascorbic acid, total phenol, and 5-hydroxymethylfurfural content, respectively. Using the true value labels as labels, mean squared error as the loss function, and the Adam optimizer with a learning rate of 0.001, a convolutional neural network model was trained to obtain a prediction model for the chemical composition of dried longan.
[0012] Furthermore, the predicted values of the chemical components affecting browning based on the samples are multivariate fusion, and a comprehensive scoring model is used to calculate the comprehensive browning index, which reflects the overall degree of browning. The formula is as follows: in, To achieve a comprehensive browning index, To predict ascorbic acid content, Predict the total phenol content. Predict the 5-hydroxymethylfurfural content. For the weighting coefficients, satisfying and exist Within the range.
[0013] Furthermore, a browning assessment threshold is preset, the browning grading threshold range is dynamically adjusted, and based on the matching result of the comprehensive browning index and the dynamic threshold range, the grading evaluation result of the browning degree of dried longan is output; the specific logic is as follows: if If so, the dried longan has not undergone browning. like If the dried longan shows slight browning, then the dried longan will show slight browning. If the dried longan is severely browned, then the dried longan will show signs of severe browning; in the formula, This is the preset browning assessment threshold.
[0014] This invention also provides a system for evaluating the degree of browning in dried longan based on image segmentation technology. This system is used to execute the aforementioned method for evaluating the degree of browning in dried longan based on image segmentation technology, and includes: Multi-source data synchronous acquisition module: used to perform hyperspectral imaging on dried longan samples to obtain hyperspectral image data of the samples. The hyperspectral image data includes spatial information and spectral information of the samples. At the same time, the chemical composition content of each sample is detected, and the content of chemical components affected by browning is obtained as the true value label. Spectral feature extraction module: Used to segment hyperspectral images using a semantic segmentation model to obtain the spatial region of longan pulp, and extract the average reflectance value of the pulp region based on the spectral reflectance data of each band in the spatial region to construct the spectral feature vector of the pulp region of each sample. Model training module: used to perform principal component analysis and dimensionality reduction on the spectral feature vector of the pulp region. After pairing the obtained principal component score vector with the true value label of the corresponding sample, the convolutional neural network model is trained to obtain a predictive model of the chemical composition of dried longan. Chemical composition content prediction module: Based on the predicted values of chemical composition content affecting browning of dried longan to be evaluated, multi-dimensional fusion is performed, and a comprehensive scoring model is used to calculate the comprehensive browning index reflecting the comprehensive degree of browning. The comprehensive browning index calculation module is used to perform multivariate fusion based on the predicted values of the content of chemical components affecting browning in the sample, and to calculate the comprehensive browning index reflecting the comprehensive degree of browning using a comprehensive scoring model. The comprehensive browning index grading and evaluation module is used to preset the browning assessment threshold, dynamically adjust the browning grading threshold range, and output the grading evaluation result of the browning degree of the dried longan to be evaluated based on the matching result of the comprehensive browning index and the dynamic browning grading threshold range.
[0015] The present invention also provides a storage medium storing a computer program, which, when executed by a processor, is used to implement the above-described method for evaluating the browning degree of dried longan based on image segmentation technology.
[0016] Compared with existing technologies, the beneficial effects of this invention are as follows: It achieves non-destructive testing, avoiding the damage to samples caused by traditional chemical testing methods, maintaining sample integrity, and allowing for multiple or continuous testing of the same sample, which is beneficial for dynamic monitoring of the browning process; It accurately extracts the pulp region through a semantic segmentation model, eliminating background and pit interference, improving the accuracy of feature extraction, and solving the evaluation error problem caused by inaccurate sample region selection in traditional methods; It effectively processes high-dimensional spectral data by employing principal component analysis dimensionality reduction and a one-dimensional convolutional neural network model, improving computational efficiency and enabling the system to complete the evaluation of a large number of samples in a short time, meeting the high-efficiency requirements of industrial production; It establishes a comprehensive browning index calculation method based on the content of multiple chemical components, making the evaluation results more comprehensive and objective, and more accurately reflecting the actual browning status of dried longan compared to traditional single-index evaluation methods; By setting scientific grading thresholds, it achieves automatic grading of browning degree, eliminating the subjectivity of manual evaluation, improving the consistency and comparability of evaluation results, and providing a scientific basis for the quality control and storage management of dried longan. Attached Figure Description
[0017] Figure 1 This is a schematic diagram of the overall method flow of the present invention; Figure 2 This is a graph showing experimental data for evaluating the degree of browning in this invention; Figure 3 This is a schematic block diagram of the evaluation system for the degree of browning of dried longan in this invention. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments.
[0019] It should be noted that, unless otherwise defined, the technical or scientific terms used in this invention should have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0020] Example: Please see Figure 1 The present invention provides a technical solution: A method for evaluating the degree of browning in dried longan based on image segmentation technology, comprising the following steps: S1: Perform hyperspectral imaging on dried longan samples to obtain hyperspectral image data of the samples. The hyperspectral image data includes spatial information and spectral information of the samples. At the same time, detect the chemical composition content of each sample and obtain the content of chemical components affected by browning as the true value label. In this embodiment, hyperspectral imaging is performed on dried longan samples to obtain hyperspectral image data. Hyperspectral imaging can simultaneously capture the spatial information and detailed spectral information of the samples, providing data dimensions far exceeding those of traditional RGB cameras. Simultaneous physicochemical testing provides precise monitoring signals for the model. Traditional methods mainly rely on manual color assessment or simple optical measurements in a single wavelength band, which are highly subjective and cannot reflect changes in internal chemical composition. This step achieves a precise correlation between surface physicochemical information and internal chemical indicators, laying a solid foundation for establishing an objective and accurate quantitative analysis model. The dried longan samples were collected from dried longan samples at different storage periods, covering a complete change sequence from no browning to severe browning. The samples were placed on the stage of the hyperspectral imaging system, and the camera focal length and lighting conditions were adjusted. The wavelength range of the spectral reflectance data was 400-1000 nm. Each sample was scanned to obtain hyperspectral image data, which includes the spatial and spectral information of the sample, and its hyperspectral image cube data was obtained. ,in For spatial coordinates, The wavelength was used; the content of browning-affecting chemical components was simultaneously detected for each sample; the content of browning-affecting chemical components was obtained as a true value label; the content of browning-affecting chemical components corresponding to each sample was simultaneously measured as a true value label, including ascorbic acid, total phenols, and 5-hydroxymethylfurfural; the content of ascorbic acid was determined by 2,6-dichlorophenolindophenol titration or high performance liquid chromatography; it is an important antioxidant, and its loss is an important indicator of browning; the content of total phenols was determined by the Folin-Ciocalteu method, and the total phenol content was expressed as gallic acid equivalent; phenolic substances are substrates for enzymatic browning, and their changes are related to browning. The content of 5-hydroxymethylfurfural was determined by high performance liquid chromatography; 5-hydroxymethylfurfural content is a hallmark product of Maillard reaction and caramelization, and is the most critical indicator for measuring non-enzymatic browning. The hyperspectral data cube of each sample was compared with the measured content of the three browning-affecting chemical components. Image-component pairings are used to create the original dataset with ground truth labels. The high-quality image-component pairings obtained are the fundamental source for all subsequent machine learning model training and validation; their accuracy and completeness directly determine the upper limit of the final model's performance.
[0021] In this embodiment, 600 dried longan samples were selected, covering different degrees of browning. 480 sample data points were divided into two parts: a training and validation set for S3 (training the principal component analysis model and the convolutional neural network model) and a test set for S4, S5, and S6 (finally validating the overall performance of the solution). This latter part of the data was completely invisible during model training and was used to demonstrate the model's generalization ability.
[0022] S2: Use a semantic segmentation model to segment the hyperspectral image to obtain the spatial region of longan pulp, and extract the average reflectance value of the pulp region based on the spectral reflectance data of each band in the spatial region to construct the spectral feature vector of the pulp region of each sample. In this embodiment, the hyperspectral image data is first preprocessed. This preprocessing includes dark current correction and whiteboard correction of the sample's spectral information, converting the raw data into reflectance data to eliminate the effects of uneven ambient lighting and sensor dark current noise, and converting the raw intensity values into physically meaningful reflectance values for comparison of data collected at different times and from different devices. The formula is as follows: in, The corrected reflectivity. These are the original values of the sample. As a dark reference value, The white reference value is used; in this embodiment: This is the corrected reflectance in this embodiment. The original digital intensity values of the sample. The image serves as a dark reference, representing system noise. A white reference image is used to eliminate the effects of uneven ambient lighting and sensor dark current noise, converting the original intensity value into a physically meaningful reflectivity value, which facilitates the comparison of data collected at different times and from different devices.
[0023] In this embodiment, a semantic segmentation model is used to segment the preprocessed hyperspectral image to obtain the spatial region of longan pulp: the U-Net semantic segmentation model is used to accurately segment the longan pulp region in the hyperspectral image, eliminating interference from background, shell, and seed; the U-Net semantic segmentation model is trained, and for each sample, images in three bands (550nm, 650nm, and 800nm) are selected and combined into a pseudo-RGB image while preserving spectral features. An image annotation tool is used to outline the contour of the longan pulp in each pseudo-RGB image; in this embodiment, the LabelImg image annotation tool is used to manually and accurately outline the contour region of the longan pulp in each pseudo-RGB image, generating a binary mask image; the annotation result generates a mask image with the same size as the original image. In the mask image, the pixel values of all longan pulp regions are set to 1, and the pixel values of all other background regions are set to 0; The method for training the U-Net semantic segmentation model is as follows: pseudo-RGB images are used as input, and the corresponding binary mask images are used as labels. The images are randomly divided into training, validation, and test sets. Each training image has a corresponding label. A combination of binary cross-entropy loss and Dice Loss is used to simultaneously optimize pixel accuracy and region overlap loss functions. in, For loss function, For binary cross-entropy loss, For Dice Loss, This is the Dice coefficient. It is the set of pixels predicted as foreground, that is, the set of foreground pixels predicted by the model as fruit pulp. The dataset is the set of real foreground pixels, i.e., the set of real-labeled fruit pulp pixels. Data is batch-input into the U-Net semantic segmentation model, the loss between the predicted output and the real mask is calculated, and the model is trained using the Adam optimizer. The network weights are updated, and the model completes one pass through the entire training dataset. After this process, the model performance is evaluated on the validation set. Training stops when the performance on the validation set no longer improves over several consecutive rounds, and the weights of the best-performing model on the validation set are saved, resulting in the trained U-Net semantic segmentation model. The U-Net semantic segmentation model can segment irregular, blurry-edge fruit pulp regions with extremely high accuracy, overcoming the poor performance of traditional thresholding and edge detection methods in complex backgrounds. The combined loss function better handles class imbalance and large differences in fruit pulp area between the pulp and background. Traditional methods often manually select regions of interest or use simple algorithms for segmentation, resulting in low efficiency, high subjectivity, and poor accuracy. This step achieves fully automatic, high-precision, and reproducible segmentation of the fruit pulp region, ensuring that the subsequently extracted spectral features come purely from the fruit pulp itself, excluding interference from irrelevant regions such as the background, kernel, and scars; this step is crucial for ensuring feature quality. Only by accurately segmenting the fruit pulp can the extracted average spectrum truly reflect the chemical information related to browning; otherwise, the introduced noise will seriously mislead subsequent chemometric models. It serves as a bridge connecting the original image and the effective features.
[0024] In this embodiment, the logic for constructing the spectral feature vector of each sample pulp region is as follows: extract the spectral reflectance data corresponding to each pixel in the sample pulp region, calculate the average reflectance curve of the sample's spectral reflectance data as the average reflectance value, and the formula used is: in, For the first Bands of each sample Average reflectance curve at the location, For band variables in spectral reflectance data, For the first In the nth sample Spectral reflectance data of pixels in the fruit pulp region For the first The total number of pixels in the pulp region of each sample: The average reflectance value of all wavelengths is calculated, sampled at equal wavelength intervals, and concatenated into a one-dimensional vector according to wavelength order. in, For the first The spectral feature vector of each sample, The number of sampled bands forms the spectral feature vector of the fruit pulp region in this sample. Using the reflectance values of all bands to construct the vector avoids information loss that might occur due to manual selection of feature bands. Each dimension of this vector has a clear physical meaning: the average reflectance of the sample at a specific wavelength. S3: Perform principal component analysis and dimensionality reduction on the spectral feature vector of the pulp region. After pairing the obtained principal component score vector with the true value label of the corresponding sample, train the convolutional neural network model to obtain a predictive model of the chemical composition of dried longan. In this embodiment, principal component analysis and dimensionality reduction are performed on the spectral feature vectors of the fruit pulp region. Principal component analysis is used to reduce the dimensionality of the matrix formed by stacking the spectral feature vectors of all sample fruit pulp regions. Each column (i.e., each wavelength) of the matrix is standardized. In the matrix formed by stacking spectral feature vectors, the reflectance data for each wavelength in each spectral feature vector are arranged horizontally according to wavelength, forming a row of the matrix. All rows formed by samples are stacked together to form the matrix. The elements in the same column of the matrix are the reflectance data of each sample in the same wavelength band. During standardization, the elements in each column are normalized, scaling all elements in the matrix to a normalized value. Within the specified range, standardization is performed, the covariance matrix of the standardized matrix is calculated, eigenvalue decomposition is performed on the covariance matrix to obtain the eigenvalues and eigenvectors of each column, and the contribution rate of each eigenvalue is calculated using the following formula: in, For band Contribution rate, For band The eigenvalues of the covariance matrix eigenvalues corresponding to the eigenvectors are used to calculate the contribution rate of all sampled bands. The bands are sorted according to their contribution rates and summed until the cumulative contribution rate exceeds 99%. The sampled bands corresponding to all the cumulative contribution rates are extracted as the screening bands after dimensionality reduction. The reflectance of the screening bands in the spectral feature vector of each sample is extracted to form the component score vector of the corresponding sample.
[0025] The phrase "retaining those with a cumulative contribution rate exceeding 99%" The "principal component analysis" is performed only once during model training. Its purpose is to summarize dimensionality reduction rules from the training data. In this embodiment, the n training samples obtained from step S2 are each a 150-dimensional vector. They form an n×150 matrix. Calculate the matrix In each column, that is, the average value over each band, we obtain a... mean vector Then use matrix Subtract this mean vector from each row The centered matrix is obtained. Distribute the data around the origin; calculate the centered matrix. The covariance matrix C. The size of this matrix is... The covariance matrix quantifies the pairwise correlation between the original 150 bands. If two bands always rise or fall simultaneously, their covariance value will be large; performing eigenvalue decomposition on the covariance matrix C yields 150 eigenvalues. ) and the corresponding 150 eigenvectors; eigenvalues The magnitude of represents the magnitude of the variance in the direction of its corresponding eigenvector. The larger the value, the more drastic the change in the data in that direction, and the more important this principal component is. The direction of the eigenvector v represents a new "coordinate axis" direction, also known as the principal component. The eigenvalues are sorted from largest to smallest. The contribution rate of each eigenvalue is calculated, and the cumulative contribution rate is calculated, starting from the first eigenvalue and accumulating until the cumulative contribution rate exceeds 99%. In this embodiment, the cumulative contribution rate of the first 17 principal components exceeds 99.3%, therefore k=17 is determined, and the first 17 are selected. The eigenvectors corresponding to the largest eigenvalues in the 17 dimensions; these eigenvectors are then combined into a column vector. projection matrix This projection matrix and mean vector This is the "dimensionality reduction rule" we obtained during the training phase, which is also the fitted principal component analysis model we will use later. The training phase is now complete. The dimensionality reduction rule we obtained is: "For any sample, first subtract the mean μ, then multiply by the projection matrix W, and it will be reduced from 150 dimensions to 17 dimensions; the principal component score vector is..." W; It is a 1×17 dimensional vector. This is the new feature vector after dimensionality reduction, also known as the principal component score vector of the sample; In this embodiment, a convolutional neural network model is constructed, using the principal component score vector of the sample as the feature input and the corresponding true value label of the browning effect chemical component content as the feature output to train the convolutional neural network model. The principal component score vector is used as input, passed through three one-dimensional convolutional layers with 32, 64, and 128 filters respectively, a kernel size of 3, and the ReLU activation function, and a max pooling layer for feature extraction. Finally, through a global average pooling layer and a fully connected layer, three nodes are output, corresponding to the predicted values of ascorbic acid, total phenols, and 5-hydroxymethylfurfural content, respectively. Chemical measurement values are used as labels, mean squared error is used as the loss function, and the Adam optimizer is used with a learning rate of 0.001 to train the model, resulting in a trained prediction model for the chemical component content of dried longan. In this embodiment, the principal component score vector is used as the feature vector. The corresponding content of the three chemical components is used as the label. A one-dimensional convolutional neural network is constructed. The input layer receives a 17-dimensional principal component score vector. Convolutional layer 1 has 32 filters with a kernel size of 3 and ReLU activation. Max pooling layer 1 has a pooling size of 2. Convolutional layer 2 has 64 filters with a kernel size of 3 and ReLU activation. Max pooling layer 2 has a pooling size of 2. Convolutional layer 3 has 128 filters with a kernel size of 3 and ReLU activation. Global average pooling pools each feature map into a scalar, replacing the traditional flattening operation and further reducing parameters. The fully connected output layer has 3 neurons, each outputting a different value. The predicted values are obtained using a linear activation function. This step automatically extracts deep, complex nonlinear features from the principal component score sequence, making it ideal for processing sequential spectral data. Its local connectivity and weight sharing characteristics endow the model with good translation invariance and high training efficiency; traditional chemometric methods often employ shallow models such as partial least squares regression or support vector regression. These models have limited capabilities when dealing with complex nonlinear relationships. Deep learning models have stronger nonlinear fitting capabilities and can capture the relationship between spectral features and chemical composition, thus potentially achieving higher prediction accuracy.
[0026] S4: Perform hyperspectral image acquisition, semantic segmentation, spectral feature vector extraction and principal component analysis on the dried longan to be evaluated, obtain the corresponding principal component score vector of the spectrum, and input it into the trained prediction model to obtain the predicted value of the content of chemical components affecting browning of the sample to be tested. In this embodiment, the process of steps S1 and S2 is completely repeated for the dried longan sample to be tested: hyperspectral imaging, reflectance correction, segmentation of the pulp region using a trained U-Net semantic segmentation model, and extraction of the principal component score vector of the pulp region. The entire prediction process is highly automated. Once the model is trained, prediction of new samples can be completed in a short time, achieving rapid and non-destructive detection. Traditional methods require destructive processing of the sample to obtain chemical values, which takes several hours or even days. This solution only requires destructive detection in the initial stage for labeling, and is completely non-destructive and fast in later applications. In this embodiment, the average spectral vector of the dried longan sample to be evaluated is used with a fitted semantic segmentation model and principal component analysis to obtain the 17-dimensional principal component score vector of the sample. The obtained 17-dimensional principal component score vector is input into the convolutional neural network model trained in step S4, and the model output is the three chemical components of the sample to be tested. The predicted value; After dimensionality reduction using principal component analysis (PCA) on all samples in S1, 12 representative data points were selected and displayed. The cumulative contribution rate of the top 17 principal components was 99.3%. The data is shown in Table 1 below. Table 1: Data on Actual and Predicted Values of Typical Samples S5: Based on the predicted values of the chemical components affecting browning in the dried longan to be evaluated, a multivariate fusion was performed, and a comprehensive scoring model was used to calculate the comprehensive browning index, which reflects the overall degree of browning. In this embodiment, the predicted values of the chemical components affecting browning in the sample are used for multivariate fusion. Multivariate fusion involves using the three predicted key chemical component indicators as elements and fusing them through a specific mathematical formula. Specifically, a comprehensive scoring model is used to calculate the comprehensive browning index, which reflects the overall degree of browning. The formula is as follows: in, To achieve a comprehensive browning index, To predict ascorbic acid content, Predict the total phenol content. Predict the 5-hydroxymethylfurfural content. For the weighting coefficients, satisfying and exist Within the range. The ratio of ascorbic acid (a consumable product) to 5-hydroxymethylfurfural (a product product) is used to amplify the browning effect. At the same time as rising If the ratio is reduced, the ratio will increase sharply, making it more sensitive to the degree of browning. Adding 1 is to prevent the denominator from being zero. The same method was used to construct a product-to-consumer ratio, i.e., the ratio of ascorbic acid to the total product, which reflects the potential for enzymatic browning. When the content of phenolic substances is high and the content of antioxidants is low, the risk and degree of enzymatic browning are high, and it can more sensitively reflect the reaction process. It represents The content may be very high; taking the logarithm can compress its numerical range, preventing any single indicator from dominating the entire index and making the index more stable. This formula incorporates factors related to enzymatic browning. loss, Changes, and non-enzymatic browning The accumulated multi-path mechanism, combined with fuzzy comprehensive evaluation and analytic hierarchy process, scientifically and weightedly integrates multiple individual chemical indicators into a comprehensive index, more comprehensively reflecting the complex nature of browning. Traditional methods often rely on only a single indicator, such as... Content or subjective color scoring are simplistic and one-sided evaluation methods. This index, however, is a multi-parameter, chemically interpretable, and objective quantitative indicator, resulting in more scientific and reliable evaluation results. In this embodiment, , , ; The weight is 0.5 because it is a highly stable and specific marker product in the middle and late stages of the Maillard reaction. Its accumulation directly and quantitatively reflects the extent of the Maillard reaction; the Maillard reaction is the most important non-enzymatic browning pathway during the storage of dried foods; in the browning of dried longan during storage, the Maillard reaction is usually the dominant process, especially in the middle and late stages. Therefore, the term representing this reaction is given the highest weight, indicating that it is... The most important driving factor of the index; Total phenols It is a key substrate for enzymatic browning; under the action of polyphenol oxidase, phenolic substances are oxidized to quinones, which further polymerize to form brown substances; oxidative browning contributes significantly in the early stage of browning and under certain conditions, but its overall contribution is usually less than that of the Maillard reaction. Therefore, it is given a secondary weight, indicating that it is an important co-contributing factor; A weight of 0.2 is for Mathematical corrections for the high-concentration saturation effect; although the first term already includes However, listing it separately and assigning it a basic weight is to further emphasize it. Its core position in the evaluation system; and the use of the natural logarithm function. The concentration can become very high in the later stages of browning, so high concentrations should be avoided. The "numerical flooding" effect: preventing [the problem] due to [various factors]. HMF The value is too large, causing the contributions of other components to be ignored.
[0027] S6: Preset browning assessment threshold, dynamically adjust browning grading threshold range, and output grading evaluation results of the browning degree of the dried longan to be evaluated based on the matching results of the comprehensive browning index and the dynamic browning grading threshold range.
[0028] In this embodiment, a browning assessment threshold is preset, the browning grading threshold range is dynamically adjusted, and based on the matching result of the comprehensive browning index and the dynamic threshold range, the grading evaluation result of the browning degree of dried longan is output; the specific logic is as follows: if If so, the dried longan has not undergone browning. like If the dried longan shows slight browning, then the dried longan will show slight browning. If the dried longan is severely browned, then the dried longan will show signs of severe browning; in the formula, This is a preset browning assessment threshold. This threshold can be determined based on a large number of samples. The value distribution is determined by combining industry standards or expert experience; the adaptive mechanism is reflected in the fact that, after accumulating a sufficient amount of sample data, it can be dynamically adjusted periodically based on the distribution of historical data. To better reflect the actual situation of the current batch or variety, an initial browning index threshold is set. In this embodiment, a preset browning assessment threshold is used. This threshold can be based on a large number of samples. The value distribution is determined by combining industry standards or expert experience. The adaptive mechanism is reflected in the fact that, after accumulating a sufficient amount of sample data, it can be dynamically adjusted periodically based on the distribution of historical data. This makes it more consistent with the actual situation of the current batch or variety. The comprehensive browning index of the test set in this embodiment ( The calculation and grading results are shown in Table 2 below; Table 2: Overall Browning Index of the Test Set ( Calculation and grading results Please see Figure 2The figures in Tables 1 and 2 provide a visual representation of the changes. Ascorbic acid content decreased sharply from approximately 45 mg / 100g initially to approximately 8 mg / 100g, clearly reflecting its rapid oxidation and consumption during storage, a key early driver of browning. Total phenol content initially increased slightly before continuously decreasing. This accurately simulates the classic kinetic process of phenols being released from their bound state in the early stages of browning, followed by enzymatic oxidation or participation in Maillard reactions for continuous consumption. 5-Hydroxymethylfurfural content increased explosively from an extremely low level of approximately 5 mg / kg to approximately 90 mg / kg. As a key marker of Maillard reaction and sugar degradation, its sharp increase directly proves the vigorous progress of non-enzymatic browning reaction, which is a major characteristic of the middle and late stages of browning. Furthermore, the predicted value is very close to the actual chemical measurement value, demonstrating a high degree of agreement between the predicted and actual values. This fundamentally confirms that changes in the internal chemical composition of dried longan, i.e., the essence of browning, are manifested through its external optical properties, and this relationship is stable and can be captured. The proposed method can replace traditional time-consuming and destructive chemical detection methods, achieving rapid, non-destructive, online intelligent monitoring and quality evaluation of the degree of browning in dried longan. Experimental results show that the degree of browning is directly proportional to the number of storage days, and the selected browning-affecting chemical components... It is the main component that truly affects the degree of browning in longan; it provides a brand-new solution for quality control in modern agriculture and food processing. Please see Figure 3 The present invention also provides an evaluation system for the browning degree of dried longan based on image segmentation technology. This system is used to perform the aforementioned evaluation method for the browning degree of dried longan based on image segmentation technology, and includes: Multi-source data synchronous acquisition module: used to perform hyperspectral imaging on dried longan samples to obtain hyperspectral image data of the samples. The hyperspectral image data includes spatial information and spectral information of the samples. At the same time, the chemical composition content of each sample is detected, and the content of chemical components affected by browning is obtained as the true value label. Spectral feature extraction module: Used to segment hyperspectral images using a semantic segmentation model to obtain the spatial region of longan pulp, and extract the average reflectance value of the pulp region based on the spectral reflectance data of each band in the spatial region to construct the spectral feature vector of the pulp region of each sample. Model training module: used to perform principal component analysis and dimensionality reduction on the spectral feature vector of the pulp region, and after pairing the processed principal component score vector with the true value label of the content of the corresponding browning-affecting chemical components, the convolutional neural network model is trained to obtain a predictive model of the chemical components of dried longan. Chemical composition content prediction module: used to perform hyperspectral image acquisition, semantic segmentation, spectral feature vector extraction and principal component analysis on the dried longan samples to be evaluated, obtain the corresponding principal component score vector of the spectrum, and input it into the trained prediction model to obtain the predicted value of the browning effect chemical composition content of the sample to be tested. The comprehensive browning index calculation module is used to perform multivariate fusion based on the predicted values of the content of chemical components affecting browning in the sample, and to calculate the comprehensive browning index reflecting the comprehensive degree of browning using a comprehensive scoring model. The comprehensive browning index grading and evaluation module presets a browning assessment threshold, dynamically adjusts the browning grading threshold range, and outputs a grading and evaluation result of the browning degree of dried longan based on the matching result of the comprehensive browning index and the dynamic browning grading threshold range. This invention also provides a storage medium storing a computer program, which, when executed by a processor, implements the above-described method for evaluating the browning degree of dried longan based on image segmentation technology.
[0029] The above formulas are all dimensionless calculations. The formulas are derived from software simulations based on a large amount of collected data to obtain the most recent real-world results. The preset parameters in the formulas are set by those skilled in the art according to the actual situation.
[0030] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented in software, the above embodiments can be implemented, in whole or in part, as a computer program product. Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution.
[0031] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0032] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A method for evaluating the degree of browning in dried longan based on image segmentation technology, characterized in that, The specific steps include: S1: Perform hyperspectral imaging on dried longan samples to obtain hyperspectral image data of the samples. The hyperspectral image data includes spatial information and spectral information of the samples. At the same time, detect the chemical composition content of each sample and obtain the content of chemical components affected by browning as the true value label. S2: Use a semantic segmentation model to segment the hyperspectral image to obtain the spatial region of longan pulp, and extract the average reflectance value of the pulp region based on the spectral reflectance data of each band in the spatial region to construct the spectral feature vector of the pulp region of each sample. S3: Perform principal component analysis and dimensionality reduction on the spectral feature vector of the pulp region. After pairing the obtained principal component score vector with the true value label of the corresponding sample, train the convolutional neural network model to obtain a predictive model of the chemical composition of dried longan. S4: Perform hyperspectral image acquisition, semantic segmentation, spectral feature vector extraction and principal component analysis on the dried longan to be evaluated, obtain the corresponding principal component score vector of the spectrum, and input it into the trained prediction model to obtain the predicted value of the content of chemical components affecting browning of the sample to be tested. S5: Based on the predicted values of the chemical components affecting browning in the dried longan to be evaluated, a multivariate fusion was performed, and a comprehensive scoring model was used to calculate the comprehensive browning index, which reflects the overall degree of browning. S6: Preset browning assessment threshold, dynamically adjust browning grading threshold range, and output grading evaluation results of the browning degree of the dried longan to be evaluated based on the matching results of the comprehensive browning index and the dynamic browning grading threshold range. The spatial information is the positional distribution of each pixel in the hyperspectral image in two-dimensional space; the spectral information is the spectral reflectance data of each pixel in the hyperspectral band, with the wavelength range of the spectral reflectance data being 400-1000nm; the content of browning-affecting chemical components corresponding to each sample is simultaneously measured as the true value label, wherein the browning-affecting chemical components include: ascorbic acid, total phenols and 5-hydroxymethylfurfural. The predicted chemical components affecting browning in the dried longan to be evaluated are used for multivariate fusion, and a comprehensive scoring model is employed to calculate the comprehensive browning index, which reflects the overall degree of browning. The formula is as follows: in, To achieve a comprehensive browning index, To predict ascorbic acid content, Predict the total phenol content. Predict the 5-hydroxymethylfurfural content. For the weighting coefficients, satisfying and exist Within the range.
2. The method for evaluating the degree of browning in dried longan based on image segmentation technology according to claim 1, characterized in that: When the semantic segmentation model segments the preprocessed hyperspectral image, the hyperspectral image data is input into the training... In the completed U-Net semantic segmentation model, the U-Net semantic segmentation model uses the spectral inverse of each pixel in the spatial information to reflect the semantic segmentation process. The emissivity data is segmented, with the pixel value of pixels in the pulp area marked as 1, and the pixel value of pixels in the non-pulp area marked as 1. The label is set to 0, and the annotation result generates a mask image with the same size as the original image; Using this mask image, spectral reflectance data of the fruit pulp region in the hyperspectral band is extracted from the hyperspectral image data to form a spectral feature vector for each sample's fruit pulp region. The spectral reflectance data corresponding to each pixel in the sample's fruit pulp region is extracted, and the average reflectance curve of the sample's spectral reflectance data is calculated as the average reflectance value. The formula used is as follows: in, For the first Bands of each sample Average reflectance curve, For band variables in spectral reflectance data, For the first The pulp region in the sample Spectral reflectance data of each pixel For the first The total number of pixels in the pulp region of each sample: The average reflectance value of all wavelengths is calculated, sampled at equal wavelength intervals, and concatenated into a one-dimensional vector according to wavelength order. in, For the first The spectral feature vector of each sample, This represents the number of bands sampled.
3. The method for evaluating the degree of browning in dried longan based on image segmentation technology according to claim 2, characterized in that: The steps for performing principal component analysis and dimensionality reduction on the spectral feature vector of the pulp region are as follows: Principal component analysis was used to stack the spectral eigenvectors of all fruit pulp regions in the samples to form a sample matrix. Each column (i.e., each band) of the sample matrix was standardized, and the covariance matrix of the standardized sample matrix was calculated. Eigenvalue decomposition was then performed on the covariance matrix to obtain the eigenvalues and eigenvectors corresponding to each column. The contribution rate of each eigenvalue was calculated using the following formula: in, For band Contribution rate, For band The eigenvalues of the covariance matrix eigenvalues corresponding to the eigenvectors are used to calculate the contribution rate of all sampled bands. The bands are sorted according to their contribution rates and summed until the cumulative contribution rate exceeds 99%. The sampled bands corresponding to all the cumulative contribution rates are extracted as the screening bands after dimensionality reduction. The reflectance of the screening bands in the spectral feature vector of each sample is extracted to form the component score vector of the corresponding sample.
4. The method for evaluating the degree of browning in dried longan based on image segmentation technology according to claim 3, characterized in that: A convolutional neural network model was constructed, with the principal component score vector of the sample as the feature input and the true value label of the content of chemical components affecting browning as the feature output, and the convolutional neural network model was trained. The convolutional neural network model includes three one-dimensional convolutional layers with 32, 64, and 128 filters respectively, a kernel size of 3, and ReLU activation function. Feature extraction is performed using a max pooling layer and a global average pooling layer. Finally, three nodes are output through a global average pooling layer and a fully connected layer, which correspond to the predicted values of ascorbic acid, total phenol, and 5-hydroxymethylfurfural content, respectively. Using the true value labels as labels, mean squared error as the loss function, and the Adam optimizer with a learning rate of 0.001, a convolutional neural network model was trained to obtain a prediction model for the chemical composition of dried longan.
5. The method for evaluating the degree of browning in dried longan based on image segmentation technology according to claim 1, characterized in that: A preset browning assessment threshold is established, and the browning grading threshold range is dynamically adjusted. Based on the matching result of the comprehensive browning index and the dynamic threshold range, the grading evaluation result of the browning degree of dried longan is output. The specific logic is as follows: If If so, the dried longan has not undergone browning. like If the dried longan shows slight browning, then the dried longan will show slight browning. If the dried longan is severely browned, then the dried longan will show signs of severe browning; in the formula, This is the preset browning assessment threshold.
6. An evaluation system for the degree of browning in dried longan based on image segmentation technology, characterized in that: The image segmentation-based evaluation system for the browning degree of dried longan is used to perform the image segmentation-based evaluation method for the browning degree of dried longan as described in any one of claims 1-5, comprising: Multi-source data synchronous acquisition module: used to perform hyperspectral imaging on dried longan samples to obtain hyperspectral image data of the samples. The hyperspectral image data includes spatial information and spectral information of the samples. At the same time, the chemical composition content of each sample is detected, and the content of chemical components affected by browning is obtained as the true value label. Spectral feature extraction module: Used to segment hyperspectral images using a semantic segmentation model to obtain the spatial region of longan pulp, and extract the average reflectance value of the pulp region based on the spectral reflectance data of each band in the spatial region to construct the spectral feature vector of the pulp region of each sample. Model training module: used to perform principal component analysis and dimensionality reduction on the spectral feature vector of the pulp region. After pairing the obtained principal component score vector with the true value label of the corresponding sample, the convolutional neural network model is trained to obtain a predictive model of the chemical composition of dried longan. Chemical composition content prediction module: Based on the predicted values of chemical composition content affecting browning of dried longan to be evaluated, multi-dimensional fusion is performed, and a comprehensive scoring model is used to calculate the comprehensive browning index reflecting the comprehensive degree of browning. The comprehensive browning index calculation module is used to perform multivariate fusion based on the predicted values of the content of chemical components affecting browning in the sample, and to calculate the comprehensive browning index reflecting the comprehensive degree of browning using a comprehensive scoring model. The comprehensive browning index grading and evaluation module is used to preset the browning assessment threshold, dynamically adjust the browning grading threshold range, and output the grading evaluation result of the browning degree of the dried longan to be evaluated based on the matching result of the comprehensive browning index and the dynamic browning grading threshold range.
7. A storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, is used to implement the method for evaluating the degree of browning of dried longan based on image segmentation technology as described in any one of claims 1-5.