A method, system and storage medium for identifying adulteration of lotus root starch
Through hyperspectral imaging technology and deep learning framework, combined with channel attention module and convolutional neural network, the problems of complex operations and high sample preparation requirements in the detection of lotus root powder adulteration are solved, and the rapid, accurate identification and visualization of lotus root powder adulteration are achieved. Analysis improves detection efficiency and accuracy.
Patent Information
- Application Number
- CN202410758270.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-11-01
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art has problems such as destructive, complex operation and high sample preparation requirements in the detection of root lotus powder adulteration, making it difficult to quickly and accurately identify pure root lotus powder and other starch incorporated.
Hyperspectral imaging technology combined with a deep learning framework is used to extract feature wavelengths through the channel attention module, and classify and identify them using convolutional neural networks to achieve rapid and accurate identification of adulteration of lotus root powder, and visual analysis is performed through pseudo-color images.
It realizes rapid and accurate identification of adulteration of lotus root powder, reduces model complexity and computing resource consumption, improves recognition accuracy, and has fast and lossless identification capabilities.
Smart Images

Figure CN118334649B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of lotus root starch detection, and particularly relates to a method, system and storage medium for identifying adulteration of lotus root starch. Background Art
[0002] Lotus root starch is a kind of starch, which is made from lotus roots through a series of rigorous steps such as selecting, cleaning, grinding, filtering, dehydrating, and drying. The production method of pure lotus root starch is complicated, the output rate is low, and the market price is dozens of times that of ordinary starches such as cassava starch, sweet potato starch, potato starch, and corn starch. Moreover, it is difficult to distinguish lotus root starch from other starches in appearance, so a method that can quickly identify pure lotus root starch is needed.
[0003] Patent CN113533318A discloses an application of divalent iron ions in the rapid detection of adulteration of lotus root powder and a method for rapid detection of adulteration of lotus root powder using divalent iron ions. The invention adds different proportions of corn starch to the lotus root powder, and makes a standard colorimetric card based on the depth of the color reacted with the color developer. According to whether the lotus root powder to be tested reacts with the color developer and the depth of the displayed color, it is judged whether the lotus root powder is adulterated with other starches and the adulteration ratio. This identification method has a good resolution effect and can quickly and effectively detect lotus root powder products on the market that are mixed with other starches. However, as a destructive method, this method has relatively high requirements for sample preparation, requires the continuous use of chemical reagents, and requires professional personnel to operate. Summary of the invention
[0004] The purpose of the present invention is to provide a method for identifying lotus root starch adulteration
[0005] The method, system and storage medium have the advantages of fast, non-destructive and accurate identification of the authenticity of lotus root powder.
[0006] To achieve the above object, the present invention adopts the following technical solution:
[0007] The first object of the present invention is to provide a method for identifying adulteration of lotus root starch, comprising the following specific steps:
[0008] S1. Using a hyperspectral imaging system to collect hyperspectral images of pure lotus root starch samples, other starch samples and adulterated samples in the short-wave near-infrared region by pushing broom linear scanning, the spectral band range for collection is 900-1700nm, and black and white correction processing is performed; the adulterated sample is a sample in which other starch is added to the pure lotus root starch sample;
[0009] S2, using the Otsu algorithm for the sample and background in the hyperspectral image of the adulterated sample after segmentation correction, and extracting the sample spectral data after segmentation of the background; randomly dividing the circular region of interest into pixel points for the pure lotus root starch sample and other starch samples added therein, and obtaining the spectral data of each pixel of the sample in the region of interest;
[0010] S3, using the isolation forest algorithm to remove abnormal sample spectral data to obtain normal spectral data;
[0011] S4. Use the channel attention module in the deep learning framework to extract the representative characteristic wavelength part in the spectral data to obtain characteristic spectral data; the channel attention module is represented as a function , its input is Sample A full-band spectrum vector set composed of spectral bands , as a A numeric matrix of size , The rows represent the number of samples. The column represents the number of spectral bands; the channel attention module will fully learn the nonlinear relationship between the bands and output a non-negative band weight tensor , as a A numeric matrix of size , Each value in the column represents the band weight of each spectral band. is the symbol of the real number set, representing the full-band spectrum vector set Each value in is a real number, and its expression is:
[0012] ,
[0013] In the formula, Represents the trainable parameters involved in the channel attention module;
[0014] S5, further inputting the characteristic spectral data and different types of sample labels into the convolutional neural network module in the deep learning framework for classification and identification, so as to achieve accurate classification of pure lotus root starch samples and other starch samples added thereto;
[0015] S6. Input the hyperspectral image data of the adulterated samples into the trained deep learning network model to achieve visual identification of the adulterated samples.
[0016] Furthermore, in step S1, the other starch added to the adulterated sample includes at least one of corn starch, potato starch, sweet potato starch or cassava starch.
[0017] Furthermore, the collected spectral data is subjected to black and white correction, and the formula for black and white correction is shown as follows:
[0018] ,
[0019] in, Corrected spectral image; Raw hyperspectral images; Cover the dark reference image acquired by the lens; Captured standard whiteboard image.
[0020] Furthermore, in step S2, each sample of the pure lotus root powder sample and other starch samples added thereto is randomly divided into 40 circular ROIs in units of pixels, and the radius of each ROI is 10 pixels. The spectral curve is obtained by calculating the average spectral value of all pixels in the ROI, thereby obtaining the spectral curve of each type of pure starch.
[0021] Furthermore, in step S3, the isolation forest algorithm is used to remove the front 33 bands and the rear 36 bands of the entire band, and 443 bands between 940nm and 1675nm are retained.
[0022] Further, in step S4, the characteristic band is determined by averaging the band weights of all input samples. The average weight of each band is calculated as:
[0023] ,
[0024] in, Indicates The average weight of the bands, is the number of training samples; For the The sample The band weight of each band.
[0025] Furthermore, in step S5, the convolutional neural network module includes two one-dimensional convolutional layers, one flattened layer and three fully connected layers. Each convolutional layer and fully connected layer uses a ReLU activation function. The ReLU activation function does not have complex exponential operations, can improve the operation efficiency, and has a faster convergence speed. Its function formula is:
[0026] f ( x ) = max (0, x ),
[0027] In the formula, f ( x ) represents the output of the ReLU activation function; x Represents the input value; max (0, x ) means taking the maximum value between the input value and zero.
[0028] Furthermore, the process of using the convolutional neural network module for classification and identification is to input the labels and characteristic spectral data of the pure lotus root powder sample and other starch samples into the model, and randomly divide the spectral data into a training set and a test set in a ratio of 8:2. After the model training output, the model classification confusion matrix is obtained, and the classification result is obtained through the classification accuracy displayed by the confusion matrix.
[0029] Furthermore, in step S6, the hyperspectral image data of the adulterated sample is input into the trained deep learning network model, and different colors are assigned to different categories of pixels in the hyperspectral image of the adulterated sample, and the coordinate information of each pixel is presented in a pseudo-color image, thereby realizing a visual analysis of the adulterated sample.
[0030] The second object of the present invention is to provide a system for identifying adulteration of lotus root starch, wherein the system is used to implement the above-mentioned method for identifying adulteration of lotus root starch, and at least comprises:
[0031] The data acquisition module is configured to acquire hyperspectral images of pure lotus root starch samples, samples of other starches added, and adulterated samples, and acquire corresponding corrected hyperspectral images through black and white correction; the adulterated samples are pure lotus root starch samples mixed with other starches;
[0032] The abnormal elimination module is configured to use an isolation forest algorithm to eliminate abnormal data in each type of starch spectral data, and retain the remaining spectral data as normal starch sample spectral data;
[0033] A feature extraction module is configured to select a channel attention module in a deep learning framework to extract characteristic wavelengths from the preprocessed spectral data to obtain characteristic spectral data after eliminating redundant wavelengths;
[0034] The classification and discrimination module is configured to use the convolutional neural network in the deep learning framework as the classification and discrimination model, input the labels and characteristic spectral data of the pure lotus root starch sample and other starch sample added into the model, and randomly divide the spectral data into a training set and a test set at a ratio of 8:2. After the model training output, the model classification confusion matrix is obtained, and the classification result is obtained through the classification accuracy displayed by the confusion matrix;
[0035] The visualization module is configured as a trained deep learning network model to identify the starch category of each pixel in the hyperspectral image of the adulterated sample, assign different colors to pixels of different categories, and present them in a pseudo-color image based on the coordinate information of each pixel, thereby realizing a visual analysis of the adulterated sample.
[0036] The third object of the present invention is to provide a computer-readable storage medium, wherein the computer-readable storage medium stores a program, wherein the program can be executed by one or more processors to implement the above-mentioned method for identifying adulteration of lotus root starch.
[0037] The English abbreviations in the present invention are explained as follows:
[0038] ROI: region of interest;
[0039] PLS-DA: Partial least squares discriminant analysis;
[0040] CAMM: Channel Attention Module;
[0041] CNN: Convolutional Neural Network;
[0042] IF: Isolation Forest Algorithm;
[0043] CARS: Competitive Adaptive Weighted Algorithm;
[0044] BOSS: self-service soft shrink algorithm;
[0045] RMSECV: root mean square error of cross validation;
[0046] RC: regression coefficient;
[0047] SVM: Support vector machine.
[0048] Compared with the prior art, the technical solution provided by the present invention has the following beneficial effects:
[0049] (1) The present invention provides a method, system and storage medium for identifying adulterated lotus root powder. The method uses hyperspectral imaging technology to quickly detect other starches mixed into pure lotus root powder, inputs the spectral data of pure lotus root powder samples and other starch samples mixed into the classification model for training, obtains the best classification model, and then inputs the spectral data of the adulterated sample into the best classification model for identification, obtains the starch category to which each pixel of the adulterated sample belongs, assigns different colors to pixels of different categories, and presents them in a pseudo-color image according to the coordinate information of each pixel, thereby realizing visual detection of adulterated samples. The present invention uses a channel attention module (CAMM) to select characteristic wavelengths, thereby minimizing the complexity of the model while ensuring the model effect, shortening the model running time, and saving computing resources; and uses a convolutional neural network model (CNN) to improve recognition accuracy.
[0050] (2) The method provided by the present invention has a fast recognition speed and high precision, and can quickly and accurately identify pure lotus root powder samples and adulterated samples mixed with other starches. This has important technical reference value for distinguishing lotus root powder from other starches and detecting the adulteration of lotus root powder. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 A flow chart of the method for identifying adulteration of lotus root starch provided by the present invention;
[0052] Figure 2 This is a diagram showing the effect of using the isolation forest algorithm to remove abnormal sample data in the present invention;
[0053] Figure 3 This is a feature extraction flow chart of the CAMM in the deep learning framework used in the present invention;
[0054] Figure 4 A network structure diagram of the CAMM provided by the present invention;
[0055] Figure 5 The band weight visualization of the CAMM provided by the present invention during the iteration process. The value of the chromaticity bar in the figure represents the band weight. The larger the value, the greater the band weight.
[0056] Figure 6 The training loss and classification accuracy of the CAMM provided by the present invention during the iteration process;
[0057] Figure 7 The classification performance of SVM, PLS-DA and CNN provided by the present invention under the feature band selected based on CAMM;
[0058] Figure 8 This is the test set confusion matrix under the best classification effect of SVM, PLS-DA and CNN provided by the present invention. The value of the chromaticity bar in the figure represents the number of samples;
[0059] Fig. 9 This is a CNN structure diagram in the deep learning framework used in the present invention;
[0060] Fig.10 The loss and accuracy of the test set during the CNN iteration process adopted by the present invention;
[0061] Fig.11 A visualization result diagram of adulterated samples provided by the present invention;
[0062] Fig.12 A schematic diagram of the structure of a system for identifying adulteration of lotus root starch provided by the present invention. DETAILED DESCRIPTION
[0063] In order to make the purpose, technical scheme and advantages of the present invention clearer, the specific implementation of the present invention is further described in detail below in conjunction with specific embodiments and drawings. If no specific technology or conditions are specified in the embodiments, the technology or conditions described in the literature in the art or the product instructions are used.
[0064] Unless otherwise specified, the raw materials, equipment and methods used in the present invention are commonly used in the art.
[0065] like Figure 1 As shown, it is a flow chart of the method for identifying adulteration of lotus root starch of the present invention, which comprises the following steps:
[0066] (1) Prepare samples of pure lotus root starch and other starch samples, as well as adulterated samples mixed with multiple other starches; use a hyperspectral imaging system to collect hyperspectral images of the samples, with a spectral band range of 900-1700nm;
[0067] (2) Perform black and white correction on the collected hyperspectral images;
[0068] (3) Use the Otsu algorithm to segment the sample and background in the corrected hyperspectral image, and extract the sample spectral data after background segmentation;
[0069] (4) Use the isolation forest algorithm to remove abnormal sample spectral data and obtain normal spectral data;
[0070] (5) Use the channel attention module in the deep learning framework to extract the representative characteristic wavelength part of the spectral data to obtain the characteristic spectral data;
[0071] (6) The characteristic spectral data and different types of sample labels are further input into the convolutional neural network module in the deep learning framework for classification and recognition, so as to achieve accurate classification of pure lotus root starch samples and other starch samples added thereto;
[0072] (7) The hyperspectral image data of the adulterated samples is input into the trained deep learning network model to achieve visual identification of the adulterated samples.
[0073] Example 1
[0074] The present invention provides a method for identifying adulteration of lotus root starch, which specifically comprises the following steps:
[0075] 1. Preparation of pure lotus root starch samples, samples mixed with other starches, and adulterated samples;
[0076] Prepare 10 samples of pure lotus root powder and four common pure starches (sweet potato starch, cassava starch, potato starch, corn starch), each weighing 20 g, for a total of 50 pure starch samples. For the preparation of adulterated samples, binary, ternary, quaternary and quinary mixed adulterated samples were prepared in turn by adding one, two, three and four different adulterants (sweet potato starch, cassava starch, potato starch, corn starch) to pure lotus root powder, for a total of four types of adulterated samples. In each type of adulterated sample, the concentration of each other starch added has five gradients of 0.2%, 0.4%, 0.6%, 0.8% and 1%. Therefore, 5 samples of each type of adulterated sample were prepared, each weighing 20 g, for a total of 20 adulterated samples. The adulteration concentration can be obtained by the following formula:
[0077] ,
[0078] In the formula, for the quality of the adulterated substance; It is the quality of pure lotus root powder.
[0079] 2. Acquisition and black-and-white correction of hyperspectral images
[0080] Hyperspectral images of grain samples were obtained using a hyperspectral image acquisition system. The hyperspectral imaging system mainly consists of a GaiaField-N17E-HR hyperspectral camera (spectral range 900-1700 nm, spectral resolution 5 nm, 512 bands, Jiangsu Shuangli Hepu Technology Co., Ltd.); four FSL halogen light sources (power 55 w, Foshan Electric Lighting Co., Ltd.); and an ASUS computer (equipped with hyperspectral data acquisition software SpecVIEW, Asus Computer Co., Ltd., Taiwan, China). The sample was placed in a circular glass culture dish with a diameter of 10 cm and a height of 2 cm, and the surface was flattened using a glass pressing plate to ensure the flatness and fullness of the surface. Then it was placed in the center of the acquisition platform 40 cm away from the lens of the hyperspectral imager, and a hyperspectral image of 640×666 pixels×512 bands was acquired. In order to obtain accurate hyperspectral image data, the relevant parameters of the SpecView software were set in advance. The R, G, and B channel values of the image were set to 954.15, 927.55, and 904.28 nm, respectively, the camera gain was set to 2, and the exposure time was set to 2 ms.
[0081] The collected spectral data is subjected to black and white correction. The formula for black and white correction is shown below:
[0082] ,
[0083] In the formula, Corrected spectral image; Raw hyperspectral images; Cover the dark reference image acquired by the lens; Captured standard whiteboard image.
[0084] 3. Extract sample spectral data
[0085] Each hyperspectral image contains samples and background. The background is useless information. Therefore, the Otsu threshold algorithm is used to segment the sample and background in the image, and the sample area after removing the background is divided into regions of interest (ROI). For pure starch samples, each sample is randomly divided into 40 circular ROIs in units of pixels, and the radius of each ROI is 10 pixels. The spectral curve is obtained by calculating the average spectral value of all pixels in the ROI, thereby obtaining 400 spectral curves for each type of pure starch.
[0086] 4. Eliminate abnormal sample spectral data
[0087] After extracting valid spectral data, the data needs to be cleaned to remove abnormal data that affects the modeling effect. The present invention adopts the isolation forest (IF) algorithm to remove abnormal data. The isolation forest is composed of a large number of isolated trees. The IF algorithm constructs these isolated trees by continuously and randomly dividing the samples in the spectral data set. In this process, all samples are repeatedly divided until they are all classified to the left or right side of an isolated tree, and finally an isolation forest is formed. Then, the corresponding anomaly score is calculated according to the path length of each sample in the isolation forest. Finally, the abnormal samples are eliminated by setting the anomaly score threshold.
[0088] Before using the IF algorithm to remove abnormal spectral data, it is necessary to remove the abnormal bands affected by noise before and after the spectral data. Specifically, the front 33 bands and the last 36 bands of the full band are removed, thus retaining 443 bands between 940nm and 1675nm. Subsequently, the IF algorithm is used to remove abnormal data in the spectral data.
[0089] refer to Figure 2 , taking the pure lotus root starch sample as an example, the effect of removing abnormal data from the spectral data is demonstrated. The red line corresponds to the spectral curve of the normal pure lotus root starch sample, and the black line corresponds to the spectral curve of the abnormal pure lotus root starch sample. It can be clearly observed that some outlier spectral curves are "isolated" and thus identified as abnormal data.
[0090] 5. Extract characteristic wavelength
[0091] Spectral data usually contains a lot of complex and redundant band information. Directly using high-dimensional data may lead to a surge in the amount of calculation, thereby prolonging the calculation time, which will affect the operating efficiency of the model in actual detection applications. Therefore, it is necessary to use a characteristic wavelength extraction algorithm to extract characteristic wavelengths that are representative, stable, and discriminative from the full wavelength. The present invention uses a deep learning algorithm for the first time to select characteristic wavelengths.
[0092] The channel attention module (CAMM) is a deep learning neural network module used to learn band weights by introducing a channel attention mechanism. Figure 3 As shown, CAMM is expressed as a function g , its input is Sample A full-band spectrum vector set composed of spectral bands , as a A numeric matrix of size , The rows represent the number of samples. The column represents the number of spectral bands; the channel attention module will fully learn the nonlinear relationship between the bands and output a non-negative band weight tensor , as a A numeric matrix of size , Each value in the column represents the band weight of each spectral band. is the symbol of the real number set, representing the full-band spectrum vector set Each value in is a real number, and its expression is:
[0093] ,
[0094] In the formula, Represents the trainable parameters involved in the channel attention module.
[0095] In order to ensure the non-negativity of the learned weights, the Sigmoid function is used as the activation of the output layer in the channel attention module, and its expression is:
[0096] ,
[0097] In the formula, Represents the output of the Sigmoid function; Represents the band weight.
[0098] Next, based on the learned band weights, the feature bands are determined by averaging the band weights of all input samples. The average weight of the jth band is calculated as:
[0099] ,
[0100] In the formula, is the number of training samples; ij is the band weight of the jth band of the ith sample.
[0101] Finally, the bands are sorted according to the average weight, and the first C bands with the highest average weights are selected as feature bands to form a feature spectrum vector subset. .like Figure 4 As shown in the figure represents the number of samples, so Representative Samples ( , ,......, , a total of S samples), CAMM is designed as a bottleneck structure with multiple fully connected layers, which is conducive to the extraction of feature information.
[0102] In order to better evaluate the performance of the model, precision is used as the model evaluation indicator. Precision is the ratio of the number of correctly identified samples to the total number of samples, and is the most intuitive model performance evaluation indicator. The higher the precision, the better the discrimination effect of the model. The calculation method of precision is as follows:
[0103] ,
[0104] Where: Indicates the number of correctly classified starches, Indicates the amount of starch that was misclassified.
[0105] In CAMM, in order to show the changing trend of band weights, all band weights in the iteration process are scaled to the range of [0,1]. The average weight changes of each band in the 100 iterations of CAMM are as follows: Figure 5 shown. Figure 5 The value of the middle chromaticity bar represents the band weight. The larger the value, the larger the band weight. It can be seen that with the increase of the number of iterations, the distribution of the band weight gradually becomes more and more sparse. At the same time, since the redundant bands will eventually be assigned very small weights, the characteristic bands are easier to distinguish. In addition, in order to analyze the convergence of CAMM, the present invention also draws the loss function curve of CAMM in the iterative process, and the 12 bands with the largest band weights in each iteration constitute the characteristic band vector set, which is input into the PLS-DA classification model for analyzing the model classification effect.
[0106] The loss function curve of CAMM and the change in PLS-DA classification accuracy are visualized as follows Figure 6As shown in the figure, as the number of iterations increases, the training loss decreases rapidly and the classification accuracy of PLS-DA gradually improves. When the iteration reaches about 20 times, the loss value of CAMM is very close to zero. After 80 iterations of PLS-DA, the classification accuracy of both the training set and the test set is stable at about 96%. At the same time, it can be found that the classification accuracy of PLS-DA has increased from 88% to 96%, an increase of 8%, which proves the effectiveness of CAMM. The above analysis shows that CAMM is easy to train and converges quickly.
[0107] To further analyze the effectiveness of CAMM, the effects of competitive adaptive weighting algorithm (CARS), bootstrap soft shrinkage algorithm (BOSS) and CAMM were compared based on the partial least squares discriminant analysis (PLS-DA) classification algorithm. The specific classification results are shown in Table 1. As can be seen from the table, the number of wavelengths selected by CARS and BOSS are 45 and 32 respectively, which reduces the number of wavelengths by 89.84% and 92.78%, while the number of bands selected by CAMM according to the band weight sorting is 12, which reduces the number of wavelengths by 97.29%. Although the classification accuracy of the CAMM algorithm is reduced by 1.11% and 1.77% in the training set and the test set respectively compared with the full band, it is much higher than the classification accuracy of the CARS and BOSS algorithms, and it is obvious that CAMM screens fewer characteristic wavelengths, indicating that CAMM has achieved better classification results while selecting fewer characteristic bands. The reason for this may be that CARS and BOSS did not completely eliminate redundant wavelengths, and eliminated some weak characteristic wavelengths, resulting in a decrease in model accuracy. In addition, the two algorithms use the absolute values of RMSECV and RC as evaluation indicators to search for feature band subsets with the minimum RMSECV and maximum RC absolute values. This band selection process based on extreme value search has a certain degree of randomness, requiring researchers to continuously conduct experiments to select the best feature band subset, which has great instability and increases the amount of calculation. The neural network structure of CAMM can fully learn the nonlinear relationship between bands, and in the iterative process, continuously increase the weight of important feature bands and reduce the weight of irrelevant or redundant bands, which avoids the uncertainty of randomly dividing feature band subsets. The above analysis results show that CAMM greatly reduces the complexity of the model, shortens the running time of the model, and saves computing resources while ensuring the model effect. Therefore, CAMM can be used as the best feature extraction algorithm for the authenticity discrimination of lotus root starch.
[0108] Table 1. Modeling results of different feature extraction algorithms
[0109]
[0110] 6. Model construction and evaluation
[0111] The previous analysis shows that the characteristic bands extracted by CAMM have better classification effect. Therefore, the characteristic wavelengths selected by CAMM are used to form a characteristic spectrum data set and input into different classification algorithms for further analysis to find the best classification model. When the characteristic band size is 3 to 50 and the band interval is 1, the classification accuracy of the training set and test set of the three classification algorithms, support vector machine (SVM), partial least squares discriminant analysis (PLS-DA) and convolutional neural network (CNN), is calculated. Figure 7 As shown. In the figure, we first discovered an anti-conscious phenomenon, that is, the accuracy does not continue to increase with the increase of the feature band subset. At the beginning, as the feature band increased, the accuracy of the training set and test set under the three algorithms increased to a certain extent, but when the feature band size increased to 35, the accuracy tended to slowly decrease. This phenomenon can be called the Hughes phenomenon, that is, when the feature dimension increases, the classification accuracy will increase, but when it increases to a certain critical value, if the dimension continues to increase, the classification accuracy will decrease. The reason for this phenomenon may be that when the feature band subset is small, they are all significant feature bands with large band weights, which can help improve the model classification accuracy, but when the size of the feature band subset reaches a certain number, the added band weights are small, the characteristics are weak, and the improvement on the model effect is not large. They are even redundant and irrelevant interference bands, which affect the model classification accuracy and bring side effects. Continue to observe Figure 7 In the figure, a is the SVM processing result, b is the PLS-DA processing result, and c is the CNN processing result. Comparative analysis shows that both SVM and CNN show the best classification performance when the feature band subset size is 35, while PLS-DA achieves the best performance when the feature band subset size is 12. Although PLS-DA requires the smallest feature band to achieve the best classification performance, CNN has a higher classification accuracy than PLS-DA under the same feature band size. In order to further analyze the classification effects of the three classification algorithms, the test set confusion matrix when each of them achieves the best classification performance is plotted (as shown in Figure 8 As shown in the figure, the value of the chromaticity bar represents the number of samples. Figure a is the test set confusion matrix under the best classification effect of SVM, b is the test set confusion matrix under the best classification effect of PLS-DA, and c is the test set confusion matrix under the best classification effect of CNN), as well as the corresponding detailed classification results (Table 2). Figure 8 From the results in Table 2, we can see that only one sweet potato starch sample was misclassified as a corn starch sample by CNN, and all other categories were correctly classified, with an overall accuracy of 99.69%, which is much higher than the support vector machine (SVM) and partial least squares discriminant analysis (PLS-DA). Considering that the classification effect of CNN is better than that of SVM and PLS-DA, the convergence and effectiveness of CNN will be further analyzed.
[0112] Table 2. Processing results of different classification models
[0113]
[0114] Convolutional neural network (CNN) is a feedforward neural network with a convolutional structure. As one of the representative algorithms of deep learning, CNN has a stronger ability to capture the features of input data compared with other traditional machine learning models. The present invention considers the input data size, model calculation rate and classification effect, and designs a lightweight 1D-CNN deep learning model to complete the classification task of the present invention. Fig. 9 As shown in the figure, the model mainly contains two one-dimensional convolutional layers Conv1 and Conv2, a flattening layer Flaten and three fully connected layers FC1, FC2 and FC3. A one-dimensional spectrum with S bands of C is input into the network. Each one-dimensional spectrum vector of size C×1 is expressed as 1@ C×1. First, the local features of the one-dimensional spectrum are extracted through the first one-dimensional convolutional layer Conv1 to obtain 16 feature maps of size C / 2×1, expressed as 16@ C / 2×1. These feature maps are further extracted through the second one-dimensional convolutional layer Conv2 to obtain 32 feature maps of C / 4×1, expressed as 32@ C / 4×1. Then, the 32 feature maps are flattened into a feature vector of length 32×C / 4. The flattened one-dimensional feature vector is connected to all local features through three fully connected layers FC1, FC2, and FC3 in turn. The output is converted into the probability distribution of five output categories, namely sweet potato starch (H), cassava starch (M), lotus root starch (O), potato starch (T), and corn starch (Y), through the Softmax activation function. As shown in the figure, represents the number of samples, so Representative Samples ( , ,......, , a total of S samples), thereby realizing the recognition and classification of different starches. The Softmax activation function can be expressed as:
[0115] ,
[0116] In the formula, represents the output of the Softmax activation function, represents the input feature value, Indicates Class, Indicates total A class.
[0117] In addition, each convolutional layer and fully connected layer uses the ReLU activation function. Because the ReLU function does not have complex exponential operations, it can improve computational efficiency and converge faster. Its function formula is:
[0118] f ( x ) = max (0, x ),
[0119] In the formula, f ( x ) represents the output of the ReLU activation function; x Represents the input feature value; max (0, x ) means taking the maximum value between the input value and zero.
[0120] The present invention trains CNN for 100 iterations based on the 35 feature bands selected by CAMM, and plots the loss change curve and the test set accuracy change curve during the training process, as shown in Figure 2. Fig.10 As shown in the figure, it can be seen that CNN converges quickly and reaches convergence after about 40 iterations. At the same time, the accuracy of the test set increased from the initial 80.88% to 98.84%, and then gradually stabilized, fluctuating around 99%, and finally reached a classification accuracy of 99.69%, indicating that CNN has excellent training effects and can effectively learn the characteristics of input spectral data.
[0121] In summary, in the present invention, CAMM has more distinguishing characteristics than the characteristic wavelengths extracted by CARS and BOSS, and the characteristic information is more obvious, which can bring better classification effect to the model. At the same time, CNN has higher classification accuracy than SVM and PLS-DA, and better classification effect. Therefore, the deep learning network model CAMM-CNN is selected as the best classification model of the present invention. The best classification performance of CAMM-CNN selects 35 bands with the largest band weights, accounting for only 7.9% of the full band, and the classification accuracy of the model training set and test set reaches 100% and 99.69% respectively.
[0122] 7. Visualization of adulterated samples
[0123] The established deep learning network model CAMM-CNN can not only use spectral data to identify pure lotus root powder and other pure starches, but also visualize adulterated samples in the spatial dimension through two-dimensional images in hyperspectral data. The present invention adds potato starch to the binary mixed adulterated sample, then adds corn starch to prepare a ternary mixed adulterated sample, then adds sweet potato starch to form a quaternary mixed adulterated sample, and finally adds cassava starch to obtain a quinary mixed adulterated sample. By extracting the spectral data of all pixels of the adulterated sample, it is input into the trained deep learning network model to obtain the category to which each pixel belongs. In order to intuitively display the classification results, different colors are assigned to pixels of different categories, and they are presented in a pseudo-color image according to the coordinate information of each pixel, thereby realizing the visual analysis of the adulterated sample.
[0124] refer to Fig.11 , showing pseudo-color images of 20 mixed adulterated samples, where white pixels represent pure lotus root powder, green pixels represent potato starch, blue pixels represent corn starch, purple pixels represent sweet potato starch, and orange pixels represent cassava starch. 0.2%, 0.4%, 0.6%, 0.8%, and 1.0% represent the concentrations of other starches added, respectively. Columns a, b, c, and d in the figure are pseudo-color images of one, two, three, and four other starches added, respectively, namely a: potato starch; b: potato starch and corn starch; c: potato starch, corn starch, and sweet potato starch; d: potato starch, corn starch, sweet potato starch, and cassava starch. From the visualization results, the number of adulterant pixels increases with the increase of adulteration concentration, indicating that the deep learning model can accurately identify adulterants in lotus root powder. In addition, the mixed adulterated samples with the lowest adulteration concentration of 0.2% were also successfully identified as having other starches added by the deep learning network model, demonstrating the great potential of hyperspectral imaging technology combined with deep learning methods to quickly and accurately identify powdered substances.
[0125] Example 2
[0126] This embodiment is based on the design of embodiment 1 and discloses a system for identifying adulteration of lotus root starch. Fig.12 As shown, the system implements the above-mentioned adulteration identification method, and at least includes:
[0127] The data acquisition module is configured to obtain a hyperspectral image of a lotus root starch sample and obtain a corresponding corrected hyperspectral image through black and white correction; wherein the lotus root starch sample includes a pure lotus root starch sample and an adulterated sample, and the adulterated sample is a sample in which other starches are added to the pure lotus root starch sample;
[0128] The abnormal elimination module is configured to use an isolation forest algorithm to eliminate abnormal data in each type of starch spectral data, and retain the remaining spectral data as normal starch sample spectral data;
[0129] A feature extraction module is configured to select a CAMM in a deep learning framework to extract characteristic wavelengths from the preprocessed spectral data to obtain characteristic spectral data after eliminating redundant wavelengths;
[0130] The classification and discrimination module is configured to use CNN in the deep learning framework as the classification and discrimination model. The labels and characteristic spectral data of pure lotus root powder and other added starches are input into the model, and the spectral data are randomly divided into training set and test set in a ratio of 8:2. After model training, the model classification confusion matrix is output, and the classification result is obtained through the classification accuracy displayed by the confusion matrix.
[0131] The visualization module is configured as the trained deep learning network model CAMM-CNN to identify the starch category of each pixel in the hyperspectral image of the adulterated sample, assign different colors to pixels of different categories, and present them in a pseudo-color image based on the coordinate information of each pixel, thereby realizing the visualization analysis of the adulterated sample.
[0132] Example 3
[0133] This embodiment is based on the design basis of Embodiments 1 and 2, and discloses a computer-readable storage medium, which stores a program. The program can be executed by one or more processors to implement the above-mentioned system for identifying adulterated lotus root powder.
[0134] In the absence of conflict, the above embodiments and features in the embodiments may be combined with each other.
[0135] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for identifying adulteration of lotus root starch, characterized in that: The specific steps include: S1. Using a hyperspectral imaging system to collect hyperspectral images of pure lotus root starch samples, other starch samples and adulterated samples in the short-wave near-infrared region by pushing broom linear scanning, the spectral band range for collection is 900-1700nm, and black and white correction processing is performed; the adulterated sample is a sample in which other starch is added to the pure lotus root starch sample; The other starch added to the adulterated sample includes at least one of corn starch, potato starch, sweet potato starch or cassava starch; the collected spectral data is subjected to black and white correction, and the formula of black and white correction is shown as follows: , in, Corrected spectral image; Raw hyperspectral images; Cover the dark reference image acquired by the lens; The collected standard whiteboard image; S2, using the Otsu algorithm for the sample and background in the hyperspectral image of the adulterated sample after segmentation correction, and extracting the sample spectral data after segmentation of the background; randomly dividing the circular region of interest into pixel points for the pure lotus root starch sample and other starch samples added therein, and obtaining the spectral data of each pixel of the sample in the region of interest; Each sample of the pure lotus root starch sample and other starch samples mixed with it was randomly divided into 40 circular ROIs with pixels as the unit, and the radius of each ROI was 10 pixels. The spectral curve was obtained by calculating the average spectral value of all pixels in the ROI, thereby obtaining the spectral curve of each type of pure starch; S3, using the isolation forest algorithm to remove abnormal sample spectral data to obtain normal spectral data, specifically: removing the front 33 bands and the last 36 bands in the whole band, thereby retaining 443 bands between 940nm and 1675nm, and then using the IF algorithm to remove abnormal data in the spectral data; S4, using the channel attention module in the deep learning framework to extract the representative characteristic wavelength part in the spectral data to obtain characteristic spectral data; The channel attention module is represented as a function , its input is Sample A full-band spectrum vector set composed of spectral bands , as a A numeric matrix of size , The rows represent the number of samples. The column represents the number of spectral bands; the channel attention module will fully learn the nonlinear relationship between the bands and output a non-negative band weight tensor , as a A numeric matrix of size , Each value in the column represents the band weight of each spectral band. is the symbol of the real number set, representing the full-band spectrum vector set Each value in is a real number, and its expression is: , In the formula, Represents the trainable parameters involved in the channel attention module; The Sigmoid function is used as the activation of the output layer in the channel attention module, and its expression is: , In the formula, Represents the output of the Sigmoid function; Indicates the band weight; According to the learned band weights, the feature band is determined by averaging the band weights of all input samples. The average weight of the j-th band is calculated as: , In the formula, Indicates The average weight of the bands, is the number of training samples; For the The sample The band weights of the bands; Finally, the bands are sorted according to the average weights, and the first C bands with the highest average weights are selected as feature bands to form a feature spectrum vector subset. ; S5, further inputting the characteristic spectrum data obtained in step S4 and the sample labels of different types into the convolutional neural network module in the deep learning framework for classification and recognition, so as to achieve accurate classification of the pure lotus root starch sample and the mixed other starch samples, The convolutional neural network module mainly includes two one-dimensional convolutional layers Conv1 and Conv2, a flattening layer Flaten and three fully connected layers FC1, FC2 and FC3. A one-dimensional spectrum with S bands of C is input into the network. Each one-dimensional spectrum vector with a size of C×1 first passes through the first one-dimensional convolutional layer Conv1 to extract the local features of the one-dimensional spectrum, and obtains 16 feature maps with a size of C / 2×1. These feature maps are further extracted through the second one-dimensional convolutional layer Conv2 to obtain 32 feature maps of C / 4×1. Then, the 32 feature maps are flattened into a feature vector with a length of 32×C / 4. The flattened one-dimensional feature vector is sequentially connected through three fully connected layers FC1, FC2, and FC3 to connect all local features. The output is converted into the probability distribution of five output categories of sweet potato starch, cassava starch, lotus root starch, potato starch and corn starch through the Softmax activation function. The Softmax activation function can be expressed as: , In the formula, represents the output of the Softmax activation function, represents the input feature value, Indicates Class, Indicates total Class; In addition, each convolutional layer and fully connected layer uses the ReLU activation function, whose function formula is: f ( x ) = max (0, x ), In the formula, f ( x ) represents the output of the ReLU activation function; x Represents the input feature value; max (0, x ) means taking the maximum value between the input value and zero; S6. Input the hyperspectral image data of the adulterated sample into the trained deep learning network model, assign different colors to different categories of pixels in the hyperspectral image of the adulterated sample, and present them in a pseudo-color image according to the coordinate information of each pixel, so as to realize the visual analysis of the adulterated sample. The adulterated samples contained at least 0.2% of other starches in lotus root powder, and at most four types of other starches.
2. A system for identifying adulteration of lotus root starch, characterized in that: The system is used to implement the method for identifying adulteration of lotus root starch as described in claim 1, and at least includes: The data acquisition module is configured to acquire hyperspectral images of pure lotus root starch samples, samples with other starch added, and adulterated samples, and acquire corresponding corrected hyperspectral images through black and white correction; the adulterated samples are samples with other starch added to the pure lotus root starch samples; The abnormal elimination module is configured to use an isolation forest algorithm to eliminate abnormal data in each type of starch spectral data, and retain the remaining spectral data as normal starch sample spectral data; A feature extraction module is configured to select a channel attention module in a deep learning framework to extract characteristic wavelengths from the preprocessed spectral data to obtain characteristic spectral data after eliminating redundant wavelengths; The classification and discrimination module is configured to use the convolutional neural network in the deep learning framework as the classification and discrimination model, input the labels and characteristic spectral data of the pure lotus root starch sample and other starch sample added into the model, and randomly divide the spectral data into a training set and a test set at a ratio of 8:
2. After the model training output, the model classification confusion matrix is obtained, and the classification result is obtained through the classification accuracy displayed by the confusion matrix; The visualization module is configured as a trained deep learning network model to identify the starch category of each pixel in the hyperspectral image of the adulterated sample, assign different colors to pixels of different categories, and present them in a pseudo-color image based on the coordinate information of each pixel, thereby realizing a visual analysis of the adulterated sample.
3. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program, and the program can be executed by one or more processors to implement the method for identifying adulteration of lotus root starch as described in claim 1.
