Battery anomaly detection method, system, device and medium based on boundary prototype
Through the battery abnormality detection method based on boundary prototype, the problem of low battery abnormality detection accuracy in the prior art is solved. By maximizing the distance between normal and abnormal samples and building a composite loss function, the accuracy and robustness of the detection are improved. , adaptability and generalization ability.
Patent Information
- Application Number
- CN202410881740.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-03
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2044-07-03
AI Technical Summary
When existing machine learning methods face changes in data distribution or new abnormalities, the battery abnormality detection accuracy is low, making it difficult to effectively identify unknown data and new abnormalities.
Using the battery abnormality detection method based on boundary prototypes, the optimization target is defined to maximize the distance between normal samples and abnormal samples, combined with classification loss, boundary limit and prototype point loss, a composite loss function is constructed, and the abnormality detection model parameters are optimized, so as to Improve the discrimination and accuracy of detection.
Improve the accuracy and robustness of battery anomaly detection, enables to build clear decision boundaries in feature space, define the boundaries between normal and abnormal, and enhances the adaptability and generalization capabilities of the model, especially when facing unseen data. Shows stronger adaptability.
Smart Images

Figure CN118425788B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of battery anomaly detection, and in particular to a battery anomaly detection method, system, device and medium based on boundary prototype. Background Art
[0002] The background of battery anomaly detection technology mainly stems from the demand for battery system safety, reliability and performance. With the widespread use of batteries in various applications, such as electric vehicles, portable devices, energy storage systems, etc., battery monitoring and management have become increasingly important, and battery anomaly detection technology has received extensive attention and research.
[0003] At present, battery anomaly detection technologies include but are not limited to traditional voltage monitoring and temperature monitoring technologies, as well as technologies based on machine learning and data mining. However, existing machine learning methods are often based on focusing only on historical data itself and are good at identifying known data. When faced with changes in data distribution or new anomalies, there is a problem of low detection accuracy. Summary of the invention
[0004] The embodiments of the present application provide a battery anomaly detection method, system and medium based on boundary prototypes to at least solve the problem of low detection accuracy in the related art when facing changes in data distribution or new abnormal situations.
[0005] In a first aspect, an embodiment of the present application provides a battery anomaly detection method based on a boundary prototype, the method comprising:
[0006] Defining an optimization goal of the anomaly detection model, wherein the optimization goal includes maximizing the distance between normal samples and abnormal samples;
[0007] Minimizing the classification loss of boundary points of the anomaly detection model, optimizing the parameters of the anomaly detection model, and determining the sample category;
[0008] According to the preset constraint conditions, each sample is constrained, a boundary restriction is constructed and a loss function is established for the boundary restriction, wherein the boundary restriction is used to limit the maximum distance between each sample and the boundary point;
[0009] Taking the prototype point of the normal sample as the center of the normal category, and determining the loss function of the boundary prototype point according to the center of the normal category;
[0010] A target anomaly detection model is determined based on the classification loss, the boundary restriction loss, and the prototype point loss, and an anomaly detection result is obtained based on the target anomaly detection model.
[0011] In one embodiment, the prototype point of the normal sample is used as the center of the normal category, and the loss function of the boundary prototype point is determined according to the center of the normal category, including:
[0012] Determine the prototype point of the normal sample by acquiring sample features belonging to the normal sample category;
[0013] Taking the prototype point of the normal sample as the center of the normal sample category;
[0014] A loss function of a boundary prototype point is established according to the center of the normal sample category, the boundary point and a preset radius.
[0015] In one embodiment, the optimization goal of defining the anomaly detection model includes:
[0016] According to the normal sample category, determine the sample points far away from the normal sample category as boundary points, the sample set far away from the boundary points as normal samples, and the sample set close to the boundary points as abnormal samples;
[0017] According to the distance metric function, the anomaly detection model, the abnormal samples, the unlabeled samples, the boundary points, the preset distance and the normal samples, the distance between the normal samples and the abnormal samples is maximized, and the maximized distance between the normal samples and the abnormal samples is used as the optimization target of the anomaly detection model.
[0018] In one embodiment, the preset constraint condition includes limiting the maximum distance between each sample and the boundary point in the feature space to not exceed a preset radius; according to the preset constraint condition, constraining each sample, constructing a boundary constraint and establishing a loss function for the boundary constraint, the method includes:
[0019] By limiting the maximum distance between each sample and the boundary point in the feature space to not exceed a preset radius, each sample is constrained to obtain a boundary limit of the sample;
[0020] A loss function is established for the boundary restriction according to the parameters of the anomaly detection model, the boundary point, the preset radius and the distance metric function.
[0021] In one embodiment, obtaining anomaly detection results based on the target anomaly detection model includes:
[0022] According to the target anomaly detection model, based on the current detection sample, obtaining an initial category of the current sample;
[0023] Determine a target threshold based on the distance metric, the ratio threshold, and the candidate threshold;
[0024] Comparing the distance between the prototype point of the initial category and the prototype point of the abnormal sample to see whether it exceeds the target threshold;
[0025] When the target threshold is exceeded, it is determined that the battery of the current detection sample is in an abnormal state.
[0026] In one embodiment, minimizing the classification loss of the boundary points of the anomaly detection model, optimizing the parameters of the anomaly detection model, and determining the sample category include:
[0027] Determining an initial category of the detection sample according to the distance between the detection sample and the boundary point;
[0028] Minimize the classification loss function of the boundary points, optimize the parameters of the anomaly detection model, and determine the sample category.
[0029] In one embodiment, after detecting the distance between the sample and the boundary point, the method further includes:
[0030] Through the category probability formula , determine the initial category of the detection sample, where, Indicates healthy samples, represents anomaly detection model, Indicates a boundary point.
[0031] In a second aspect, an embodiment of the present application provides a battery anomaly detection system based on a boundary prototype, the system comprising a module for defining an optimization target, a module for determining a sample category, a module for constructing a boundary restriction, a boundary prototype point module, and a module for anomaly detection results, wherein:
[0032] The optimization target definition module is used to define the optimization target of the anomaly detection model, and the optimization target includes maximizing the distance between normal samples and abnormal samples;
[0033] The sample category determination module is used to minimize the classification loss of the boundary points of the anomaly detection model, optimize the parameters of the anomaly detection model, and determine the sample category;
[0034] The boundary restriction building module is used to constrain each sample according to a preset constraint condition, build a boundary restriction and establish a loss function for the boundary restriction, wherein the boundary restriction is used to limit the maximum distance between each sample and the boundary point;
[0035] The boundary prototype point module is used to take the prototype point of the normal sample as the center of the normal category and determine the loss function of the boundary prototype point according to the center of the normal category;
[0036] The anomaly detection result module is used to determine a target anomaly detection model based on classification loss, boundary restriction loss and prototype point loss, and obtain anomaly detection results based on the target anomaly detection model.
[0037] In a third aspect, an embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the battery anomaly detection method based on a boundary prototype as described in the first aspect above is implemented.
[0038] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a battery anomaly detection method based on a boundary prototype as described in the first aspect above.
[0039] The battery anomaly detection method, system and medium based on boundary prototype provided by the embodiments of the present application have at least the following technical effects.
[0040] This application establishes the optimization goal of maximizing the distance between normal samples and abnormal samples, aiming to improve the discrimination and accuracy of anomaly detection by expanding the difference between the two types of samples in the feature space. By applying the classification loss minimization strategy to the anomaly detection model, the model parameters are optimized in combination with the concepts of boundary restrictions and prototype points. It can not only effectively classify, but also build a clear decision boundary in the feature space to define the boundary between normal and abnormal. Using classification loss, boundary restriction loss and prototype point loss, a composite loss function framework is constructed to ensure that the model can balance classification accuracy, boundary clarity and sample distribution characteristics during training. Through boundary restrictions and prototype points, the model can better understand the data distribution law, especially when facing unseen data, the model can show stronger adaptability and generalization ability. Solve the problem of low detection accuracy in related technologies when facing changes in data distribution or new abnormal situations. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0042] Figure 1 is a schematic diagram showing a voltage sensor freezing fault according to an exemplary embodiment;
[0043] Figure 2 is a flowchart of step S101 according to an exemplary embodiment;
[0044] Figure 3 is a flowchart of step S103 according to an exemplary embodiment;
[0045] Figure 4is a flowchart of step S104 according to an exemplary embodiment;
[0046] Figure 5 is a structural block diagram of a battery abnormality detection system based on a boundary prototype according to an exemplary embodiment;
[0047] Figure 6 It is a structural block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0049] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.
[0050] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0051] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantity limitation, and may indicate the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0052] In a first aspect, an embodiment of the present application provides a battery anomaly detection method based on a boundary prototype. Figure 1 It is a flow chart of a battery anomaly detection method based on boundary prototype, such as Figure 1 As shown, a battery anomaly detection method based on boundary prototype includes:
[0053] Step S101: define an optimization target of an anomaly detection model, where the optimization target includes maximizing the distance between normal samples and abnormal samples.
[0054] Step S102: Minimize the classification loss of the boundary points of the anomaly detection model, optimize the parameters of the anomaly detection model, and determine the sample category.
[0055] Step S103: Constrain each sample according to preset constraints, construct boundary constraints and establish a loss function for the boundary constraints. The boundary constraints are used to limit the maximum distance between each sample and the boundary point.
[0056] Step S104: taking the prototype point of the normal sample as the center of the normal category, and determining the loss function of the boundary prototype point according to the center of the normal category.
[0057] Step S105: determine a target anomaly detection model based on the classification loss, the boundary restriction loss and the prototype point loss, and obtain anomaly detection results based on the target anomaly detection model.
[0058] In summary, a battery anomaly detection method based on boundary prototype provided by an embodiment of the present application aims to improve the discrimination and accuracy of anomaly detection by expanding the difference between the two types of samples in the feature space by establishing an optimization goal to maximize the distance between normal samples and abnormal samples. By applying the classification loss minimization strategy to the anomaly detection model, the model parameters are optimized in combination with the concepts of boundary restrictions and prototype points. Not only can it be effectively classified, but it can also construct a clear decision boundary in the feature space to define the boundary between normal and abnormal. Using classification loss, boundary restriction loss and prototype point loss, a composite loss function framework is constructed to ensure that the model can balance classification accuracy, boundary clarity and sample distribution characteristics during training. Through boundary restrictions and prototype points, the model can better understand the data distribution law, especially when facing unseen data, the model can show stronger adaptability and generalization ability. Solve the problem of low detection accuracy in the related technology when facing changes in data distribution or new abnormal situations.
[0059] Figure 2 is a flow chart of step S101 according to an exemplary embodiment. Figure 2 As shown, step S101, defining the optimization target of the anomaly detection model, the optimization target includes maximizing the distance between normal samples and abnormal samples. Specifically, the following steps are included:
[0060] Step S1011, according to the normal sample category, determine the sample points far away from the normal sample category as boundary points, the sample set far away from the boundary points as normal samples, and the sample set close to the boundary points as abnormal samples;
[0061] Step S1012: According to the distance metric function, the anomaly detection model, the abnormal samples, the unlabeled samples, the boundary points, the preset distances and the normal samples, the distance between the normal samples and the abnormal samples is maximized, and the maximization of the distance between the normal samples and the abnormal samples is used as the optimization target of the anomaly detection model.
[0062] Optionally, the optimization goal of the anomaly detection model is to convert the normal class (target class) The boundary points (non-adjacent points) of , it is considered that the boundary points are samples of the normal category Inconsistent samples Therefore, samples that do not belong to the normal category are abnormal category samples, close to the boundary point , the formula is
[0063]
[0064] in, Indicates the preset distance. represents the distance metric function, represents the neural network model, represents the neural network model parameters, represents an abnormal sample, represents unlabeled samples, Represents the boundary points and represents a normal sample, and max() represents a maximization operation.
[0065] The distance metric function is mainly composed of the classic Euclidean distance and cosine similarity, which can be calculated by the following formula:
[0066]
[0067] In the formula, Represents the distance metric function, which is used to measure the neural network model and boundary points The distance express and Euclidean distance, express and The cosine similarity of represents the neural network model, represents the input sample, represents the boundary point, Represents the dimension of the sample; As can be seen from the above formula, the closer the distance, the higher the similarity between the sample and the non-adjacent point. It should be noted that combining the Euclidean distance and the cosine distance can better reflect the similarity between two samples in terms of distance and angle.
[0068] Through step S101, the optimization goal of the anomaly detection model is defined. First, the distance between normal and abnormal samples is maximized, so that the anomaly detection model can more accurately identify abnormal samples, reduce classification errors, and improve the overall detection accuracy. Secondly, by combining the concept of boundary points and composite distance metrics, the model has better resistance to noise and data offset, and improves robustness. Finally, the definition of boundary points and distance measurement methods provide an intuitive explanation for the anomaly detection results, making it easier to understand which features cause the sample to be classified as abnormal.
[0069] In one embodiment, step S102 minimizes the classification loss of the boundary points of the anomaly detection model, optimizes the parameters of the anomaly detection model, and determines the sample category. Specifically, it includes:
[0070] Determine the initial category of the detection sample according to the distance between the detection sample and the boundary point;
[0071] Minimize the classification loss function of the boundary points, optimize the parameters of the anomaly detection model, and determine the sample category.
[0072] Optionally, according to the distance metric value of S101, the detection sample is determined The final category probability is obtained by the following formula:
[0073]
[0074] In the formula, Indicates that given input , neural network model , and the boundary point set Under the condition of , the probability that category y is k is, represents the input sample, represents the neural network model, represents the set of boundary points, represents the i-th boundary point in the boundary point set;
[0075] Minimize the non-adjacent point classification loss To optimize the neural network parameters
[0076]
[0077] Specifically, first, an initial category is marked for each sample based on the distance from the detection sample to each boundary point. Then, the probability calculation formula in the form of a softmax function is used to determine the probability that each sample belongs to each category. The parameters of the neural network model are optimized by minimizing the classification loss function of the boundary points. The purpose is to make the features learned by the model minimize the distance between normal samples and the center (boundary points) of their respective categories, while staying away from the boundary points of other categories, so as to optimize the classification performance of the model.
[0078] Step S102, minimize the classification loss of the boundary points of the anomaly detection model, optimize the parameters of the anomaly detection model, and determine the sample category. By applying the classification loss minimization strategy to the anomaly detection model, the model parameters are optimized in combination with the concepts of boundary restrictions and prototype points. Not only can it effectively classify, but it can also build a clear decision boundary in the feature space to define the boundary between normal and abnormal. Minimizing the classification loss of non-adjacent points prompts the model to consider not only correctly classified samples during the learning process, but also samples near the boundary, avoiding overfitting and improving the model's generalization ability for new data.
[0079] Figure 3 is a flow chart of step S103 according to an exemplary embodiment. Figure 3 As shown, step S103, according to the preset constraint conditions, constrain each sample, construct a boundary restriction and establish a loss function for the boundary restriction, and the boundary restriction is used to limit the maximum distance between each sample and the boundary point. Specifically, it includes the following steps:
[0080] Step S1031, constraining each sample by limiting the maximum distance between each sample and the boundary point in the feature space to not exceed a preset radius, and obtaining the boundary limit of the sample;
[0081] Step S1032: Establish a loss function for boundary constraints according to the parameters of the anomaly detection model, boundary points, preset radius and distance metric function.
[0082] Optionally, in step S101, the optimization goal of the anomaly detection model is defined so that the open space continues to expand and the closed set space samples are no longer further reduced. The spatial distribution of normal category samples becomes larger and the distribution becomes sparse. All of the above reduce the effectiveness of the anomaly detection task. It is necessary to further release the constraints of the feature space.
[0083] Limit all samples to the radius The following formula is used inside:
[0084]
[0085] In the formula, represents a known sample, represents unlabeled samples, represents the boundary point, represents the neural network model, Represents a preset radius; that is, the maximum distance between each sample and the boundary point in the feature space is limited to not exceed the preset radius, each sample is constrained, and the boundary limit of the sample is obtained.
[0086] According to the parameters of the anomaly detection model, boundary points, preset radius and distance measurement function, a loss function is established for the boundary restriction. The loss function of the boundary restriction is:
[0087]
[0088] Specifically, step S1031 restricts each sample to the boundary point in the feature space. The maximum distance does not exceed the preset radius , realizing the boundary constraint of the sample. It ensures that the normal samples have a clear and controlled distribution area in the feature space, while the abnormal samples tend to fall outside this area. Step S1032 is based on the model parameters , boundary points , preset radius And the distance metric function, establish the boundary restriction loss function The loss function is designed to reduce the loss when the sample is too far from the boundary point of its category (i.e., more than ), resulting in a large loss, prompting the model to keep normal samples within the boundary as much as possible during learning. By setting boundary limits, the model can distinguish normal and abnormal samples more accurately, because only when the sample is too far away from the boundary point of its corresponding category will it be considered abnormal, reducing the possibility of false positives and improving the accuracy of detection. The boundary limit loss function guides the model to focus not only on correct classification during training, but also on the distribution density and boundary constraints of samples in the feature space, which helps the model learn more reasonable decision boundaries, optimize model parameters, and enhance the understanding of data distribution.
[0089] Figure 4 is a flow chart of step S104 according to an exemplary embodiment. Figure 4 As shown, step S104, taking the prototype point of the normal sample as the center of the normal category, and determining the loss function of the boundary prototype point according to the center of the normal category. Specifically, the following steps are included:
[0090] Step S1041, determining the prototype point of the normal sample by acquiring the sample features belonging to the normal sample category;
[0091] Step S1042, taking the prototype point of the normal sample as the center of the normal sample category;
[0092] Step S1043: Establish a loss function of the boundary prototype point according to the center, boundary point and preset radius of the normal sample category.
[0093] Optionally, after the processing of step S103, the distribution of normal category samples is still sparse and needs to be further reduced. The closed set space can reduce the risk of the open space. To this end, the prototype points of the normal class samples will be used to make the known class distribution space more compact. The prototype points of the normal samples are determined by obtaining the sample features belonging to the normal sample category, that is, by calculating at the boundary of n Prototype points of samples , which is formally described as:
[0094]
[0095] Prototype Point is the average center of a class of embedded features, and the goal is to move similar samples toward the center to reduce the closed set space. Therefore, the optimization objective is defined as:
[0096]
[0097] prototype The calculation of has certain limitations, and it is necessary to consider that the target class samples are at a distance for The situation at the boundary of the circle. is calculated in this case and may be close to , which is the center of the circle. We hope that the sample is far away from ,near Once the prototype point approaches , which makes model optimization more difficult and requires considering the relative position of the prototype point relative to non-adjacent points. Constraints are imposed to fix the prototype so that it remains on the boundary, i.e. the farthest point relative to non-adjacent points. This operation can be defined as
[0098]
[0099] Then, the boundary prototype loss is defined as
[0100]
[0101] in is a hyperparameter.
[0102] Specifically, step S1041 determines the prototype point by calculating the mean of the features of the samples belonging to the normal category. , which is essentially finding the center of the normal sample in the feature space, reflecting the typical characteristics of normal data. Step S1042 uses the prototype point as the center of the normal sample category, and attracts similar samples to the center point through the optimization process, thereby reducing the distribution range of the normal sample, making it more compact, and combating the open space problem caused by sparse samples. Step S1043 constructs a loss function by considering the normal category center, boundary points, and preset radius, with the aim of ensuring that the prototype point can serve as the center of condensation of normal samples and remain near the boundary to maintain a reasonable decision boundary. Restrictions on the relative position of the prototype point relative to the boundary point are introduced to ensure that the prototype point will not be too close to the non-adjacent point (the side of the abnormal sample), but remain on the boundary of the normal sample side, which is achieved through restrictions. The boundary prototype loss finally defined combines the attraction of the prototype point to the sample (clustering the normal sample) and the positioning constraint of the prototype point to the boundary point (staying on the decision boundary), and balances the importance of these two aspects through hyperparameters.
[0103] Step S104 effectively improves the performance of the model when processing sparse sample space and enhances the accuracy and robustness of anomaly detection by introducing prototype points and constructing a boundary prototype point loss function.
[0104] In one embodiment, step S105 determines a target anomaly detection model based on classification loss, boundary restriction loss and prototype point loss, and obtains anomaly detection results based on the target anomaly detection model. Specifically includes:
[0105] According to the target anomaly detection model, based on the current detection sample, the initial category of the current sample is obtained;
[0106] Determine a target threshold based on the distance metric, the ratio threshold, and the candidate threshold;
[0107] Compare the distance between the prototype point of the initial category and the prototype point of the abnormal sample to see if it exceeds the target threshold;
[0108] When the target threshold is exceeded, it is determined that the battery of the current detection sample is in an abnormal state.
[0109] Optionally, in adversarial edge prototype learning, the above losses are combined to obtain the overall loss function:
[0110]
[0111] In the formula, represents minimizing the non-adjacent point classification loss function, represents the boundary prototype loss function, The loss function representing the boundary limit is multiplied by the hyperparameter. The above formula is optimized using the Adam optimizer to obtain a neural network model with anomaly detection (target anomaly detection model).
[0112] The test set samples will first be determined to belong to a category based on the distance and compared with the corresponding class threshold to determine whether they are unknown samples. The distance of the sample is used as the target class threshold, where represents the optimal threshold. The calculation of the anomaly certainty is as follows:
[0113]
[0114] In the formula, represents the boundary points in the feature space used for anomaly detection, Indicates category, Indicates the category determined according to the given conditions. , Indicates different categories The normal boundary points and abnormal boundary points of represents the class probability, Represents a normal sample.
[0115] Specifically, a global loss function is formed by combining classification loss, boundary restriction loss (ensuring that the distance between samples and boundary points is not too large) and prototype point loss (maintaining a reasonable layout of prototype points). This comprehensive loss function can comprehensively guide model learning, focusing not only on the correct classification of samples, but also on the distribution and boundary relationship of samples in the feature space, as well as the optimization of prototype points, to achieve better anomaly detection performance. The Adam optimizer is used to solve the minimum value of the above comprehensive loss function, and by adaptively adjusting the learning rate, it can provide faster convergence speed and more stable performance in various situations. This enables the model to quickly and effectively learn the features and boundary information required for anomaly detection from the data. The target threshold is determined by distance measurement, ratio threshold and candidate threshold, and the best critical value for distinguishing normal from abnormal is found. Afterwards, the model determines whether it is an abnormal state based on whether the distance from the sample to the prototype point of its category and the abnormal prototype point exceeds the threshold. This ensures the objectivity and accuracy of the judgment. The certainty of the anomaly is determined by comparing the relationship between the predicted probability of each category and the threshold, which further refines the identification process of abnormal samples so that the judgment is not only based on distance, but also considers the model's confidence in the sample classification, thereby improving the robustness of the decision.
[0116] In summary, a battery anomaly detection method based on boundary prototype provided by an embodiment of the present application aims to improve the discrimination and accuracy of anomaly detection by expanding the difference between the two types of samples in the feature space by establishing an optimization goal to maximize the distance between normal samples and abnormal samples. By applying the classification loss minimization strategy to the anomaly detection model, the model parameters are optimized in combination with the concepts of boundary restrictions and prototype points. Not only can it be effectively classified, but it can also construct a clear decision boundary in the feature space to define the boundary between normal and abnormal. Using classification loss, boundary restriction loss and prototype point loss, a composite loss function framework is constructed to ensure that the model can balance classification accuracy, boundary clarity and sample distribution characteristics during training. Through boundary restrictions and prototype points, the model can better understand the data distribution law, especially when facing unseen data, the model can show stronger adaptability and generalization ability. Solve the problem of low detection accuracy in the related technology when facing changes in data distribution or new abnormal situations.
[0117] In a second aspect, an embodiment of the present application provides a battery anomaly detection system based on a boundary prototype. Figure 5 FIG. 1 is a block diagram of a battery abnormality detection system based on a boundary prototype according to an exemplary embodiment. Figure 5 As shown, the system includes a module 510 for defining optimization targets, a module 520 for determining sample categories, a module 530 for constructing boundary limits, a module 540 for boundary prototype points, and a module 550 for detecting abnormalities, wherein:
[0118] An optimization target definition module 510 is used to define an optimization target of an anomaly detection model, wherein the optimization target includes maximizing the distance between a normal sample set and an abnormal sample set;
[0119] The sample category determination module 520 is used to minimize the classification loss of the boundary points of the anomaly detection model, optimize the parameters of the anomaly detection model, and determine the sample category;
[0120] A boundary restriction module 530 is used to constrain each sample according to a preset constraint condition, construct a boundary restriction and establish a loss function for the boundary restriction, wherein the boundary restriction is used to limit the maximum distance between each sample and the boundary point;
[0121] The boundary prototype point module 540 is used to take the prototype point of the normal sample as the center of the normal category and determine the loss function of the boundary prototype point according to the center of the normal category;
[0122] The anomaly detection result module 550 is used to determine a target anomaly detection model based on the classification loss, the boundary restriction loss and the prototype point loss, and obtain anomaly detection results based on the target anomaly detection model.
[0123] In summary, the present application provides a battery anomaly detection system based on boundary prototype. The system includes a module 510 for defining an optimization target, a module 520 for determining a sample category, a module 530 for constructing a boundary restriction, a module 540 for constructing a boundary prototype point, and a module 550 for anomaly detection results, so as to solve the problem of low detection accuracy in the related art when facing changes in data distribution or new abnormal situations. Specifically, by establishing the optimization target as maximizing the distance between normal samples and abnormal samples, the aim is to improve the discrimination and accuracy of anomaly detection by expanding the difference between the two types of samples in the feature space. By applying the classification loss minimization strategy to the anomaly detection model, the model parameters are optimized in combination with the concepts of boundary restriction and prototype point. Not only can it be effectively classified, but it can also construct a clear decision boundary in the feature space to define the boundary between normal and abnormal. Using classification loss, boundary restriction loss and prototype point loss, a composite loss function framework is constructed to ensure that the model can balance the classification accuracy, boundary clarity and sample distribution characteristics during the training process. Through boundary restrictions and prototype points, the model can better understand the data distribution law, especially when facing unseen data, the model can show stronger adaptability and generalization ability. The invention solves the problem of low detection accuracy in related technologies when facing changes in data distribution or new abnormal situations.
[0124] It should be noted that the battery anomaly detection system based on boundary prototype provided in this embodiment is used to implement the above-mentioned implementation mode, and the descriptions that have been made will not be repeated. As used above, the terms "module", "unit", "subunit", etc. can implement a combination of software and / or hardware of predetermined functions. Although the device described in the above embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0125] In a third aspect, an embodiment of the present application provides an electronic device, Figure 6 FIG. 1 is a block diagram of an electronic device according to an exemplary embodiment. Figure 6 As shown, the electronic device may include a processor 61 and a memory 62 storing computer program instructions.
[0126] Specifically, the processor 61 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0127] Among them, the memory 62 may include a large-capacity memory for data or instructions. For example, but not limitation, the memory 62 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 62 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 62 may be inside or outside the data processing device. In a specific embodiment, the memory 62 is a non-volatile memory. In a specific embodiment, the memory 62 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically alterable ROM (EAROM) or a flash memory (FLASH), or a combination of two or more of these. Under appropriate circumstances, the RAM can be a static random access memory (SRAM) or a dynamic random access memory (DRAM), wherein the DRAM can be a fast page mode dynamic random access memory (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.
[0128] The memory 62 may be used to store or cache various data files required for processing and / or communication, as well as possible computer program instructions executed by the processor 61 .
[0129] The processor 61 reads and executes computer program instructions stored in the memory 62 to implement any one of the battery abnormality detection methods based on boundary prototypes in the above embodiments.
[0130] In one embodiment, a battery abnormality detection device based on a boundary prototype may further include a communication interface 63 and a bus 60. Figure 6 As shown, the processor 61, the memory 62, and the communication interface 63 are connected via a bus 60 and communicate with each other.
[0131] The communication interface 63 is used to implement communication between the modules, devices, units and / or equipment in the embodiment of the present application. The communication port 63 can also implement data communication with other components such as: external devices, image / data acquisition equipment, databases, external storage, and image / data processing workstations.
[0132] The bus 60 includes hardware, software or both, coupling the components of a battery abnormality detection device based on a boundary prototype to each other. The bus 60 includes but is not limited to at least one of the following: a data bus, an address bus, a control bus, an expansion bus, and a local bus. By way of example and not limitation, bus 60 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses or a combination of two or more of the above. Where appropriate, bus 60 may include one or more buses. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.
[0133] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a program stored thereon. When the program is executed by a processor, a battery anomaly detection method based on a boundary prototype provided in the first aspect is implemented.
[0134] The readable storage medium may include but is not limited to: a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device or any suitable combination of the above.
[0135] In a possible implementation, the present invention can also be implemented in the form of a program product, which includes program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of a battery anomaly detection method based on a boundary prototype provided in the first aspect.
[0136] Among them, the program code for executing the present invention can be written in any combination of one or more programming languages, and the program code can be executed completely on the user device, partially on the user device, as an independent software package, partially on the user device and partially on a remote device, or completely on the remote device.
[0137] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0138] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A battery anomaly detection method based on boundary prototype, It is characterized in that The method comprises: Defining an optimization goal of the anomaly detection model, wherein the optimization goal includes maximizing the distance between the normal sample and the abnormal sample according to the distance metric function, the anomaly detection model, the abnormal sample, the unlabeled sample, the boundary point, the preset distance and the normal sample; Minimizing the classification loss of boundary points of the anomaly detection model, optimizing the parameters of the anomaly detection model, and determining the sample category; According to the preset constraint conditions, each sample is constrained, a boundary restriction is constructed and a loss function is established for the boundary restriction, wherein the boundary restriction is used to limit the maximum distance between each sample and the boundary point; The prototype point of the normal sample is used as the center of the normal category, and the loss function of the boundary prototype point is determined according to the center of the normal category, wherein the loss function of the boundary prototype point combines the attraction from the prototype point to the sample and the positioning constraint from the prototype point to the boundary point; A target anomaly detection model is determined based on the classification loss, the boundary restriction loss, and the prototype point loss, and an anomaly detection result is obtained based on the target anomaly detection model.
2. The method according to claim 1, It is characterized in that The prototype point of the normal sample is used as the center of the normal category, and the loss function of the boundary prototype point is determined according to the center of the normal category, including: Determine the prototype point of the normal sample by acquiring sample features belonging to the normal sample category; Taking the prototype point of the normal sample as the center of the normal sample category; A loss function of a boundary prototype point is established according to the center of the normal sample category, the boundary point and a preset radius.
3. The method according to claim 1, It is characterized in that The optimization goal of defining the anomaly detection model includes: According to the normal sample category, determine the sample points far away from the normal sample category as boundary points, the sample set far away from the boundary points as normal samples, and the sample set close to the boundary points as abnormal samples; According to the distance metric function, the anomaly detection model, the abnormal samples, the unlabeled samples, the boundary points, the preset distance and the normal samples, the distance between the normal samples and the abnormal samples is maximized, and the maximized distance between the normal samples and the abnormal samples is used as the optimization target of the anomaly detection model.
4. The method according to claim 1, It is characterized in that The preset constraint condition includes limiting the maximum distance between each sample and the boundary point in the feature space to not exceed a preset radius; constraining each sample according to the preset constraint condition, constructing a boundary constraint and establishing a loss function for the boundary constraint, and the method includes: By limiting the maximum distance between each sample and the boundary point in the feature space to not exceed a preset radius, each sample is constrained to obtain a boundary limit of the sample; A loss function is established for the boundary restriction according to the parameters of the anomaly detection model, the boundary point, the preset radius and the distance metric function.
5. The method according to claim 1, It is characterized in that Based on the target anomaly detection model, an anomaly detection result is obtained, including: According to the target anomaly detection model, based on the current detection sample, obtaining an initial category of the current sample; Determine a target threshold based on the distance metric, the ratio threshold, and the candidate threshold; Comparing the distance between the prototype point of the initial category and the prototype point of the abnormal sample to see whether it exceeds the target threshold; When the target threshold is exceeded, it is determined that the battery of the current detection sample is in an abnormal state.
6. The method according to claim 1, It is characterized in that Minimizing the classification loss of the boundary points of the anomaly detection model, optimizing the parameters of the anomaly detection model, and determining the sample category include: Determining an initial category of the detection sample according to the distance between the detection sample and the boundary point; Minimize the classification loss function of the boundary points, optimize the parameters of the anomaly detection model, and determine the sample category.
7. The method according to claim 1, It is characterized in that After detecting the distance between the sample and the boundary point, the method further includes: By class probability formula , determine the initial category of the detection sample, where, Indicates that given an input sample , neural network model , and the set of boundary points Under the condition of , the probability that category y is k is, represents the input sample, represents the neural network model, represents the set of boundary points, represents the i-th boundary point in the boundary point set, represents the boundary point, Represents the distance metric function.
8. A battery anomaly detection system based on boundary prototype, It is characterized in that The system includes a module for defining optimization targets, a module for determining sample categories, a module for constructing boundary limits, a module for boundary prototype points, and a module for detecting anomalies, wherein: The optimization target definition module is used to define the optimization target of the anomaly detection model, wherein the optimization target includes maximizing the distance between the normal sample and the abnormal sample according to the distance metric function, the anomaly detection model, the abnormal sample, the unlabeled sample, the boundary point, the preset distance and the normal sample; The sample category determination module is used to minimize the classification loss of the boundary points of the anomaly detection model, optimize the parameters of the anomaly detection model, and determine the sample category; The boundary restriction building module is used to constrain each sample according to a preset constraint condition, build a boundary restriction and establish a loss function for the boundary restriction, wherein the boundary restriction is used to limit the maximum distance between each sample and the boundary point; The boundary prototype point module is used to take the prototype point of the normal sample as the center of the normal category, and determine the loss function of the boundary prototype point according to the center of the normal category, wherein the loss function of the boundary prototype point combines the attraction from the prototype point to the sample and the positioning constraint from the prototype point to the boundary point; The anomaly detection result module is used to determine a target anomaly detection model based on classification loss, boundary restriction loss and prototype point loss, and obtain anomaly detection results based on the target anomaly detection model.
9. An electronic device, It is characterized in that The invention comprises a memory and a processor, a computer program stored in the memory and executable on the processor, and the processor implements a battery anomaly detection method based on a boundary prototype as claimed in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, a battery anomaly detection method based on a boundary prototype as described in any one of claims 1 to 7 is implemented.
