Drug mixture trace impurity identification and quantification method based on deep learning

By improving the YOLOv8 deep learning algorithm, the convolution kernel is dynamically adjusted to adapt to the characteristics of the drug, and the problem of difficult to identify and quantify trace impurities in traditional methods is solved, and impurity analysis with high sensitivity and accuracy is achieved, and the level of drug quality control is improved.

CN119694431AInactive Publication Date: 2025-03-25NANJING UNIV OF TRADITIONAL CHINESE MEDICINE

Patent Information

Application Number
CN202510192632.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-21
Publication Date
2025-03-25
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional drug impurity analysis methods rely on standard product libraries and chemical rules, making it difficult to identify and quantify trace impurities, especially in unknown impurities, and the spectral data are complex and difficult to extract effective features.

Method used

Using a deep learning-based method, the spectral data is trained by improving the YOLOv8 deep learning algorithm, and the convolution kernel is dynamically adjusted to adapt to the characteristics of the drug, so as to realize the identification and quantitative analysis of trace impurities.

Benefits of technology

It realizes accurate identification of unknown impurities without a standard product library and conducts accurate quantitative analysis, which improves the sensitivity and accuracy of impurity identification and quantification, and significantly improves the level of drug quality control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119694431A_ABST
    Figure CN119694431A_ABST
Patent Text Reader

Abstract

The invention discloses a drug mixture trace impurity identification and quantification method based on deep learning, and the method comprises the steps: collecting the spectral data of a target drug mixture, and carrying out the preprocessing of the spectral data; training the spectral data through an improved YOLOv8 deep learning algorithm which performs dynamic adjustment according to the spectral data through a convolution kernel, and evaluating a deep learning model obtained according to the improved YOLOv8 deep learning algorithm through a cross validation method. And performing impurity identification and quantitative analysis on the to-be-detected sample by using a deep learning model of which the evaluation result meets a preset condition, and performing dynamic convolution adjustment by aiming at a convolution layer according to a drug feature corresponding to input spectral data in the training and detection process. The deep learning model can better adapt to different morphological characteristics of drugs, and the recognition and quantification precision of trace impurities is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of drug quality control and analytical detection, and in particular to a method for identifying and quantifying trace impurities in drug mixtures based on deep learning. Background Art

[0002] In the process of drug production and quality control, the detection and quantitative analysis of impurities are important links to ensure the safety, efficacy and quality of drugs. Traditional impurity analysis methods, such as high performance liquid chromatography (HPLC), gas chromatography (GC), mass spectrometry (MS), etc., have been widely used in the separation and identification of drug components. These methods rely on standard libraries and known chemical rules, usually require complex operating steps and a lot of time, and have certain limitations in the detection sensitivity and accuracy of trace impurities, especially trace impurities. In addition, the impurity components of many new drugs have not been fully defined, and the lack of a complete standard library makes it impossible for traditional analytical methods to effectively identify and quantify unknown impurities.

[0003] In recent years, spectral analysis technology (such as infrared spectroscopy, Raman spectroscopy, nuclear magnetic resonance spectroscopy, etc.) has gradually become an important tool in drug quality testing due to its non-destructive, rapid and high sensitivity. However, these spectral data are usually very complex and contain a lot of redundant and noisy information, making it difficult to extract effective features for impurity analysis. Therefore, how to accurately identify and quantify trace impurities from complex spectral data has become a major difficulty in current drug analysis technology research. Summary of the invention

[0004] The purpose of the present invention is to provide a method for identifying and quantifying trace impurities in drug mixtures based on deep learning, so as to achieve trace impurity identification and quantification independent of a standard library and with higher sensitivity and accuracy, thereby significantly improving the level of drug quality control.

[0005] In order to solve the above technical problems, an embodiment of the present invention provides a method for identifying and quantifying trace impurities in a drug mixture based on deep learning, comprising the following steps:

[0006] S1. Collecting spectral data of the target drug mixture and preprocessing the spectral data, wherein the spectral data is any one of infrared spectrum, mass spectrum, and nuclear magnetic resonance spectrum;

