A classification method for identifying biological samples based on infrared spectroscopy

CN122548449APending Publication Date: 2026-08-11BEIJING INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-27
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

此外,实际采集的样本往往存在类别不平衡问题,这些问题限制了红外光谱技术在生物样本分类中的直接应用

Benefits of technology

[0041]1、解决样本不均衡: 通过SMOTE等数据增强技术,有效扩增了少数类样本,显著提升了模型对小样本疾病类别的识别敏感性和整体泛化性能。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122548449A_ABST
    Figure CN122548449A_ABST
Patent Text Reader

Abstract

The application discloses a classification method for identifying biological samples based on infrared spectrum, and belongs to the technical field of classification detection of biological sample spectrum data.The application realizes the method as follows: 1, forming a biological sample spectrum; 2, generating a biological sample spectrum feature; 3, forming a principal component matrix; 4, generating an enhanced training sample; 5, sequentially training a support vector machine, a random forest, an integrated tree, a K nearest neighbor and a majority vote fusion model by using the enhanced training sample, and taking the model with the maximum classification accuracy obtained through five-fold cross validation as a trained model; 6, obtaining a classification result; 7, batch calling an encapsulated model to perform blind sample classification detection on unknown biological samples, and obtaining biological sample classification results containing but not limited to pancreatitis, calculus, occupying lesion, jaundice and inflammation; compared with the prior art, the application solves the technical problems of spectrum classification relying on manual processing, sample category imbalance and poor model generalization ability in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a classification method for biological samples based on infrared spectroscopy, belonging to the field of classification and detection technology of biological sample spectral data, and is applicable to the classification and detection of biological samples. Background Technology

[0002] Rapid and accurate classification of biological samples is of great significance in disease diagnosis and pathological research sample classification. Traditional biological sample classification methods mostly rely on pathological sections, biochemical index analysis, and immunological detection. These methods are usually complex and time-consuming, and have high requirements for sample volume and quality, making them difficult to meet the needs of large-scale screening and rapid diagnosis.

[0003] Fourier transform infrared spectroscopy (FTIR) has gained widespread attention in biological sample analysis in recent years due to its non-destructive, rapid, highly sensitive, and label-free advantages. Biological macromolecules such as proteins, lipids, and nucleic acids in biological samples exhibit characteristic absorption peaks in the infrared band. Samples in different pathological states exhibit differences in their infrared spectra, thus allowing for sample classification through spectral analysis. However, Fourier transform infrared spectral data often suffers from high dimensionality, high noise, and feature overlap, making direct classification and identification challenging. Traditional spectral classification methods typically rely on manual extraction of characteristic peaks or simple chemometric methods, which are not only inefficient but also highly dependent on operator experience, exhibiting strong subjectivity and hindering automated, high-throughput, and accurate classification. Furthermore, the actual samples collected often suffer from class imbalance, further limiting the direct application of infrared spectroscopy in biological sample classification.

[0004] Therefore, how to combine Fourier transform infrared spectroscopy with machine learning to solve the problems of spectral classification relying on manual processing, sample class imbalance, and poor model generalization ability in existing technologies has become an urgent issue to be addressed. Summary of the Invention

[0005] The purpose of this invention is to overcome the shortcomings of existing technologies in the field of biological sample spectral data classification, and to provide an automatic classification method for biological samples based on Fourier transform infrared spectroscopy, so as to achieve rapid and accurate automatic classification of biological samples.

[0006] The objective of this invention is achieved through the following technical solution:

[0007] This invention discloses a classification method for biological samples based on infrared spectroscopy, comprising the following steps:

[0008] Step 1: Collect FTIR spectral data of biological samples using Fourier transform infrared spectroscopy, covering the wavelength range from 500 cm⁻¹ to 5000 cm⁻¹, with each sample containing 5846 wavelength points to form the biological sample spectrum;

[0009] Step 1.1: For the original biological samples, Fourier transform infrared spectroscopy was used to collect biological samples in the infrared band range of 500 cm⁻¹ to 5000 cm⁻¹, with each sample containing 5846 wavelength points;

[0010] Step 1.2: Repeat the process described in Step 1.1 to collect and average the original biological samples in batches to form biological sample spectra. Integrate the spectral data of different samples into a unified data matrix to form a sample spectrum set.

