Torque testing method and system based on torque testing device
By collecting and processing continuous torque and impact torque data on the torque testing device, and using a model based on the attention mechanism for anomaly detection, the problems of low test accuracy and low efficiency in traditional methods are solved, and efficient analysis of the torque characteristics of power tools is achieved. Catching and anomaly detection.
Patent Information
- Application Number
- CN202410987574.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-07-23
AI Technical Summary
Traditional torque testing methods rely on manual experience and fixed thresholds, and are difficult to adapt to complex and changeable testing environments and different types of power tools, leading to problems such as missed detections and false detections. It is difficult for existing systems to take into account continuous torque and impact torque at the same time, affecting the accuracy of testing. sex and efficiency.
Using a method based on a torque test device, by collecting and preprocessing continuous torque data and impact torque data, a hierarchical temporal memory model based on an attention mechanism is used for anomaly detection, and a combination of wavelet transform, median filtering and multi-head self-attention mechanism is used to capture Spatiotemporal dependence of torque data and perform dynamic threshold calculation.
It improves the accuracy and efficiency of torque testing, reduces false positives and false negatives, can flexibly respond to torque changes under different working conditions, and intuitively presents test results through visual reports.
Smart Images

Figure CN118518240B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of torque testing, and in particular to a torque testing method and system based on a torque testing device. Background Art
[0002] Traditional torque testing methods mainly rely on manual experience and fixed threshold judgments, which are difficult to adapt to complex and changeable test environments and different types of power tools. They are prone to problems such as missed detection and false detection, which affect the accuracy and reliability of test results. At the same time, as two important performance indicators of power tools, continuous torque and impact torque have obvious differences in their testing and analysis methods. Existing test systems often find it difficult to take into account both torque characteristics at the same time, resulting in low test efficiency and low data utilization.
[0003] Existing technologies still face many challenges when processing time series data, such as difficulty in effectively capturing long-term dependencies, sensitivity to noise and outliers, and difficulty adapting to dynamically changing data distributions. Especially in highly dynamic and nonlinear scenarios such as torque testing, traditional anomaly detection algorithms often fail to meet actual needs, resulting in low accuracy of existing technologies. Summary of the invention
[0004] The present application provides a torque testing method and system based on a torque testing device, which are used to improve the accuracy of torque testing.
[0005] In a first aspect, the present application provides a torque testing method based on a torque testing device, and the torque testing method based on the torque testing device includes:
[0006] Performing a torque test on the tool to be tested by using a torque test bench, and collecting original continuous torque data and original impact torque data of the tool to be tested;
[0007] Preprocessing and feature extraction are performed on the original continuous torque data and the original impact torque data to obtain a continuous torque feature set and an impact torque feature set;
[0008] Inputting the continuous torque feature set and the impact torque feature set into a hierarchical time memory model based on an attention mechanism for model training to obtain a torque anomaly detection model, and deploying the torque anomaly detection model on the torque test bench;
[0009] Acquiring real-time continuous torque data and real-time impact torque data of the tool to be tested through the torque test bench, and inputting the real-time continuous torque data and the real-time impact torque data into the torque anomaly detection model to perform torque anomaly detection, thereby obtaining a torque anomaly detection result;
[0010] A report is generated for the torque anomaly detection result to obtain a comprehensive torque test report, and the comprehensive torque test report is visually displayed through the torque test bench.
[0011] In a second aspect, the present application provides a torque testing system based on a torque testing device, the torque testing system based on the torque testing device comprising:
[0012] An acquisition module, used for performing a torque test on a tool to be tested through a torque test bench, and acquiring original continuous torque data and original impact torque data of the tool to be tested;
[0013] An extraction module, used for preprocessing and feature extraction of the original continuous torque data and the original impact torque data to obtain a continuous torque feature set and an impact torque feature set;
[0014] A training module, used for inputting the continuous torque feature set and the impact torque feature set into a hierarchical time memory model based on an attention mechanism for model training, obtaining a torque anomaly detection model, and deploying the torque anomaly detection model on the torque test bench;
[0015] A detection module, used for acquiring real-time continuous torque data and real-time impact torque data of the tool to be tested through the torque test bench, and inputting the real-time continuous torque data and the real-time impact torque data into the torque anomaly detection model to perform torque anomaly detection, and obtain a torque anomaly detection result;
[0016] A generating module is used to generate a report on the torque anomaly detection result to obtain a comprehensive torque test report, and to visually display the comprehensive torque test report through the torque test bench.
[0017] A third aspect of the present application provides a torque testing device based on a torque testing device, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the torque testing device based on the torque testing device performs the above-mentioned torque testing method based on the torque testing device.
[0018] A fourth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned torque testing method based on the torque testing device.
[0019] In the technical solution provided by the present application, by simultaneously collecting continuous torque data and impact torque data, the torque characteristics of the tool to be tested can be fully captured. The continuous torque data and impact torque data are processed by wavelet transform denoising and median filtering respectively, which can effectively remove the noise in different types of torque data. By extracting time domain features, frequency domain features and statistical features, the characteristics of torque data can be characterized from multiple dimensions. The hierarchical time memory model based on the attention mechanism is adopted, which combines advanced technologies such as spatial pooling, time memory and attention mechanism, and can effectively capture the spatiotemporal dependency of torque data. By processing and analyzing real-time torque data, torque anomalies can be discovered in time, which is conducive to rapid response and handling of potential problems. The multi-step spatial pooling process, including local inhibition, global activation, repeated pattern detection, etc., can effectively extract key features, reduce data dimensions, and improve computational efficiency. By dynamically adjusting the synaptic connection strength of the time memory unit, the time series pattern can be adaptively learned and memorized, and the ability to capture long-term dependencies can be improved. The multi-head self-attention mechanism can focus on important time series information from multiple angles, which helps to improve the model's ability to recognize key patterns. Through dynamic threshold calculation and adaptive anomaly detection, it can flexibly respond to torque changes under different working conditions and reduce false positives and false negatives. By generating a comprehensive torque test report and visually displaying it, the test results can be presented intuitively, making it easier for operators to quickly understand and make decisions. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0021] Figure 1 A schematic diagram of an embodiment of a torque testing method based on a torque testing device in an embodiment of the present application;
[0022] Figure 2 Schematic diagram of an embodiment of a torque testing system based on a torque testing device in an embodiment of the present application. DETAILED DESCRIPTION
[0023] The embodiments of the present application provide a torque testing method and system based on a torque testing device. The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0024] For ease of understanding, the specific process of the embodiment of the present application is described below. Figure 1 , an embodiment of a torque testing method based on a torque testing device in an embodiment of the present application includes:
[0025] Step S101, performing a torque test on the tool to be tested by using a torque test bench, and collecting original continuous torque data and original impact torque data of the tool to be tested;
[0026] It is understandable that the execution subject of the present application may be a torque test system based on a torque test device, or may be a terminal or a server, which is not specifically limited here. The present application embodiment is described by taking a server as the execution subject as an example.
[0027] Specifically, a high-precision torque test bench is configured, which has the ability to collect and process torque data in real time. The torque test bench includes a highly sensitive sensor system for detecting and converting the torque applied to the tool to be tested. These sensors have a high sampling rate and a wide dynamic range to ensure that torque signals ranging from small to drastic changes can be captured, thereby obtaining raw continuous torque data and raw impact torque data. During the test, the tool to be tested is fixed on the fixture of the torque test bench to ensure that the tool remains stable and does not slip or move during the test. Different degrees of torque are applied to the torque test bench through a control system, including continuous gradually increasing or decreasing torque, and instantaneously applied impact torque. The application of continuous torque can simulate the slow loading and unloading process experienced by the tool during actual use, while the impact torque is used to simulate the response of the tool when it is suddenly impacted by an external force. As the test progresses, the sensor system transmits the detected torque signal to the data acquisition system in real time. The data acquisition system consists of a high-speed data processor and a storage device, which can record all data generated during the torque test in real time. The data acquisition system is equipped with an anti-interference design to reduce the impact of external noise on data acquisition. At the same time, the data processor performs preliminary processing on the transmitted signal, filters out high-frequency noise and unnecessary interference signals, and ensures that the collected torque data has a high signal-to-noise ratio. The original continuous torque data and the original impact torque data are stored and marked separately in the data acquisition system for subsequent processing and analysis. The original continuous torque data reflects the change in torque applied to the tool under stable conditions. These data are usually continuous curves with time as the horizontal axis and torque value as the vertical axis. The original impact torque data records the change in torque applied to the tool under instantaneous impact conditions. These data show the characteristics of a sudden jump or drop at a certain point in time.
[0028] Step S102, preprocessing and feature extraction are performed on the original continuous torque data and the original impact torque data to obtain a continuous torque feature set and an impact torque feature set;
[0029] Specifically, the original continuous torque data is subjected to wavelet transform denoising. The wavelet transform can effectively separate the noise components in the signal to obtain the denoised continuous torque data. At the same time, for the original impact torque data, the median filter processing method is adopted. The median filter is a nonlinear filtering technology that can effectively remove the pulse noise in the data to obtain the filtered impact torque data. The continuous torque outlier value identification and elimination are performed on the denoised continuous torque data. By setting a reasonable anomaly detection algorithm, the outliers in the data can be identified and the outliers can be eliminated to obtain the continuous torque data after the outliers are eliminated. The impact torque peak value detection is performed on the filtered impact torque data. The peak detection algorithm is used to capture the impact torque peak value in the data to obtain the impact torque peak value sequence. The continuous torque data after the outliers are eliminated is standardized. Through the standardized processing, the dimension difference in the data is eliminated, and the data is compared on a unified scale to obtain the standardized continuous torque data. The standardized continuous torque data is segmented by sliding windows. The sliding window technology can divide long time series data into multiple short time segments. Each segment contains less data, making data processing and feature extraction more efficient, and obtaining the segmented continuous torque data sequence. In the feature extraction stage, the segmented continuous torque data sequence is subjected to time domain feature extraction. By calculating the statistical characteristics of the data in each time segment, such as mean, variance, kurtosis and skewness, the continuous torque time domain feature subset is obtained. The segmented continuous torque data sequence is subjected to frequency domain feature extraction using frequency domain analysis techniques such as Fourier transform, and the frequency components and energy distribution characteristics in the data are captured to obtain the continuous torque frequency domain feature subset. The statistical characteristics of the impact torque, such as the number of peaks, the average value of the peaks, the standard deviation of the peaks, etc., are calculated based on the impact torque peak sequence to obtain the impact torque feature set. These features can effectively describe the dynamic changes and fluctuations of the impact torque data. The feature fusion of the continuous torque time domain feature subset and the continuous torque frequency domain feature subset is performed. By combining the features of the time domain and the frequency domain, the inherent laws and characteristics of the data can be more comprehensively characterized to obtain a continuous torque feature set.
[0030] Step S103: input the continuous torque feature set and the impact torque feature set into the hierarchical time memory model based on the attention mechanism for model training to obtain a torque anomaly detection model, and deploy the torque anomaly detection model on the torque test bench;
[0031] Specifically, the continuous torque feature set and the impact torque feature set are aligned in time series to obtain a first input feature sequence. The first input feature sequence is input into a hierarchical temporal memory model based on an attention mechanism. The model includes multiple key layers: an input layer, a spatial pooling layer, a temporal memory layer, an attention layer, a prediction layer, an output layer, and a feedback layer. In the input layer, the first input feature sequence is encoded to generate a first encoded temporal torque feature, and the raw data is converted into a higher-level feature representation through preliminary processing of a neural network. The first encoded temporal torque feature is spatially pooled through a spatial pooling layer to obtain a first sparse distribution representation. Spatial pooling reduces data dimensions by aggregating adjacent features while retaining key information and improving computational efficiency. The first sparse distribution representation is input into a temporal memory layer for processing to obtain a first temporal context representation. The temporal memory layer usually adopts a structure such as a recurrent neural network or a long short-term memory network to capture long-term dependencies and dynamic change characteristics in time series data in a recursive manner. The first temporal context representation is input into the attention layer and processed through a multi-head self-attention mechanism to obtain a first attention-weighted context representation. The multi-head self-attention mechanism can focus on the features of different time steps at the same time. By calculating the similarity between each time step, it dynamically adjusts the weight of the features to better capture the global information and local details in the data. The prediction layer performs sequence prediction on the first attention weighted context representation to generate a training anomaly score. In the sequence prediction stage, the model performs inference and prediction based on the input feature sequence and outputs a score reflecting the degree of anomaly. The output layer generates the training prediction result based on the training anomaly score. The prediction result is an evaluation of the anomaly detection capability under the current model state. After the prediction result is generated, the feedback layer calculates the prediction error of the training prediction result, feeds the error information back to the model, and performs back propagation to update the model parameters. The back propagation algorithm adjusts the model weights and biases according to the prediction error to continuously optimize the performance of the model. According to the updated model parameters, the hierarchical temporal memory model based on the attention mechanism is optimized to improve the accuracy and robustness of the model. During the model optimization process, repeated training and adjustment are performed to ensure that the model can maintain efficient and accurate anomaly detection capabilities when processing actual data. After completing model training and optimization, the final torque anomaly detection model is deployed on the torque test bench. The model deployment process involves loading the trained model parameters and structure into the computing unit of the test bench, enabling it to process the torque data collected from the sensor in real time and perform anomaly detection.
[0032] Step S104, obtaining real-time continuous torque data and real-time impact torque data of the tool to be tested through the torque test bench, and inputting the real-time continuous torque data and the real-time impact torque data into the torque anomaly detection model to perform torque anomaly detection, and obtaining a torque anomaly detection result;
[0033] Specifically, the real-time continuous torque data and real-time impact torque data of the tool to be tested are obtained through the torque test bench. The torque data captured by the sensor is transmitted to the data processing unit in real time through the data acquisition module to ensure that the torque changes at each moment are accurately recorded. Data feature extraction and feature combination are performed on the acquired real-time continuous torque data and real-time impact torque data. Data feature extraction involves extracting representative and discriminant features from the original data, such as maximum value, minimum value, mean value, standard deviation, rate of change, etc. These features can effectively describe the change trend and pattern of the torque signal. Through feature combination, different types of features are fused to form a comprehensive feature vector to obtain a second input feature sequence. In the input layer of the torque anomaly detection model, the second input feature sequence is time-encoded, and the time series data is converted into a format suitable for model processing, so that the model can capture the time dependence and dynamic change characteristics of the data, and obtain the second encoded time series torque feature. Time encoding can map the original feature sequence to a high-dimensional space, thereby enhancing the expression ability of the model. In the spatial pooling layer of the torque anomaly detection model, the second encoded temporal torque features are spatially pooled. Spatial pooling is a dimensionality reduction technique that locally summarizes the input features, reduces the feature dimensions while retaining the main information, and obtains the second sparse distribution representation. Sparse distribution representation helps to improve the computational efficiency and generalization ability of the model, enabling the model to process large-scale data more effectively. In the temporal memory layer of the torque anomaly detection model, the corresponding neurons are activated according to the second sparse distribution representation for processing to obtain the second temporal context representation. The temporal memory layer usually adopts structures such as recurrent neural networks or long short-term memory networks. By recursively processing the time series data, it captures the long-term dependencies and sequence characteristics in the data and generates a representation that reflects the temporal context. In the attention layer of the torque anomaly detection model, the second temporal context representation is processed by a multi-head self-attention mechanism. The multi-head self-attention mechanism can simultaneously pay attention to the information at different positions in the sequence, dynamically adjust the weights of the features by calculating the similarity between each position, and obtain the second attention-weighted context representation. In the prediction layer of the torque anomaly detection model, the second attention weighted context representation is sequence predicted to obtain the torque anomaly score. Sequence prediction generates a score reflecting the degree of anomaly by modeling and reasoning about time series data. This score is used to measure whether the current torque data is abnormal. In the output layer of the torque anomaly detection model, the torque anomaly score is dynamically calculated to obtain an adaptive anomaly threshold. The adaptive anomaly threshold is adjusted according to the dynamic changes of the data to ensure that a high detection accuracy can be maintained under different test conditions. By comparing the torque anomaly score with the adaptive anomaly threshold, it is determined whether the current torque data is abnormal and the torque anomaly detection result is obtained.
[0034] The second encoded time series torque feature is processed in the spatial pooling layer, and the encoded time series feature is divided into multiple feature sub-blocks. Each feature sub-block represents a feature set in a specific time window or spatial region. The local suppression threshold is calculated according to the feature sub-block, and an appropriate threshold is determined by analyzing the distribution of feature values in each feature sub-block to suppress feature values below the threshold, and the suppression threshold of each feature sub-block is obtained. The feature values in each feature sub-block are compared with the corresponding suppression threshold, and features above the threshold are screened out to form a preliminary activated neuron set. Based on the preliminary activated neuron set, the global suppression coefficient is calculated, and a global suppression standard is determined by comprehensively considering the activation conditions in all feature sub-blocks to obtain the global activation threshold. The neurons in the preliminary activated neuron set are compared with the global activation threshold, and the neurons that meet the global standard are screened out to obtain the final activated neuron set. A sparse binary vector is generated according to the final activated neuron set to form an initial sparse representation. Repeated pattern detection is performed on the initial sparse representation to identify possible repeated patterns therein. By identifying and marking these patterns, the representation and compression efficiency of the data are optimized. The initial sparse representation is compressed and encoded according to the set of repeated patterns, and the repeated patterns are compressed to reduce redundant data to obtain a compressed sparse representation. In order to improve the dimension and distinguishing ability of the representation, the compressed sparse representation is subjected to a random projection transformation, and the low-dimensional sparse representation is mapped to a higher-dimensional space through random projection technology to obtain a high-dimensional sparse representation. This transformation helps to improve the sparsity of the data representation and the distinguishability of the features. After obtaining the high-dimensional sparse representation, the sparsity index is calculated, which reflects the proportion and distribution of non-zero elements in the representation. According to the sparsity index, the high-dimensional sparse representation is normalized. Through normalization, the representations of different features can have the same scale, which is convenient for subsequent processing and analysis, and finally the second sparse distributed representation is obtained.
[0035] The second sparse distribution representation is segmented into a time series and divided into multiple time window sequences. The time window sequence can capture the changing trend of torque data in different time periods and provide time series information. According to the time window sequence, an initial time memory unit set is constructed, and each memory unit represents a feature set in a specific time window. The synaptic connection strength of the initial time memory unit set is initialized, and an initial weight is assigned to each time memory unit to form a weighted time memory unit set, and the correlation strength between the time memory units is quantified, thereby reflecting the time series dependency of the data. The activation probability of each time memory unit is calculated according to the weighted time memory unit set to obtain the activation probability distribution. By counting and analyzing the weight information, it is determined which memory units have a higher probability of activation at the current moment. The activation probability distribution is processed by a dynamic threshold mechanism to obtain the set of activated neurons at the current moment. The dynamic threshold mechanism dynamically adjusts the activation threshold according to the real-time data to ensure that important features can be accurately identified in different situations. According to the set of activated neurons at the current moment, the internal state of the time memory unit is updated to form an updated state of the time memory unit. By adjusting the neuron state, new time series information is reflected. Perform temporal pattern matching on the updated state of the temporal memory unit to obtain a matching score sequence. Temporal pattern matching compares the current state with the pattern in the historical data, evaluates the similarity between the features at the current moment and the known pattern, and generates a matching score. Based on the matching score sequence, a set of prediction neurons is generated to obtain the predicted activation pattern at the next moment. By predicting the features at future moments, the model can be helped to identify possible abnormal situations in advance. The predicted activation pattern at the next moment is compared with the actual activation pattern to obtain the prediction error. By calculating the prediction error, the prediction accuracy of the model is evaluated and feedback is provided for model optimization. According to the prediction error, the synaptic connection strength of the temporal memory unit is adjusted, the weight and connection strength are corrected, and the accuracy and robustness of the model are improved. Based on the adjusted synaptic connection strength, a second temporal context representation is generated. This representation combines the feature information of the current moment and the temporal dependency of the historical data, and can more accurately reflect the dynamic changes of the data.
[0036] The second temporal context representation is linearly transformed to generate the query matrix, key matrix and value matrix, and the input features are mapped to different subspaces through linear projection. The attention score is calculated based on the query matrix and the key matrix, and the similarity score of each query and key is obtained through dot product calculation to form the original attention weight. In order to ensure numerical stability and training effect, the original attention weight is softmax processed to obtain the normalized attention weight. The softmax function converts the original weight into a probability distribution so that each weight value is between 0 and 1 and the sum is 1, ensuring that the relative importance of each feature is reasonably reflected. Matrix multiplication is performed based on the normalized attention weight and the value matrix to generate a single-head attention output. The attention weight is applied to the value matrix through weighted summation to aggregate the context information required for the current query. In order to improve the expressiveness of the model and capture diverse features, the single-head attention output is calculated multiple times in parallel to obtain multiple independent attention head outputs. Each attention head independently learns and processes different feature subsets to capture multi-level information in the data. Multiple independent attention head outputs are spliced together along the feature dimension to form a unified multi-head attention feature. Through the splicing operation, the feature representations of different attention heads are integrated to enhance the overall perception ability of the model. The spliced multi-head attention features are linearly transformed to obtain the fused attention features. In order to enhance the stability and training effect of the model, the fused attention features and the second temporal context representation are residually connected. The residual connection directly adds the input features to the transformed features to retain the original information while alleviating the gradient vanishing problem that may occur in the deep network, and obtains the initial attention weighted representation. The initial attention weighted representation is layer-normalized. Layer normalization adjusts the feature distribution to make its mean zero and variance one, thereby accelerating training convergence and improving the stability of the model, and obtaining the normalized attention weighted representation. The normalized attention weighted representation is feed-forwarded, and features are extracted and processed through a series of linear transformations and nonlinear activation functions to obtain the second attention weighted context representation.
[0037] Step S105, generating a report on the torque anomaly detection result to obtain a comprehensive torque test report, and visually displaying the comprehensive torque test report through a torque test bench.
[0038] Specifically, the torque anomaly detection results are comprehensively analyzed and processed. The test results include the anomalies of continuous torque data and impact torque data in various time periods. By summarizing and counting these data, key information such as the frequency, intensity and specific time point of the anomaly can be identified. Statistical analysis tools are used to conduct in-depth analysis of the test results, and potential problems in the data are mined by calculating the distribution, trend and pattern of the anomaly values. These statistical information are intuitively displayed using charts and graphical tools such as bar charts, line charts, and heat maps. These charts can not only clearly present the changing trend of abnormal data, but also help users quickly locate the root cause of the problem. When generating a comprehensive torque test report, the analysis results are systematically organized, including the specific results of the anomaly detection, the charts of the statistical analysis and the relevant explanations. After the report is generated, the comprehensive torque test report is visualized through the display screen of the torque test bench or the connected computer system. The visual display can use an interactive graphical interface, and users can flexibly view the contents of the report by clicking, zooming in, and zooming out. For example, a time series graph of torque data can be displayed on the display screen to visually show abnormal situations through changes in color and lines; or the distribution of abnormal values can be displayed on a heat map to help users quickly identify areas where abnormalities are concentrated.
[0039] In the embodiment of the present application, by simultaneously collecting continuous torque data and impact torque data, the torque characteristics of the tool to be tested can be fully captured. The continuous torque data and impact torque data are respectively subjected to wavelet transform denoising and median filtering, which can effectively remove the noise in different types of torque data. By extracting time domain features, frequency domain features and statistical features, the characteristics of torque data can be characterized from multiple dimensions. The hierarchical time memory model based on the attention mechanism is adopted, which combines advanced technologies such as spatial pooling, time memory and attention mechanism, and can effectively capture the spatiotemporal dependency of torque data. By processing and analyzing real-time torque data, torque anomalies can be discovered in time, which is conducive to rapid response and handling of potential problems. The multi-step spatial pooling process, including local inhibition, global activation, repeated pattern detection, etc., can effectively extract key features, reduce data dimensions, and improve computational efficiency. By dynamically adjusting the synaptic connection strength of the time memory unit, the time series pattern can be adaptively learned and memorized, and the ability to capture long-term dependencies can be improved. The multi-head self-attention mechanism can focus on important time series information from multiple angles, which helps to improve the model's ability to recognize key patterns. Through dynamic threshold calculation and adaptive anomaly detection, it can flexibly respond to torque changes under different working conditions and reduce false positives and false negatives. By generating a comprehensive torque test report and visually displaying it, the test results can be presented intuitively, making it easier for operators to quickly understand and make decisions.
[0040] In a specific embodiment, the process of executing step S102 may specifically include the following steps:
[0041] (1) Performing wavelet transform denoising on the original continuous torque data to obtain denoised continuous torque data, and performing median filtering on the original impact torque data to obtain filtered impact torque data;
[0042] (2) Identify and eliminate the outliers of the continuous torque data after denoising to obtain the continuous torque data after outliers are eliminated, and perform impact torque peak detection on the filtered impact torque data to obtain the impact torque peak sequence;
[0043] (3) The continuous torque data after outliers are removed is standardized to obtain standardized continuous torque data, and the standardized continuous torque data is segmented using a sliding window to obtain a segmented continuous torque data sequence;
[0044] (4) extracting time domain features from the segmented continuous torque data sequence to obtain a continuous torque time domain feature subset, and extracting frequency domain features from the segmented continuous torque data sequence to obtain a continuous torque frequency domain feature subset;
[0045] (5) The statistical characteristics of the impact torque are calculated according to the impact torque peak sequence to obtain the impact torque feature set, and the continuous torque time domain feature subset and the continuous torque frequency domain feature subset are fused to obtain the continuous torque feature set.
[0046] Specifically, the original continuous torque data is subjected to wavelet transform. Wavelet transform is a time-frequency analysis method that can effectively decompose different frequency components in the signal and analyze the signal at different scales. Through wavelet transform, the original continuous torque data is decomposed into low-frequency components and high-frequency components, where the high-frequency components usually contain noise. By retaining the low-frequency components and removing the high-frequency noise components, the denoised continuous torque data is obtained. For a continuous torque signal , can be expressed by wavelet transform as: ;in, is the wavelet basis function, is the corresponding transformation coefficient. By selecting appropriate wavelet basis functions and thresholds, the noise components can be effectively removed. At the same time, for the original impact torque data, median filtering is used. Median filtering is a nonlinear filtering method that can effectively remove impulse noise in the signal. For each data point in the signal, the original value is replaced by the median of the point and its adjacent data points. For example, given the original impact torque data , after the window size is After median filtering, the filtered impact torque data is obtained ,in: ; Identify and remove outliers in the continuous torque data after denoising, and identify outliers in the data through statistical analysis. For example, calculate the mean of the denoised data and standard deviation , and will exceed The values in the range are identified as outliers. By removing these outliers, continuous torque data after outlier removal is obtained. After obtaining the filtered impact torque data, the impact torque peak detection is performed. Peak detection is the process of identifying the local maximum value in the signal. The peak value in the impact torque data can be identified by setting a threshold or using mathematical methods. For example, given the filtered impact torque data , the peak can be detected by finding the point that satisfies the following conditions: and ; Get the peak sequence of impact torque . The continuous torque data after outliers are removed is standardized by adjusting the data to a standard normal distribution with a mean of 0 and a variance of 1. After standardization, the standardized continuous torque data is subjected to sliding window segmentation. Sliding window segmentation is to divide the data into multiple segments according to the time window, each segment contains a fixed number of data points, and obtains a segmented continuous torque data sequence. Time domain features are extracted from the segmented continuous torque data sequence. Time domain features include data statistics, such as mean, variance, skewness, kurtosis, etc. Frequency domain features are extracted from the segmented continuous torque data sequence, and the time domain data is converted to the frequency domain using methods such as Fourier transform. Frequency domain features include the spectral energy and main frequency of the data. Through Fourier transform, the time domain signal is converted to Convert to frequency domain signal , its frequency domain characteristics may include: spectrum energy ;
[0047] Combining the above time domain features and frequency domain features, a complete continuous torque feature set is obtained. According to the impact torque peak sequence, the statistical features of the impact torque, such as the mean and standard deviation of the peak value, can be calculated. The statistical features of the impact torque are extracted to obtain the impact torque feature set. The continuous torque time domain feature subset and the frequency domain feature subset are feature fused, and combined with the impact torque feature set to obtain the continuous torque feature set.
[0048] In a specific embodiment, the process of executing step S103 may specifically include the following steps:
[0049] (1) Performing time series alignment on the continuous torque feature set and the impact torque feature set to obtain a first input feature sequence;
[0050] (2) Inputting the first input feature sequence into the hierarchical temporal memory model based on the attention mechanism, the hierarchical temporal memory model based on the attention mechanism includes: an input layer, a spatial pooling layer, a temporal memory layer, an attention layer, a prediction layer, an output layer and a feedback layer;
[0051] (3) Encoding the first input feature sequence through the input layer to obtain a first encoded time series torque feature;
[0052] (4) performing spatial pooling processing on the first encoded temporal torque feature through a spatial pooling layer to obtain a first sparse distribution representation;
[0053] (5) Input the first sparse distribution representation into the temporal memory layer for processing to obtain the first temporal context representation;
[0054] (6) Input the first temporal context representation into the attention layer for multi-head self-attention mechanism processing to obtain the first attention-weighted context representation;
[0055] (7) The prediction layer performs sequence prediction on the first attention-weighted context representation to obtain a training anomaly score, and the output layer generates a training prediction result based on the training anomaly score;
[0056] (8) Calculate the prediction error of the training prediction result through the feedback layer, and back-propagate the update of the hierarchical temporal memory model based on the attention mechanism to obtain the updated model parameters;
[0057] (9) The hierarchical temporal memory model based on the attention mechanism is optimized according to the updated model parameters to obtain the torque anomaly detection model, which is then deployed on the torque test bench.
[0058] Specifically, the continuous torque feature set and the impact torque feature set are aligned in time series to obtain a first input feature sequence. Through interpolation or synchronous sampling, it is ensured that the continuous torque features and the impact torque features at each time point can be matched accordingly. The first input feature sequence is input into a hierarchical time memory model based on an attention mechanism. The model includes an input layer, a spatial pooling layer, a time memory layer, an attention layer, a prediction layer, an output layer, and a feedback layer. These layers work together to achieve efficient processing and anomaly detection of time series data. The first input feature sequence is encoded through the input layer, and the original features are converted into a high-dimensional representation suitable for model processing to obtain a first encoded time series torque feature. The encoding process can be implemented by linear transformation or deep neural network, mapping the input features to a new feature space for subsequent processing. The first encoded time series torque feature is spatially pooled through the spatial pooling layer to obtain a first sparse distribution representation. Spatial pooling reduces the dimension and complexity of features by locally summarizing the features while retaining key information. For example, using the maximum pooling or average pooling method, the maximum or average value of the local feature is used as the pooling result to obtain a sparse feature representation. The first sparse distribution representation is input into the time memory layer for processing to obtain the first temporal context representation. The temporal memory layer is usually implemented using a recurrent neural network or a long short-term memory network. By recursively processing the time series data, the long-term dependencies and temporal characteristics in the data are captured. The temporal memory layer can retain information from past moments and update it according to the current input to generate a feature representation that reflects the temporal context. The first temporal context representation is input into the attention layer for multi-head self-attention mechanism processing to obtain the first attention-weighted context representation. The multi-head self-attention mechanism captures global information and local details by calculating multiple independent attention heads in parallel, with each head responsible for paying attention to different parts of the input sequence. The attention mechanism obtains the attention weight by calculating the dot product of the query matrix, key matrix, and value matrix, and normalizes it through the softmax function. The specific formula is as follows: Attention softmax ;in, is the query matrix, is the key matrix, is the value matrix, is the dimension of the key matrix. By weighted summation, the attention-weighted context representation is obtained. The prediction layer performs sequence prediction on the first attention-weighted context representation to generate a training anomaly score. Sequence prediction models the input features through a neural network and outputs a score indicating the degree of anomaly. The training anomaly score can be used to evaluate whether there are anomalies in the current input sequence and guide the optimization of the model. The output layer generates training prediction results based on the training anomaly score, and converts the prediction results of the model into interpretable outputs, such as labels or scores for anomaly detection. The feedback layer calculates the prediction error of the training prediction results, and back-propagates the update of the hierarchical time memory model based on the attention mechanism. The back-propagation algorithm adjusts the parameters of the model according to the prediction error to optimize the performance of the model. The specific formula is as follows: ;in, represents the model parameters, represents the learning rate, Represents the loss function. By calculating the gradient of the loss function and updating the model parameters, the prediction error is gradually reduced and the accuracy of the model is improved. According to the updated model parameters, the hierarchical temporal memory model based on the attention mechanism is optimized to obtain the torque anomaly detection model. The optimization process continuously adjusts the model parameters through multiple rounds of training and verification, so that it can perform well on actual data and has high detection accuracy and robustness. The optimized torque anomaly detection model is deployed on the torque test bench. The deployment process includes loading the trained model into the computing unit of the test bench so that it can process the torque data collected from the sensor in real time and perform anomaly detection.
[0059] In a specific embodiment, the process of executing step S104 may specifically include the following steps:
[0060] (1) obtaining real-time continuous torque data and real-time impact torque data of the tool to be tested through the torque test bench, and performing data feature extraction and feature combination on the real-time continuous torque data and the real-time impact torque data to obtain a second input feature sequence;
[0061] (2) In the input layer of the torque anomaly detection model, the second input feature sequence is time-encoded to obtain a second encoded time series torque feature;
[0062] (3) In the spatial pooling layer of the torque anomaly detection model, the second encoded temporal torque features are spatially pooled to obtain a second sparse distribution representation;
[0063] (4) In the time memory layer of the torque anomaly detection model, the corresponding neurons are activated for processing according to the second sparse distribution representation to obtain the second temporal context representation;
[0064] (5) In the attention layer of the torque anomaly detection model, the second temporal context representation is processed by a multi-head self-attention mechanism to obtain the second attention weighted context representation;
[0065] (6) In the prediction layer of the torque anomaly detection model, the second attention weighted context representation is sequence predicted to obtain the torque anomaly score;
[0066] (7) In the output layer of the torque anomaly detection model, a dynamic threshold calculation is performed on the torque anomaly score to obtain an adaptive anomaly threshold, and the torque anomaly score is compared with the adaptive anomaly threshold to obtain the torque anomaly detection result.
[0067] Specifically, the torque test bench is connected to the tool to be tested, and continuous torque data and impact torque data are collected in real time through high-precision sensors. These data reflect the different types of torque loads that the tool bears during operation. Data feature extraction is performed on real-time continuous torque data and real-time impact torque data. For continuous torque data, time domain features and frequency domain features are extracted. For example, time domain features include mean, standard deviation, skewness, and kurtosis, etc., while frequency domain features can be obtained through Fourier transform to obtain the signal's spectral energy, main frequency, etc. Fourier transform converts time domain signals into frequency domain signals ;
[0068] For the impact torque data, extract its peak value, pulse width and frequency and other features. After extracting the features, perform feature combination to obtain the second input feature sequence. In the input layer of the torque anomaly detection model, the second input feature sequence is time-encoded. Through the long short-term memory network (LSTM), the input feature sequence is encoded into a time context feature. The calculation formula of the LSTM unit is as follows: ;in, , , They are input gate, forget gate and output gate respectively. For candidate memory, For the memory unit, is the hidden state, is the sigmoid activation function, is the tanh activation function, and are weights and biases, respectively. The second encoded temporal torque features are spatially pooled through the spatial pooling layer to obtain a second sparse distribution representation. Spatial pooling can use the maximum pooling or average pooling method to take the maximum or average value of the local features as the pooling result. In the temporal memory layer, the corresponding neurons are activated for processing according to the second sparse distribution representation to obtain a second temporal context representation. The temporal memory layer is usually implemented using a recurrent neural network or a long short-term memory network, which captures the long-term dependencies and temporal characteristics in the data by recursively processing the time series data. The second temporal context representation is input into the attention layer for multi-head self-attention mechanism processing to obtain the second attention weighted context representation. The multi-head self-attention mechanism captures global information and local details by calculating multiple independent attention heads in parallel, with each head responsible for paying attention to different parts of the input sequence. The attention mechanism calculates the query matrix , key matrix Sum Matrix The dot product of , get the attention weight, and normalize it through the softmax function: Attention softmax ;in, is the query matrix, is the key matrix, is the value matrix, is the dimension of the key matrix. In the prediction layer, the second attention weighted context representation is sequence predicted to generate a torque anomaly score. Sequence prediction models the input features through a neural network and outputs a score indicating the degree of anomaly. The prediction score can be used to evaluate whether there is an anomaly in the current input sequence. In the output layer, a dynamic threshold is calculated for the torque anomaly score to obtain an adaptive anomaly threshold. The adaptive anomaly threshold is dynamically adjusted according to real-time data to ensure that anomalies can be accurately identified in different situations. The specific dynamic threshold calculation formula can be expressed as:
[0069] ;in, is the adaptive anomaly threshold, is the average value of anomaly scores, is the standard deviation, The torque anomaly detection result is obtained by comparing the torque anomaly score with the adaptive anomaly threshold.
[0070] In a specific embodiment, the execution step of performing spatial pooling on the second encoded time series torque feature in the spatial pooling layer of the torque anomaly detection model to obtain the second sparse distribution representation may specifically include the following steps:
[0071] (1) In the spatial pooling layer of the torque anomaly detection model, the second encoded temporal torque features are processed in blocks to obtain multiple feature sub-blocks;
[0072] (2) Calculate the local inhibition threshold based on multiple feature sub-blocks to obtain the inhibition threshold of each feature sub-block, and compare the feature value in each feature sub-block with the corresponding inhibition threshold to obtain the preliminary activated neuron set;
[0073] (3) Calculate the global inhibition coefficient based on the preliminary activated neuron set to obtain the global activation threshold, and compare the neurons in the preliminary activated neuron set with the global activation threshold to obtain the final activated neuron set;
[0074] (4) Generate a sparse binary vector based on the final set of activated neurons to obtain an initial sparse representation, and perform repeated pattern detection on the initial sparse representation to obtain a repeated pattern set;
[0075] (5) compressing and encoding the initial sparse representation according to the set of repeated patterns to obtain a compressed sparse representation, and performing random projection transformation on the compressed sparse representation to obtain a high-dimensional sparse representation;
[0076] (6) Calculate a sparsity index based on the high-dimensional sparse representation, and normalize the high-dimensional sparse representation based on the sparsity index to obtain a second sparse distributed representation.
[0077] Specifically, the second encoding time series torque feature is divided into several independent feature sub-blocks, and local information is captured by segmenting the data. Assume that the second encoding time series torque feature is , which is divided into Feature sub-block , each feature sub-block contains the same number of feature values. The local suppression threshold is calculated based on multiple feature sub-blocks. Each has its own distribution, and by calculating its mean and standard deviation , and get the local suppression threshold. The local suppression threshold can be set as:
[0078] ;in, It is a feature sub-block The suppression threshold, is a tuning parameter used to control the suppression strength. Compare and get the initial set of activated neurons , that is, satisfy According to the initial activation of the neuron set Calculate the global suppression coefficient. The global suppression coefficient sets a unified standard by comprehensively considering the activation of all feature sub-blocks. Global activation threshold This can be obtained by calculating the mean and standard deviation of all the initial activated neuron sets: ;in, and are the mean and standard deviation of all the initially activated neuron sets, is a tuning parameter. By comparing the neurons in the initial activation neuron set with the global activation threshold Compare and get the final set of activated neurons , that is, satisfy The feature value set of . According to the final activation neuron set Generate a sparse binary vector to obtain an initial sparse representation. The sparse binary vector represents activated neurons as 1 and inactivated neurons as 0, thus forming a sparse feature representation. For example, if The feature indices contained in , then the initial sparse representation is [1, 0, 0, 1, 0, 0, 1, 0, 0]. Repeated pattern detection is performed on the initial sparse representation to identify possible repeated patterns. Repeated pattern detection forms a set of repeated patterns by counting the frequency of occurrence of patterns in the initial sparse representation. For example, if the sub-pattern that frequently appears in the sparse representation is [1, 0, 1], then it is included in the set of repeated patterns. The initial sparse representation is compressed and encoded to compress the recurring patterns to obtain a compressed sparse representation. Compression encoding reduces data redundancy by replacing recurring patterns with a single symbol. For example, assuming that [1, 0, 1] is represented by symbol A, the initial sparse representation [1, 0, 1, 0, 1, 0, 1] can be compressed to . Perform random projection transformation on the compressed sparse representation to obtain a high-dimensional sparse representation. Random projection transformation enhances the sparsity and distinguishability of data by mapping low-dimensional data to high-dimensional space. Calculate the sparsity index based on the high-dimensional sparse representation. The sparsity index reflects the proportion of non-zero elements in the high-dimensional sparse representation and can be calculated by the following formula: ;in, represents the number of non-zero elements in the high-dimensional sparse representation, Represents the sum of the absolute values of all elements. Sparsity index It is used to measure the sparsity of sparse representation. The high-dimensional sparse representation is normalized according to the sparsity index to obtain the second sparse distribution representation. Normalization adjusts the value range of the high-dimensional sparse representation to make it conform to the expected distribution characteristics.
[0079] In a specific embodiment, the execution step activates corresponding neurons for processing in the time memory layer of the torque anomaly detection model according to the second sparse distribution representation to obtain the second temporal context representation may specifically include the following steps:
[0080] (1) segmenting the second sparse distribution representation into time series to obtain multiple time window sequences, and constructing an initial time memory unit set based on the multiple time window sequences;
[0081] (2) Initializing the synaptic connection strength of the initial time memory unit set to obtain a weighted time memory unit set, and calculating the activation probability of each time memory unit based on the weighted time memory unit set to obtain an activation probability distribution;
[0082] (3) The activation probability distribution is processed by a dynamic threshold mechanism to obtain the set of activated neurons at the current moment, and the internal state of the time memory unit is updated according to the set of activated neurons at the current moment to obtain the updated state of the time memory unit;
[0083] (4) Perform temporal pattern matching on the updated temporal memory unit state to obtain a matching score sequence, and generate a predicted neuron set based on the matching score sequence to obtain the predicted activation pattern at the next moment;
[0084] (5) Compare the predicted activation pattern at the next moment with the actual activation pattern to obtain a prediction error. According to the prediction error, the synaptic connection strength of the temporal memory unit is adjusted to generate a second temporal context representation.
[0085] Specifically, the second sparse distribution representation is segmented into time series, and is divided into multiple time window sequences. Assume that the second sparse distribution representation is , split it into several pieces of length time windows, each of which contains a set of continuous sparse distribution representations. These time window sequences can be expressed as ,in Through this segmentation method, the changing trend of sparse distribution representation in different time periods is captured. The initial time memory unit set is constructed based on multiple time window sequences. The time memory unit is the basic unit used by the model to store and process time series data. Each unit stores the feature information within a time window. The initial time memory unit set can be expressed as , where each Corresponding to a time window The synaptic connection strength of the initial time memory unit set is initialized, and an initial weight is assigned to each memory unit. The synaptic connection strength represents the strength of the association between memory units, which can be expressed as a matrix Indicates that Represents memory unit and The connection weights between them are usually initialized by random initialization or initialization based on historical data, so that each weight has an initial value. A set of weighted time memory units is obtained through initialization. The activation probability of each time memory unit is calculated based on the set of weighted time memory units. The activation probability reflects the possibility of each memory unit being activated under the current input. Assume that the current input is , the activation probability can be calculated by the following formula: ;in, It is a memory unit The activation probability, is the weight vector of the memory unit, is the sigmoid activation function. By calculating the activation probability of all memory cells, the activation probability distribution is obtained. The activation probability distribution is processed by the dynamic threshold mechanism to determine the set of activated neurons at the current moment. The dynamic threshold mechanism dynamically adjusts the activation threshold according to the distribution characteristics of the activation probability. , ensuring that neurons can be reasonably selected for activation in different situations. The activation threshold can be calculated using the following formula: ;in, and are the mean and standard deviation of the activation probability, is a tuning parameter. By dividing the activation probability by the threshold Compare and get the set of activated neurons at the current moment , that is, satisfy The internal state of the time memory unit is updated according to the activated neuron set at the current moment. The internal state of the memory unit represents its activity level at the current moment and can be updated by the following formula: ;in, It is a memory unit At the moment The internal state of It's a neuron The activation value of is the update rate. In this way, the state information of each memory unit is gradually accumulated to reflect its changes in different time periods. The updated state of the time memory unit is matched with the time series pattern to obtain a matching score sequence. The time series pattern matching compares the current memory unit state with the historical pattern to evaluate its similarity. The matching score can be obtained by calculating the cosine similarity between the current state and the historical pattern: ; Among them, score It is a memory unit The matching score of It is a historical model. Represents the norm of the vector. By calculating the matching scores of all memory units, a matching score sequence is obtained. A set of prediction neurons is generated according to the matching score sequence to obtain the predicted activation pattern at the next moment. The prediction neuron set contains those neurons with high matching scores at the current moment, and the activation patterns of these neurons are used to predict the state at the next moment. The predicted activation pattern can be represented as a binary vector, where 1 indicates that the neuron is predicted to be activated and 0 indicates inactivation. The predicted activation pattern at the next moment is compared with the actual activation pattern to obtain the prediction error. The prediction error represents the difference between the activation pattern predicted by the model and the activation pattern actually observed, which can be calculated by the following formula: ;in, It's a neuron The prediction error, is the actual activation value, is the predicted activation value. The synaptic connection strength of the temporal memory unit is adjusted according to the prediction error. The adjustment process usually uses a gradient descent algorithm to update the connection weight according to the prediction error. The adjustment formula is as follows: ;in, is the learning rate, is the prediction error, is the input feature vector. In this way, the parameters of the model are gradually optimized so that it can more accurately predict the activation pattern. The second temporal context representation is generated by the optimized temporal memory unit state. The second temporal context representation combines the current moment and historical temporal information, and can reflect the dynamic changes of torque data in different time periods.
[0086] In a specific embodiment, the execution step performs multi-head self-attention mechanism processing on the second temporal context representation in the attention layer of the torque anomaly detection model to obtain the second attention weighted context representation, which may specifically include the following steps:
[0087] (1) Perform a linear transformation on the second temporal context representation to obtain a query matrix, a key matrix, and a value matrix;
[0088] (2) Calculate the attention score based on the query matrix and the key matrix to obtain the original attention weight, and perform softmax processing on the original attention weight to obtain the normalized attention weight;
[0089] (3) Perform matrix multiplication based on the normalized attention weight and value matrix to obtain a single-head attention output, and perform multiple parallel calculations on the single-head attention output to obtain multiple independent attention head outputs;
[0090] (4) Perform a splicing operation on the outputs of multiple independent attention heads to obtain the spliced multi-head attention features, and perform a linear transformation on the spliced multi-head attention features to obtain the fused attention features;
[0091] (5) Perform a residual connection on the fused attention features and the second temporal context representation to obtain a preliminary attention weighted representation;
[0092] (6) The preliminary attention weighted representation is layer-normalized to obtain a normalized attention weighted representation, and the normalized attention weighted representation is feed-forwarded to obtain a second attention weighted context representation.
[0093] Specifically, a linear transformation is performed on the second temporal context representation. Assume that the second temporal context representation is , through three different weight matrices , and , respectively Linear transformation to query matrix , key matrix Sum Matrix Through linear transformation, the input feature are projected into different subspaces. According to the query matrix and key matrix Calculate the attention score. The attention score measures the relevance of each query to the key by calculating the dot product of the query matrix and the key matrix. The specific formula is as follows: ;in, is the dimension of the key vector, which is used to scale the dot product result to avoid gradient instability caused by too large a value. The original attention score is processed by softmax to obtain the normalized attention weight. The softmax function converts the original weight into a probability distribution so that its sum is 1. The formula is as follows: weights=softmax ; According to the normalized attention weights Attention_weights and value matrix Perform matrix multiplication to get the single-head attention output. In order to improve the expressiveness of the model and capture different feature information, multiple independent attention heads are usually used for parallel calculation. Each attention head has an independent weight matrix , and , and independently calculate their outputs. Assume that The output of attention head can be expressed as: ;in, Indicates The outputs of multiple independent attention heads are concatenated to obtain the concatenated multi-head attention features. The concatenation operation connects the outputs of each attention head along the feature dimension to form a comprehensive feature representation. The concatenated multi-head attention features are linearly transformed to obtain the fused attention features. The linear transformation is done through a weight matrix Map the concatenated features to the target dimension. Perform a residual connection on the fused attention features and the second temporal context representation. The residual connection directly adds the input features and the attention features, retaining the original information while alleviating the gradient vanishing problem in the deep network: the preliminary attention weighted representation is layer normalized. Layer normalization accelerates training convergence and improves model stability by adjusting the feature distribution so that its mean is zero and its variance is one. Perform feedforward processing on the normalized attention weighted representation. The feedforward processing further extracts and processes features through a series of linear transformations and nonlinear activation functions, and finally obtains the second attention weighted context representation. Among them, the feedforward neural network includes one or more linear layers and activation functions. For example, a feedforward network can contain two layers of linear transformations and a ReLU activation function: ;in, and is the weight matrix, and is the bias vector.
[0094] The torque testing method based on the torque testing device in the embodiment of the present application is described above. The torque testing system based on the torque testing device in the embodiment of the present application is described below. Figure 2 In the embodiment of the present application, a torque testing system based on a torque testing device comprises:
[0095] The acquisition module 201 is used to perform a torque test on the tool to be tested through a torque test bench, and to acquire original continuous torque data and original impact torque data of the tool to be tested;
[0096] An extraction module 202 is used to preprocess and extract features from the original continuous torque data and the original impact torque data to obtain a continuous torque feature set and an impact torque feature set;
[0097] A training module 203 is used to input the continuous torque feature set and the impact torque feature set into the hierarchical time memory model based on the attention mechanism for model training, obtain a torque anomaly detection model, and deploy the torque anomaly detection model on the torque test bench;
[0098] The detection module 204 is used to obtain the real-time continuous torque data and the real-time impact torque data of the tool to be tested through the torque test bench, and input the real-time continuous torque data and the real-time impact torque data into the torque anomaly detection model to perform torque anomaly detection, and obtain the torque anomaly detection result;
[0099] The generation module 205 is used to generate a report on the torque anomaly detection result, obtain a comprehensive torque test report, and visualize the comprehensive torque test report through a torque test bench.
[0100] Through the cooperation of the above components, by collecting continuous torque data and impact torque data at the same time, the torque characteristics of the tool to be tested can be fully captured. The continuous torque data and impact torque data are processed by wavelet transform denoising and median filtering respectively, which can effectively remove the noise in different types of torque data. By extracting time domain features, frequency domain features and statistical features, the characteristics of torque data can be characterized from multiple dimensions. The hierarchical time memory model based on the attention mechanism is combined with advanced technologies such as spatial pooling, time memory and attention mechanism, which can effectively capture the spatiotemporal dependency of torque data. By processing and analyzing real-time torque data, torque anomalies can be discovered in time, which is conducive to rapid response and handling of potential problems. The multi-step spatial pooling processing, including local inhibition, global activation, repeated pattern detection, etc., can effectively extract key features, reduce data dimensions and improve computational efficiency. By dynamically adjusting the synaptic connection strength of the time memory unit, the time sequence pattern can be adaptively learned and memorized, and the ability to capture long-term dependencies can be improved. The multi-head self-attention mechanism can focus on important timing information from multiple angles, which helps improve the model's ability to recognize key patterns. Through dynamic threshold calculation and adaptive anomaly detection, it can flexibly respond to torque changes under different working conditions and reduce false positives and false negatives. By generating a comprehensive torque test report and visually displaying it, the test results can be presented intuitively, making it easier for operators to quickly understand and make decisions.
[0101] The present application also provides a torque testing device based on a torque testing device, wherein the torque testing device based on the torque testing device includes a memory and a processor, wherein computer-readable instructions are stored in the memory, and when the computer-readable instructions are executed by the processor, the processor executes the steps of the torque testing method based on the torque testing device in the above-mentioned embodiments.
[0102] The present application also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the torque testing method based on the torque testing device.
[0103] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, systems and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0104] 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 application is essentially 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 to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.
[0105] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. 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 application.
Claims
1. A torque testing method based on a torque testing device, characterized in that: The method comprises: The torque test is performed on the tool to be tested by a torque test bench, and the original continuous torque data and the original impact torque data of the tool to be tested are collected; specifically, during the test, the tool to be tested is fixed on the fixture of the torque test bench, and different degrees of torque are applied to the torque test bench through a control system, and these torques include continuous gradually increasing or decreasing torques, and instantaneously applied impact torques; the application of continuous torque is used to simulate the slow loading and unloading process experienced by the tool during actual use, and the impact torque is used to simulate the response of the tool when it is suddenly impacted by an external force; the sensor system transmits the detected torque signal to the data acquisition system in real time, and the data acquisition system is composed of It is composed of a high-speed data processor and a storage device, and can record all data generated during the torque test in real time; the data processor performs preliminary processing on the transmitted signal to filter out high-frequency noise and unnecessary interference signals; the original continuous torque data and the original impact torque data are stored and marked separately in the data acquisition system, and the original continuous torque data reflects the change of the torque applied to the tool under stable conditions. The original continuous torque data is a continuous curve with time as the horizontal axis and torque value as the vertical axis; the original impact torque data records the change of the torque applied to the tool under instantaneous impact conditions, and the original impact torque data shows the characteristics of a sudden jump or drop at a certain point in time; The original continuous torque data and the original impact torque data are preprocessed and feature extracted to obtain a continuous torque feature set and an impact torque feature set; specifically including: performing wavelet transform denoising on the original continuous torque data to obtain denoised continuous torque data, and performing median filtering on the original impact torque data to obtain filtered impact torque data; performing continuous torque outlier identification and elimination on the denoised continuous torque data to obtain continuous torque data after outlier elimination, and performing impact torque peak detection on the filtered impact torque data to obtain an impact torque peak sequence; performing continuous torque outlier identification and elimination on the denoised continuous torque data to obtain continuous torque data after outlier elimination, and performing impact torque peak detection on the filtered impact torque data to obtain an impact torque peak sequence; The torque data is standardized to obtain standardized continuous torque data, and the standardized continuous torque data is segmented by sliding windows to obtain a segmented continuous torque data sequence; the segmented continuous torque data sequence is subjected to time domain feature extraction to obtain a continuous torque time domain feature subset, and the segmented continuous torque data sequence is subjected to frequency domain feature extraction to obtain a continuous torque frequency domain feature subset; the impact torque statistical features are calculated according to the impact torque peak sequence to obtain an impact torque feature set, and the continuous torque time domain feature subset and the continuous torque frequency domain feature subset are subjected to feature fusion to obtain a continuous torque feature set; The continuous torque feature set and the impact torque feature set are input into a hierarchical time memory model based on an attention mechanism for model training to obtain a torque anomaly detection model, and the torque anomaly detection model is deployed on the torque test bench; specifically comprising: performing time series alignment on the continuous torque feature set and the impact torque feature set to obtain a first input feature sequence; inputting the first input feature sequence into a hierarchical time memory model based on an attention mechanism, the hierarchical time memory model based on an attention mechanism comprising: an input layer, a spatial pooling layer, a time memory layer, an attention layer, a prediction layer, an output layer and a feedback layer; encoding the first input feature sequence through the input layer to obtain a first encoded time series torque feature; performing spatial pooling processing on the first encoded time series torque feature through the spatial pooling layer to obtain a first sparse distribution table The method comprises the following steps: inputting the first sparse distribution representation into the time memory layer for processing to obtain a first temporal context representation; inputting the first temporal context representation into the attention layer for multi-head self-attention mechanism processing to obtain a first attention-weighted context representation; performing sequence prediction on the first attention-weighted context representation through the prediction layer to obtain a training anomaly score, and generating a training prediction result according to the training anomaly score through the output layer; calculating the prediction error of the training prediction result through the feedback layer, and performing back-propagation update on the hierarchical time memory model based on the attention mechanism to obtain updated model parameters; performing model optimization on the hierarchical time memory model based on the attention mechanism according to the updated model parameters to obtain a torque anomaly detection model, and deploying the torque anomaly detection model on the torque test bench; The real-time continuous torque data and the real-time impact torque data of the tool to be tested are obtained through the torque test bench, and the real-time continuous torque data and the real-time impact torque data are input into the torque anomaly detection model for torque anomaly detection to obtain a torque anomaly detection result; specifically comprising: obtaining the real-time continuous torque data and the real-time impact torque data of the tool to be tested through the torque test bench, and extracting and combining data features of the real-time continuous torque data and the real-time impact torque data to obtain a second input feature sequence; in the input layer of the torque anomaly detection model, time-encoding the second input feature sequence to obtain a second encoded time series torque feature; in the spatial pooling layer of the torque anomaly detection model, performing data feature extraction and feature combination on the second encoded time series torque feature; Spatial pooling is performed to obtain a second sparse distribution representation; in the time memory layer of the torque abnormality detection model, the corresponding neurons are activated for processing according to the second sparse distribution representation to obtain a second temporal context representation; in the attention layer of the torque abnormality detection model, the second temporal context representation is processed by a multi-head self-attention mechanism to obtain a second attention-weighted context representation; in the prediction layer of the torque abnormality detection model, the second attention-weighted context representation is subjected to sequence prediction to obtain a torque abnormality score; in the output layer of the torque abnormality detection model, the torque abnormality score is subjected to dynamic threshold calculation to obtain an adaptive abnormality threshold, and the torque abnormality score is compared with the adaptive abnormality threshold to obtain a torque abnormality detection result; A report is generated for the torque anomaly detection result to obtain a comprehensive torque test report, and the comprehensive torque test report is visually displayed through the torque test bench.
2. The torque testing method based on the torque testing device according to claim 1, characterized in that: In the spatial pooling layer of the torque anomaly detection model, spatially pooling the second encoded time series torque feature to obtain a second sparse distribution representation includes: In the spatial pooling layer of the torque anomaly detection model, the second encoded temporal torque feature is processed into blocks to obtain a plurality of feature sub-blocks; Calculating a local inhibition threshold according to the plurality of feature sub-blocks to obtain an inhibition threshold for each feature sub-block, and comparing a feature value in each feature sub-block with the corresponding inhibition threshold to obtain a preliminary activated neuron set; Calculating a global inhibition coefficient according to the preliminary activated neuron set to obtain a global activation threshold, and comparing neurons in the preliminary activated neuron set with the global activation threshold to obtain a final activated neuron set; Generating a sparse binary vector according to the final activated neuron set to obtain an initial sparse representation, and performing repeated pattern detection on the initial sparse representation to obtain a repeated pattern set; Compressing and encoding the initial sparse representation according to the set of repeated patterns to obtain a compressed sparse representation, and performing random projection transformation on the compressed sparse representation to obtain a high-dimensional sparse representation; A sparsity index is calculated according to the high-dimensional sparse representation, and the high-dimensional sparse representation is normalized according to the sparsity index to obtain a second sparse distributed representation.
3. The torque testing method based on the torque testing device according to claim 1, characterized in that: In the time memory layer of the torque anomaly detection model, activating corresponding neurons for processing according to the second sparse distributed representation to obtain a second temporal context representation includes: Performing time series segmentation on the second sparse distribution representation to obtain a plurality of time window sequences, and constructing an initial time memory unit set according to the plurality of time window sequences; Initializing the synaptic connection strength of the initial time memory unit set to obtain a weighted time memory unit set, and calculating the activation probability of each time memory unit according to the weighted time memory unit set to obtain an activation probability distribution; Processing the activation probability distribution using a dynamic threshold mechanism to obtain a set of activated neurons at the current moment, and updating an internal state of a time memory unit according to the set of activated neurons at the current moment to obtain an updated state of the time memory unit; Performing time sequence pattern matching on the updated time memory unit state to obtain a matching score sequence, and generating a predicted neuron set according to the matching score sequence to obtain a predicted activation pattern at the next moment; The predicted activation pattern at the next moment is compared with the actual activation pattern to obtain a prediction error, and the synaptic connection strength of the temporal memory unit is adjusted according to the prediction error to generate a second temporal context representation.
4. The torque testing method based on the torque testing device according to claim 1, characterized in that: In the attention layer of the torque anomaly detection model, the second temporal context representation is processed by a multi-head self-attention mechanism to obtain a second attention-weighted context representation, including: Performing a linear transformation on the second temporal context representation to obtain a query matrix, a key matrix, and a value matrix; Calculating the attention score according to the query matrix and the key matrix to obtain the original attention weight, and performing softmax processing on the original attention weight to obtain the normalized attention weight; Performing a matrix multiplication operation on the normalized attention weight and the value matrix to obtain a single-head attention output, and performing multiple parallel calculations on the single-head attention output to obtain multiple independent attention head outputs; Performing a splicing operation on the outputs of the multiple independent attention heads to obtain a spliced multi-head attention feature, and performing a linear transformation on the spliced multi-head attention feature to obtain a fused attention feature; Performing a residual connection on the fused attention feature and the second temporal context representation to obtain a preliminary attention weighted representation; The preliminary attention weighted representation is layer-normalized to obtain a normalized attention weighted representation, and the normalized attention weighted representation is feed-forwarded to obtain a second attention-weighted context representation.
5. A torque testing system based on a torque testing device, characterized in that: Used to perform a torque testing method based on a torque testing device as described in any one of claims 1 to 4, the device comprising: An acquisition module, used for performing a torque test on a tool to be tested through a torque test bench, and acquiring original continuous torque data and original impact torque data of the tool to be tested; An extraction module, used for preprocessing and feature extraction of the original continuous torque data and the original impact torque data to obtain a continuous torque feature set and an impact torque feature set; A training module, used for inputting the continuous torque feature set and the impact torque feature set into a hierarchical time memory model based on an attention mechanism for model training, obtaining a torque anomaly detection model, and deploying the torque anomaly detection model on the torque test bench; A detection module, used for acquiring real-time continuous torque data and real-time impact torque data of the tool to be tested through the torque test bench, and inputting the real-time continuous torque data and the real-time impact torque data into the torque anomaly detection model to perform torque anomaly detection, and obtain a torque anomaly detection result; A generating module is used to generate a report on the torque anomaly detection result to obtain a comprehensive torque test report, and to visually display the comprehensive torque test report through the torque test bench.
6. A torque testing device based on a torque testing device, characterized in that: The torque testing device based on the torque testing device comprises: a memory and at least one processor, wherein the memory stores instructions; The at least one processor calls the instructions in the memory to enable the torsion testing device based on the torsion testing device to execute the torsion testing method based on the torsion testing device as described in any one of claims 1-4.
7. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by the processor, the torque testing method based on the torque testing device as described in any one of claims 1 to 4 is implemented.