[0007] S2. The spectral data is trained by improving the YOLOv8 deep learning algorithm, wherein the convolution kernel in the convolution layer of the improved YOLOv8 deep learning algorithm is dynamically adjusted according to the spectral data;

[0008] S3. Evaluate the deep learning model obtained according to the improved YOLOv8 deep learning algorithm by a cross-validation method, and optimize the deep learning model whose evaluation results do not meet the preset conditions until the evaluation results meet the preset conditions;

[0009] S4. Use the deep learning model whose evaluation results meet the preset conditions to perform impurity identification and quantitative analysis on the sample to be tested;

[0010] S5. Feedback optimization is performed based on the results of impurity identification and quantitative analysis, and iterative training is performed through incremental learning methods to improve the accuracy of impurity identification and quantitative analysis.

[0011] In addition, in one example, the preprocessing of the spectral data in step S1 includes: preprocessing the spectral data using a wavelet transform denoising method and a minimum-maximum normalization method.

[0012] In addition, in one example, preprocessing the spectral data using a wavelet transform denoising method includes:

[0013] For the spectral dataset Perform wavelet decomposition, where n is an integer greater than or equal to 1, x n is the spectral data in the spectral dataset. For each spectral data x in the spectral dataset n , with the corresponding discrete signal Represent it, and then choose the wavelet basis function , its wavelet decomposition formula is: ,in is the wavelet coefficient, is the conjugate of the wavelet basis function, Indicates scale, represents the translation parameter; The wavelet coefficients are processed by soft threshold function to obtain the wavelet coefficients after soft threshold processing. , the formula is as follows ,in is the threshold value, determined according to the noise level estimate; The spectral data is obtained by inverse wavelet transform reconstruction and denoising. , the formula is: .

[0014] In addition, in one example, the spectral data is preprocessed using a minimum-maximum normalization method, including: Normalized to the [0,1] interval, the normalization formula is: ,in is the normalized spectral data point, is the denoised spectral dataset, and They are The minimum and maximum values ​​in .

[0015] In addition, in one example, the improvements to the YOLOv8 deep learning algorithm in step S2 include:

[0016] Construct an improved YOLOv8 deep learning model, determine the other architecture parameters except the dynamically adjusted part of the convolution layer, and randomly initialize the model parameters; for the convolution layer, dynamically adjust the convolution kernel according to the drug characteristics corresponding to the input spectral data; determine the loss function of the YOLOv8 deep learning model after the dynamic adjustment of the convolution kernel.

[0017] In addition, in one example, dynamically adjusting the convolution kernel according to the drug features corresponding to the input spectral data includes: designing a drug feature recognition module, the drug feature recognition module extracts preliminary features of the spectral data and uses the principal component analysis method to reduce the dimensionality of the spectral data; identifying the reduced spectral data through a feedforward neural network to obtain the shape type of the drug and the key shape features corresponding to each shape type; dynamically generating a convolution kernel of the corresponding shape and position according to the identified key shape features of the drug; performing a convolution operation using the dynamically generated convolution kernel, when the input spectral data is I (U, V), the dynamically generated convolution kernel is T (U, V), the feature map after convolution is F (U, V), and the calculation formula is: , where t is the half length of the convolution kernel, u represents the offset in the horizontal direction, and v represents the offset in the vertical direction.

[0018] In addition, in one example, determining the loss function of the YOLOv8 deep learning model after the convolution kernel is dynamically adjusted includes: using the bounding box loss function CIoU to determine the positioning loss: , , ,in and are the horizontal and vertical coordinates of the center point of the prediction box, is the width of the prediction box, is the height of the prediction box; and are the horizontal and vertical coordinates of the center point of the real frame, is the width of the real box, is the height of the real box, w is the diagonal length of the minimum closure area, is the balance parameter, is the aspect ratio consistency, IoU is the intersection over union ratio; the confidence loss L is determined by using the binary cross entropy loss to measure the confidence deviation of the predicted impurity.conf : ,in is the total number of prediction boxes, is the true confidence, is the prediction confidence; the classification loss L is determined by the cross entropy loss cls : ,in, is the number of impurity categories, is the true category label of the one-hot encoding, is the predicted class probability distribution.

