A method for classifying anesthetic drugs using neural networks

By using one-dimensional convolutional neural networks (1D-CNN) and Raman spectroscopy data preprocessing techniques, the problem of noise interference in Raman spectroscopy data was solved, enabling efficient and accurate classification of anesthetic drugs with an accuracy rate of 95%.

CN122087518APending Publication Date: 2026-05-26DALIAN UNIV OF TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
DALIAN UNIV OF TECH
Filing Date
2026-01-16
Publication Date
2026-05-26

Smart Images

  • Figure CN122087518A_ABST
    Figure CN122087518A_ABST
Patent Text Reader

Abstract

This invention discloses a method for classifying anesthetic drugs using a neural network, comprising: raw data acquisition and preprocessing; acquiring Raman spectral data of anesthetic drugs using a Raman spectrometer; performing format conversion and standardization on the acquired Raman spectral data; constructing a neural network; classifying anesthetic drugs based on a one-dimensional convolutional neural network (1D-CNN); training the neural network using the Adam optimizer; training the loss function; using the preprocessed data samples as the training and testing sets, performing multiple iterations during training until the loss is minimized and the accuracy is verified to be stable; classifying and identifying newly measured Raman spectral data; using the trained neural network model, taking the newly measured Raman spectral data of anesthetic drugs as input, and outputting the category of the anesthetic drug to which the sample belongs, thereby reducing noise and background interference in the Raman spectral data and ensuring high accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of smart medical biology, medicine and artificial intelligence technology, and specifically to a method for classifying anesthetic drugs using neural networks. Background Technology

[0002] In the medical field, there are numerous types of anesthetic drugs, and their identification and classification are crucial for surgical safety. Currently, the identification of anesthetic drugs mainly relies on chemical analysis methods, such as high-performance liquid chromatography (HPLC) and mass spectrometry (MS). However, these methods suffer from drawbacks such as expensive equipment, complex operation, and long testing cycles. Therefore, finding an efficient, accurate, and automated method for classifying anesthetic drugs is of significant practical importance.

[0003] Raman spectroscopy, due to its non-destructive, rapid, and highly sensitive advantages, has been widely used in pharmaceutical analysis. However, Raman spectral data often contains noise and background interference, making it difficult for traditional classification methods to guarantee high accuracy. In recent years, Convolutional Neural Networks (CNNs) have demonstrated excellent performance in pattern recognition, particularly suitable for classifying complex data. Therefore, applying CNNs to the Raman spectral classification of anesthetic drugs can improve recognition efficiency and accuracy. Summary of the Invention

[0004] The purpose of this invention is to address the problem that existing technologies often contain noise and background interference in Raman spectroscopy data, making it difficult for traditional classification methods to guarantee high accuracy.

[0005] To address the above problems, this invention provides a method for classifying anesthetic drugs using a neural network, comprising: Step S1: Raw data acquisition and preprocessing. Raman spectrometer is used to acquire Raman spectral data of anesthetic drugs. The acquired Raman spectral data of anesthetic drugs is then converted and standardized. Step S2: Construct a neural network to classify these 15 anesthetic drugs based on a one-dimensional convolutional neural network (1D-CNN); Step S3: Train the neural network based on the Adam optimizer, setting the learning rate, loss function, batch size, dropout rate, and learning rate; Step S4: Train the loss function. Use 80% of the preprocessed data samples obtained in Step S1 as the training set and 20% as the test set. After each training round, use cross-entropy as the loss function to minimize the difference between the predicted distribution and the true distribution. Calculate the loss on the training set and the validation set, and adjust the learning rate according to the loss on the validation set. Iterate multiple times during training until the loss is minimized and the validation accuracy is stable. Step S5: Classify and identify the newly measured Raman spectral data. Using the best-performing neural network model trained in Step 3, the newly measured Raman spectral data of the anesthetic drugs is used as input, and the anesthetic drug category to which the sample belongs is output. Among the 100 new sample data, which consist of 5 anesthetic drugs with 20 Raman spectral data for each drug, more than 93% were accurately identified.

