Endurance abnormality identification and testing method, device, testing equipment and storage medium
Through the 1D convolutional detection model of battery life discharge test and adaptive loss function training on audio equipment, the problems of low efficiency and high cost of battery life test in the existing technology are solved, and the automatic abnormal identification and prediction of audio equipment is realized, which improves the Test efficiency and accuracy.
Patent Information
- Application Number
- CN202411170512.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2044-08-26
AI Technical Summary
The existing audio equipment battery life test methods are inefficient and costly, lack automation and intelligent means, and it is difficult to detect abnormal power jumps or disconnection problems in a timely manner. The test results are easily affected by human factors and have low data processing efficiency.
By conducting battery life discharge tests on multiple designated scenarios on the audio equipment, combining real-time logs and power feedback information to generate battery life curves and data sets, using loss function that adaptively adjusts weights to train a 1D convolutional detection model, build a battery life abnormality recognition model, and implement a battery life error recognition model. Automated anomaly prediction.
It improves the efficiency and accuracy of battery life tests, reduces test costs, reduces manual intervention, can detect abnormal situations in a timely manner, and improves the stability and consistency of test results.
Smart Images

Figure CN118688643B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of performance detection and data analysis, and in particular to a battery life anomaly identification and testing method, device, testing equipment and storage medium. Background Art
[0002] The battery life information of an audio device refers to the length of time the device can work continuously when powered by a battery. It is usually the estimated time the device can continue to work when the battery is fully charged. Battery life information is an important indicator for wireless audio devices such as portable Bluetooth speakers, smart speakers, amplifiers, and audio sampling cards. Taking speaker devices as an example, battery life information can mainly include relevant information such as maximum playback time, charging time, and battery capacity. This information varies depending on the usage conditions (such as volume, whether additional functions are turned on, ambient temperature, whether energy-saving mode is turned on, etc.). Battery life information is very important for users, especially for those who plan to use the speaker outdoors or away from a power source. Understanding the battery life of the speaker can help users choose the right product according to their own needs and make corresponding charging plans.
[0003] Existing testing methods often rely on testers to regularly check test results or logs, which is not only inefficient but also prone to missing important abnormal information. In addition, during the battery life test, due to the long test cycle, abnormal power outages and abnormal disconnections that may be encountered during the process are often difficult to detect in a timely manner.
[0004] For battery life testing and data analysis, existing methods often require manual setting of test conditions, execution steps, and subsequent report compilation. This test process that relies on manual intervention is not only time-consuming and labor-intensive, but also easily affected by human factors, resulting in instability and inconsistency in test results.
[0005] In actual situations, a large amount of log data is generated during the battery life test. Existing methods often lack the ability to efficiently process these log data. Testers need to spend a lot of time browsing and analyzing logs to find potential abnormal problems. This not only reduces test efficiency, but also increases test costs.
[0006] In summary, the existing audio battery life test and analysis methods lack automation and intelligent means. When conducting battery life tests, testers need to manually execute test steps, analyze test results, and make subsequent adjustments and optimizations based on the test results. This method is not only inefficient and labor-intensive, but also difficult to cope with increasingly complex testing needs. Summary of the invention
[0007] The present invention provides a battery life anomaly identification and testing method, device, testing equipment and storage medium, which are used to solve or partially solve the technical problems of low testing efficiency and high testing cost in the existing related technologies.
[0008] The present invention provides a method for identifying and testing battery life anomalies, the method comprising:
[0009] When the audio device to be tested is in a fully charged state, a battery life discharge test is performed on the audio device in multiple specified scenarios, and real-time log information and power feedback information are obtained in combination with power feedback;
[0010] Generate a real-time endurance curve based on the real-time log information and the power feedback information, and generate an endurance data set according to the real-time endurance curve;
[0011] According to the endurance data set, based on the loss function of adaptively adjusting weights, the 1D convolution detection model is trained and verified to obtain an endurance anomaly recognition model;
[0012] The audio battery life information to be identified is input into the battery life anomaly recognition model for anomaly prediction to obtain the battery life prediction result.
[0013] Optionally, performing a battery life discharge test on the audio device in a plurality of specified scenarios and obtaining real-time log information and battery feedback information in combination with battery feedback includes:
[0014] Performing battery life discharge tests on the audio device in multiple specified scenarios and printing real-time log information;
[0015] During the battery life discharge test, the power feedback detection of the audio device is performed in real time;
[0016] If the audio device cannot normally feedback the power, it is determined that the audio device is abnormal, and the corresponding abnormal information is printed to the real-time log information;
[0017] If the audio device normally feeds back the power, corresponding power feedback information is obtained.
[0018] Optionally, the real-time log information includes battery life status information corresponding to the normal operation of the audio device, and generating a real-time battery life curve based on the real-time log information and the power feedback information includes:
[0019] The battery life test time is taken as the horizontal axis, the power feedback information of the audio device is taken as the vertical axis, the battery life status information and the abnormal information are used as battery life test variables to generate a real-time battery life curve.
[0020] Optionally, generating a battery life data set according to the real-time battery life curve includes:
[0021] Data preprocessing is performed on the time and power information of the real-time endurance curve, and abnormal information in the real-time endurance curve is marked with abnormal labels to be integrated into an endurance data set.
[0022] Optionally, the training and verification of the 1D convolution detection model based on the endurance data set and the adaptively adjusted weight loss function to obtain the endurance anomaly recognition model includes:
[0023] Dividing the battery life data set into a battery life training set and a battery life test set according to a preset ratio;
[0024] The pre-built 1D convolution detection model is trained using the endurance training set, and during the model training process, the weights corresponding to each sample category in the endurance training set are dynamically adjusted based on a loss function that adaptively adjusts the weights;
[0025] The endurance test set is used to verify the model performance of the trained 1D convolution detection model, obtain the model verification result, and output the final endurance anomaly recognition model.
[0026] Optionally, the endurance training set corresponds to a plurality of different sample categories, each of the sample categories corresponds to a plurality of training samples, and the adaptive weight-adjusting loss function dynamically adjusts the weights corresponding to the sample categories in the endurance training set, including:
[0027] By predicting the loss function, after a preset number of iterations, the loss value of the current iteration is calculated;
[0028] For each of the sample categories, judging whether the prediction accuracy corresponding to the current round is greater than or equal to a preset accuracy threshold according to the loss value;
[0029] If yes, keep the weight of the sample category in the current round unchanged for the next round of training iteration;
[0030] If not, the weight of the sample category in the current round is multiplied by a preset weighting coefficient to adjust and update the weight of the sample category, and the adjusted and updated weight is used for the next round of training iteration.
[0031] Optionally, the calculation formula of the prediction loss function is as follows:
[0032]
[0033] Where L represents the prediction loss function of the model; N represents the total number of training samples in the endurance training set; C represents the total number of sample categories in the endurance training set, including one normal sample category and the rest are different types of abnormal sample categories; represents the weight of the j-th sample category at the t-th weight update; represents the true label of training sample i. When training sample i belongs to the jth category, ,otherwise ; It represents the probability that the model predicts that training sample i belongs to the jth category.
[0034] The present invention also provides a battery life abnormality identification and testing device, comprising:
[0035] A battery life discharge test module is used to perform battery life discharge tests on the audio device under test in multiple specified scenarios when the audio device under test is in a fully charged state, and obtain real-time log information and battery feedback information in combination with battery feedback;
[0036] A battery life data set generation module, used to generate a real-time battery life curve based on the real-time log information and the power feedback information, and generate a battery life data set according to the real-time battery life curve;
[0037] An anomaly recognition model training module is used to train and verify the 1D convolution detection model based on the endurance data set and the loss function of adaptively adjusting the weights to obtain an endurance anomaly recognition model;
[0038] The abnormality prediction module is used to input the audio battery life information to be identified into the battery life abnormality recognition model for abnormality prediction to obtain the battery life prediction result.
[0039] The present invention also provides a testing device, the device comprising a processor and a memory:
[0040] The memory is used to store program code and transmit the program code to the processor;
[0041] The processor is used to execute the battery life abnormality identification and testing method as described in any one of the above items according to the instructions in the program code.
[0042] The present invention also provides a computer-readable storage medium, which is used to store program code, and the program code is used to execute the endurance abnormality identification and testing method as described in any one of the above items.
[0043] It can be seen from the above technical solutions that the present invention has the following advantages:
[0044] A battery life anomaly identification and testing method is provided. When the audio device to be tested is in a fully charged state, the audio device is subjected to battery life discharge tests in multiple specified scenarios, and real-time log information and battery feedback information are obtained in combination with power feedback; a real-time battery life curve is generated based on the real-time log information and power feedback information, and a battery life data set is generated based on the real-time battery life curve; based on the battery life data set, a 1D convolution detection model is trained and verified based on a loss function that adaptively adjusts weights to obtain a battery life anomaly identification model; the audio battery life information to be identified is input into the battery life anomaly identification model for anomaly prediction, and a battery life prediction result is obtained, thereby realizing battery life testing through intelligent automation means, improving test efficiency, and reducing test costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0046] Figure 1 It is a structural schematic diagram of a battery life anomaly identification and testing system;
[0047] Figure 2 A flowchart of the steps of a battery life anomaly identification and testing method;
[0048] Figure 3 A schematic diagram of the network architecture of a battery life anomaly recognition model;
[0049] Figure 4 A schematic diagram of the prediction results of a trained model verified using an endurance test set;
[0050] Figure 5 It is a schematic diagram of the overall process of a battery life anomaly identification and testing method;
[0051] Figure 6 The present invention is a structural block diagram of a battery life abnormality identification and testing device. DETAILED DESCRIPTION
[0052] The embodiments of the present invention provide a battery life anomaly identification and testing method, device, testing equipment and storage medium, which are used to solve or partially solve the technical problems of low testing efficiency and high testing cost in the existing related technologies.
[0053] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0054] As an example, taking the endurance test scenario of a speaker device as an example, the existing test methods often rely on testers to regularly check the test results or logs, which is not only inefficient but also easy to miss important abnormal information. In addition, during the endurance test, due to the long test cycle, abnormal power outages and abnormal disconnections that may be encountered in the process are often difficult to detect in time.
[0055] For battery life testing and data analysis, existing methods often require manual setting of test conditions, execution steps, and subsequent report compilation. This test process that relies on manual intervention is not only time-consuming and labor-intensive, but also easily affected by human factors, resulting in instability and inconsistency in test results.
[0056] In actual situations, a large amount of log data is generated during the battery life test. Existing methods often lack the ability to efficiently process these log data. Testers need to spend a lot of time browsing and analyzing logs to find potential abnormal problems. This not only reduces test efficiency, but also increases test costs.
[0057] In summary, the existing audio battery life test and analysis methods lack automation and intelligent means. When conducting battery life tests, testers need to manually execute test steps, analyze test results, and make subsequent adjustments and optimizations based on the test results. This method is not only inefficient and labor-intensive, but also difficult to cope with increasingly complex testing needs.
[0058] Furthermore, through a more detailed analysis, the present invention also finds that the current speaker endurance test method still has the following problems:
[0059] (1) Speaker battery life dataset: insufficient sample size, abnormal labels, and data diversity.
[0060] Currently, the number of samples in the speaker battery life dataset is relatively small, and the sample size is obviously insufficient. This makes it difficult to support the training of an accurate and generalizable anomaly detection model, which limits the model's ability to identify battery life anomalies in various actual usage scenarios.
[0061] The existing labeled data does not have enough labels for abnormal types, which may result in insufficient number and details of abnormal types. This makes it difficult for the model to accurately distinguish and identify different types of endurance abnormalities. The lack of detailed abnormality classification makes the model perform poorly when dealing with complex abnormal situations.
[0062] Speakers face a variety of complex battery life scenarios in actual use. These involve the selection of Bluetooth encoding, volume settings, connected mobile phone models, and other external factors that may affect the speaker's energy consumption. However, existing speaker battery life datasets fail to fully cover these important usage scenarios, and the data diversity is very limited. This may lead to a lack of sufficient data support when training the battery life anomaly detection model, thus affecting the accuracy and generalization ability of the model.
[0063] (2) Traditional speaker battery life anomaly detection model: fixed loss function and sample imbalance problem.
[0064] Traditional speaker life anomaly detection models usually use fixed loss functions such as mean squared error (MSE) for supervised training. This fixed loss function remains unchanged throughout the training process, making it impossible to adaptively adjust according to the model's training status or the characteristics of the data distribution.
[0065] In the speaker battery life data set, abnormal data is often rarer than normal data, resulting in an imbalanced distribution of data samples. When a fixed loss function is used for model training, the model is more likely to favor a larger number of normal data, while the ability to identify abnormal data is weaker and lacks sensitivity to sample imbalance.
[0066] Due to the fixed loss function and the influence of sample imbalance, traditional models often cannot fully learn the characteristics of abnormal data during training, which leads to insufficient generalization ability of the model and makes it difficult to accurately identify various abnormal situations in practical applications.
[0067] Therefore, one of the core inventive points of the embodiments of the present invention is: in view of the deficiencies in the prior art, a method for identifying and testing battery life anomalies is proposed. By constructing a comprehensive and refined data set, using a loss function that adaptively adjusts weights, and a real-time battery life detection model and automated testing process based on 1D convolution, the challenges of battery life data sets, the limitations of traditional battery life anomaly detection models, and the lack of real-time anomaly detection and automated intelligent means in the battery life test process are effectively solved. By adopting the technical solution of the present invention, the accuracy and efficiency of battery life anomaly detection can be significantly improved, the testing cost can be reduced, and strong support can be provided for the optimization of the battery life performance of audio equipment.
[0068] Reference Figure 1, showing a structural schematic diagram of a battery life abnormality identification and testing system provided by an embodiment of the present invention.
[0069] Let's continue to use the abnormal battery life test of the speaker device as an example. Figure 1 It can be seen that the battery life abnormality identification and testing system 100 provided in the embodiment of the present invention is mainly composed of three modules: a power judgment module 101, a battery life discharge module 102, and an abnormality detection module 103. In the process of performing the battery life test of the smart speaker, the main devices involved are mobile phones, computers, relays, and speaker devices.
[0070] The power determination module 101 is used to determine whether the current power of the speaker device is fully charged. Specifically, it can be determined whether the speaker device is fully charged through AT communication (a method of using AT instruction set for communication). If not, it is powered on through a program-controlled relay (a relay that can be controlled by a program); if so, the program-controlled relay is powered off.
[0071] The battery life discharge module 102 is used to perform a battery life discharge test on a fully charged speaker device and obtain relevant test data such as battery life information, abnormal information, and power information.
[0072] Specifically, in the battery life discharge module 102, a battery life discharge test of multiple specified scenarios is performed on a fully charged speaker device. Multiple specified scenarios may include eight common battery life scenarios, such as battery life in silent mode in speaker testing, battery life at medium volume, battery life at high volume, battery life under Bluetooth connection, battery life under Wi-Fi connection, battery life under multi-device connection, battery life under voice assistant activation, and battery life for looping different sound quality files. In addition, according to actual test requirements, the specified scenario can also be set to different battery life scenarios in other specific situations. It can be understood that the present invention is not limited to this.
[0073] During the battery life discharge test, the log information is printed in real time, including abnormal information. At the same time, the power feedback detection of the speaker device is carried out through the AT communication method.
[0074] If normal communication is not possible (i.e., power feedback is not possible), it means that the speaker device is disconnected or has other abnormalities. At this time, the relevant abnormal information can be printed in the log information. If normal communication is possible, power feedback information can be obtained.
[0075] In addition to the AT communication method, the connection status between the mobile phone and the speaker device can also be determined by the automated testing tool uiautomator. Or the abnormal disconnection keyword "connected:0" in the log information can be used to confirm the abnormal disconnection. It is understandable that those skilled in the art can make a choice according to actual needs for determining the connection status, and the present invention does not limit this.
[0076] Then, the abnormal information, power feedback information and battery life status information obtained in real time are printed into a curve to reflect the power changes in all stages. When the curve is generated, it is determined whether the actual power of the speaker device is lower than the shutdown power. If so, the shutdown is controlled; if not, the test is continued, and finally specific battery life information is generated.
[0077] Then, the time and power information in the printed curve are preprocessed, and the abnormal information is labeled and integrated into a battery life dataset for training the abnormality recognition model.
[0078] The anomaly detection module 103 is used to perform model training based on the battery life data set, and use the trained model to perform battery life anomaly prediction analysis on the actual measured speaker battery life information. A battery life test report can also be generated based on the analysis results.
[0079] Specifically, the battery life data set can first be divided into a battery life training set and a battery life test set in a ratio of 8:2 (or other appropriate division ratios). Then the 1D convolution detection model is trained with the battery life training set. This model is used to process time and power information at the same time. During the model training process, based on the loss function of adaptively adjusting the weights, the weights of each anomaly category are dynamically adjusted according to the anomaly detection success rate (anomaly prediction accuracy) during the training process. Then the battery life test set is used to verify the model performance of the trained model, obtain the model verification results, and output the battery life anomaly recognition model that is finally put into use.
[0080] Through this battery life abnormality identification model, for other speaker devices to be tested, based on the measured speaker battery life information obtained by referring to the above-mentioned battery life discharge module 102 related processing flow, it is possible to identify the power jump, disconnection and other abnormalities of the corresponding speaker device in real time, synchronize the time information, and finally give the test conclusion through model prediction analysis. Furthermore, based on the test conclusion, combined with the measured speaker battery life information, the information is summarized and a corresponding battery life test report can be generated.
[0081] Assume that for a certain speaker device, when conducting a battery life test, there are certain indicator requirements for the battery life scenario. For example, set the battery life scenario: the battery life of a certain music is required to be greater than 15 hours, and there are no abnormalities during the test. If these conditions can be met at the same time, the test conclusion can be PASS (test passed), otherwise it is Fail (test failed). Fail means that the standard is not met or there is an abnormality in a certain process.
[0082] For example, for the above-mentioned battery life scenario, after prediction analysis, the battery life test report may be as follows:
[0083] 1. The source of the sound is "Hotel California"
[0084] 2. The test phone is XX model
[0085] 3. Select the Bluetooth encoding mode as aac / sbc / lhdc (select only one for each battery life information)
[0086] 4. Turn on the absolute volume of your phone
[0087] 5. The volume can be set to 50% / 80% / 100%
[0088] 6. The specific battery life scenario is: the music source is "Hotel California" + mobile phone model XX + Bluetooth code aac + turn on the absolute volume of the mobile phone + 50% volume + turn on the lighting effect
[0089] 7. Charging time: XX-XX (e.g. 7:00-9:00), lasting 2 hours
[0090] 8. The battery life is 15 hours, and the specific time period is XX-XX (such as 9:00-24:00)
[0091] 9. Test conclusion: There is no abnormality in the real-time endurance prediction process, PASS
[0092] In combination with the battery life abnormality identification and testing system provided in the above embodiments, in order to enable those skilled in the art to better understand the technical solution of the present invention, refer to Figure 2 , shows a flowchart of a method for identifying and testing battery life anomalies provided by an embodiment of the present invention, which may specifically include the following steps:
[0093] Step 201, when the audio device to be tested is in a fully charged state, a battery life discharge test of multiple specified scenarios is performed on the audio device, and real-time log information and power feedback information are obtained in combination with power feedback;
[0094] Combined with the above introduction, in a specific implementation, the endurance discharge test of the audio device in multiple specified scenarios is performed, and combined with the power feedback, real-time log information and power feedback information are obtained, which can be: the endurance discharge test of the audio device in multiple specified scenarios is performed, and the real-time log information is printed; during the endurance discharge test, the audio device is tested for power feedback in real time; if the audio device cannot normally feedback the power, it is determined that the audio device is abnormal, and the corresponding abnormal information is printed to the real-time log information; if the audio device normally feedbacks the power, the corresponding power feedback information is obtained. The power feedback information can be expressed as a percentage of the full power state. If the power feedback information is 70%, it means that the current power of the audio device is 70% of the full power state.
[0095] Step 202, generating a real-time endurance curve based on the real-time log information and the power feedback information, and generating an endurance data set according to the real-time endurance curve;
[0096] In addition to abnormal information such as disconnection that occurs during the test of the audio device, the real-time log information also includes the corresponding battery life status information when the audio device is operating normally. In a specific implementation, based on the real-time log information and power feedback information, a real-time battery life curve is generated. The battery life test time is used as the horizontal axis, the power feedback information of the audio device is used as the vertical axis, and the battery life status information and abnormal information are used as battery life test variables to generate a real-time battery life curve.
[0097] Furthermore, a battery life data set is generated based on the real-time battery life curve, which can be specifically: data preprocessing is performed on the time and power information of the real-time battery life curve, and abnormal labels are marked on abnormal information in the real-time battery life curve to integrate them into the battery life data set.
[0098] Exemplarily, for the abnormal battery life test scenario of the speaker device, the embodiment of the present invention collected and sorted out a total of 22 battery life curve data in 8 common battery life scenarios of the speaker device through actual testing. The battery life curve data contains 104,570 data points. And 3,764 abnormal points are accurately marked with labels. Then the timestamp format of these 22 battery life curves is unified, accurate to milliseconds.
[0099] Specifically, the anomaly types corresponding to the 3764 anomaly points are labeled, which can be mainly divided into three types of anomaly labels: abnormal power exceeding the actual power, abnormal power lower than the actual power, abnormal shutdown or other disconnection. Each anomaly label corresponds to an abnormal sample category.
[0100] Therefore, through a large number of carefully designed actual battery life tests and data collection and processing, a rich actual battery life test data set containing 22 detailed data curves was constructed. These curves cover 8 typical battery life scenarios that speaker devices may encounter in actual applications. At the same time, the battery life data set with a wide range of information provides comprehensive and refined data support for model training. This data set enables the model to fully learn various abnormal battery life characteristics, significantly improving the prediction accuracy and generalization ability of the model.
[0101] Step 203, according to the endurance data set, based on the adaptively adjusted weight loss function, the 1D convolution detection model is trained and verified to obtain an endurance anomaly recognition model;
[0102] Specifically, according to the endurance data set, based on the loss function of adaptively adjusting the weights, the 1D convolution detection model is trained and verified to obtain the endurance anomaly recognition model, which can be achieved by executing the following sub-steps S01 to S03:
[0103] Step S01: dividing the battery life data set into a battery life training set and a battery life test set according to a preset ratio;
[0104] Exemplarily, the battery life data set is divided into a battery life training set and a battery life test set in a ratio of 8:2. Both the battery life training set and the battery life test set contain multiple normal samples and abnormal samples. Both the battery life training set and the battery life test set correspond to several different sample categories (one normal sample category and three abnormal sample categories), and each sample category corresponds to multiple training samples.
[0105] It should be pointed out that the method proposed in the embodiment of the present invention is universal and portable. In practical applications, if the battery life data of other audio devices (or other electronic devices, electronic products) needs to be tested, it is only necessary to replace the specific training set used by the model, and then execute the subsequent same or similar processes. It can be understood that, in addition to the battery life test of the speaker device, the scheme of using the same or similar technical means provided in the embodiment of the present invention to perform battery life tests on other audio devices, non-audio electronic devices or electronic products falls within the protection scope of the technical solution of the present invention.
[0106] Step S02: training the pre-built 1D convolution detection model through the endurance training set, and dynamically adjusting the weights corresponding to each sample category in the endurance training set based on the loss function of adaptively adjusting the weights during the model training process;
[0107] The network architecture of the battery life anomaly recognition model built based on the 1D convolution detection model is as follows: Figure 3 shown.
[0108] Combination Figure 3 ,The battery life anomaly recognition model (1D convolution detection model) can be mainly divided into input module (Input), training module (Train model) and output module (Output).
[0109] The model input is a labeled endurance training set, including abnormal sample sets (Abnormal Datasets) and normal sample sets (Normal Datasets).
[0110] The training module consists of three 1D convolutional layers (Conv 1D) and three activation layers (Relu), each convolutional layer is followed by an activation layer.
[0111] The output module consists of a fully connected layer and an activation layer (Sigmoid), and finally determines the type of data, such as Abnormal①, Abnormal② of different abnormal categories, and Normal of the normal category.
[0112] In the embodiment of the present invention, the batch size batch_size is set to 32, the number of epochs is 1000, the optimizer uses Adam, and other parameters use the default values.
[0113] For model training and optimization, a fixed parameter loss function, such as MSE, is currently generally used. However, when faced with unbalanced samples, this loss function often over-focuses on a certain anomaly, resulting in inaccurate prediction results. Based on this, an embodiment of the present invention provides a variable loss function that can adaptively adjust weights to better allocate the model's attention and improve the model's accuracy in multi-classification problems.
[0114] Specifically, the calculation formula of the prediction loss function adopted by the present invention is as follows:
[0115]
[0116] Where L represents the prediction loss function of the model; N represents the total number of training samples in the endurance training set; C represents the total number of sample categories in the endurance training set, including one normal sample category and the rest are different types of abnormal sample categories; represents the weight of the j-th sample category at the t-th weight update; represents the true label of training sample i. When training sample i belongs to the jth category, ,otherwise ; It represents the probability that the model predicts that training sample i belongs to the jth category.
[0117] After determining the loss function to be used, it is necessary to set initial weights for different sample categories. Specifically, the initial weights are set according to the rarity of the samples. The basis for setting the weights is to set the weights of categories with a small number of samples to relatively large values.
[0118] For example, the embodiment of the present invention divides the data set into one normal sample category and three different abnormal sample categories, that is, there are four sample categories. Assume that the initial weight corresponding to the category with the largest number of normal samples is set to 1, that is ; Set the initial weight of the abnormal category corresponding to the largest number of abnormal samples to 2, that is, ; Set the initial weight of the abnormal category corresponding to the second largest abnormal sample to 3, that is, ; Set the initial weight of the abnormal category corresponding to the smallest number of abnormal samples to 4, that is, .
[0119] As an optional embodiment, for abnormal samples of different categories, since the number of abnormal samples may vary greatly, weight allocation may be performed according to the proportion of abnormal samples of different abnormal categories.
[0120] For example, first set the initial weight value of the normal sample to 1 (because there are many normal samples, it can be directly set to 1 by default).
[0121] Then, the categories are arranged in order of the number of abnormal samples from most to least. It is assumed that the ratio of abnormal sample category 1: abnormal sample category 2: abnormal sample category 3 is 5:2:1.
[0122] If you want to unify the number levels of these three abnormal sample categories to the same value (for example, unified as 1), the corresponding coefficient ratio that needs to be multiplied is 0.2:0.5:1.
[0123] If the initial weight of abnormal sample category 1 is set to 2, the weights of abnormal sample category 1: abnormal sample category 2: abnormal sample category 3 should be set to 2:5:10.
[0124] The weights of the normal sample category, abnormal sample category 1, abnormal sample category 2, and abnormal sample category 3 are 1, 2, 5, and 10 respectively.
[0125] If the initial weight of abnormal sample category 1 is set to other values (such as 3), the initial weights of abnormal sample category 2 and abnormal sample category 3 will also change accordingly.
[0126] It should be noted that the above two examples are only used as an illustrative example. In addition to the above two examples, those skilled in the art can set the initial weight value of each sample category to other values according to actual needs, provided that the setting basis of "the weight value of the less data samples is large" is met. It is understandable that the present invention is not limited to this.
[0127] In addition, the embodiment of the present invention also provides a dynamic adjustment strategy for weights. Specifically, during the model training process, the weights of the corresponding sample categories are dynamically adjusted according to the prediction accuracy of the model on each sample category.
[0128] For example, when the prediction accuracy of a certain sample category is lower than an accuracy threshold, such as 0.8, it means that the prediction accuracy of the sample category is low and needs to be paid more attention. You can set the weight corresponding to the sample category to be multiplied by a weighting coefficient, such as 1.5 times, to adjust and update the weight, and perform the next round of training iterations based on the adjusted and updated weight value. When the prediction accuracy of a certain sample category is greater than or equal to 0.8, it means that the prediction accuracy of the sample category is high, and the current weight can be continued for training iterations. For the weight update node, the time point for the first weight update can be set to after the 100th epoch, that is, starting from the 101st epoch, the weight is updated once each round.
[0129] In the specific implementation, based on the loss function of adaptively adjusting the weights, the weights corresponding to each sample category in the endurance training set are dynamically adjusted, which can be:
[0130] Through the prediction loss function, after a preset number of iterations, the loss value of the current iteration is calculated; for each sample category, according to the loss value, it is determined whether the prediction accuracy corresponding to the current round is greater than or equal to the preset accuracy threshold; if so, the weight of the sample category in the current round is kept unchanged for the next round of training iteration; if not, the weight of the sample category in the current round is multiplied by a preset weighting coefficient to adjust and update the weight of the sample category, and the adjusted and updated weight is used for the next round of training iteration.
[0131] Thus, the differences in the number of training samples are taken into account. Through this setting, even if there are large differences in the number of samples of different types, it is equivalent to giving the model a relatively balanced initial probability value. In the subsequent training adjustment process, the prediction accuracy of each sample category can be analyzed according to the calculated loss function value, and the weight proportion of each sample category in the loss function can be adjusted in real time based on the prediction accuracy, so as to adjust and update the loss function in real time, so as to achieve better training optimization effect of the model, reduce prediction error, and improve subsequent prediction accuracy.
[0132] In summary, the embodiments of the present invention innovatively propose a loss function that can adaptively adjust weights. This function can dynamically adjust the weights of various types of outliers according to the anomaly detection success rate (prediction accuracy) of the model during the training process. When the model's recognition rate of a certain type of outlier is lower than a preset threshold, the loss function will automatically increase the weight of this type of outlier, thereby guiding the model to pay more attention to and optimize the recognition of this type of outlier. The loss function for adaptively adjusting weights provided by the present invention can effectively solve the problem of sample imbalance, significantly improve the model's ability to recognize imbalanced samples, and enhance the generalization performance of the model.
[0133] Step S03: Use the endurance test set to verify the model performance of the trained 1D convolution detection model, obtain the model verification result, and output the final endurance anomaly recognition model.
[0134] The trained model is verified on the battery life test set. Continuing with the above example, the battery life test set is a data set containing 4640 data points. 50 abnormal data points are marked, and the rest are normal points. Through the trained model, 46 abnormal data points can be detected with an accuracy of 92%. For example, Figure 4 The figure shows a schematic diagram of the prediction results of a trained model using a battery life test set. The figure mainly shows the schematic diagrams of three typical anomalies detected.
[0135] Combination Figure 4 , with the battery life test time as the horizontal axis and the battery capacity of battery (power feedback information) as the vertical axis, the battery life test variables are the battery life status information under normal operating conditions (corresponding to the battery life information of normal samples) and the abnormal information when an abnormality occurs (corresponding to the battery life information of abnormal samples). The battery life prediction result is roughly the same as the real-time battery life curve generated by the previous data processing steps. The anomalies marked by arrows correspond to the abnormal information, from left to right, respectively, Jump-Change-Point (abnormal power is lower than the actual power), Abnormal-Disconnection (abnormal shutdown or other disconnection), Jump-Change-Point (abnormal power exceeds the actual power). Other unmarked points correspond to the battery life status information under normal conditions.
[0136] Therefore, by building a real-time anomaly recognition model based on 1D convolution and combining it with an automated testing process, the battery life test task can be completed efficiently.
[0137] Step 204: input the audio battery life information to be identified into the battery life anomaly identification model for anomaly prediction to obtain a battery life prediction result.
[0138] In a specific implementation, the relevant steps of generating specific battery life information through the battery life discharge module in the aforementioned embodiment can be used to generate the audio battery life information that actually needs to be predicted in real time (for example, for a speaker device, the specific generated information is the speaker battery life information), and the generated audio battery life information is input into the trained and model performance verified battery life abnormality recognition model for abnormality prediction to obtain real-time battery life prediction results. If the battery life status at the next moment remains normal, or what type of abnormal situation may occur at the next moment.
[0139] In an embodiment of the present invention, a method for identifying and testing battery life anomalies is provided. By constructing a comprehensive and refined data set, using a loss function with adaptive weight adjustment, and a real-time battery life detection model and an automated test process based on 1D convolution, real-time anomaly detection of audio battery life data is achieved. By predicting battery life anomalies based on a battery life anomaly recognition model obtained through training of a comprehensive and refined battery life data set, abnormal situations such as abnormal power outages and abnormal disconnections can be discovered and reported in real time, greatly improving the real-time and accuracy of the test. At the same time, in combination with the constructed battery life anomaly recognition and testing system, the technical solution provided by the embodiment of the present invention also integrates an automatic power-on and power-off function, which can automatically execute test steps according to preset test cases and conditions, reduce manual intervention, and reduce the impact of human factors on test results. By combining the real-time anomaly recognition model with the automated test process, not only the test efficiency and accuracy are improved, the test cost is reduced, but also the stability and consistency of the battery life test can be ensured as much as possible.
[0140] In order to better illustrate, Figure 1 The various processing modules in the battery life abnormality identification and testing system are taken as an example to test the abnormal battery life of the speaker device. Figure 5 , showing a schematic diagram of the overall process of a battery life anomaly identification and testing method provided by an embodiment of the present invention. It should be pointed out that this embodiment only briefly describes the general process of battery life anomaly identification and testing. The specific implementation process of each step can be understood by referring to the relevant content in the aforementioned embodiment. It will not be repeated here. It can be understood that the present invention does not limit this.
[0141] (A) First, the processing flow in the power judgment module:
[0142] Determine whether the speaker device is fully charged (power level greater than 99%) through AT communication;
[0143] If not, the power-on operation continues through the program-controlled relay;
[0144] If so, the power is turned off through the programmable relay and the endurance discharge test process begins.
[0145] (B) Next is the processing flow in the battery life discharge module:
[0146] Perform endurance discharge tests in multiple specified scenarios on a fully charged speaker device, and print log information in real time during the test, including abnormal information;
[0147] At the same time, the power feedback detection of the speaker device is carried out through AT communication;
[0148] If the speaker device cannot communicate normally (i.e. cannot feedback the power normally), the corresponding abnormal information will be printed to the log information; if the speaker device can communicate normally, the real-time power feedback information will be obtained;
[0149] Print real-time curves based on real-time log information (abnormal information during battery life discharge test, battery life status information during normal operation), abnormal information during power feedback detection, and real-time power feedback information;
[0150] When the curve is generated, determine whether the real-time power of the speaker device is lower than the shutdown power;
[0151] If not, continue to perform endurance discharge test on the speaker device;
[0152] If yes, the device is shut down and the specific battery life information is exported;
[0153] The real-time curve is preprocessed and the abnormal information is marked with abnormal labels to generate a flight endurance data set.
[0154] (C) Finally, the processing flow in the anomaly detection module:
[0155] The battery life data set is divided into a battery life training set and a battery life test set;
[0156] Train the 1D convolution detection model based on the endurance training set, and optimize the model based on the loss function of adaptively adjusting weights during the training process;
[0157] Based on the endurance test set, the trained model is validated for model performance, an endurance anomaly recognition model is obtained, and the model validation results are output, and the model test conclusions are analyzed;
[0158] Based on the battery life anomaly recognition model, the actual speaker battery life information that needs to be identified (the generation process refers to the battery life information generation related steps in the battery life discharge module. The same processing flow is shared here and will not be drawn repeatedly) is identified for anomalies, the prediction results are obtained, and a battery life test report is generated.
[0159] Reference Figure 6 , shows a structural block diagram of a battery life abnormality identification and testing device provided by an embodiment of the present invention, which may specifically include:
[0160] The battery life discharge test module 601 is used to perform battery life discharge tests in multiple specified scenarios on the audio device to be tested when the audio device to be tested is in a fully charged state, and obtain real-time log information and battery feedback information in combination with battery feedback;
[0161] A battery life data set generation module 602 is used to generate a real-time battery life curve based on the real-time log information and the power feedback information, and generate a battery life data set according to the real-time battery life curve;
[0162] The abnormality recognition model training module 603 is used to train and verify the 1D convolution detection model based on the endurance data set and the loss function of the adaptively adjusted weights to obtain the endurance abnormality recognition model;
[0163] The abnormality prediction module 604 is used to input the audio battery life information to be identified into the battery life abnormality identification model for abnormality prediction to obtain a battery life prediction result.
[0164] In an optional embodiment, the battery life discharge test module 601 includes:
[0165] A real-time log information printing module, used to perform a battery life discharge test on the audio device in multiple specified scenarios and print real-time log information;
[0166] A power feedback detection module, used to perform real-time power feedback detection on the audio device during the battery life discharge test;
[0167] An abnormality determination module, used for determining that the audio device is abnormal when the audio device cannot normally feedback power, and printing corresponding abnormality information to the real-time log information;
[0168] The power feedback information acquisition module is used to acquire corresponding power feedback information when the audio device normally feeds back power.
[0169] In an optional embodiment, the real-time log information includes the battery life status information corresponding to the normal operation of the audio device, and the battery life data set generation module 602 includes:
[0170] The real-time battery life curve generation module is used to generate a real-time battery life curve with the battery life test time as the horizontal axis, the power feedback information of the audio device as the vertical axis, and the battery life status information and the abnormal information as battery life test variables.
[0171] In an optional embodiment, the battery life data set generation module 602 includes:
[0172] The battery life data set integration module is used to perform data preprocessing on the time and power information of the real-time battery life curve, and to mark abnormal information in the real-time battery life curve with abnormal labels to integrate them into a battery life data set.
[0173] In an optional embodiment, the abnormality recognition model training module 603 includes:
[0174] A data set division module, used for dividing the endurance data set into an endurance training set and an endurance test set according to a preset ratio;
[0175] An adaptive weight adjustment module, used to train the pre-built 1D convolution detection model through the endurance training set, and dynamically adjust the weights corresponding to each sample category in the endurance training set based on the loss function of adaptively adjusting the weights during the model training process;
[0176] The model performance verification module is used to use the endurance test set to perform model performance verification on the trained 1D convolution detection model, obtain the model verification result, and output the final endurance anomaly recognition model.
[0177] In an optional embodiment, the endurance training set corresponds to a plurality of different sample categories, each sample category corresponds to a plurality of training samples, and the adaptive weight adjustment module includes:
[0178] A loss value calculation module is used to calculate the loss value of the current round of iteration after a preset round of iterations by predicting the loss function;
[0179] A prediction accuracy judgment module, used to judge, for each sample category, whether the prediction accuracy corresponding to the current round is greater than or equal to a preset accuracy threshold according to the loss value;
[0180] A weight keeping module, used to keep the weight of the sample category in the current round unchanged for the next round of training iteration;
[0181] The weight adjustment and update module is used to multiply the weight of the sample category in the current round by a preset weighting coefficient to adjust and update the weight of the sample category, and use the adjusted and updated weight for the next round of training iterations.
[0182] In an optional embodiment, the calculation formula of the prediction loss function is as follows:
[0183]
[0184] Where L represents the prediction loss function of the model; N represents the total number of training samples in the endurance training set; C represents the total number of sample categories in the endurance training set, including one normal sample category and the rest are different types of abnormal sample categories; represents the weight of the j-th sample category at the t-th weight update; represents the true label of training sample i. When training sample i belongs to the jth category, ,otherwise ; It represents the probability that the model predicts that training sample i belongs to the jth category.
[0185] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the aforementioned method embodiment.
[0186] The embodiment of the present invention further provides a testing device, the device comprising a processor and a memory:
[0187] The memory is used to store the program code and transmit the program code to the processor;
[0188] The processor is used to execute the battery life anomaly identification and testing method of any embodiment of the present invention according to the instructions in the program code.
[0189] An embodiment of the present invention further provides a computer-readable storage medium, which is used to store program code, and the program code is used to execute the endurance abnormality identification and testing method of any embodiment of the present invention.
[0190] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0191] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0192] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0193] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0194] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0195] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for identifying and testing battery life anomalies, characterized in that: include: When the audio device to be tested is in a fully charged state, a battery life discharge test is performed on the audio device in multiple specified scenarios, and real-time log information and power feedback information are obtained in combination with power feedback; Generate a real-time endurance curve based on the real-time log information and the power feedback information, and generate an endurance data set according to the real-time endurance curve; According to the endurance data set, based on the loss function of adaptively adjusting the weights, the 1D convolution detection model is trained and verified. During the model training process, the weights of each corresponding sample category are dynamically adjusted according to the prediction accuracy of the model on each sample category to obtain an endurance anomaly recognition model. Each sample category corresponds to an initial weight, and the initial weight is set according to the rarity of the sample in the sample category. The audio battery life information to be identified is input into the battery life anomaly identification model for anomaly prediction to obtain a battery life prediction result; The endurance discharge test of the audio device in multiple specified scenarios is performed, and real-time log information and power feedback information are obtained in combination with power feedback, including: Performing battery life discharge tests on the audio device in multiple specified scenarios and printing real-time log information; During the battery life discharge test, the power feedback detection of the audio device is performed in real time; If the audio device cannot normally feedback the power, it is determined that the audio device is abnormal, and the corresponding abnormal information is printed to the real-time log information; If the audio device normally feeds back the power, corresponding power feedback information is obtained.
2. The method for identifying and testing battery life anomalies according to claim 1, characterized in that: The real-time log information includes the battery life status information corresponding to the normal operation of the audio device, and the generating of the real-time battery life curve based on the real-time log information and the power feedback information includes: The battery life test time is taken as the horizontal axis, the power feedback information of the audio device is taken as the vertical axis, the battery life status information and the abnormal information are used as battery life test variables to generate a real-time battery life curve.
3. The method for identifying and testing battery life anomalies according to claim 2, characterized in that: The generating a battery life data set according to the real-time battery life curve includes: Data preprocessing is performed on the time and power information of the real-time endurance curve, and abnormal information in the real-time endurance curve is marked with abnormal labels to be integrated into an endurance data set.
4. The method for identifying and testing battery life anomalies according to any one of claims 1 to 3, characterized in that: According to the endurance data set, based on the adaptively adjusted weight loss function, the 1D convolution detection model is trained and verified. During the model training process, the weights of each corresponding sample category are dynamically adjusted according to the prediction accuracy of the model on each sample category to obtain the endurance anomaly recognition model, including: Dividing the battery life data set into a battery life training set and a battery life test set according to a preset ratio; The pre-built 1D convolution detection model is trained by the endurance training set, and during the model training process, the weights corresponding to each sample category in the endurance training set are dynamically adjusted according to the prediction accuracy of the model on each sample category based on the loss function of adaptively adjusting the weights; The endurance test set is used to verify the model performance of the trained 1D convolution detection model, obtain the model verification result, and output the final endurance anomaly recognition model.
5. The method for identifying and testing battery life anomalies according to claim 4, characterized in that: The endurance training set corresponds to several different sample categories, each of which corresponds to multiple training samples. The loss function based on adaptive weight adjustment dynamically adjusts the weights corresponding to each sample category in the endurance training set according to the prediction accuracy of the model on each sample category, including: By predicting the loss function, after a preset number of iterations, the loss value of the current iteration is calculated; For each of the sample categories, judging whether the prediction accuracy corresponding to the current round is greater than or equal to a preset accuracy threshold according to the loss value; If yes, keep the weight of the sample category in the current round unchanged for the next round of training iteration; If not, the weight of the sample category in the current round is multiplied by a preset weighting coefficient to adjust and update the weight of the sample category, and the adjusted and updated weight is used for the next round of training iteration.
6. The method for identifying and testing battery life anomalies according to claim 5, characterized in that: The calculation formula of the prediction loss function is as follows: ; Where L represents the prediction loss function of the model; N represents the total number of training samples in the endurance training set; C represents the total number of sample categories in the endurance training set, including one normal sample category and the rest are different types of abnormal sample categories; represents the weight of the j-th sample category at the t-th weight update; represents the true label of training sample i. When training sample i belongs to the jth category, ,otherwise ; It represents the probability that the model predicts that training sample i belongs to the jth category.
7. A battery life abnormality identification and testing device, characterized in that: include: A battery life discharge test module is used to perform battery life discharge tests on the audio device under test in multiple specified scenarios when the audio device under test is in a fully charged state, and obtain real-time log information and battery feedback information in combination with battery feedback; A battery life data set generation module, used to generate a real-time battery life curve based on the real-time log information and the power feedback information, and generate a battery life data set according to the real-time battery life curve; An anomaly recognition model training module is used to train and verify the 1D convolution detection model based on the endurance data set and the loss function of adaptively adjusting the weights. During the model training process, the weights of each corresponding sample category are dynamically adjusted according to the prediction accuracy of the model on each sample category to obtain an endurance anomaly recognition model. Each sample category corresponds to an initial weight, and the initial weight is set according to the rarity of the sample in the sample category. The abnormality prediction module is used to input the audio battery life information to be identified into the battery life abnormality recognition model for abnormality prediction to obtain the battery life prediction result; The battery life discharge test module includes: A real-time log information printing module, used to perform a battery life discharge test on the audio device in multiple specified scenarios and print real-time log information; A power feedback detection module, used to perform real-time power feedback detection on the audio device during the battery life discharge test; An abnormality determination module, used for determining that the audio device is abnormal when the audio device cannot normally feedback power, and printing corresponding abnormality information to the real-time log information; The power feedback information acquisition module is used to acquire corresponding power feedback information when the audio device normally feeds back power.
8. A testing device, characterized in that: The device comprises a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the endurance abnormality identification and testing method described in any one of claims 1-6 according to the instructions in the program code.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store program code, and the program code is used to execute the endurance abnormality identification and testing method described in any one of claims 1-6.
Citation Information
Patent Citations
Testing method of cyclic discharging of BBU
CN107422208A
Battery fault diagnosis method and device, medium and BMS system
CN116819332A