[0019] In addition, in one example, step S3 includes: dividing the preprocessed spectral data into a training set , validation set ; Obtain the prediction results of the forward propagation of the deep learning model, calculate the loss value of the prediction results according to the loss function, calculate the gradient of the loss value through back propagation, and then use the Adam optimizer according to Update the initialization model parameters, where are model parameters, is the learning rate, is the gradient of the loss function L with respect to the parameter θ; after each round of training, the validation set is used Evaluate performance indicators, including accuracy, recall rate, F1 value, and average precision. If the performance indicators no longer improve or decrease, adjust the hyperparameters. Use regularization for optimization in case of overfitting. Continue training until the model converges.

[0020] Compared with the prior art, the present invention automatically learns impurity characteristics from a large amount of known data through a deep learning model, overcoming the limitations of traditional methods that rely on standard product libraries and chemical rules, so that even in the absence of a complete standard product library, unknown impurities can be accurately identified and precise quantitative analysis can be performed. In addition, during the training and detection process, the convolution layer generates a convolution kernel according to the drug characteristics corresponding to the input spectral data and performs dynamic convolution adjustment, so that the deep learning model can better adapt to the different morphological characteristics of the drug, improve the recognition and quantitative accuracy of trace impurities, and maintain the high efficiency of the calculation and the lightweight of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION

[0022] To make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in the embodiments of the present invention, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can be implemented. The division of the following embodiments is for the convenience of description, and should not constitute any limitation on the specific implementation of the present invention. The various embodiments can be combined and referenced with each other without contradiction.

[0023] The present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0024] One embodiment of the present invention relates to a method for identifying and quantifying trace impurities in a drug mixture based on deep learning, and the implementation steps are as follows: Figure 1 shown.

[0025] In step S1, spectral data of the target drug mixture is collected and preprocessed, wherein the spectral data is any one of infrared spectrum, mass spectrum and nuclear magnetic resonance spectrum.

[0026] In one example, preprocessing the spectral data includes: preprocessing the spectral data using a wavelet transform denoising method and a minimum-maximum normalization method.

[0027] The spectral data is preprocessed by using the wavelet transform denoising method. The principle is to decompose the signal into wavelet coefficients of different scales, remove the wavelet coefficients corresponding to the noise through threshold processing, and then reconstruct the signal. The specific implementation includes: Perform wavelet decomposition, where n is an integer greater than or equal to 1, x n is the spectral data in the spectral dataset. For each spectral data x in the spectral dataset n , with the corresponding discrete signal Represent it, and then choose the wavelet basis function , its wavelet decomposition formula is: ,in is the wavelet coefficient, is the conjugate of the wavelet basis function, Indicates scale, Represents the translation parameter; the wavelet coefficients are threshold processed using the soft threshold function to obtain the wavelet coefficients after soft threshold processing , the formula is as follows ,in is the threshold value, which is determined according to the noise level estimation; sgn is the sign function; the spectral data is obtained after reconstructing and denoising through inverse wavelet transform , the formula is: .

[0028] The spectral data is preprocessed using a minimum-maximum normalization method, including: Normalized to the [0,1] interval, the normalization formula is: ,in is the normalized spectral data point, is the denoised spectral dataset, and They are The data after denoising and normalization preprocessing will be more suitable for the subsequent training of deep learning algorithms, improving the accuracy and reliability of precise identification and quantification of trace impurities.

[0029] In step S2, the preprocessed spectral data is trained by improving the YOLOv8 deep learning algorithm, wherein the convolution kernel in the convolution layer of the improved YOLOv8 deep learning algorithm is dynamically adjusted according to the preprocessed spectral data.

[0030] Specifically, the improvements to the YOLOv8 deep learning algorithm include: building an improved YOLOv8 deep learning model,