[0006] In the preferred embodiment, step S1, raw data acquisition and preprocessing, includes: Raman spectrometers were used to collect Raman spectral data of anesthetic drugs. The same acquisition parameters were set, including laser power and sampling time. Each anesthetic drug was sampled 50 times to ensure sufficient data. A total of 15 anesthetic drugs were collected to obtain a dataset. Each Raman spectral data obtained for each anesthetic drug is saved in a .txt file. Each file contains the spectral value of the drug, the category label, and the name of the anesthetic drug. Data format conversion and standardization: Convert the .txt file to CSV format and perform standardization to scale the amplitude range of the Raman spectral data to the [0, 1] interval. The data standardization formula is as follows: in, For standardized data, The original data is converted into a CSV file. The mean of the data. The standard deviation of the data is denoted as σ. Standardized data helps accelerate neural network training and improve the convergence speed of the model. Data filtering and wavelength selection: Select standardized data with a wavelength range of 500-2500 MHz. Baseline correction: Baseline correction was performed using the least squares method to fit the ALS. The baseline fitting result was calculated through an optimization problem, as shown in the following formula: in, This represents the standardized Raman spectral data. The baseline fitting results, These are weighting coefficients. To smooth the control parameters, solve equation (1.2) to obtain the baseline. Then, the data Subtract baseline To remove spectral baseline errors caused by factors such as instrument drift; Smoothing and Denoising: The Savitzky-Golay smoothing filter is used to smooth the Raman spectral data. The filtering formula is as follows: in, For the smoothed data points, These are the filter coefficients. For window size; Data augmentation and enhancement: Random translation, scaling, and flipping operations on data after smoothing and denoising.

[0007] In the preferred embodiment, step S2, constructing the neural network, includes: The 15 anesthetic drugs were classified using a one-dimensional convolutional neural network (1D-CNN). The neural network structure is as follows: Convolutional layer: The first convolutional layer uses 32 kernels with a size of 3 and a stride of 1, and is activated using the ReLU activation function, as shown in the formula: in, For convolution kernel parameters, For input data, For bias, The size of the convolution kernel; Pooling layer: After the convolutional layer, a max pooling layer is used to perform pooling operations on the data obtained by formula (1.4). The formula is as follows: in, The feature vector matrix obtained after convolution calculation according to formula (1.4); Flattening layer: The pooled data is flattened into a one-dimensional vector, as shown in the formula: in, Flatten The () function is a function in the NumPy function library called by the Python programming language. Its function is to unfold a two-dimensional or three-dimensional matrix into a one-dimensional vector. Fully connected layer: The input dimension is 32×(1684−2232) / 2, which is the number of features after convolution and pooling, and the output dimension is 15 neurons, corresponding to 15 drugs; Output layer: The output layer uses the Softmax activation function to output the probability of each category.

[0008] In the preferred approach, step S3, optimizer training, includes: The Adam optimizer is used to train neural networks. The Adam optimizer is based on adaptive estimation of the first and second moments, as shown in the following formula: in, For learning rate, and The attenuation rate estimated for the first and second moments. To prevent division by zero constants, To Gradient operator of parameters, For loss function, Predicted values ​​of stochastic gradient The correction value, Stochastic gradient standard deviation The correction value, This represents the parameters of the neural network model at the t-th iteration. This represents the model parameters at the (t-1)th iteration; Learning rate adjustment: The ReduceLROnPlateau strategy is adopted; Loss function: The cross-entropy loss function is used to measure the difference between the prediction and the true label; Hyperparameter selection and tuning, including: Batch size: The batch size is set to 32; Dropout rate: Dropout layers are added to the network, with the first layer having a dropout rate of 0.25 and the second layer having a dropout rate of 0.5; Learning rate: The initial learning rate is set to 0.001.