[0011] Step 2: After removing outliers from the sample spectral set using Z-score and smoothing and denoising using Savitzky-Golay filtering, baseline correction is performed using polynomial fitting, and after Z-score standardization, biological sample spectral features are generated.

[0012] Step 2.1: Perform outlier detection and processing on the spectral data. Use the Z-score method to remove outliers with |Z|>3, where Z is the number of standard deviations of an observation from the mean. The formula for Z-score is:

[0013] Z = (x - μ) / σ (1)

[0014] x is the original data point; μ is the mean of the dataset; σ is the standard deviation of the dataset.

[0015] Step 2.2: Smooth the spectrum using Savitzky-Golay filtering to remove high-frequency noise;

[0016] Step 2.3: Use polynomial fitting to perform baseline correction and eliminate spectral baseline drift;

[0017] Step 2.4: After Z-score standardization of the preprocessed spectral data, the spectral characteristics of the biological samples are generated, with a mean of 0 and a standard deviation of 1.

[0018] Step 3: Screen the characteristic wavelengths of the biological sample spectral features by setting a variance threshold, and combine them with principal component analysis to reduce the dimensionality of the spectral data features and form a principal component matrix;

[0019] Step 3.1: Calculate the variance of the spectral data at each wavelength point, set the variance threshold to 0.01, and filter out the characteristic wavelengths that are higher than the threshold to achieve preliminary feature selection;

[0020] Step 3.2: Principal component analysis (PCA) is used to reduce the dimensionality of the screened spectral features, retaining 95% of the cumulative variance to form a principal component matrix;

[0021] Step 4: After performing data augmentation and class sample size folding on the biological sample spectra using synthetic minority class oversampling and target ratio methods respectively, principal component analysis is used to re-transform the samples to generate enhanced training samples;

[0022] Step 4.1: Use the Synthetic Minority Oversampling Technique (SMOTE) to augment the biological sample spectra and generate training samples;

[0023] Step 4.2: Use the target ratio method to fold increase the sample size of the biological sample spectrum by category;

[0024] Step 4.3: The training samples are transformed again using Principal Component Analysis (PCA) to generate enhanced training samples by multiplying the sample size of each category.

[0025] Step 5: Use enhanced training samples to train the support vector machine, random forest, ensemble tree, K-nearest neighbors and majority voting fusion model in sequence, and use the model that obtains the maximum classification accuracy through five-fold cross-validation as the trained model;

[0026] Step 5.1: Use support vector machine, random forest, ensemble tree, K-nearest neighbors and majority voting fusion model as training models, and train the training models in sequence using augmented training samples;

[0027] Step 5.2: Use five-fold cross-validation as shown in equation (2) to obtain the classification accuracy of the training model on enhanced training samples;

[0028] (2)

[0029] Indicates the first Model performance metrics computed on the validation set; =1,2,…,5 corresponds to five independent training / validation processes.

[0030] Step 5.3: Take the training model corresponding to the maximum classification accuracy as the trained model;

[0031] Step 6: Use biological sample spectra to obtain classification results through the trained model, and encapsulate the model after robustness verification;

[0032] Step 6.1: Input the biological sample spectrum into the trained model to obtain the classification result;

[0033] Step 6.2: Validate the robustness of the trained model using five-fold cross-validation, recall, and F1 score;

[0034] Step 6.3: Encapsulate the model parameters, preprocessing parameters, feature masks, PCA transformation matrix, and class mapping table that have passed the robustness verification;

[0035] Step 7: Batch-by-blindly classify and detect unknown biological samples using the encapsulation model to obtain classification results for biological samples including, but not limited to, pancreatitis, stones, space-occupying lesions, jaundice, and inflammation;

[0036] Step 7.1: Load the trained model package and extract the preprocessing parameters, feature mask, and PCA transformation matrix;

[0037] Step 7.2: Perform the same preprocessing and feature processing procedures on the spectra of the new unknown samples;

[0038] Step 7.3: Use the encapsulated model for classification, and output the predicted label, confidence score, and probability distribution of each category;

[0039] Step 7.4: Output the generated prediction results table;