[0031] Determine other architecture parameters except the dynamic adjustment part of the convolution layer. In this embodiment, other architecture parameters include selecting the pooling method and kernel size for the pooling layer, determining the number of neurons for the fully connected layer, and randomly initializing the model parameters; for the convolution layer, dynamically adjust the convolution kernel according to the drug characteristics corresponding to the input spectral data; determine the loss function of the YOLOv8 deep learning model after the dynamic adjustment of the convolution kernel.

[0032] Dynamic convolution kernel adjustment based on the drug features corresponding to the input preprocessed spectral data includes: designing a drug feature recognition module, which extracts preliminary features of the spectral data and uses principal component analysis to reduce the dimensionality of the spectral data. Specifically, it includes: designing a drug feature recognition module, which is based on the preliminary feature extraction of the preprocessed spectral data. The spectral data is processed using dimension reduction techniques such as principal component analysis (PCA) to convert high-dimensional spectral data into low-dimensional feature vectors so as to more efficiently analyze the main feature patterns of the data. A simple feedforward neural network (FNN) is trained to identify the approximate type of drugs (such as capsules, bottles, etc.) and their key shape features (such as round, square, elongated, etc.). This FNN includes an input layer with the same number of neurons as the dimension of the spectral feature vector after dimension reduction, a hidden layer using the ReLU activation function, the number of neurons is set to an appropriate value based on experience, and an output layer, the output category label represents the drug type and shape feature information. For the training of FNN, the following Table 1 is the spectral data after dimension reduction:

[0033] Table 1 Spectral data after dimensionality reduction

[0034] After 500 rounds of training, the following training results may be obtained on the test set: Drug type recognition accuracy: about 90%. Among them, the recognition accuracy of capsule drugs may reach 92%, the recognition accuracy of bottled drugs is about 88%, the recognition accuracy of tablet drugs is about 90%, and the recognition accuracy of other types of drugs such as bagged and boxed drugs is between 85%-90%. Shape feature recognition accuracy: about 85%. For drugs with circular features, the recognition accuracy can reach 88%, the recognition accuracy of drugs with slender features is about 83%, and the recognition accuracy of drugs with irregular and rectangular features is about 80%-85%.

[0035] Then, based on the key shape features of the identified drugs, a convolution kernel of the corresponding shape and position is dynamically generated; specifically, for capsule drugs, a convolution kernel of a slender shape is generated. Assuming that the characteristic distribution range of the long axis direction of the capsule in the spectral data is α1 to α2, and the short axis direction is β1 to β2, the generated convolution kernel is The dimension of the direction is α2-α1, The size of the direction is a smaller value determined empirically to highlight the feature extraction in the long axis direction, and the center position of the convolution kernel is adjusted to For bottled medicines, if the bottle is round, the radius is , then the generated convolution kernel can be expressed in polar coordinates as The convolution kernel shape is composed of uniformly distributed sampling points, and the position of the convolution kernel is adjusted according to the center position (α0, β0) of the bottle in the spectral data. If the bottle is square, the side lengths are and , then the generated convolution kernel is The direction size is , The direction size is , the center position is (α0+a / 2, β0+b / 2).

[0036] Then, the dynamically generated convolution kernel is used for convolution operation. When the characteristic coordinates of the input spectral data are I (U, V), the dynamically generated convolution kernel is T (U, V), and the characteristic map after convolution is F (U, V). The calculation formula is: , where t is the half length of the convolution kernel, u represents the offset in the horizontal direction, and v represents the offset in the vertical direction.

[0037] By optimizing the generation and adjustment algorithms of convolution kernels, such as adopting efficient matrix operation libraries and parallel computing technologies, we can ensure that this process is implemented without increasing the amount of calculations too much, thus achieving the goal of lightweight.