[0009] In the preferred embodiment, the training loss function in step S4 includes: using 80% of the preprocessed data samples obtained in step S1 as the training set and 20% as the test set; after each round, using cross-entropy as the loss function to minimize the difference between the predicted distribution and the true distribution, the formula is as follows: in, Let C be the cross-entropy loss function, and C be the total number of classification categories. This represents the probability distribution of the true labels, with the category containing the label denoted as 1 and the rest as 0. The probability distribution predicted by the model is used; during training, multiple iterations are performed until the loss is minimized and the accuracy is verified to be stable.

[0010] In the preferred embodiment, the power range in step S1 is 350-499mW, and the sampling time is 1-10s.

[0011] In the preferred mode, the 15 anesthetic drugs include: 9 red prescription drugs, namely remifentanil, sufentanil, alfentanil, ephedrine, morphine, ketamine, midazolam, oxaliplatin, and hydromorphone hydrochloride; and 6 white prescription drugs, namely butorphanol, dezocine, remimazolam, pentazocine, tramadol, and nalbuphine.

[0012] The beneficial effects of this invention are as follows: it enables more efficient and accurate identification of anesthetic drugs. By training with a Convolutional Neural Network (CNN), the model can quickly identify and classify different anesthetic drugs with an accuracy rate exceeding 95%, far surpassing traditional machine learning methods such as KNN. This method maintains good stability and robustness when facing different instruments, experimental environments, and batches of samples, ensuring efficient and accurate classification. Simultaneously, the model can quickly process newly measured spectral data with low energy consumption, meeting the needs of real-time medical testing. Attached Figure Description

[0013] Figure 1 This is a flowchart of classifying anesthetic drugs based on a one-dimensional CNN neural network; Figure 2 This is a schematic diagram of the actual measured Raman signal of the drug alfentanil. Detailed Implementation

[0014] Example 1: like Figure 1 As shown, methods for classifying anesthetic drugs using neural networks include: Step S1: Raw data acquisition and preprocessing; Data acquisition: Raman spectrometer was used to collect Raman spectral data of anesthetic drugs. The same acquisition parameters were set, including laser power and sampling time. Each anesthetic drug was sampled 50 times to ensure sufficient data. A total of 15 anesthetic drugs were collected to obtain a dataset. Each Raman spectral data point for each anesthetic drug was saved as a .txt file. Each file contained the drug's spectral values ​​and category label (i.e., the anesthetic drug name). The generated Raman spectral images were then processed... Figure 2 The text appears to be a mix of Chinese characters and symbols, possibly representing a corrupted or incomplete translation. A direct translation wouldn't be Data format conversion and standardization: Convert the .txt file to CSV format and perform standardization to scale the amplitude range of the Raman spectral data to the [0, 1] interval. The data standardization formula is as follows: in, For standardized data, The original data is converted into a CSV file. The mean of the data. The standard deviation of the data is denoted as σ. Standardized data helps accelerate neural network training and improve the convergence speed of the model. Data filtering and wavelength cutoff: Standardized data with a wavelength range of 500-2500 MHz are selected. In order to remove irrelevant data points and reduce noise interference, data in this wavelength range is cutoff to eliminate irrelevant noise data. This step ensures the quality of Raman spectroscopy data and reduces unnecessary calculations during training. Baseline Correction: To reduce baseline drift in spectral data, baseline correction is performed using least squares baseline fitting (ALS). The baseline fitting result is calculated through an optimization problem, as shown in the following formula: in, This represents the standardized Raman spectral data. The baseline fitting results, These are weighting coefficients. To smooth the control parameters, solve equation (1.2) to obtain the baseline. Then, the data Subtract baseline To remove spectral baseline errors caused by factors such as instrument drift; Smoothing and Noise Reduction: To reduce noise in the measurement, a Savitzky-Golay smoothing filter is used to smooth the Raman spectral data. The filter achieves smoothing through local polynomial fitting, and the filtering formula is as follows: in, For the smoothed data points, These are the filter coefficients. The window size is used; this method can effectively remove noise while preserving the main features of the spectrum.

