Construction method, system and application of micro-plastic infrared spectrum recognition model
By constructing a microplastic identification model that combines Fourier transform infrared spectroscopy and deep learning, and by optimizing feature extraction using Grad-CAM and multi-scale attention mechanisms, the problem of low accuracy in microplastic identification was solved, achieving efficient identification of various mixed microplastics and improving technical support for environmental monitoring and public health prevention and control.
Patent Information
- Application Number
- CN202511371080.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-24
- Publication Date
- 2026-02-10
AI Technical Summary
Existing technologies have low accuracy in infrared spectroscopy identification of microplastics and lack research on various mixed microplastics. Traditional methods rely on manual feature selection or dimensionality reduction, which leads to loss of feature information.
A microplastic infrared spectroscopy recognition model was constructed. Spectral data was obtained through Fourier transform infrared spectroscopy and recognition was performed using deep learning algorithms. The VGG spectral recognition model was used for training, and gradient weighted class activation mapping (Grad-CAM) technology was introduced to optimize the model structure and feature extraction. Multi-scale and multi-head attention mechanisms were adopted to improve recognition accuracy.
It significantly improves the accuracy and stability of infrared spectral identification of microplastics, enabling rapid and accurate identification of various mixed microplastics and enhancing environmental monitoring and public health control capabilities.
Smart Images