[0038] The loss function of the YOLOv8 deep learning model after the dynamic adjustment of the convolution kernel includes: using the bounding box loss function CIoU to determine the positioning loss, which has the advantage of comprehensively considering the box overlap, center distance and aspect ratio, accurately positioning the spectral impurity area, overcoming the limitations of traditional positioning loss, and improving the positioning accuracy under complex spectra, including: , , ,in and are the horizontal and vertical coordinates of the center point of the prediction box, is the width of the prediction box, is the height of the prediction box; and are the horizontal and vertical coordinates of the center point of the real frame, is the width of the real box, is the height of the real box, w is the diagonal length of the minimum closure area, is the balance parameter, is the consistency of aspect ratio, and IoU is the intersection over union ratio. The intersection over union ratio is a commonly used evaluation index in the field of target detection, which is used to measure the degree of overlap between two bounding boxes (in the detection of trace impurities in medicines, when the model predicts the bounding box where the impurity is located and compares it with the actual impurity bounding box, IoU can reflect the overlap between the predicted bounding box and the actual bounding box. The value of IoU is between 0 and 1. The closer the value is to 1, the higher the overlap between the two bounding boxes, that is, the higher the accuracy of the model prediction; the closer the value is to 0, the lower the overlap is, and the worse the prediction effect is).

[0039] The confidence loss L is determined by using the binary cross entropy loss to measure the confidence deviation of the predicted impurity conf , so that the model can accurately judge the possibility of spectral features containing impurities, reduce misjudgment, and enhance the reliability of impurity identification. The specific formula is as follows: ,in is the total number of prediction boxes, is the true confidence, is the prediction confidence; the classification loss L is determined by the cross entropy loss cls , ensuring that the model can accurately distinguish various impurities in spectral data, laying the foundation for quantitative analysis, which is of great significance for the analysis of multi-impurity systems, including: ,in, is the number of impurity categories, is the true category label of the one-hot encoding, is the predicted class probability distribution.

[0040] Through the above improvements, the improved YOLOv8 algorithm can better adapt to the different morphological characteristics of drugs when processing drug spectral data, improve the identification and quantitative accuracy of trace impurities, while maintaining high computational efficiency and lightweight model.

[0041] In step S3, the deep learning model obtained according to the improved YOLOv8 deep learning algorithm is evaluated by a cross-validation method, and the deep learning model whose evaluation result does not meet the preset conditions is optimized until the evaluation result meets the preset conditions.

[0042] In one example, S3 specifically includes: dividing the preprocessed spectral data into a training set in proportion , validation set ; Get the prediction results of the forward propagation of the deep learning model, calculate the loss value of the prediction results according to the loss function, calculate the gradient of the loss value through back propagation, and then use the Adam optimizer according to Update the initialization model parameters, where is the model parameter, including the parameter set such as weights in the neural network; The learning rate controls the step size of each parameter update. If the learning rate is too large, the parameters may oscillate or even diverge near the optimal solution during update. If the learning rate is too small, the model converges too slowly. It is the gradient of the loss function L with respect to the parameter θ. The direction of the gradient indicates the direction in which the loss function grows fastest, and using the negative gradient direction in the formula means updating the parameter θ in the direction that reduces the loss function L.

[0043] After each round of training, use the validation set The performance indicators are evaluated, including accuracy, recall, F1 value, and average precision. The calculation methods of the evaluation indicators are as follows: Accuracy: ,in True positive, True negative, False positive, is a false negative; recall rate: ; F1 value: ,in ; Mean average precision: in For the Class average precision, K represents the number of samples or other related counting parameters involved in calculating the average precision under each category.

[0044] When the performance index no longer improves or decreases, adjust the hyperparameters, use regularization for optimization when overfitting occurs, and continue training until the model converges. The optimization here is mainly to optimize the deep learning model itself. When encountering the overfitting problem, regularization technology is used to optimize the parameters of the model. Overfitting is usually manifested as a model that performs very well on the training set, but performs poorly on the validation set or test set, indicating that the model has over-learned the noise and details in the training data and has not captured the general characteristics of the data well. Regularization limits the size of model parameters by adding additional penalty terms (such as L1 regularization or L2 regularization) to the loss function of the model to prevent the model from being too complex. For parameters such as the convolutional layer weights and the fully connected layer weights in the improved YOLOv8 model, regularization will prevent their values ​​from being too large, making the model more robust and generalized. During the continuous training process, the hyperparameters are constantly adjusted and optimization methods such as regularization are applied, so that the model gradually converges to a better state, which can accurately identify and quantitatively analyze trace impurities in drug mixtures.

