TDLAS intravenous medication concentration prediction method based on one-dimensional convolutional neural network
Through the TDLAS method based on one-dimensional convolutional neural network, the 1D-CNN deep learning model of adaptive high-efficiency channel attention module and multi-level residual module is constructed, solving the difficulty of the existing technology Accurately predicting the problem of low concentrations of intravenous medications, achieving efficient and accurate concentration prediction.
Patent Information
- Application Number
- CN202510060925.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2045-01-15
AI Technical Summary
Existing spectral analysis techniques are difficult to accurately predict the low concentration of intravenous drug solutes and require complex optical systems.
Using TDLAS intravenous drug concentration prediction method based on one-dimensional convolutional neural network, the second harmonic data of intravenous drug concentration is obtained, and the adaptive high-efficiency channel attention module and multi-level residual module are constructed. 1D-CNN deep learning model, trained to predict concentration.
Accurate prediction of low-concentration intravenous drug concentrations is achieved, reducing dependence on complex optical systems, and improving the accuracy and efficiency of prediction.
Smart Images

Figure CN119479986A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of spectral analysis, and specifically relates to a TDLAS intravenous drug concentration prediction method based on a one-dimensional convolutional neural network. Background Art
[0002] With the continuous advancement of medical technology, intravenous drug preparation centers (PIVAS) have become increasingly important as a key link in providing intravenous preparation services. PIVAS facilities and equipment are the basis for ensuring the quality of drug preparation. Modern equipment and advanced auxiliary equipment can improve the accuracy and efficiency of drug preparation and reduce the occurrence of human errors. They not only reduce the risk of drug cross-contamination, but also improve the quality and safety of drug preparation. Therefore, the control of intravenous drug dosage is of great significance to the construction of intravenous preparation centers.
[0003] In recent years, the application of spectral analysis technology in the field of liquid detection has made significant progress. By analyzing the absorption characteristics within the spectral range of liquid samples, the composition information of the liquid can be obtained quickly and non-destructively. For example, in the quantitative analysis method of liquid concentration, Raman spectroscopy detection technology, near-infrared spectroscopy detection technology, and ultraviolet visible spectroscopy (UV-Vis) are relatively mature. However, there are relatively few studies on the detection of intravenous drug solute concentrations using the above-mentioned spectral methods combined with deep learning, and the accuracy of distinguishing low-concentration drug solutions is insufficient, and this method requires a complex optical system. How to provide a method that does not rely on complex optical systems to achieve accurate prediction of low-concentration solutes for intravenous medication is a problem worth studying. Summary of the invention
[0004] Purpose of the invention: The technical problem to be solved by the present invention is to address the deficiencies in the prior art. The present invention proposes a TDLAS intravenous drug concentration prediction method based on a one-dimensional convolutional neural network, which can accurately predict the concentration of low-concentration intravenous drugs.
[0005] The present invention specifically provides a TDLAS intravenous drug concentration prediction method based on a one-dimensional convolutional neural network, comprising the following steps:
[0006] Step 1, obtaining second harmonic data of intravenous drug concentration;
[0007] Step 2, preprocessing the second harmonic data of intravenous medication and dividing it into a training set, a validation set, and a test set;
[0008] Step 3, construct a one-dimensional convolutional neural network 1D-CNN deep learning model;
[0009] Step 4: Input the training set and validation set into the deep learning model, and set the hyperparameters to train the model to obtain the optimal parameter model;
[0010] Step 5: Input the test set into the trained optimal parameter model to obtain the prediction result.
[0011] Step 1 includes:
[0012] Step 1-1, using wavelength modulation spectroscopy technology in tunable laser absorption spectroscopy TDLAS technology, setting LD laser to irradiate two paths respectively, one of which passes through the liquid, and calculating the light intensity of the liquid concentration according to the Beer-Lambert law. The calculation formula is:
[0013]
[0014] in, is the wavelength of incident light, The light intensity after transmission, is the incident light intensity, is the absorption coefficient, is the concentration of the liquid to be tested, is the optical absorption distance, e is a natural constant;
[0015] The other path does not pass through the liquid and is emitted through the light attenuator. The light intensity is , is the light decay coefficient; let the light decay coefficient , for two light intensity signals and Make a difference and get a differential signal ;
[0016] Step 1-2, the obtained differential signal Perform Taylor series expansion to obtain the second harmonic signal , the calculation formula is:
[0017]
[0018] in is the modulation amplitude, Represents the differential symbol, used for derivatives;
[0019] Step 1-3, demodulate the second harmonic signal by phase-locked amplification ,The second harmonic data of intravenous medication at various concentrations are collected through the host computer.
[0020] Step 2 includes the following steps:
[0021] Step 2-1, using the Savitzky-Golay smoothing filter method, the second harmonic data of intravenous medication with length N Perform smoothing to obtain the output sequence ; i = 0, 1, 2, 3, ..., N-1; for the output sequence For each data point in , a sliding window with a window size of 2m+1 is set, and the sliding window includes the current data point and m neighboring points on the left and right of the current data point. In the sliding window, an n-order polynomial is used to fit the current data point;
[0022] The Savitzky-Golay smoothing filter formula is:
[0023]
[0024] in, is the filter coefficient, Refers to the second harmonic data of intravenous medication with length N The index is The elements of are located within the sliding window 2m+1 data points;
[0025] Step 2-2, the filter coefficient is obtained by the following formula :
[0026]
[0027] in, is an N A (2m+1) matrix, where each row corresponds to a data point in the sliding window; is a column vector of length N, representing the second harmonic data of intravenous medication A vector of
[0028] Step 2-3, by solving the filter coefficients in step 2-2 , substitute into the Savitzky-Golay smoothing filter formula in step 2-1, and calculate the smoothed second harmonic data of intravenous medication , get the second harmonic data set of intravenous medication;
[0029] In step 2-4, the intravenous medication second harmonic data set is divided into a training set, a validation set, and a test set according to the ratio of 8:1:1.
[0030] In step 3, the 1D-CNN deep learning model includes an adaptive and efficient channel attention module, a multi-level residual module, and a regression prediction module.
[0031] In step 3, an adaptive and efficient channel attention module is constructed through the following steps:
[0032] Step 3-1, calculate the mean of the input feature map in the channel dimension to obtain the mean representation of each channel, where the channel mean The calculation formula is:
[0033]
[0034] in Indicates The first channel input feature map elements, is the length of the feature map.
[0035] Step 3-2: Through learnable dynamic factors and Adjust the convolution kernel and The size is calculated as:
[0036]
[0037]
[0038] in, , is the learnable weight matrix optimized during training, is the activation function , ensuring that the generated attention weights are Within the range, and is the bias term, which, like the weight of the convolution kernel, is automatically learned through back propagation. The update formula of the bias term is:
[0039]
[0040]
[0041] in is the learning rate, and Respectively represent the loss function for the bias term and The gradient of and The initialization setting is 0.1; and Respectively represent the bias terms Updated values and biases Updated value;
[0042] Step 3-3, through the generated dynamic factor and Adjust the convolution kernel and The size is calculated as:
[0043]
[0044]
[0045] in and is the initial convolution kernel size, and is the new convolution kernel size after dynamic factor adjustment; is the rounding function;
[0046] Step 3-4, through the dynamically generated convolution kernel and , generate the attention weight of each channel, the calculation formula is:
[0047]
[0048] The activation function ReLU is responsible for introducing nonlinear characteristics. Scale the output range between 0 and 1; represents the attention weight of the i-th channel;
[0049] Step 3-5, input feature map By generating dynamic attention weights Get the output feature map , the calculation formula is as follows:
[0050]
[0051] In step 3, a multi-level residual module is constructed by the following steps: 4 convolutional layers are set, and the size of the first convolutional layer is , the size of the second and third convolutional layers is , the size of the fourth convolutional layer is , and add a BN batch normalization layer and ReLU activation function to each convolutional layer output, input feature After the first convolutional layer, the first feature map is obtained ; The first feature map Input to the second convolutional layer and the third convolutional layer to obtain the second feature map ; The first feature map is connected through skip links With the second feature map Add to get the third feature map ; The third feature map The fourth feature map obtained after the fourth convolutional layer And jump link with the input feature to get the output feature map .
[0052] In step 3, the regression prediction module includes three fully connected layers, a ReLU activation function layer, and a Dropout random loss layer; the output of the first fully connected layer is 128, and the output end is connected to a ReLU activation function layer and a Dropout random loss layer; the output of the second fully connected layer is 32, and the output end is connected to a ReLU activation function layer and a Dropout random loss layer; the output of the third fully connected layer is 1, and the prediction result is output.
[0053] In step 4, the mean square error (MSE) loss function is used to train the model, and gradient descent is performed based on the difference between the true value and the predicted value in the training set to optimize the neural network parameters. The formula is:
[0054]
[0055] in Represents the output sequence The true value of Represents the output sequence The predicted value of , n represents the number of training sets.
[0056] In step 4, set the hyperparameter batch size to 16, the number of training epochs to 800, use the stochastic gradient descent (SGD) optimizer, and the learning rate to 0.0001; input the training set and the validation set into the model training, and save the optimal parameter model during the training process.
[0057] The present invention also provides an electronic device, comprising a processor and a memory, wherein the memory stores program code, and when the program code is executed by the processor, the processor executes the steps of the described method.
[0058] The present invention has the following beneficial effects: (1) Before extracting features from data, the data is first preprocessed by SG smoothing filtering to effectively reduce noise, enhance data quality, and ensure the accuracy of subsequent feature extraction.
[0059] (2) A dynamic adaptive mechanism is introduced on the original ECA module. By calculating the channel mean and attention weight, the contribution of each channel in the feature map is automatically adjusted, thereby improving the performance of the model.
[0060] (3) By replacing the traditional convolutional layer with an improved residual block to capture multi-level feature information, the risk of gradient vanishing is reduced, and the network is allowed to perform deeper learning, thereby improving the model's ability to process complex data. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 It is a schematic diagram of the present invention.
[0062] Figure 2 This is a network structure diagram of the improved one-dimensional convolutional neural network deep learning model of the present invention.
[0063] Figure 3 This is a network structure diagram of the adaptive and efficient channel attention module of the present invention.
[0064] Figure 4 This is a diagram of the improved one-dimensional convolutional neural network deep learning model architecture of the present invention. DETAILED DESCRIPTION
[0065] The technical solution of the present invention is further described below in conjunction with the accompanying drawings.
[0066] like Figure 1 As shown, an embodiment of the present invention provides a TDLAS intravenous drug concentration prediction method based on a one-dimensional convolutional neural network, comprising the following steps:
[0067] Step 1, obtaining the second harmonic data of intravenous drug concentration, specifically includes the following steps:
[0068] Step 1-1, using wavelength modulation spectroscopy technology in tunable laser absorption spectroscopy TDLAS technology, setting LD laser to irradiate two paths respectively, one of which passes through the liquid, and calculating the light intensity of the liquid concentration according to the Beer-Lambert law. The calculation formula is as follows:
[0069]
[0070] in, is the wavelength of incident light, The light intensity after transmission, is the incident light intensity, is the absorption coefficient, is the concentration of the liquid to be tested, is the optical absorption distance.
[0071] The other path does not pass through the liquid and is emitted through the optical attenuator. Its light intensity is , is the light decay coefficient. Let the light decay coefficient , for these two light intensity signals and Make a difference and get a differential signal ;
[0072] Step 1-2, the obtained differential signal The Taylor series expansion is performed to obtain the second harmonic signal, and the calculation formula is as follows:
[0073]
[0074] Steps 1-4, finally the signal is demodulated by phase-locked amplifier, and the second harmonic data of intravenous medication of various concentrations are collected by the host computer.
[0075] Step 2: Preprocess the second harmonic data of intravenous medication and divide it into training set, validation set, and test set, as follows:
[0076] Step 2-1, using the Savitzky-Golay smoothing filter method, the second harmonic data of intravenous medication with length N Perform smoothing to obtain the output sequence ; i = 0, 1, 2, 3, ..., N-1; for the output sequence For each data point in , a sliding window with a window size of 2m+1 is set, and the sliding window includes the current data point and m neighboring points on the left and right of the current data point. In the sliding window, an n-order polynomial is used to fit the current data point;
[0077] The Savitzky-Golay smoothing filter formula is:
[0078]
[0079] in, is the filter coefficient, Refers to the second harmonic data of intravenous medication with length N The index is The elements of are located within the sliding window 2m+1 data points;
[0080] Step 2-2, the filter coefficient is obtained by the following formula :
[0081]
[0082] in, is an N A (2m+1) matrix, where each row corresponds to a data point in the sliding window; is a column vector of length N, representing the second harmonic data of intravenous medication A vector of
[0083] Step 2-3, by solving the filter coefficients in step 2-2 , substitute into the Savitzky-Golay smoothing filter formula in step 2-1, and calculate the smoothed second harmonic data of intravenous medication , get the second harmonic data set of intravenous medication;
[0084] In step 2-4, the intravenous medication second harmonic data set is divided into a training set, a validation set, and a test set according to the ratio of 8:1:1.
[0085] Step 3: Build a 1D-CNN deep learning model based on an adaptive and efficient channel attention module and a multi-level residual module, such as Figure 2 As shown, the specific steps are as follows:
[0086] like Figure 3 As shown in Figure 1, an adaptive and efficient channel attention module is constructed through the following steps:
[0087] Step 3-1, calculate the mean of the input feature map in the channel dimension to obtain the mean representation of each channel. The calculation formula is as follows:
[0088]
[0089] in Indicates The first channel input feature map elements, is the length of the feature map.
[0090] Step 3-2: Through learnable dynamic factors and Adjust the convolution kernel and The size is calculated as follows:
[0091]
[0092]
[0093] in, , is the learnable weight matrix optimized during training, is the activation function , ensuring that the generated attention weights are Within the range, and The bias term, like the weight of the convolution kernel, is automatically learned through back propagation. The update formula of the bias term is:
[0094]
[0095]
[0096] in is the learning rate, and is the loss function for the bias term and The gradient of and The initialization setting is 0.1;
[0097] Step 3-3, through the generated dynamic factor and Adjust the convolution kernel and The size is calculated as:
[0098]
[0099]
[0100] in and is the initial convolution kernel size, and is the new convolution kernel size after dynamic factor adjustment; is the rounding function;
[0101] Step 3-4, through the dynamically generated convolution kernel and , generate the attention weights for each channel , the calculation formula is as follows:
[0102]
[0103] The activation function ReLU is responsible for introducing nonlinear characteristics. Scale the output range between 0 and 1; represents the attention weight of the i-th channel;
[0104] In step 3, a multi-level residual module is constructed by the following steps: Figure 4 As shown, the details are as follows: 4 convolutional layers are set, and the size of the first convolutional layer is , the size of the second and third convolutional layers is , the size of the fourth convolutional layer is , and add a BN batch normalization layer and ReLU activation function to each convolutional layer output, input feature After the first convolutional layer, the first feature map is obtained ; The first feature map Input to the second convolutional layer and the third convolutional layer to obtain the second feature map ; The first feature map is connected through skip links With the second feature map Add to get the third feature map ; The third feature map The fourth feature map obtained after the fourth convolutional layer And jump link with the input feature to get the output feature map .
[0105] In step 3, if Figure 4 As shown, the regression prediction module includes three fully connected layers, a ReLU activation function layer, and a Dropout random loss layer; the output of the first fully connected layer is 128, and the output end is connected to a ReLU activation function layer and a Dropout random loss layer; the output of the second fully connected layer is 32, and the output end is connected to a ReLU activation function layer and a Dropout random loss layer; the output of the third fully connected layer is 1, and the prediction result is output.
[0106] Step 4: Input the training set and validation set into the deep learning model, and set the hyperparameters to train the model to obtain the optimal parameter model, as follows:
[0107] The mean square error (MSE) loss function is used for model training, and gradient descent is performed based on the difference between the true value and the predicted value in the training set to optimize the neural network parameters; among them, the loss function The formula is:
[0108]
[0109] in Represents the output sequence The true value of Represents the output sequence The predicted value of , n represents the number of training sets.
[0110] Set the hyperparameter batch size to 16, the number of training Epochs to 800, use the Stochastic Gradient Descent (SGD) optimizer, and the learning rate to 0.0001; input the training set and the validation set into the model training, and save the optimal parameter model during the training process.
[0111] Step 5: Input the test set into the trained optimal parameter model to obtain the prediction result.
[0112] In order to better illustrate the effect of the present invention, 5% glucose solution was used as a solvent and ambroxol hydrochloride was used as a solute. The mixture was mixed according to a prescribed ratio and method to prepare a corresponding pharmaceutical dosage form. A total of 600 data sets of 5 concentrations were obtained. The data sets were divided into a training set, a validation set, and a test set in a ratio of 8:1:1. Several existing machine learning models were used to compare with the present invention, as shown in Table 1.
[0113] Table 1
[0114] Model <![CDATA[R 2 ]]> MAE RMSE PCR 0.792 2.881 3.594 SVR 0.827 2.740 3.379 PLSR 0.852 2.382 3.032 The present invention 0.993 0.541 0.710
[0115] In Table 1, R 2 The coefficient of determination, MAE and RMSE are used as evaluation indicators. PCR, SVR and PLSR are commonly used regression prediction models in machine learning. Compared with these three machine learning models, the present invention has stronger representation learning ability and generalization ability. 2 , MAE, and RMSE indicators are all superior to the compared existing technologies. The present invention has certain advantages in signal extraction, feature learning, and complex relationship modeling of the second harmonic of intravenous medication.
[0116] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A TDLAS intravenous drug concentration prediction method based on a one-dimensional convolutional neural network, characterized in that: The following steps are involved: Step 1, obtaining second harmonic data of intravenous drug concentration; Step 2, preprocessing the second harmonic data of intravenous medication and dividing it into a training set, a validation set, and a test set; Step 3, construct a one-dimensional convolutional neural network 1D-CNN deep learning model; Step 4: Input the training set and validation set into the deep learning model, and set the hyperparameters to train the model to obtain the optimal parameter model; Step 5: Input the test set into the trained optimal parameter model to obtain the prediction result.
2. The method according to claim 1, characterized in that Step 1 includes: Step 1-1, using wavelength modulation spectroscopy technology in tunable laser absorption spectroscopy TDLAS technology, setting LD laser to irradiate two paths respectively, one of which passes through the liquid, and calculating the light intensity of the liquid concentration according to the Beer-Lambert law. The calculation formula is: , in, is the wavelength of incident light, The light intensity after transmission, is the incident light intensity, is the absorption coefficient, is the concentration of the liquid to be tested, is the optical absorption distance, e is a natural constant; The other path does not pass through the liquid and is emitted through the light attenuator. The light intensity is , is the light decay coefficient; let the light decay coefficient , for two light intensity signals and Make a difference and get a differential signal ; Step 1-2, the obtained differential signal Perform Taylor series expansion to obtain the second harmonic signal , the calculation formula is: , in is the modulation amplitude, represents the differential symbol; Step 1-3, demodulate the second harmonic signal by phase-locked amplification ,The second harmonic data of intravenous medication at various concentrations are collected through the host computer.
3. The method according to claim 2, characterized in that Step 2 includes the following steps: Step 2-1, using the Savitzky-Golay smoothing filter method, the second harmonic data of intravenous medication with length N Perform smoothing to obtain the output sequence ; i = 0, 1, 2, 3, ..., N-1; for the output sequence For each data point in , a sliding window with a window size of 2m+1 is set, and the sliding window includes the current data point and m neighboring points on the left and right of the current data point. In the sliding window, an n-order polynomial is used to fit the current data point; The Savitzky-Golay smoothing filter formula is: , in, is the filter coefficient, Refers to the second harmonic data of intravenous medication with length N The index is The elements of are located within the sliding window 2m+1 data points; Step 2-2, the filter coefficient is obtained by the following formula : , in, is an N A (2m+1) matrix, where each row corresponds to a data point in the sliding window; is a column vector of length N, representing the second harmonic data of intravenous medication A vector of Step 2-3, by solving the filter coefficients in step 2-2 , substitute into the Savitzky-Golay smoothing filter formula in step 2-1, and calculate the smoothed second harmonic data of intravenous medication , get the second harmonic data set of intravenous medication; In step 2-4, the intravenous medication second harmonic data set is divided into a training set, a validation set, and a test set.
4. The method according to claim 3, characterized in that In step 3, the 1D-CNN deep learning model includes an adaptive and efficient channel attention module, a multi-level residual module, and a regression prediction module.
5. The method according to claim 4, characterized in that In step 3, an adaptive and efficient channel attention module is constructed through the following steps: Step 3-1, calculate the mean of the input feature map in the channel dimension to obtain the mean representation of each channel, where the channel mean The calculation formula is: , in Indicates The first channel input feature map elements, is the length of the feature map; Step 3-2: Through learnable dynamic factors and Adjust the convolution kernel and The size is calculated as: , , in, , is the learnable weight matrix optimized during training, is the activation function, and is the bias term, which is automatically learned through back propagation. The update formula of the bias term is: , , in is the learning rate, and Respectively represent the loss function for the bias term and The gradient of and Respectively represent the bias terms Updated values and biases Updated value; Step 3-3, through the generated dynamic factor and Adjust the convolution kernel and The size is calculated as: , , in and is the initial convolution kernel size, and is the new convolution kernel size after dynamic factor adjustment; Step 3-4, through the dynamically generated convolution kernel and , generate the attention weight of each channel, the calculation formula is: , The activation function ReLU is responsible for introducing nonlinear characteristics. Scale the output range between 0 and 1; represents the attention weight of the i-th channel; Step 3-5, input feature map By generating dynamic attention weights Get the output feature map , the calculation formula is as follows: 。 6. The method according to claim 5, characterized in that In step 3, a multi-level residual module is constructed by the following steps: 4 convolutional layers are set, and the size of the first convolutional layer is , the size of the second and third convolutional layers is , the size of the fourth convolutional layer is , and add a BN batch normalization layer and ReLU activation function to each convolutional layer output, input feature After the first convolutional layer, the first feature map is obtained ; The first feature map Input to the second convolutional layer and the third convolutional layer to obtain the second feature map ; The first feature map is connected through skip links With the second feature map Add to get the third feature map ; The third feature map The fourth feature map obtained after the fourth convolutional layer And jump link with the input feature to get the output feature map .
7. The method according to claim 6, characterized in that In step 3, the regression prediction module includes three fully connected layers, a ReLU activation function layer, and a Dropout random loss layer; the output of the first fully connected layer is 128, and the output end is connected to a ReLU activation function layer and a Dropout random loss layer; the output of the second fully connected layer is 32, and the output end is connected to a ReLU activation function layer and a Dropout random loss layer; the output of the third fully connected layer is 1, and the prediction result is output.
8. The method according to claim 7, characterized in that In step 4, the mean square error (MSE) loss function is used to train the model, and gradient descent is performed based on the difference between the true value and the predicted value in the training set to optimize the neural network parameters. The formula is: , in Represents the output sequence The true value of Represents the output sequence The predicted value of , n represents the number of training sets.
9. The method according to claim 8, characterized in that In step 4, set the hyperparameter batch size to 16, the number of training Epochs to 800, use the stochastic gradient descent SGD optimizer, and the learning rate to 0.0001; input the training set and the validation set into the model training, and save the optimal parameter model during the training process.
10. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores program codes, and when the program codes are executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Method and system for predicting states of infusion tube
CN110841143A
Environment compensation model-based detection error correction method for oxygen in glass bottle
CN111413285A
TDLAS trace gas concentration detection method based on pooling LSTM
CN111898744A
Intravenous infusion liquid level detection method based on image processing
CN113298089A
Raman spectrum-based cancer tissue identification method and system
CN118155007A