[0015] Data augmentation and expansion: To increase the diversity of the training set and prevent model overfitting, data augmentation techniques are used to expand the samples, including random translation, scaling, and flipping of the smoothed and denoised data. These augmentation operations help the model better learn the variability and details in the data. Finally, preprocessed data samples are obtained. Step S2: Construct the neural network; The 15 anesthetic drugs were classified using a one-dimensional convolutional neural network (1D-CNN). The neural network structure is as follows: Convolutional layer: The first convolutional layer uses 32 kernels with a size of 3 and a stride of 1, and is activated using the ReLU activation function, as shown in the formula: in, For convolution kernel parameters, For input data, For bias, The size of the convolution kernel; Pooling layer: After the convolutional layer, a max pooling layer is used to perform pooling operations on the data obtained by formula (1.4). The formula is as follows: in, The feature vector matrix obtained after convolution calculation according to formula (1.4); Flattening layer: The pooled data is flattened into a one-dimensional vector to be passed to the fully connected layer, as shown in the formula: in, Flatten The `()` function is a function in the NumPy library that is called by the Python programming language. Its function is to unfold a two-dimensional or three-dimensional matrix into a one-dimensional vector. h The high-dimensional data is obtained after pooling according to formula (1.5); Fully connected layer: The input dimension is 32×(1684−2232) / 2, which is the number of features after convolution and pooling, and the output dimension is 15 neurons, corresponding to 15 drugs; Output layer: The output layer uses the Softmax activation function to output the probability of each category; Step S3: Optimizer training; Optimizer: The model is trained using the Adam optimizer, which is based on adaptive estimation of the first and second moments, as shown in the following formula:

[0016] The above formula is the iterative formula for stochastic gradient descent with adaptive learning rate, where, For learning rate, and The attenuation rate estimated for the first and second moments. To prevent division by zero constants, To Gradient operator of parameters, For loss function, Predicted values ​​of stochastic gradient The correction value, Stochastic gradient standard deviation The correction value, This represents the parameters of the neural network model at the t-th iteration. This represents the model parameters at the (t-1)th iteration; Learning rate adjustment: The ReduceLROnPlateau strategy is used to adjust the learning rate when the validation set loss does not decrease. This strategy helps avoid oscillations caused by excessively large learning rates in the later stages of training.

[0017] Loss function: The cross-entropy loss function is used to measure the difference between the prediction and the true label.

[0018] Hyperparameter selection and tuning Batch Size: The batch size is set to 32. This choice was adjusted experimentally; smaller batches reduce memory usage and improve the model's generalization ability.

[0019] Dropout Rate: To prevent overfitting, dropout layers are added to the network. The dropout rate for the first layer is 0.25, and for the second layer it is 0.5, which helps avoid network overfitting.

[0020] Learning Rate: The initial learning rate is set to 0.001. During training, ReduceLROnPlateau is used to adjust the learning rate to avoid overtraining and failure to converge.

[0021] During training, cross-validation was used to divide the data into a training set (80%) and a test set (20%). An early stopping strategy was employed during model training: training was stopped and the optimal model was saved when the validation set loss showed no improvement for 10 consecutive epochs.

[0022] Step S4: Train the loss function; Use 80% of the preprocessed data samples obtained in step S1 as the training set and 20% as the test set. After each epoch, cross-entropy is used as the loss function to minimize the difference between the predicted and true distributions. The formula is as follows: This is used to calculate the loss on both the training and validation sets, and the learning rate is adjusted based on the validation set loss. Training is iterated multiple times until the loss is minimized and the validation accuracy stabilizes. in, Let C be the cross-entropy loss function, and C be the total number of classification categories. This represents the probability distribution of the true labels, with the category containing the label denoted as 1 and the rest as 0. The model predicts the probability distribution; the cross-entropy loss function evaluates the model's performance by calculating the difference between the true probability and the predicted probability for each class and summing them over all classes. The smaller the loss value, the closer the model's prediction is to the true label.

[0023] During the testing phase, the model was evaluated using a test set. We calculated metrics such as classification accuracy, recall, and F1-score. The results show that the classification accuracy of the method in this invention reaches over 95%. A classification accuracy greater than 90% for three consecutive rounds and a stable solution of the cross-entropy loss function less than 1e-2 were used as convergence conditions for the neural network model.