[0040] Compared with existing technologies, it has the following beneficial effects:

[0041] 1. Addressing sample imbalance: Through data augmentation techniques such as SMOTE, minority class samples are effectively amplified, significantly improving the model's sensitivity to identifying disease categories with small sample sizes and its overall generalization performance.

[0042] 2. Precise feature extraction: By filtering the importance of features and using PCA dimensionality reduction, redundant noise is removed and key discriminative spectral features are enhanced, making model learning more efficient and decision-making more interpretable.

[0043] 3. Superior and robust classification performance: By adopting a multi-model fusion strategy, the advantages of different classifiers are integrated. The final model achieves near-perfect classification indicators in five major disease classification tasks, and has high stability and practical clinical application value. Attached Figure Description

[0044] Figure 1 This is a schematic diagram of a classification method for identifying biological samples based on infrared spectroscopy.

[0045] Figure 2 This is a comparison of PCA dimensionality reduction before and after FTIR spectral data enhancement in one embodiment of the present invention (a: original data PCA, b: enhanced data PCA).

[0046] Figure 3This is a schematic diagram showing the order of importance of key wavenumbers in FTIR spectroscopy in one embodiment of the present invention;

[0047] Figure 4 This is a schematic diagram of the confusion matrix of the final classification result in one embodiment of the present invention;

[0048] Figure 5 is a bar chart comparing the performance of multiple models (accuracy, precision, recall, and F1 score). Detailed Implementation

[0049] To better illustrate the purpose and advantages of this invention, the invention will be further described below with reference to the accompanying drawings and examples. It should be noted that the implementation of this invention is not limited to the following embodiments, and any modifications or alterations made to this invention will fall within the scope of protection of this invention.

[0050] Example

[0051] like Figure 1 As shown in the figure, the specific implementation steps of the classification method for biological samples based on infrared spectroscopy in this embodiment are as follows:

[0052] This invention discloses a classification method for biological samples based on infrared spectroscopy, comprising the following steps:

[0053] Step 1: Collect FTIR spectral data of biological samples using Fourier transform infrared spectroscopy, covering the wavelength range from 500 cm⁻¹ to 5000 cm⁻¹, with each sample containing 5846 wavelength points to form the biological sample spectrum;

[0054] Step 1.1: For the original biological samples, Fourier transform infrared spectroscopy was used to collect biological samples in the infrared band range of 500 cm⁻¹ to 5000 cm⁻¹, with each sample containing 5846 wavelength points;

[0055] Step 1.2: Repeat the process described in Step 1.1 to collect and average the original biological samples in batches to form biological sample spectra. Integrate the spectral data of different samples into a unified data matrix to form a sample spectrum set.

[0056] In this embodiment, 26 biological samples collected from a hospital were used as an example. These samples included five types of diseases: pancreatitis, gallstones, space-occupying lesions, jaundice, and inflammation. Specifically, the distribution was as follows: 1 case of pancreatitis, 16 cases of gallstones, 3 cases of space-occupying lesions, 4 cases of jaundice, and 2 cases of inflammation. All samples were confirmed by pathological examination. Fourier transform infrared spectrometers were used to collect the sample spectra at room temperature. The scanning range was 500 cm⁻¹ to 5000 cm⁻¹, and each sample was scanned 20 times to obtain the average spectrum, resulting in 5846 wavelength points for each sample. The spectral data of all samples were integrated into a 26×5846 data matrix.

[0057] Step 2: After removing outliers from the sample spectral set using Z-score and smoothing and denoising using Savitzky-Golay filtering, baseline correction is performed using polynomial fitting, and after Z-score standardization, biological sample spectral features are generated.

[0058] Step 2.1: Perform outlier detection and processing on the spectral data. Use the Z-score method to remove outliers with |Z|>3, where Z is the number of standard deviations of an observation from the mean. The formula for Z-score is:

[0059] Z = (x - μ) / σ (1)

[0060] x is the original data point; μ is the mean of the dataset; σ is the standard deviation of the dataset.

[0061] Step 2.2: Smooth the spectrum using Savitzky-Golay filtering to remove high-frequency noise;

[0062] Step 2.3: Use polynomial fitting to perform baseline correction and eliminate spectral baseline drift;