[0045] In step S4, the deep learning model whose evaluation results meet the preset conditions is used to perform impurity identification and quantitative analysis on the sample to be tested.

[0046] In step S5, feedback optimization is performed based on the results of the impurity identification and quantitative analysis, and iterative training is performed through an incremental learning method to improve the accuracy of impurity identification and quantitative analysis.

[0047] In one example, step S5 includes: obtaining new sample spectral data, performing the same processing on the new sample spectral data as steps S1-S4 and obtaining evaluation standard indicators; integrating the evaluation standard indicators of multiple rounds of new sample spectral data, and dynamically monitoring the changes in deep learning model performance according to the evaluation standard indicators; when the performance of the deep learning model does not meet the preset conditions, making targeted improvements to the deep learning model.

[0048] Specifically, the deep learning model integrates the results of multiple rounds of incremental learning, regularly evaluates the indicators of the validation set (including the corresponding part of new samples), including accuracy, recall, F1 value and mAP, and dynamically monitors performance changes. If the indicators fluctuate or decline, retrospectively analyze the characteristics of new samples and the learning process, retrospectively check parameter updates, sample feature learning status, retrospective layer adjustment, learning rate setting, sample feature extraction effect, retrospectively check the model's response to new impurities and feature extraction learning, and make targeted improvements.

[0049] After multiple rounds of iterations, the model continues to accumulate new impurity knowledge, optimize decision boundaries, accurately identify quantitative trace impurities, strongly support drug quality control and complex sample analysis in multiple fields, adapt to the dynamic evolution of impurity components and drug formulations, ensure the accuracy and reliability of impurity monitoring in the production process, improve quality control efficiency and level, and provide strong adaptable technical support for complex trace impurity analysis.

[0050] Those skilled in the art will appreciate that the above-mentioned embodiments are specific examples for implementing the present invention, and in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present invention.

Claims

1. A method for identifying and quantifying trace impurities in drug mixtures based on deep learning, characterized in that: include: S1. Collecting spectral data of the target drug mixture and preprocessing the spectral data, wherein the spectral data is any one of infrared spectrum, mass spectrum, and nuclear magnetic resonance spectrum; S2. The spectral data is trained by improving the YOLOv8 deep learning algorithm, wherein the convolution kernel in the convolution layer of the improved YOLOv8 deep learning algorithm is dynamically adjusted according to the spectral data; S3. Evaluate the deep learning model obtained according to the improved YOLOv8 deep learning algorithm by a cross-validation method, and optimize the deep learning model whose evaluation result does not meet the preset conditions until the evaluation result meets the preset conditions; S4. Use the deep learning model whose evaluation results meet the preset conditions to perform impurity identification and quantitative analysis on the sample to be tested; S5. Feedback optimization is performed based on the results of the impurity identification and quantitative analysis, and iterative training is performed through an incremental learning method to improve the accuracy of impurity identification and quantitative analysis.

2. The method for identifying and quantifying trace impurities in drug mixtures based on deep learning according to claim 1, characterized in that: The preprocessing of the spectral data in step S1 includes: preprocessing the spectral data using a wavelet transform denoising method and a minimum-maximum normalization method.

3. The method for identifying and quantifying trace impurities in drug mixtures based on deep learning according to claim 2, characterized in that: The spectral data is preprocessed using a wavelet transform denoising method, including: The spectral data set composed of the spectral data Perform wavelet decomposition, where n is an integer greater than or equal to 1, x n is the spectral data in the spectral dataset. For each spectral data x in the spectral dataset n , with the corresponding discrete signal Represent it, and then choose the wavelet basis function , its wavelet decomposition formula is: ,in is the wavelet coefficient, is the conjugate of the wavelet basis function, Indicates scale, Represents the translation parameter; the wavelet coefficients are threshold processed using the soft threshold function to obtain the wavelet coefficients after soft threshold processing , the formula is as follows ,in is the threshold value, which is determined according to the noise level estimation; sgn is the sign function; the spectral data is obtained after reconstructing and denoising through inverse wavelet transform , the formula is: .