[0024] Step S5: Classify and identify the newly measured Raman spectral data; Using the best-performing CNN classification model trained in step 3, the newly measured Raman spectral data of anesthetic drugs were taken as input, and the anesthetic drug category to which the sample belonged was output. It was found that among the 100 new sample data of 5 anesthetic drugs, 20 Raman spectral data of each drug, more than 93% could be accurately identified.

[0025] Feature Extraction: The core of step 2 is feature extraction from the data. For each data sample, its features are contained within the standardized Raman spectral data. Since each Raman spectral data is a high-dimensional vector, these features need to be extracted before they can be input into the multilayer perceptron neural network for training.

[0026] Feature extraction: The core of step 2 is feature extraction of the data. Considering that Raman spectroscopy data is a high-dimensional vector, directly using the standardized Raman spectroscopy data for classification will cause the "curse of dimensionality". Therefore, feature extraction is performed on it.

[0027] The power range in step S1 is 350-499mW, and the sampling time is 1-10s.

[0028] The 15 anesthetic drugs include: 9 red prescription drugs, namely remifentanil, sufentanil, alfentanil, ephedrine, morphine, ketamine, midazolam, oxaliplatin, and hydromorphone hydrochloride; and 6 white prescription drugs, namely butorphanol, dezocine, remimazolam, pentazocine, tramadol, and nalbuphine.

[0029] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the present invention. Various changes and modifications can be made to the present invention without departing from its spirit and scope. All such changes and modifications fall within the scope of the present invention as claimed, which is defined by the appended claims and their equivalents.

Claims

1. A method for classifying anesthetic drugs using neural networks, characterized in that, include: Step S1: Raw data acquisition and preprocessing. Raman spectrometer is used to acquire Raman spectral data of anesthetic drugs. The acquired Raman spectral data of anesthetic drugs is then converted and standardized. Step S2: Construct a neural network to classify these 15 anesthetic drugs based on a one-dimensional convolutional neural network (1D-CNN). Step S3: Train the neural network based on the Adam optimizer, and set the learning rate, loss function, batch size, dropout rate, and learning rate. Step S4: Train the loss function. Use 80% of the preprocessed data samples obtained in Step S1 as the training set and 20% as the test set. After each training round, use cross-entropy as the loss function to minimize the difference between the predicted distribution and the true distribution. Calculate the loss on the training set and the validation set, and adjust the learning rate according to the loss on the validation set. Iterate multiple times during training until the loss is minimized and the validation accuracy is stable. Step S5: Classify and identify the newly measured Raman spectral data. Using the best-performing neural network model trained in Step 3, the newly measured Raman spectral data of the anesthetic drugs is used as input, and the anesthetic drug category to which the sample belongs is output. Among the 100 new sample data, which consist of 5 anesthetic drugs with 20 Raman spectral data for each drug, more than 93% were accurately identified.

2. The method for classifying anesthetic drugs using a neural network according to claim 1, characterized in that, Step S1, raw data acquisition and preprocessing, includes: Raman spectrometers were used to collect Raman spectral data of anesthetic drugs. The same acquisition parameters were set, including laser power and sampling time. Each anesthetic drug was sampled 50 times to ensure sufficient data. A total of 15 anesthetic drugs were collected to obtain a dataset. Each Raman spectral data obtained for each anesthetic drug is saved in a .txt file. Each file contains the spectral value of the drug, the category label, and the name of the anesthetic drug. Data format conversion and standardization: Convert the .txt file to CSV format and perform standardization to scale the amplitude range of the Raman spectral data to the [0, 1] interval. The data standardization formula is as follows: in, For standardized data, The original data is converted into a CSV file. The mean of the data. The standard deviation of the data; Data filtering and wavelength selection: Select standardized data with a wavelength range of 500-2500 MHz. Baseline correction: Baseline correction was performed using the least squares method to fit the ALS. The baseline fitting result was calculated through an optimization problem, as shown in the following formula: in, This represents the standardized Raman spectral data. The baseline fitting results, These are weighting coefficients. To smooth the control parameters, solve equation (1.2) to obtain the baseline. Then, the data Subtract baseline To remove spectral baseline errors caused by factors such as instrument drift; Smoothing and Denoising: The Savitzky-Golay smoothing filter is used to smooth the Raman spectral data. The filtering formula is as follows: in, For the smoothed data points, These are the filter coefficients. For window size; Data augmentation and enhancement: Random translation, scaling, and flipping operations on data after smoothing and denoising.