[0063] Step 2.4: After Z-score standardization of the preprocessed spectral data, the spectral characteristics of the biological samples are generated, with a mean of 0 and a standard deviation of 1.

[0064] In this embodiment, firstly, Z-score outlier detection was performed on the absorbance value at each wavelength point to remove outlier samples with |Z|>3. No obvious outliers were found in this embodiment. Then, Savitzky-Golay convolutional smoothing was used to remove high-frequency noise, with a window width of 11 and a polynomial order of 3. Next, baseline correction was performed using second-order polynomial fitting to eliminate baseline drift. Finally, the corrected spectral data was Z-score standardized to ensure that the mean of each wavelength point was 0 and the standard deviation was 1, resulting in a preprocessed spectral feature matrix (26×5846).

[0065] Step 3: Screen the characteristic wavelengths of the biological sample spectral features by setting a variance threshold, and combine them with principal component analysis to reduce the dimensionality of the spectral data features and form a principal component matrix;

[0066] Step 3.1: Calculate the variance of the spectral data at each wavelength point, set the variance threshold to 0.01, and filter out the characteristic wavelengths that are higher than the threshold to achieve preliminary feature selection;

[0067] Step 3.2: Principal component analysis (PCA) is used to reduce the dimensionality of the screened spectral features, retaining 95% of the cumulative variance to form a principal component matrix;

[0068] In the embodiments, such as Figure 3 As shown, the variance of each wavelength point was calculated, and a variance threshold of 0.01 was set. Wavelength points with variances greater than 0.01 were selected, and the top 20 wavenumbers with the highest importance scores were chosen as key features. The results showed that the key wavenumbers were mainly concentrated in the range of 545 cm⁻¹-3691 cm⁻¹, with importance distributed between 0.05 and 0.25, and no wavenumbers with negative importance. Principal component analysis (PCA) was then performed on the selected features, retaining the principal components with a cumulative variance contribution rate of 95%, resulting in the final principal component matrix.

[0069] Step 4: After performing data augmentation and class sample size folding on the biological sample spectra using synthetic minority class oversampling and target ratio methods respectively, principal component analysis is used to re-transform the samples to generate enhanced training samples;

[0070] Step 4.1: Use the Synthetic Minority Oversampling Technique (SMOTE) to augment the biological sample spectra and generate training samples;

[0071] Step 4.2: Use the target ratio method to fold increase the sample size of the biological sample spectrum by category;

[0072] Step 4.3: The training samples are transformed again using Principal Component Analysis (PCA) to generate enhanced training samples by multiplying the sample size of each category.

[0073] In the embodiments, such as Figure 2As shown, to address the severe imbalance in class sample sizes in the original data, the SMOTE algorithm combined with a target proportioning method was used to oversample minority class samples. The largest class was gallstones (16 cases). According to the target proportioning method, the number of samples in each class was increased to 0.6 times the number of samples in the largest class, i.e., 16 × 0.6 = 9.6, rounded down to 10 cases. Therefore, pancreatitis (1 case) was increased to 10 cases, space-occupying lesions (3 cases) to 10 cases, jaundice (4 cases) to 10 cases, inflammation (2 cases) to 10 cases, while the gallstone class remained unchanged at 16 cases. The oversampling parameter was set to nearest neighbor number k = 5. A total of 56 enhanced samples were obtained (10 + 16 + 10 + 10 + 10). Subsequently, PCA dimensionality reduction was performed on the enhanced spectral data. The 2D score plot showed that the distribution of samples in each class was more concentrated and the inter-class separation was clearer, ultimately yielding the principal component matrix of the enhanced training samples.

[0074] Step 5: Use enhanced training samples to train the support vector machine, random forest, ensemble tree, K-nearest neighbors and majority voting fusion model in sequence, and use the model that obtains the maximum classification accuracy through five-fold cross-validation as the trained model;

[0075] Step 5.1: Use support vector machine, random forest, ensemble tree, K-nearest neighbors and majority voting fusion model as training models, and train the training models in sequence using augmented training samples;

[0076] Step 5.2: Use five-fold cross-validation as shown in equation (2) to obtain the classification accuracy of the training model on enhanced training samples;

[0077] (2)