Figure CN121506301A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of spectral analysis and machine learning technology, specifically to a method, system, and application for constructing a microplastic infrared spectral recognition model that combines deep learning with class activation mapping. Background Technology
[0002] Microplastics are broadly defined as plastic particles with a diameter of less than 5 mm. Types of microplastics include polyethylene (PE), polypropylene (PP), polyamide (PA), polystyrene (PS), polyvinyl chloride (PVC), polycarbonate (PC), polyethersulfone (PES), and polyethylene terephthalate (PET). Microplastics not only pollute the environment but also pose a threat to human health. Therefore, establishing rapid and accurate methods for the detection and identification of microplastics is of significant practical importance for infectious disease early warning and control, and for protecting the global environment. With increasing attention paid to global environmental and public health issues, the detection and identification of microplastics has become a hot research area. While scholars both domestically and internationally have achieved many valuable research results in this field, there is still considerable room for development in detection and identification technologies. Currently, the main detection methods for microplastics in environmental media include visual methods, spectroscopic methods, and thermal analysis. Visual methods cannot distinguish polymer types, cannot be automated, and are very time-consuming. Spectroscopic methods are mainly divided into Raman spectroscopy and Fourier transform infrared (FTIR) spectroscopy. Raman spectroscopy is a non-destructive technique for analyzing microplastics, and its analytical process is basically similar to that of FTIR, identifying microplastics by obtaining the functional group spectrum of the polymer. The most widely used thermal analysis techniques include pyrolysis gas chromatography-mass spectrometry (Py-GC-MS), thermal extraction-thermal desorption gas chromatography-mass spectrometry (TED-GC-MS), and thermogravimetric analysis differential scanning calorimetry (TGA-DSC). Py-GC-MS and TED-GC-MS identify microplastics by analyzing the mass spectra of the thermal degradation products of plastics. These two methods are highly sensitive but somewhat destructive to the sample and cannot provide information on the morphology and size of the plastic sample. Given the subjectivity and time-consuming nature of visual inspection, and the destructive nature of thermal analysis, spectroscopic techniques can not only identify the polymer components of microplastics but also analyze their morphological characteristics, while also being non-destructive, efficient, and high-throughput. Therefore, spectroscopic techniques are widely used in the detection and research of microplastics. The combination of spectral technology and machine learning for microplastic detection and analysis is also a current research hotspot.
[0003] In summary, scholars both domestically and internationally have conducted extensive research on the detection and identification of microplastics. However, existing research mainly focuses on the identification of individual microplastic samples, lacking studies on mixed microplastics. Furthermore, most methods rely on measuring the spectral data of microplastics and combining it with machine learning. These methods typically depend on manually selecting features or performing dimensionality reduction on the spectral data, increasing the workload and potentially missing useful feature information. In addition, research on using Fourier transform infrared spectroscopy combined with deep learning for microplastic identification is relatively limited. Therefore, this paper proposes a novel infrared spectral identification method for microplastics. This method aims to acquire spectral data of microplastics using Fourier transform infrared spectroscopy and combine this data with a deep learning algorithm for identification, achieving rapid and accurate identification of microplastics and providing important technical support for environmental monitoring and public health control. Summary of the Invention
[0004] The technical problem to be solved by this invention is: how to solve the problem of low accuracy of infrared spectral identification of microplastics in the prior art.
[0005] A method for constructing an infrared spectral recognition model for microplastics.
[0006] S1. Construct a microplastic sample set, including single-component samples and pairwise mixed samples, and obtain the sample absorbance of each microplastic sample.
[0007] S2. Baseline correction, SG filtering and normalization are performed on the absorbance of the microplastic sample to obtain the absorbance of the microplastic sample after noise reduction.
[0008] S3. Using the absorbance of the denoised microplastic samples, construct a dataset and train the adaptively modified VGG spectral recognition model. Calculate the error between the model's predicted value and the true label using the cross-entropy loss function. Use backpropagation to adjust the parameters by calculating the gradient of the loss function with respect to the network parameters. Update the network parameters using optimization algorithms such as gradient descent. Repeat the above steps until the model converges and establish a preliminary recognition model.
[0009] S4. Based on the VGG preliminary identification model, Grad-weighted class activation mapping (Grad-CAM) technology is introduced to construct an interpretable analysis framework. Using the gradient information of the last convolutional feature map of the VGG preliminary identification model, a class activation heatmap is generated to obtain the key spectral regions that the model focuses on in classification decision-making. Through Grad-CAM heatmap analysis, the network structure design and feature extraction strategy of the identification model are optimized.
[0010] S5. Train the optimized model using the microplastic sample absorbance training set until the model converges. Analyze the accuracy and loss function using the microplastic sample absorbance validation set, and select the spectral recognition model with the highest accuracy as the target recognition model.
[0011] Furthermore, in step S3, the adaptively modified VGG spectral recognition model includes: replacing the two-dimensional convolutional kernel of VGG with a one-dimensional convolutional kernel, increasing the number of network layers, and adopting a strategy of fixed multi-scale convolutional kernel size, which is set to 7, 5 and 3 respectively, extracting spectral features sequentially from larger scale to smaller scale, including 3 convolutional layers, 3 pooling layers and 2 fully connected layers.
[0012] Furthermore, in step S3, the cross-entropy loss function is expressed using the following logic:
[0013]
[0014] In the formula, Y i For the true value, is the predicted value, and m is the number of training samples.
[0015] Furthermore, in step S3, the gradient descent and other optimization algorithms are expressed using the following logic:
[0016]
[0017] In the formula, W l b represents the weight of the current layer. l The current layer bias is α, where α is a coefficient.
[0018] Furthermore, in step S4, VGG initially identifies the gradient information of the last convolutional feature map of the model as follows:
[0019]
[0020] In the formula, Representing feature map A k The value at position (i,j); the gradient represents the feature map A. k The impact of each element in feature map A on the predicted score of target category c; in order to quantify feature map A k The gradient is then subjected to global average pooling to assess the overall contribution of category c, resulting in feature map A. k weight
[0021]
[0022] In the formula, Z is the normalization factor. Representing feature map A k The degree of importance to target category c.
[0023] Furthermore, in step S4, optimizing the network structure design and feature extraction strategy of the recognition model includes: adopting a multi-scale feature extraction structure, introducing three different sizes of parallel convolutional kernels 3×1, 7×1, and 15×1 in the feature extraction stage. Among them, the small-sized convolutional kernel focuses on extracting local fine features such as peak position and shape, the medium-sized convolutional kernel is used to identify the distribution pattern of feature peak groups, and the large-sized convolutional kernel is responsible for obtaining spectral correlation information over a larger range.
[0024] Furthermore, in step S4, optimizing the network structure design and feature extraction strategy of the recognition model also includes: using a multi-head attention mechanism to learn the correlation of spectral features from different subspaces. The number of attention heads in the multi-head attention mechanism is set to 4, the spectrum is divided into 5 equal-width regions, and attention weights are calculated in each region to enhance the model's sensitivity to local features. Regional importance weights are generated through fully connected layers, and regional weights are combined with regional importance weights to form a global feature representation.
[0025] Furthermore, in step S5, the accuracy rate is calculated using the following logic:
[0026]
[0027] In the formula: TP, TN, FP, and FN represent the number of true positive, true negative, false positive, and false negative samples, respectively.
[0028] This invention also provides a system for constructing a microplastic infrared spectral recognition model, comprising:
[0029] Sample set construction module: Constructs microplastic sample sets, including single-component samples and pairwise mixed samples, and obtains the sample absorbance of each microplastic sample;
[0030] Data processing module: performs baseline correction, SG filtering and normalization on the absorbance of microplastic samples to obtain the absorbance of microplastic samples after noise reduction;
[0031] Preliminary identification model training module: Using the absorbance of the denoised microplastic sample, a dataset is constructed to train the adaptively modified VGG spectral identification model. The error between the model's predicted value and the true label is calculated using the cross-entropy loss function. Backpropagation is used to adjust the parameters by calculating the gradient of the loss function with respect to the network parameters. Optimization algorithms such as gradient descent are used to update the network parameters. The above steps are repeated until the model converges, and a preliminary identification model is established.
[0032] Model optimization module: Based on the VGG preliminary identification model, the gradient-weighted class activation mapping (Grad-CAM) technology is introduced to build an interpretable analysis framework. The gradient information of the last convolutional feature map of the VGG preliminary identification model is used to generate a class activation heatmap, which reveals the key spectral regions that the model focuses on in classification decision-making. Through Grad-CAM heatmap analysis, the network structure design and feature extraction strategy of the identification model are optimized.
[0033] Target recognition model training module: The optimized model is trained using the absorbance training set of microplastic samples until the model converges. The accuracy and loss function are analyzed using the absorbance validation set of microplastic samples, and the spectral recognition model with the highest accuracy is selected as the target recognition model.
[0034] The present invention also provides a target recognition model constructed using the above-described model construction method to identify the infrared spectrum of microplastics.
[0035] Compared with existing technologies, this invention has the following advantages: The invention preprocesses the collected microplastic spectral data, then inputs the processed spectral data into an improved VGG model for training. Grad-CAM technology is used to perform interpretability analysis on the improved VGG model, generating a class activation heatmap. Then, multi-head attention and multi-scale attention mechanisms are employed to optimize the model. The optimized model is trained using the training set, and the optimal parameters are determined using the validation set. Finally, the training effect is verified using the test dataset, achieving accurate identification of microplastic infrared spectra. Compared with traditional methods, this invention significantly improves the accuracy and stability of microplastic infrared spectral identification, providing a new technical method for rapid detection and identification of microplastics. It has significant scientific and application value for improving my country's environmental monitoring level of new pollutants, perfecting the environmental monitoring technology system for new pollutants, and studying the impact mechanisms of microplastics on the environment and health.
[0036] This invention solves the technical problem of low accuracy and stability in microplastic identification based on existing Fourier transform infrared spectroscopy technology. Attached Figure Description
[0037] Figure 1 This is a schematic diagram of the basic steps of a deep learning-based infrared spectral identification method for microplastics using class activation mapping, according to Embodiment 1 of the present invention.
[0038] Figure 2 This is a schematic diagram of the absorbance of PE after removing the ambient air background in Embodiment 1 of the present invention;
[0039] Figure 3 This is a schematic diagram of the baseline-corrected PE absorbance in Embodiment 1 of the present invention;
[0040] Figure 4This is a schematic diagram of the absorbance of PE after SG filtering in Embodiment 1 of the present invention;
[0041] Figure 5 This is a schematic diagram of the normalized absorbance of PE in Embodiment 1 of the present invention;
[0042] Figure 6 This is a preliminary VGG spectral identification model architecture design diagram of Embodiment 1 of the present invention;
[0043] Figure 7 This is a design diagram of the Grad-CAM network architecture of Embodiment 1 of the present invention;
[0044] Figure 8 The heat map of the PE sample in Example 1 of this invention is provided.
[0045] Figure 9 The training set and test set loss and accuracy training curves of the optimized model in Embodiment 1 of the present invention are shown.
[0046] Figure 10 This is a schematic diagram of the test set confusion matrix of the optimized model in Embodiment 1 of the present invention;
[0047] Figure 11 This is a flowchart illustrating the specific steps of the deep learning combined with class activation mapping method for infrared spectral recognition of microplastics according to Embodiment 1 of the present invention. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0049] Example 1
[0050] like Figure 1 As shown, the method for constructing a microplastic infrared spectral recognition model based on deep learning combined with class activation mapping provided by this invention includes the following basic steps:
[0051] S1. Using a Fourier transform infrared (FTIR) spectrometer and an attenuated total reflection (ATR) attachment, the ambient air background spectrum and the infrared absorption spectra of different types of microplastic samples were obtained.
[0052] In this embodiment, the detection and identification targets include six typical microplastics: polyamide (PA), polyethylene (PE), polyethylene terephthalate (PET), polypropylene (PP), polystyrene (PS), and polyvinyl chloride (PVC). Using potassium bromide as a matrix, single-component samples with different mass fractions (1.0%, 2.0%, 4.0%, 6.0%, 8.0%, 10.0%, 99%) and pairwise mixed samples with different ratios (1:1, 1:4, 4:1) are prepared as examples to illustrate the spectral identification process of microplastics using deep learning combined with class activation mapping.
[0053] In this embodiment, the infrared spectral data to be identified is the ATR-FTIR spectrum of microplastics, with a wavelength range including but not limited to: 4000–600 cm⁻¹. -1 Spectral resolution includes, but is not limited to, 4cm. -1 .
[0054] S2. Subtract the ambient air background spectrum from the infrared absorption spectrum of the microplastic sample to obtain the absorbance of the microplastic sample. Then, perform baseline correction, SG filtering and normalization on the absorbance of the microplastic sample to obtain the absorbance of the microplastic sample after noise reduction, so as to reduce spectral noise.
[0055] like Figure 2 As shown in the figure, in this embodiment, the absorbance of different microplastic samples is shown in the figure. Figure 2 In this figure, the horizontal axis represents wavenumber and the vertical axis represents relative light intensity.
[0056] like Figure 3 As shown, in this embodiment, the baseline-corrected PE absorbance is shown below. Figure 3 In this figure, the horizontal axis represents wavenumber and the vertical axis represents absorbance.
[0057] like Figure 4 As shown, the absorbance of PE after SG filtering is shown in the figure. Figure 4 In this figure, the horizontal axis represents wavenumber and the vertical axis represents absorbance.
[0058] like Figure 5 As shown, the normalized absorbance of PE is shown in the figure. Figure 5 In this figure, the horizontal axis represents wavenumber and the vertical axis represents absorbance.
[0059] S3. Using the absorbance of the denoised microplastic samples, construct a dataset. Randomly divide the dataset into training, validation, and test sets in a 7:1.5:1.5 ratio. Establish an adaptively modified VGG spectral recognition model. (See [link to relevant documentation]). Figure 6The model was trained using a training set of absorbance data from microplastic samples. The training process of the VGG network mainly relies on the backpropagation algorithm. At the beginning of training, the weights W and biases b need to be initialized. To ensure efficient model convergence, the weights are typically initialized using a random initialization method based on the number of input features (such as He initialization or Xavier initialization), while the biases are usually initialized to zero. The initialization process can be expressed as:
[0060]
[0061] Where n is the number of input units in the current layer, and N represents a random number generator that follows a normal distribution. Subsequently, the input data X passes through each layer of the VGG network, including convolutional layers, activation layers, pooling layers, and fully connected layers. The specific operations performed in each layer are as follows:
[0062] Z l =W l *A l-1 +b l
[0063] A l =ReLU(Z) l )
[0064] Among them, A [l-1] It is the activation output of the previous layer, Z [l] This is the linear output of the current layer; ReLU is a commonly used activation function. In the convolutional layers, small convolutional kernels (such as a 1D 3×1 convolutional kernel) are used to extract local features while preserving the spatial dimension of the feature map. In the pooling layers, max pooling is performed for downsampling to reduce feature dimension and enhance the model's spatial invariance to the input data. Then, the predicted value Y is calculated. pred The error between the actual label Y and the true label Y.
[0065]
[0066] Next, backpropagation is used to adjust the parameters by calculating the gradient of the loss function with respect to the network parameters, thereby reducing the error. The chain rule is used to propagate the error information forward layer by layer, starting from the output layer. For each layer l, the gradients of the weights and biases are calculated as follows:
[0067]
[0068] Then, optimization algorithms such as gradient descent are used to update the network parameters. For each layer l, the parameter update rule is as follows:
[0069]
[0070] Finally, repeat the above steps until the model converges, thus establishing a preliminary recognition model.
[0071] S4. Based on the initial VGG identification model, Grad-CAM technology is introduced to construct an interpretable analysis framework (see below). Figure 7 By combining the feature map of the last convolutional layer with the gradient information of the target category, a class activation map is generated, revealing the basis for the model's classification decision, and the key spectral regions that the model focuses on are visually displayed in the form of a heatmap.
[0072] Suppose the feature map of the last convolutional layer of the deep learning model is A∈R u×v , where u represents the number of channels in the feature map, and v represents the spatial dimension of each channel. For the target class c of the model, its predicted value is y. c , then y c The gradient with respect to A can be expressed as:
[0073]
[0074] In the formula, Representing feature map A k The value at position (i,j). This gradient represents the feature map A. k The impact of each element in feature map A on the predicted score of target category c. Secondly, to quantify feature map A... k For the overall contribution of class c, Grad-CAM performs global average pooling on the above gradients to obtain feature map A. k weight
[0075]
[0076] In the formula, Z is the normalization factor. Representing feature map A k The greater the weight of the feature map relative to the importance of the target category c, the greater its contribution to the classification result. Next, the calculated weights are... With the corresponding feature map A k By applying linear weighting, a preliminary class activation graph can be obtained:
[0077]
[0078] To ensure that the class activation map retains only regions that positively contribute to the target class, Grad-CAM uses the ReLU function to adjust the M... c Perform nonlinear transformation:
[0079]
[0080] In the formula, ReLu(x) = max(0,x) ensures that negative values in the class activation map are filtered out, retaining only feature regions that have a positive impact on the target class. Finally, the generated class activation map M cUpsampling is typically required to align the model with the input data size. By overlaying the class activation map onto the original input data, a heatmap can be generated, visually displaying the key regions the model focuses on within the input data. See the PE sample contribution heatmap for an example. Figure 8 .
[0081] Grad-CAM heatmap analysis revealed significant limitations in feature weight allocation, with the model focusing too heavily on specific regions. Quantitative analysis of the CAM value distribution showed that while some feature regions were assigned high weights, some potentially critical feature regions were underutilized due to their weights falling below a set threshold. To improve the model's generalization ability and classification accuracy, optimizations are needed in feature extraction and weight allocation mechanisms to ensure the model comprehensively and evenly utilizes the multidimensional information contained in the spectral data.
[0082] A multi-head attention mechanism is employed to learn the correlation of spectral features from different subspaces. With four attention heads, the spectrum is divided into five equally wide regions, and attention weights are calculated for each region, enhancing the model's sensitivity to local features. Region importance weights are generated through a fully connected layer, and these regional weights are combined to form a global feature representation. This mechanism allows the model to fully mine the potential feature information of minor components in the spectrum, improving its ability to identify complex components in mixed samples. It also enhances the model's adaptability and generalization ability to features across the entire spectrum, thus effectively optimizing the performance of spectral analysis tasks.
[0083] S5. Train the optimized model using the microplastic sample absorbance training set until the model converges. Analyze the accuracy and loss function using the microplastic sample absorbance validation set. Select the spectral recognition model with the highest accuracy as the target recognition model. Evaluate the target recognition model using the microplastic sample absorbance test set to identify the infrared spectrum of the microplastic.
[0084] The accuracy rate is calculated using the following formula:
[0085]
[0086] In the formula: TP, TN, FP, and FN represent the number of true positive, true negative, false positive, and false negative samples, respectively.
[0087] The optimized model exhibits significantly improved learning properties; see [link / reference]. Figure 9The model training process became more stable and efficient. Training and validation accuracy improved rapidly within the first 15 training epochs, rising from approximately 20% to over 80%. They then continued to improve steadily, stabilizing after about 35 epochs. Notably, the fluctuation range of the validation loss curve decreased significantly, indicating that the optimized model has stronger generalization ability. The consistency of performance on the training and validation sets also demonstrates that overfitting was effectively avoided.
[0088] The quantitative analysis results of the confusion matrix can be found in [link to relevant documentation]. Figure 10 The optimized model demonstrated a comprehensive improvement in classification performance. In pure component identification, the accuracy rate for all single microplastic samples approached 100%, indicating a further enhancement in the model's ability to grasp fundamental features. More importantly, it achieved a breakthrough in mixed sample identification: the accuracy rate for previously difficult-to-identify PE&PA and PVC&PA samples increased from approximately 63% to 100%, while the accuracy rate for other mixed samples also exceeded 95%. This improvement directly validates the effectiveness of the multi-level attention mechanism in addressing the problem of imbalanced feature extraction.
[0089] like Figure 11 As shown in this embodiment, the deep learning-based infrared spectral recognition method for microplastics combined with class activation mapping further includes the following specific steps:
[0090] S1', Spectral acquisition;
[0091] S2', Data preprocessing;
[0092] Training of S3' and VGG models;
[0093] S4', Determine if convergence has occurred;
[0094] S5' and Grad-CAM analyses;
[0095] S6', Model optimization;
[0096] S7', Model Training;
[0097] S8', Determine if convergence has occurred;
[0098] S9', Model Validation;
[0099] S10' Classification and recognition.
[0100] In summary, this invention preprocesses the collected microplastic spectral data, then inputs the processed spectral data into an improved VGG model for training. Grad-CAM technology is used to perform interpretability analysis on the improved VGG model, generating a class activation heatmap. Multi-head attention and multi-scale attention mechanisms are then employed to optimize the model. The optimized model is trained using the training set, and the optimal parameters are determined using the validation set. Finally, the training effect is verified using a test dataset, achieving accurate identification of microplastic infrared spectra. Compared with traditional methods, this invention significantly improves the accuracy and stability of microplastic infrared spectral identification, providing a new technical method for rapid detection and identification of microplastics. It has significant scientific and application value for improving my country's environmental monitoring level of new pollutants, perfecting the environmental monitoring technology system for new pollutants, and studying the impact mechanisms of microplastics on the environment and health.
[0101] This invention solves the technical problem of low accuracy and stability in microplastic identification based on existing Fourier transform infrared spectroscopy technology.
Claims
1. A method for constructing an infrared spectral recognition model for microplastics, characterized in that: S1. Construct a microplastic sample set, including single-component samples and pairwise mixed samples, and obtain the sample absorbance of each microplastic sample. S2. Baseline correction, SG filtering and normalization are performed on the absorbance of the microplastic sample to obtain the absorbance of the microplastic sample after noise reduction. S3. Using the absorbance of the denoised microplastic samples, construct a dataset and train the adaptively modified VGG spectral recognition model. Calculate the error between the model's predicted value and the true label using the cross-entropy loss function. Use backpropagation to adjust the parameters by calculating the gradient of the loss function with respect to the network parameters. Update the network parameters using optimization algorithms such as gradient descent. Repeat the above steps until the model converges and establish a preliminary recognition model. S4. Based on the VGG preliminary identification model, Grad-weighted class activation mapping (Grad-CAM) technology is introduced to construct an interpretable analysis framework. Using the gradient information of the last convolutional feature map of the VGG preliminary identification model, a class activation heatmap is generated to obtain the key spectral regions that the model focuses on in classification decision-making. Through Grad-CAM heatmap analysis, the network structure design and feature extraction strategy of the identification model are optimized. S5. Train the optimized model using the microplastic sample absorbance training set until the model converges. Analyze the accuracy and loss function using the microplastic sample absorbance validation set, and select the spectral recognition model with the highest accuracy as the target recognition model.
2. The method for constructing a microplastic infrared spectral recognition model according to claim 1, characterized in that, In step S3, the adaptively modified VGG spectral recognition model includes: replacing the two-dimensional convolutional kernel of VGG with a one-dimensional convolutional kernel, increasing the number of network layers, and adopting a strategy of fixed multi-scale convolutional kernel size, which is set to 7, 5 and 3 respectively, and extracting spectral features from larger scale to smaller scale in sequence, including 3 convolutional layers, 3 pooling layers and 2 fully connected layers.
3. The method for constructing a microplastic infrared spectral recognition model according to claim 1, characterized in that, In step S3, the cross-entropy loss function is expressed using the following logic: In the formula, Y i For the true value, is the predicted value, and m is the number of training samples.
4. The method for constructing a microplastic infrared spectral recognition model according to claim 1, characterized in that, In step S3, the gradient descent and other optimization algorithms are expressed using the following logic: In the formula, W l b represents the weight of the current layer. l The current layer bias is α, where α is a coefficient.
5. The method for constructing a microplastic infrared spectral recognition model according to claim 1, characterized in that, In step S4, VGG initially identifies the gradient information of the last convolutional feature map of the model as follows: In the formula, Representing feature map A k The value at position (i,j); the gradient represents the feature map A. k The impact of each element in feature map A on the predicted score of target category c; in order to quantify feature map A k The gradient is then subjected to global average pooling to assess the overall contribution of category c, resulting in feature map A. k weight In the formula, Z is the normalization factor. Representing feature map A k The degree of importance to target category c.
6. The method for constructing a microplastic infrared spectral recognition model according to any one of claims 1 to 5, characterized in that, In step S4, optimizing the network structure design and feature extraction strategy of the recognition model includes: adopting a multi-scale feature extraction structure, introducing three different sizes of parallel convolutional kernels 3×1, 7×1, and 15×1 in the feature extraction stage. Among them, the small-sized convolutional kernel focuses on extracting local fine features such as peak position and shape, the medium-sized convolutional kernel is used to identify the distribution pattern of feature peak groups, and the large-sized convolutional kernel is responsible for obtaining spectral correlation information over a larger range.
7. The method for constructing a microplastic infrared spectral recognition model according to any one of claims 1 to 5, characterized in that, In step S4, optimizing the network structure design and feature extraction strategy of the recognition model also includes: using a multi-head attention mechanism to learn the correlation of spectral features from different subspaces. The number of attention heads in the multi-head attention mechanism is set to 4, the spectrum is divided into 5 equal-width regions, and attention weights are calculated in each region to enhance the model's sensitivity to local features. Regional importance weights are generated through fully connected layers, and regional weights are combined with regional importance weights to form a global feature representation.
8. The method for constructing a microplastic infrared spectral recognition model according to any one of claims 1 to 5, characterized in that, In step S5, the accuracy rate is calculated using the following logic: In the formula: TP, TN, FP, and FN represent the number of true positive, true negative, false positive, and false negative samples, respectively.
9. A system for constructing a microplastic infrared spectral recognition model, characterized in that: include: Sample set construction module: Constructs microplastic sample sets, including single-component samples and pairwise mixed samples, and obtains the sample absorbance of each microplastic sample; Data processing module: performs baseline correction, SG filtering and normalization on the absorbance of microplastic samples to obtain the absorbance of microplastic samples after noise reduction; Preliminary identification model training module: Using the absorbance of the denoised microplastic sample, a dataset is constructed to train the adaptively modified VGG spectral identification model. The error between the model's predicted value and the true label is calculated using the cross-entropy loss function. Backpropagation is used to adjust the parameters by calculating the gradient of the loss function with respect to the network parameters. Optimization algorithms such as gradient descent are used to update the network parameters. The above steps are repeated until the model converges, and a preliminary identification model is established. Model optimization module: Based on the VGG preliminary identification model, the gradient-weighted class activation mapping (Grad-CAM) technology is introduced to build an interpretable analysis framework. The gradient information of the last convolutional feature map of the VGG preliminary identification model is used to generate a class activation heatmap, which reveals the key spectral regions that the model focuses on in classification decision-making. Through Grad-CAM heatmap analysis, the network structure design and feature extraction strategy of the identification model are optimized. Target recognition model training module: The optimized model is trained using the absorbance training set of microplastic samples until the model converges. The accuracy and loss function are analyzed using the absorbance validation set of microplastic samples, and the spectral recognition model with the highest accuracy is selected as the target recognition model.
10. The target recognition model constructed using the model building method according to any one of claims 1 to 9 identifies the infrared spectrum of microplastics.