3. The method for classifying anesthetic drugs using a neural network according to claim 1, characterized in that, Step S2, constructing the neural network, includes: The 15 anesthetic drugs were classified using a one-dimensional convolutional neural network (1D-CNN). The neural network structure is as follows: Convolutional layer: The first convolutional layer uses 32 kernels with a size of 3 and a stride of 1, and is activated using the ReLU activation function, as shown in the formula: in, For convolution kernel parameters, For input data, For bias, The size of the convolution kernel; Pooling layer: After the convolutional layer, a max pooling layer is used to perform pooling operations on the data obtained by formula (1.4). The formula is as follows: in, The feature vector matrix is ​​obtained after convolution calculation according to formula (1.4); Flattening layer: The pooled data is flattened into a one-dimensional vector, as shown in the formula: in, Flatten The () function is a function in the NumPy function library called by the Python programming language. Its function is to unfold a two-dimensional or three-dimensional matrix into a one-dimensional vector. Fully connected layer: The input dimension is 32×(1684−2232) / 2, which is the number of features after convolution and pooling, and the output dimension is 15 neurons, corresponding to 15 drugs; Output layer: The output layer uses the Softmax activation function to output the probability of each category.

4. The method for classifying anesthetic drugs using a neural network according to claim 1, characterized in that, Step S3 optimizer training includes: The Adam optimizer is used to train neural networks. The Adam optimizer is based on adaptive estimation of the first and second moments, as shown in the following formula: in, For learning rate, and The attenuation rate estimated for the first and second moments. To prevent division by zero constants, To Gradient operator of parameters, For loss function, Predicted values ​​of stochastic gradient The correction value, Stochastic gradient standard deviation The correction value, This represents the parameters of the neural network model at the t-th iteration. This represents the model parameters at the (t-1)th iteration; Learning rate adjustment: The ReduceLROnPlateau strategy is adopted; Loss function: The cross-entropy loss function is used to measure the difference between the prediction and the true label; Hyperparameter selection and tuning include: Batch Size: Set the batch size to 32; Dropout Rate: Add Dropout layers to the network, with the first layer having a dropout rate of 0.25 and the second layer having a dropout rate of 0.5; Learning Rate: Set the initial learning rate to 0.

001.

5. The method for classifying anesthetic drugs using a neural network according to claim 1, characterized in that, Step S4, the training loss function, includes: Use 80% of the preprocessed data samples obtained in step S1 as the training set and 20% as the test set. After each round, the cross-entropy is used as the loss function to minimize the difference between the predicted distribution and the true distribution. The formula is as follows: in, Let C be the cross-entropy loss function, and C be the total number of classification categories. This represents the probability distribution of the true labels, with the category containing the label denoted as 1 and the rest as 0. The probability distribution predicted by the model is used; during training, multiple iterations are performed until the loss is minimized and the accuracy is verified to be stable.

6. The method for classifying anesthetic drugs using a neural network according to claim 1, characterized in that, The power range in step S1 is 350-499mW, and the sampling time is 1-10s.

7. The method for classifying anesthetic drugs using a neural network according to claim 1, characterized in that, The 15 anesthetic drugs include: 9 red prescription drugs, namely remifentanil, sufentanil, alfentanil, ephedrine, morphine, ketamine, midazolam, oxaliplatin, and hydromorphone hydrochloride; and 6 white prescription drugs, namely butorphanol, dezocine, remimazolam, pentazocine, tramadol, and nalbuphine.