[0078] Indicates the first Model performance metrics computed on the validation set; =1,2,…,5 corresponds to five independent training / validation processes.

[0079] Step 5.3: Take the training model corresponding to the maximum classification accuracy as the trained model;

[0080] In this embodiment, the 20 selected key wavenumbers are used as input features, and enhanced training samples are used to train the following five classifiers: Support Vector Machine, Random Forest, Ensemble Tree, K-Nearest Neighbors, and Majority Voting Fusion Model. The average classification accuracy of each model is calculated using five-fold cross-validation. The training model corresponding to the highest classification accuracy is taken as the trained model.

[0081] Step 6: Use biological sample spectra to obtain classification results through the trained model, and encapsulate the model after robustness verification;

[0082] Step 6.1: Input the biological sample spectrum into the trained model to obtain the classification result;

[0083] Step 6.2: Validate the robustness of the trained model using five-fold cross-validation, recall, and F1 score;

[0084] Step 6.3: Encapsulate the model parameters, preprocessing parameters, feature masks, PCA transformation matrix, and class mapping table that have passed the robustness verification;

[0085] In the embodiments, such as Figure 4 As shown in Figure 5, the robustness of the trained model was validated using the original data through five-fold cross-validation, recall, and F1 score. Recall and F1 scores were calculated. The results show that the model's F1 score, precision, and recall are all close to 1.0 in each class. The confusion matrix shows that only a few placeholder samples were misclassified as inflammation, and the overall classification errors are extremely few, demonstrating very high classification accuracy and stability. This indicates that the model has good generalization ability. The model parameters, preprocessing parameters, feature masks, PCA transformation matrices, and class mapping tables were encapsulated and saved as a model package file.

[0086] Step 7: Batch-by-blindly classify and detect unknown biological samples using the encapsulation model to obtain classification results for biological samples including, but not limited to, pancreatitis, stones, space-occupying lesions, jaundice, and inflammation;

[0087] Step 7.1: Load the trained model package and extract the preprocessing parameters, feature mask, and PCA transformation matrix;

[0088] Step 7.2: Perform the same preprocessing and feature processing procedures on the spectra of the new unknown samples;

[0089] Step 7.3: Use the encapsulated model for classification, and output the predicted label, confidence score, and probability distribution of each category;

[0090] Step 7.4: Output the generated prediction results table;

[0091] In this embodiment, 10 unknown biological samples were input into the encapsulated model in batches. First, the model package was loaded, and the same preprocessing (SG filtering, baseline correction, standardization), feature selection, and PCA transformation were performed on the original spectra sequentially. Then, predicted labels and probabilities for each category were output. The final classification results, compared with pathological diagnoses, showed that the classification accuracy for pancreatitis, stones, and jaundice reached 100%, while the classification accuracy for space-occupying lesions and inflammation was slightly lower but still remained above 98%. The predicted categories, confidence levels, and key discrimination criteria were output. Through the results obtained above, objective spectroscopic-assisted judgment opinions can be quickly obtained.

[0092] The results show that the method of the present invention can achieve automatic classification of infrared spectra of a small number of biological samples with unbalanced categories. After enhancement by the target ratio method, the model can still achieve automatic classification with high accuracy and high stability, which has important clinical application value.

Claims