4. The method for identifying and quantifying trace impurities in drug mixtures based on deep learning according to claim 3, characterized in that: The spectral data are preprocessed using a minimum-maximum normalization method, including: The denoised spectral data Normalized to the [0,1] interval, the normalization formula is: ,in is the normalized spectral data point, is the denoised spectral dataset, and They are The minimum and maximum values ​​in .

5. The method for identifying and quantifying trace impurities in drug mixtures based on deep learning according to claim 1, characterized in that: The improvements to the YOLOv8 deep learning algorithm in step S2 include: Construct an improved YOLOv8 deep learning model, determine the other architecture parameters except the dynamically adjusted part of the convolution layer, and randomly initialize the model parameters; for the convolution layer, dynamically adjust the convolution kernel according to the drug characteristics corresponding to the input spectral data; determine the loss function of the YOLOv8 deep learning model after the dynamic adjustment of the convolution kernel.

6. The method for identifying and quantifying trace impurities in drug mixtures based on deep learning according to claim 5, characterized in that: Dynamic convolution kernel adjustment based on drug features corresponding to the input spectral data includes: Design a drug feature recognition module, which extracts the preliminary features of spectral data and uses principal component analysis to reduce the dimensionality of spectral data; The spectral data after dimension reduction is identified through a feedforward neural network to obtain the shape type of the drug and the key shape features corresponding to each shape type; According to the key shape features of the identified drugs, a convolution kernel of corresponding shape and position is dynamically generated; The convolution operation is performed using the dynamically generated convolution kernel. When the input spectral data is I (U, V), the dynamically generated convolution kernel is T (U, V), and the feature map after convolution is F (U, V). The calculation formula is: , where t is the half length of the convolution kernel, u represents the offset in the horizontal direction, and v represents the offset in the vertical direction.

7. The method for identifying and quantifying trace impurities in drug mixtures based on deep learning according to claim 5, characterized in that: Determine the loss function of the YOLOv8 deep learning model after the convolution kernel is dynamically adjusted, including: The bounding box loss function CIoU is used to determine the positioning loss: , , ,in and are the horizontal and vertical coordinates of the center point of the prediction box, is the width of the prediction box, is the height of the prediction box; and are the horizontal and vertical coordinates of the center point of the real frame, is the width of the real box, is the height of the real box, w is the diagonal length of the minimum closure area, is the balance parameter, is the aspect ratio consistency, and IoU is the intersection over union ratio; The confidence loss L is determined by using the binary cross entropy loss to measure the confidence deviation of the predicted impurity conf : ,in is the total number of prediction boxes, is the true confidence, is the prediction confidence; Determine the classification loss L using cross entropy loss cls : ,in, is the number of impurity categories, is the true category label of the one-hot encoding, is the predicted class probability distribution.

8. The method for identifying and quantifying trace impurities in drug mixtures based on deep learning according to claim 1, characterized in that: Step S3 includes: The preprocessed spectral data is divided into a training set , validation set ; Obtain the prediction results of the forward propagation of the deep learning model, calculate the loss value of the prediction results according to the loss function, calculate the gradient of the loss value through back propagation, and then use the Adam optimizer according to Update the initialization model parameters, where are model parameters, is the learning rate, is the gradient of the loss function L with respect to the parameter θ; After each round of training, use the validation set Evaluate performance indicators, including accuracy, recall, F1 value, and average precision. When the performance indicators no longer improve or decrease, adjust the hyperparameters. When overfitting occurs, use regularization for optimization and continue training until the model converges.

Citation Information

Patent Citations

  • Lightweight infrared target detection algorithm based on improved YOLOv8

    CN117636111A

  • Improved YOLOv8 fish image recognition method based on transfer learning

    CN119445348A

  • Unmanned aerial vehicle image rice pest recognition method based on deep learning

    CN119445417A

Cited By

  • Compound fenbendazole tablet quality evaluation method based on convolutional neural network

    CN121306594A