Anomaly detection system construction system and method based on dynamic strategy and active learning
By using a dynamic strategy and an active learning-based anomaly detection system, the sample set is dynamically updated and representative unlabeled samples are selected, which solves the problems of high sample acquisition difficulty and high labeling cost in lithium battery anomaly detection, and achieves more efficient model training and lower labeling cost.
Patent Information
- Application Number
- CN202310124865.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-16
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2043-02-16
AI Technical Summary
Existing anomaly detection models face challenges in obtaining training samples during the use of rechargeable batteries such as lithium batteries, resulting in high annotation costs and making it difficult to achieve low-cost and efficient training results.
An anomaly detection system based on dynamic strategies and active learning is adopted. Through multiple training sessions and the annotation of unlabeled samples, the labeled sample set is dynamically updated. Combining sample information content scores and representativeness scores, the most representative unlabeled samples are selected for annotation to construct an anomaly detection model.
It effectively reduces sample labeling costs, improves the accuracy and effectiveness of model training, achieves better training results with fewer samples, and reduces the cost of building anomaly detection models.
Smart Images

Figure CN116520150B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of battery anomaly detection technology, and more specifically, to a system and method for constructing an anomaly detection system based on dynamic strategies and active learning. Background Technology
[0002] During the service life of rechargeable batteries such as lithium batteries, it is necessary to detect abnormal conditions. Since manual inspection is inefficient, existing methods typically employ anomaly detection models, which mainly include machine learning-based and deep learning-based models.
[0003] Whether it's a detection model based on machine learning or a detection model based on deep learning, both require a large sample set for training. In addition, each sample in the training sample set needs to be labeled to obtain label data.
[0004] In battery anomaly detection, it is usually necessary to obtain a training sample set that meets the criteria by manually annotating historical data through experts. However, due to factors such as the diversification of battery usage scenarios, the annotation cost of historical battery data is high. Therefore, it is difficult to obtain a large number of training sample sets, which directly leads to the difficulty in achieving good training results for the trained anomaly detection model at a low cost. Summary of the Invention
[0005] This invention provides an anomaly detection system construction system based on dynamic strategies and active learning, which can overcome the problem of difficulty in obtaining samples for anomaly detection model training in the prior art. By performing model training multiple times and extracting unlabeled samples for labeling, it can significantly reduce the sample labeling cost and significantly improve the accuracy of model training.
[0006] According to the present invention, an anomaly detection system construction system based on dynamic strategy and active learning includes:
[0007] The sample library unit is used to store sample sets, which include a labeled sample set for including labeled samples and an unlabeled sample set for including unlabeled samples.
[0008] The model library unit is used to store anomaly detection models and to train anomaly detection models based on labeled sample sets.
[0009] The threshold determination unit is used to determine whether the number of samples in the labeled sample set participating in the training has reached a set threshold. When the set threshold is reached, the training of the anomaly detection model is completed. Otherwise, the unlabeled samples are selected through the sample information content scoring unit and output unit below. After the selected unlabeled samples are labeled, the labeled sample set is updated so as to realize the training of the anomaly detection model based on the updated labeled sample set.
[0010] A sample information content scoring unit, used to calculate the sample information content score for each unlabeled sample based on the trained anomaly detection model; and
[0011] The output unit is used to extract B unlabeled samples from high to low according to the sample information content score. After the B unlabeled samples are labeled, they are updated to the labeled sample set and removed from the unlabeled sample set.
[0012] The anomaly detection system of this invention can first train an anomaly detection model based on an existing labeled sample set. If the number of samples in the existing labeled sample set meets the requirements, training is complete. If the number of samples in the existing labeled sample set does not meet the training requirements, the system can select and output the most representative unlabeled samples through a sample information scoring unit and an output unit, thereby expanding and updating the labeled sample set. This effectively selects the most representative unlabeled samples to update and expand the labeled sample set, thus achieving better training results with fewer samples. Based on this, the cost of building the anomaly detection model can be effectively reduced, and because the selected samples are more representative, the training effect of the anomaly detection model can also be improved.
[0013] Furthermore, this invention also provides a method for constructing an anomaly detection system based on dynamic strategies and active learning, which includes the following steps:
[0014] Step S1: Construct a sample set P, which includes a set of labeled samples. The labeled sample set P 1 and for including unlabeled samples unlabeled sample set P 2 ;
[0015] Step S2: Construct an anomaly detection model based on the labeled sample set P 1 Train the anomaly detection model if the sample set P is already labeled. 1 Training is complete when the number of samples reaches a set threshold; otherwise, proceed to the next step. The anomaly detection model is used to process the input samples and output anomaly prediction scores S, where S∈[0,1].
[0016] Step S3: Based on the anomaly detection model trained in step S2, analyze the unlabeled sample set P. 2 For each sample in the dataset, a prediction is made and the corresponding anomaly prediction score is obtained. For unlabeled samples... Its corresponding anomaly prediction is divided into
[0017] Step S4: Calculate the unlabeled sample set P 2 The sample information content score I for each sample in the dataset, for unlabeled samples. Its corresponding sample information content score for,
[0018]
[0019] in, Unlabeled samples Uncertainty,
[0020]
[0021] Where abs(*) is the absolute value operation;
[0022] in, Unlabeled samples The representative score is obtained based on the k-means algorithm;
[0023] Step S5: Select B unlabeled samples from high to low according to the sample information content score, label them, update the labeled unlabeled samples to the labeled sample set and remove them from the unlabeled sample set;
[0024] Step S6: Based on the updated labeled sample set, repeat steps S2-S5 until the anomaly detection model training is complete.
[0025] Through the above steps S1-S6, the problem of high sample labeling costs that is common in the construction of current artificial intelligence anomaly detection models can be effectively addressed. By comprehensively considering uncertainty, diversity, and representativeness, a deep batch active learning method can be used to obtain the most representative unlabeled samples, thereby reducing the cost of sample labeling and improving the model training effect.
[0026] Preferably, in step S2, the anomaly detection model includes a machine learning model and a deep learning model; during training, a model selection threshold is set, if the currently labeled sample set P... 1 If the number of samples is lower than the model selection threshold, a machine learning model is selected as the anomaly detection model; otherwise, a deep learning model is selected as the anomaly detection model.
[0027] As a preferred choice, the XGBoost model is used for machine learning. Therefore, it achieves lower sample size requirements and higher performance.
[0028] Preferably, in step S4, representative scores for unlabeled samples are obtained based on the following steps.
[0029] Step S41: Apply the k-means algorithm to the unlabeled sample set P 2 Perform clustering;
[0030] Step S42: Calculate the initial representativeness score for each unlabeled sample based on the clustering information;
[0031] Step S43: Dimensionless processing is performed on the initial representative scores to obtain the representative scores.
[0032] Through steps S41-S43, the representative score of each unlabeled sample can be obtained more effectively based on the k-means algorithm.
[0033] Preferably, in step S41, clustering is performed based on similarity scores, and similarity scores between two unlabeled samples are calculated based on Euclidean distance.
[0034] For unlabeled sample P i 2 and unlabeled sample P j 2 Its similarity score sim(P) i 2 P j 2 The formula for calculating ) is,
[0035] sim(P i 2 P j 2 )=-D(P i 2 P j 2 );
[0036] Wherein, D(P) i 2 P j 2 ) represents unlabeled sample P i 2 and unlabeled sample P j 2 European distance between them
[0037]
[0038] in, and This indicates that sample P is unlabeled. i 2 and unlabeled sample P j 2 The feature value of the t-th corresponding feature in the sample is N, where N is the total number of features of the unlabeled samples.
[0039] Through the above methods, we can achieve better results on the unlabeled sample set P. 2 Clustering.
[0040] Preferably, in step S42, for those belonging to the k-th cluster Unlabeled samples Its initial representative score The calculation formula is as follows:
[0041]
[0042] in, Represents the k-th cluster The total number of samples included. Belongs to cluster The sample.
[0043] Based on the above, each unlabeled sample can be obtained more effectively. The initial representative score.
[0044] Preferably, in step S43, for unlabeled samples Its initial representative score Representative rating The calculation formula is as follows:
[0045]
[0046] in, This indicates all unlabeled samples. The minimum initial representative score.
[0047] Based on the above, normalization can be achieved relatively well.
[0048] Preferably, the value of B is below the set threshold. Therefore, it is possible to gradually reorder and extract unlabeled samples based on the anomaly detection model after each training, thus improving the accuracy of sample selection. Attached Figure Description
[0049] Figure 1 This is a schematic diagram of the construction system for an anomaly detection system based on dynamic strategies and active learning, as shown in Example 1.
[0050] Figure 2This is a schematic diagram of an anomaly detection system construction method based on dynamic strategy and active learning in Example 1. Detailed Implementation
[0051] To further understand the content of this invention, a detailed description of the invention will be provided in conjunction with the accompanying drawings and embodiments. It should be understood that the embodiments are merely illustrative and not limiting of the invention.
[0052] Example 1
[0053] Combination Figure 1 As shown, this embodiment provides a system for constructing an anomaly detection system based on dynamic strategies and active learning, which includes:
[0054] The sample library unit is used to store sample sets, which include a labeled sample set for including labeled samples and an unlabeled sample set for including unlabeled samples.
[0055] The model library unit is used to store anomaly detection models and to train anomaly detection models based on labeled sample sets.
[0056] The threshold determination unit is used to determine whether the number of samples in the labeled sample set participating in the training has reached a set threshold. When the set threshold is reached, the training of the anomaly detection model is completed. Otherwise, the unlabeled samples are selected through the sample information content scoring unit and output unit below. After the selected unlabeled samples are labeled, the labeled sample set is updated so as to realize the training of the anomaly detection model based on the updated labeled sample set.
[0057] A sample information content scoring unit, used to calculate the sample information content score for each unlabeled sample based on the trained anomaly detection model; and
[0058] The output unit is used to extract B unlabeled samples from high to low according to the sample information content score. After the B unlabeled samples are labeled, they are updated to the labeled sample set and removed from the unlabeled sample set.
[0059] The anomaly detection system in this embodiment can first train the anomaly detection model based on an existing labeled sample set. If the number of samples in the existing labeled sample set meets the requirements, training is complete. If the number of samples in the existing labeled sample set does not meet the training requirements, the system can select and output the most representative unlabeled samples through the sample information scoring unit and the output unit, thereby expanding and updating the labeled sample set. This effectively selects the most representative unlabeled samples to update and expand the labeled sample set, thus achieving better training results with fewer samples. Based on this, the system can effectively reduce the cost of building the anomaly detection model, and because the selected samples are more representative, it also improves the training effect of the anomaly detection model.
[0060] In this embodiment, sample representativeness refers to samples that can bring better training results. It is understood that for artificial intelligence models such as the anomaly detection model in this embodiment, the contribution of different representative samples in the sample set used for training is significantly different. For example, the training effect of 1,000 ordinary training samples may not be as good as that of 100 representative training samples.
[0061] Furthermore, in this embodiment, the aim is to select more representative samples. How the anomaly detection model is specifically constructed and how the selected samples are labeled are not the focus of this embodiment and will not be elaborated upon. In fact, the solution in this example has broad applicability, as most artificial intelligence models face the problem of how to construct a training sample set during training.
[0062] Combination Figure 2 As shown, based on the anomaly detection system construction system in this embodiment, this embodiment also provides a method for constructing anomaly detection systems based on dynamic strategies and active learning, which includes the following steps:
[0063] Step S1: Construct a sample set P, which includes a set of labeled samples. The labeled sample set P 1 and for including unlabeled samples unlabeled sample set P 2 ;
[0064] Step S2: Construct an anomaly detection model based on the labeled sample set P 1 Train the anomaly detection model if the sample set P is already labeled. 1Training is complete when the number of samples reaches a set threshold; otherwise, proceed to the next step. The anomaly detection model is used to process the input samples and output anomaly prediction scores S, where S∈[0,1].
[0065] Step S3: Based on the anomaly detection model trained in step S2, analyze the unlabeled sample set P. 2 For each sample in the dataset, a prediction is made and the corresponding anomaly prediction score is obtained. For unlabeled samples... Its corresponding anomaly prediction is divided into
[0066] Step S4: Calculate the unlabeled sample set P 2 The sample information content score I for each sample in the dataset, for unlabeled samples. Its corresponding sample information content score for,
[0067]
[0068] in, Unlabeled samples Uncertainty,
[0069]
[0070] Where abs(*) is the absolute value operation;
[0071] in, Unlabeled samples The representative score is obtained based on the k-means algorithm;
[0072] Step S5: Select B unlabeled samples from high to low according to the sample information content score, label them, update the labeled unlabeled samples to the labeled sample set and remove them from the unlabeled sample set;
[0073] Step S6: Based on the updated labeled sample set, repeat steps S2-S5 until the anomaly detection model training is complete.
[0074] Through the above steps S1-S6, the problem of high sample labeling costs that is common in the construction of current artificial intelligence anomaly detection models can be effectively addressed. By comprehensively considering uncertainty, diversity, and representativeness, a deep batch active learning method can be used to obtain the most representative unlabeled samples, thereby reducing the cost of sample labeling and improving the model training effect.
[0075] In this embodiment, since more representative unlabeled samples can be selected and labeled to obtain the labeled sample set required for training, the labeled sample set can be constructed more effectively and the requirement for the amount of samples required for training can be reduced.
[0076] Furthermore, since the representativeness score can be calculated based on both the uncertainty score and the representativeness score, it can effectively filter out unlabeled samples with high information content. The uncertainty score is obtained through a pre-trained anomaly detection model. Based on its formula, it can be seen that samples with anomaly prediction scores closer to 0.5 are given higher uncertainty scores, thus better characterizing the uncertainty of the samples. It can be understood that the anomaly detection model in this embodiment is an anomaly determination model. A result approximately close to 1 indicates a higher probability of anomaly, a value closer to 0 indicates a higher probability of normality, and a value closer to 0.5 indicates that it is more difficult to determine whether an anomaly exists.
[0077] In this embodiment, the optimal information content of the sample can be selected for manual annotation through active learning, thereby achieving better results with fewer samples. By integrating uncertainty and representativeness to calculate the information content of the sample, the problem of model failure caused by serious inconsistency between the selected sample and the true distribution is avoided.
[0078] In step S2 of this embodiment, the anomaly detection model includes a machine learning model and a deep learning model; during training, a model selection threshold is set, if the currently labeled sample set P... 1 If the number of samples is lower than the model selection threshold, a machine learning model is selected as the anomaly detection model; otherwise, a deep learning model is selected as the anomaly detection model.
[0079] This approach allows for the selection of unlabeled samples by using a machine learning model that requires fewer samples for training, thus enabling the training of the final deep learning-based anomaly detection model.
[0080] In other words, the solution implemented in this way can better select a more suitable initial training model based on the sample size of the labeled samples. When the sample size is relatively small, machine learning is used for training to reduce the risk of overfitting. When the sample size is large, deep learning is used for training to reduce the risk of underfitting.
[0081] It is understood that the machine learning model and deep learning model in this embodiment are merely specific implementation schemes. The essential requirement is that the anomaly detection model should include at least two models with different requirements for the amount of training samples.
[0082] In this embodiment, the machine learning model uses the XGBoost model. Therefore, it can achieve low sample size requirements and high performance.
[0083] In step S4 of this embodiment, representative scores of unlabeled samples are obtained based on the following steps.
[0084] Step S41: Apply the k-means algorithm to the unlabeled sample set P 2 Perform clustering;
[0085] Step S42: Calculate the initial representativeness score for each unlabeled sample based on the clustering information;
[0086] Step S43: Dimensionless processing is performed on the initial representative scores to obtain the representative scores.
[0087] Through steps S41-S43, the representative score of each unlabeled sample can be obtained more effectively based on the k-means algorithm.
[0088] In step S41 of this embodiment, clustering is performed based on similarity scores, and similarity scores between two unlabeled samples are calculated based on Euclidean distance.
[0089] For unlabeled sample P i 2 and unlabeled sample P j 2 Its similarity score sim(P) i 2 P j 2 The formula for calculating ) is,
[0090] sim(P i 2 P j 2 )=-D(P i 2 P j 2 );
[0091] Wherein, D(P) i 2 P j 2 ) represents unlabeled sample P i 2 and unlabeled sample P j 2 European distance between them
[0092]
[0093] in, and This indicates that sample P is unlabeled. i 2 and unlabeled sample P j 2 The feature value of the t-th corresponding feature in the sample is N, where N is the total number of features of the unlabeled samples.
[0094] Through the above methods, we can achieve better results on the unlabeled sample set P. 2 Clustering.
[0095] In step S41, all unlabeled samples can be... All methods are based on the k-means algorithm. By setting the relevant parameters of the k-means algorithm, the unlabeled sample set P can be processed more effectively. 2 Clustering and grouping. In this embodiment, the number of clusters K for the k-means algorithm can be set to 10, meaning that the k-means algorithm can group all unlabeled samples. They were divided into 10 different clusters based on similarity. Understandably, the k-means algorithm, as a well-known algorithm, exhibits the highest similarity between samples within the same cluster and the lowest similarity between samples from different clusters.
[0096] The k-means algorithm in this embodiment can be performed according to the following steps:
[0097] a. In all unlabeled samples K samples (K=10 in this embodiment) are randomly selected as center points, denoted as C1 to C2 respectively. 10 ;
[0098] b. Calculate all remaining unlabeled samples Similarity score to each center point, and each unlabeled sample They are assigned to the cluster containing the centroid with the highest similarity score, thus completing the acquisition of the initial cluster;
[0099] c. After obtaining the initial clusters, obtain the mean point of each cluster as the new center point C1. ′ To C1 ′ 0, thus completing the process from center point C1 to C 10 The update; understandably, the feature value corresponding to each feature in the mean point is the mean of the corresponding feature of all samples in that cluster;
[0100] d. Repeat steps b and c. After completing the set loop, such as 100 times, the unlabeled sample set P will be complete. 2 Clustering.
[0101] In step S42 of this embodiment, for those belonging to the k-th cluster Unlabeled samples Its initial representative score The calculation formula is as follows:
[0102]
[0103] in, Represents the k-th cluster The total number of samples included. Belongs to cluster The sample.
[0104] Based on the above, each unlabeled sample can be obtained more effectively. The initial representative score.
[0105] Understandable
[0106] In step S43 of this embodiment, for unlabeled samples Its initial representative score Representative rating The calculation formula is as follows:
[0107]
[0108] in, This indicates all unlabeled samples. The minimum initial representative score.
[0109] Based on the above, normalization can be achieved relatively well.
[0110] In practical application, the method in this embodiment is as follows:
[0111] In step S1, labeled samples can be selected from the sample set P to construct the labeled sample set P. 1 If there are no labeled samples in the sample set P, then, for example, 100 samples can be randomly selected and manually labeled to construct the labeled sample set P. 1 ;
[0112] In step S2, the model selection threshold can be set to 1000, which is the current labeled sample set P. 1 If the number of samples is less than 1000, a machine learning model is selected to train it, thereby completing the subsequent steps; the currently labeled sample set P 1 When the number of samples is not less than 1000, a deep learning model is selected for training, so that a machine learning model can be used as a transition to obtain the final deep learning model.
[0113] When performing step S2, a threshold can be set to 10000. The value of this threshold can be calculated based on the required sample size or labeling cost of the corresponding deep learning model, thus enabling better control over the total number of labeled samples.
[0114] When performing step S5, the value of B can be set below a set threshold, such as 100. Therefore, the unlabeled samples can be reordered and extracted step by step based on the anomaly detection model after each training, thus improving the accuracy of sample selection.
[0115] The present invention and its embodiments have been described above illustratively. This description is not restrictive, and the figures shown are only one embodiment of the present invention; the actual structure is not limited thereto. Therefore, if those skilled in the art are inspired by this description and design similar structures and embodiments without departing from the spirit of the present invention, such designs should fall within the protection scope of the present invention.
Claims
1. A method for constructing an anomaly detection system based on dynamic strategies and active learning, comprising the following steps: Step S1: Construct a sample set P, which includes a set of labeled samples. labeled sample set and for including unlabeled samples unlabeled sample set ; Step S2: Construct an anomaly detection model based on the labeled sample set. Train the anomaly detection model if the sample set has been labeled. If the number of samples reaches a set threshold, training is complete; otherwise, proceed to the next step. The anomaly detection model is used to process the input samples and output anomaly prediction scores S. ; Step S3: Based on the anomaly detection model trained in step S2, analyze the unlabeled sample set. For each sample in the dataset, a prediction is made and the corresponding anomaly prediction score is obtained. For unlabeled samples... The corresponding anomaly prediction is divided into S( ); Step S4: Calculate the unlabeled sample set The sample information content score I for each sample in the dataset, for unlabeled samples. Its corresponding sample information content score I ( )for, ; in, Unlabeled samples Uncertainty, ; in, For absolute value operations; in, Unlabeled samples The representative score is obtained based on the k-means algorithm; Step S5: Select B unlabeled samples from high to low according to the sample information content score, label them, update the labeled unlabeled samples to the labeled sample set and remove them from the unlabeled sample set; Step S6: Based on the updated labeled sample set, repeat steps S2-S5 until the anomaly detection model training is complete.
2. The method for constructing an anomaly detection system based on dynamic strategies and active learning according to claim 1, characterized in that: In step S2, the anomaly detection model includes a machine learning model and a deep learning model; during training, a model selection threshold is set, if the currently labeled sample set... If the number of samples is lower than the model selection threshold, a machine learning model is selected as the anomaly detection model; otherwise, a deep learning model is selected as the anomaly detection model.
3. The method for constructing an anomaly detection system based on dynamic strategies and active learning according to claim 2, characterized in that: The machine learning model uses the xgboost model.
4. The method for constructing an anomaly detection system based on dynamic strategies and active learning according to claim 1, characterized in that: In step S4, obtaining representative scores for unlabeled samples includes, Step S41: Process the unlabeled sample set based on the k-means algorithm. Perform clustering; In step S41, clustering is performed based on similarity scores, and the similarity score between two unlabeled samples is calculated based on Euclidean distance. For unlabeled samples and unlabeled samples Its similarity score The calculation formula is as follows: ; in, Unlabeled samples and unlabeled samples European distance between ; in, and Indicates unlabeled samples and unlabeled samples The feature value of the t-th corresponding feature in the sample is N, where N is the total number of features of the unlabeled samples.
5. The method for constructing an anomaly detection system based on dynamic strategies and active learning according to claim 4, characterized in that: In step S4, obtaining representative scores for unlabeled samples includes, Step S42: Calculate the initial representativeness score for each unlabeled sample based on the clustering information; Step S43: Dimensionless processing is performed on the initial representative scores to obtain representative scores; In step S42, for those belonging to the k-th cluster Unlabeled samples Its initial representative score The calculation formula is as follows: ; in, Represents the k-th cluster The total number of samples included. Belongs to cluster The sample; In step S43, for unlabeled samples Its initial representative score Representative rating The calculation formula is as follows: ; in, This indicates all unlabeled samples. The minimum initial representative score.
6. The method for constructing an anomaly detection system based on dynamic strategies and active learning according to claim 1, characterized in that: The value of B is lower than the set threshold.
7. A system for constructing an anomaly detection system based on dynamic strategies and active learning, used to implement the anomaly detection system construction method based on dynamic strategies and active learning as described in any one of claims 1-6, comprising: The sample library unit is used to store sample sets, which include a labeled sample set for including labeled samples and an unlabeled sample set for including unlabeled samples. The model library unit is used to store anomaly detection models and to train anomaly detection models based on labeled sample sets. The threshold determination unit is used to determine whether the number of samples in the labeled sample set participating in the training has reached a set threshold. When the set threshold is reached, the training of the anomaly detection model is completed. Otherwise, the unlabeled samples are selected through the sample information content scoring unit and output unit below. After the selected unlabeled samples are labeled, the labeled sample set is updated so as to realize the training of the anomaly detection model based on the updated labeled sample set. The sample information content scoring unit is used to calculate the sample information content score for each unlabeled sample based on the trained anomaly detection model. as well as The output unit is used to extract B unlabeled samples from high to low according to the sample information content score. After the B unlabeled samples are labeled, they are updated to the labeled sample set and removed from the unlabeled sample set.
Citation Information
Patent Citations
Active learning method of target detection system
CN111160469A