1. A classification method for biological samples based on infrared spectroscopy, characterized in that: Includes the following steps, Step 1: Collect FTIR spectral data of biological samples using Fourier transform infrared spectroscopy, covering the wavelength range from 500 cm⁻¹ to 5000 cm⁻¹, with each sample containing 5846 wavelength points to form the biological sample spectrum; Step 2: After removing outliers from the sample spectral set using Z-score and smoothing and denoising using Savitzky-Golay filtering, baseline correction is performed using polynomial fitting, and after Z-score standardization, biological sample spectral features are generated. Step 3: Screen the characteristic wavelengths of the biological sample spectral features by setting a variance threshold, and combine them with principal component analysis to reduce the dimensionality of the spectral data features and form a principal component matrix; Step 4: After performing data augmentation and class sample size folding on the biological sample spectra using synthetic minority class oversampling and target ratio methods respectively, principal component analysis is used to re-transform the samples to generate enhanced training samples; Step 4.1: Use the Synthetic Minority Oversampling Technique (SMOTE) to augment the biological sample spectra and generate training samples; Step 4.2: Use the target ratio method to fold increase the sample size of the biological sample spectrum by category; Step 4.3: The training samples are transformed again using Principal Component Analysis (PCA) to generate enhanced training samples by multiplying the sample size of each category. Step 5: Use enhanced training samples to train the support vector machine, random forest, ensemble tree, K-nearest neighbors and majority voting fusion model in sequence, and use the model that obtains the maximum classification accuracy through five-fold cross-validation as the trained model; Step 5.1: Use support vector machine, random forest, ensemble tree, K-nearest neighbors and majority voting fusion model as training models, and train the training models in sequence using augmented training samples; Step 5.2: Use five-fold cross-validation as shown in equation (2) to obtain the classification accuracy of the training model on the enhanced training samples; (2) representing the model performance metric computed on the fifth representing the model performance metric computed on the fifth = 1,2, …, 5 corresponding to five independent training / validation processes Step 5.3: Take the training model corresponding to the maximum classification accuracy as the trained model; Step 6: Use biological sample spectra to obtain classification results through the trained model, and encapsulate the model after robustness verification; Step 7: Batch-by-blindly classify and detect unknown biological samples using the encapsulation model to obtain classification results for biological samples including, but not limited to, pancreatitis, stones, space-occupying lesions, jaundice, and inflammation.

2. The method for classifying biological samples based on infrared spectroscopy as claimed in claim 1, wherein: Step 1 is implemented as follows: Step 1.1: For the original biological samples, Fourier transform infrared spectroscopy was used to collect biological samples in the infrared band range of 500 cm⁻¹ to 5000 cm⁻¹, with each sample containing 5846 wavelength points; Step 1.2: Repeat the process described in Step 1.1 to collect and average the original biological samples in batches to form biological sample spectra. Integrate the spectral data of different samples into a unified data matrix to form a sample spectrum set.

3. The classification method for biological samples based on infrared spectroscopy as described in claim 1, characterized in that: Step 2 is implemented as follows: Step 2.1: Perform outlier detection and processing on the spectral data. Use the Z-score method to remove outliers with |Z|>3, where Z is the number of standard deviations of an observation from the mean. The formula for Z-score is: Z = (x - μ) / σ (1) x is the original data point; μ is the mean of the dataset; σ is the standard deviation of the dataset; Step 2.2: Smooth the spectrum using Savitzky-Golay filtering to remove high-frequency noise; Step 2.3: Use polynomial fitting to perform baseline correction and eliminate spectral baseline drift; Step 2.4: After Z-score standardization of the preprocessed spectral data, the spectral characteristics of the biological samples are generated, with a mean of 0 and a standard deviation of 1.

4. The method of claim 1, wherein the biological sample is identified by infrared spectroscopy. 5 Step 3 is implemented as follows: Step 3.1: Calculate the variance of the spectral data at each wavelength point, set the variance threshold to 0.01, and filter out the characteristic wavelengths that are higher than the threshold to achieve preliminary feature selection; Step 3.2: Principal component analysis (PCA) is used to reduce the dimensionality of the screened spectral features, retaining 95% of the cumulative variance to form a principal component matrix.

5. The classification method for biological samples based on infrared spectroscopy as described in claim 1, characterized in that: Step 6 is implemented as follows: Step 6.1: Input the biological sample spectrum into the trained model to obtain the classification result; Step 6.2: Validate the robustness of the trained model using five-fold cross-validation, recall, and F1 score; Step 6.3: Encapsulate the model parameters, preprocessing parameters, feature masks, PCA transformation matrix, and class mapping table that have passed the robustness verification.

6. The method of claim 1, wherein the biological sample is identified by infrared spectroscopy. 5 Step 7 is implemented as follows: Step 7.1: Load the trained model package and extract the preprocessing parameters, feature mask, and PCA transformation matrix; Step 7.2: Perform the same preprocessing and feature processing procedures on the spectra of the new unknown samples; Step 7.3: Use the encapsulated model for classification, and output the predicted label, confidence score, and probability distribution of each category; Step 7.4: Output the generated prediction results table.