Control chart anomaly identification method and system based on time sequence equal-length CNN and customized transformer
Patent Information
- Application Number
- CN202610912831.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-24
- Publication Date
- 2026-09-25
AI Technical Summary
[0008]本发明的目的在于提供一种基于时序等长CNN与定制Transformer的控制图异常识别方法、系统、电子设备及计算机可读存储介质,旨在解决现有技术中存在的以下技术问题:
[0041]1、本发明通过独创的“等长不降维”多尺度CNN结构,彻底解决了传统下采样导致的特征湮没问题,实现了微弱瞬态异常时间戳的精准锁定。克服了通用模型盲目池化降维的技术偏见,本发明采用步长为1的并行卷积,在提取多尺度局部特征的同时强制保持序列长度不变。这使得模型既能敏锐捕捉刀具微小崩刃等极短时突变异常,又能与后续的Transformer无缝衔接,在保证单一模式识别率的同时,将复杂混合异常模式的分类准确率提升至98.5%以上。
Smart Images

Figure CN122818110A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of industrial internet, artificial intelligence, and intelligent manufacturing technology, and particularly relates to a data mining and analysis technique for one-dimensional high-frequency time series data in digital manufacturing workshops. Specifically, this invention relates to a control chart anomaly identification method, system, electronic device, and computer-readable storage medium adapted to an edge-cloud collaborative architecture, based on time-series equal-length CNN and a customized Transformer. Background Technology
[0002] With the rapid development of Industry 4.0 and smart manufacturing, massive amounts of sensor monitoring data are generated in digital workshops. Statistical Process Control (SPC), as a core tool for quality management, monitors the stability of the production process through control charts, promptly identifying potential abnormal fluctuations. Common control chart anomaly patterns include shift, trend, cyclic, and systematic patterns, which often indicate tool wear, equipment failure, or raw material defects.
[0003] However, existing control chart anomaly identification methods and the direct application of deep learning models from the general vision domain face the following insurmountable technical bottlenecks in practical industrial applications:
[0004] (1) General dimensionality reduction mechanisms lead to the annihilation of transient features and make it difficult to take into account long-distance dependencies. When processing time-series signals, traditional convolutional neural networks (CNNs) often use the pooling downsampling design from the field of vision to reduce dimensionality. However, sudden anomalies in industrial control charts (such as minor chipping of tools) are extremely sensitive to timestamps. Dimensionality reduction operations will completely destroy the absolute time steps of the signal, causing high-frequency transient anomalies within a few milliseconds to be directly annihilated. In addition, traditional CNNs are limited by their receptive field and tend to ignore slowly evolving trend-like long-distance anomalies; while recurrent neural networks (RNNs / LSTMs) not only suffer from gradient vanishing when faced with ultra-long sequences, but also suffer from low efficiency in serial computation.
[0005] (2) The general position encoding is disconnected from the physical entity, and the full sequence flattening makes edge deployment difficult. Although the existing Transformer model performs well in global modeling, its pure mathematical position encoding (based on fixed constants) cannot match the actual physical operating cycle of the machine tool, and is very likely to misjudge normal "processing cycle fluctuations" as "periodic anomalies". More critically, the general model often uses full sequence flattening to connect fully connected layers when classifying output, resulting in an explosive growth in the number of model parameters. This makes it impossible for workshop edge devices (such as industrial control computers and embedded gateways) with extremely limited computing power to handle, making it difficult to achieve millisecond-level real-time online anomaly detection.
[0006] (3) Poor noise immunity and extreme class imbalance under complex working conditions. The actual industrial production environment is extremely complex. The one-dimensional time series data collected by sensors is often accompanied by strong electromagnetic and mechanical coupling noise interference, which can easily lead to the masking of complex abnormal patterns such as periodicity. At the same time, in actual production, there are far more normal samples than abnormal samples, resulting in extreme class imbalance (data imbalance). This can cause traditional model training to fall into the "majority class trap", thus causing frequent missed detections of scarce and critical small abnormal patterns.
[0007] Therefore, how to eliminate the structural redundancy of general large models and design a control chart anomaly identification method that can maintain the same time sequence length to prevent annihilation, integrate physical operating condition cycles, and has extreme lightweight and high robustness is a technical problem that urgently needs to be solved in the field of industrial intelligence. Summary of the Invention
[0008] The purpose of this invention is to provide a method, system, electronic device, and computer-readable storage medium for control graph anomaly identification based on time-series equal-length CNN and a custom Transformer, aiming to solve the following technical problems existing in the prior art:
[0009] (1) In view of the problem that the downsampling mechanism of general vision model leads to the annihilation of transient features and that a single model is difficult to take into account both local and global features, this invention aims to propose a serial architecture of equal-length non-dimensionality-reduced multi-scale CNN and Transformer with a step size of 1. This not only overcomes the problem of timestamp loss caused by traditional pooling downsampling, but also accurately locks the absolute time position of weak transient anomalies. At the same time, it combines the self-attention mechanism to extract global long-distance trend features, thus solving the technical problem that existing networks cannot take into account both local mutations and long-distance dependencies.
[0010] (2) In response to the problem of parameter explosion caused by full sequence flattening and the difficulty of deploying large models at the industrial edge, this invention aims to propose an edge-cloud collaborative computing architecture that completely decouples offline parameter optimization from online real-time inference. More importantly, by extracting only a single class token that absorbs global sequence features at the classification output end for pooling and dimensionality reduction, the redundancy of tens of millions of parameters brought by traditional sequence flattening is completely eliminated, thereby meeting the real-time online detection requirements of edge gateways with limited computing power in workshops under millisecond-level latency.
[0011] (3) To address the problems of misjudgment of physical period due to pure mathematical position coding, and high false negative rates caused by strong noise and extreme class imbalance, this invention aims not only to solve the problems of strong electromagnetic interference and the "majority class trap" of samples by combining wavelet threshold denoising and SMOTE algorithm with the focal loss function, but more importantly, to abandon the general mathematical position coding and innovatively incorporate the physical reference period of the equipment ( Using this as the base to construct customized location codes, the model can accurately distinguish between normal physical operating cycles and true periodic anomalies from the underlying logic, comprehensively improving its robustness and effective detection rate in harsh industrial environments.
[0012] To achieve the above objectives, the present invention provides the following technical solution: a control graph anomaly recognition method based on time-series equal-length CNN and a customized Transformer, comprising the following online inference steps:
[0013] Step S1: Acquire one-dimensional time-series signals collected in real time by sensors in the digital manufacturing workshop, and perform online data preprocessing. The online data preprocessing includes noise reduction and normalization processing to obtain a sequence with a length of [missing information]. Real-time standardized sequence data;
[0014] Step S2: Input the real-time standardized sequence data into a pre-trained lightweight multi-scale convolutional neural network module to extract local spatiotemporal feature maps of the data; the convolutional neural network module adopts a one-dimensional parallel convolutional structure with a stride of 1 and equal-length padding to force the time series length of the output local spatiotemporal feature maps to be maintained. This remains unchanged to avoid the loss of high-frequency transient timestamp information caused by downsampling;
[0015] Step S3: Input the local spatiotemporal feature map into the feature embedding layer, map the dimensions through linear projection, and concatenate a learnable class token at the beginning of the sequence; simultaneously, extract the baseline period corresponding to the current physical operating condition of the manufacturing workshop equipment. A customized sinusoidal position code is constructed and embedded into the feature sequence to generate a feature sequence vector with long and short time series and device cycle information; the base of the formula for the customized sinusoidal position code is the reference period. This is used to enable the model to distinguish between normal operating condition periodic fluctuations and periodic abnormal patterns.
[0016] Step S4: Input the feature sequence vector into the pre-trained Transformer encoder module to extract the global long-distance dependency features of the data through a multi-head self-attention mechanism;
[0017] Step S5: Extract only the feature vector corresponding to the category label position in the global long-distance dependency features, reduce the dimensionality of the single vector based on the global average pooling layer, and output the abnormal pattern classification result of the control graph through the classifier, thereby eliminating the parameter redundancy caused by the flattening of the whole sequence.
[0018] The pre-trained model parameters are obtained by acquiring historical data during the offline training phase, performing class balancing, and optimizing parameters based on the focus loss function.
[0019] Preferably, the lightweight multi-scale convolutional neural network module in step S2 is specifically configured as follows: it employs three parallel feature extraction branches, each configured with a size of [size missing]. , , One-dimensional convolutional kernels are used; each branch convolutional layer uses depthwise separable convolution to extract features, and the number of output channels of each branch is set to a preset dimension, and the layers are concatenated along the channel dimension. Convolutional mapping dimension; a residual connection structure is set between the branch convolutional layers to directly superimpose the real-time standardized sequence data onto the output to obtain the local spatiotemporal feature map.
[0020] Preferably, the specific mathematical model for constructing the customized sinusoidal position code in step S3 is as follows:
[0021]
[0022]
[0023] in, For time step index, Indexed by feature dimensions, is the dimension of the Transformer hidden layer; the generated customized sinusoidal positional encoding is added element-wise to the feature sequence.
[0024] Preferably, the online data preprocessing in step S1 specifically includes: using a wavelet thresholding denoising algorithm to perform discrete wavelet decomposition on the one-dimensional time series signal and removing high-frequency electromagnetic and mechanical coupling noise interference based on the soft thresholding rule; calling the global mean and standard deviation saved in the offline training stage, and using the Z-score normalization method to map the processed data to a standard normal distribution.
[0025] The second technical solution is to provide an offline training method for a control chart anomaly recognition model, used to generate the pre-trained model described in the first technical solution, including the following steps:
[0026] Historical one-dimensional time series data is acquired, and after denoising using wavelet thresholding algorithm, minority class oversampling technology is used to generate minority class abnormal samples to balance the ratio of normal samples to abnormal samples. Global normalization is then performed to obtain an offline standardized dataset.
[0027] The offline standardized dataset is input into the initial network model. The forward propagation structure of the initial network model is strictly consistent with the online inference steps S2 to S5 in the first technical solution, including the initialization of category labels and forward propagation calculation.
[0028] The classification error is calculated using a focal loss function, which incorporates dynamic modulation coefficients. To dynamically reduce the weight of easily distinguishable samples and increase the penalty weight of difficult-to-distinguish weakly anomalous samples, among which... To predict probabilities, As a regulating factor;
[0029] The network weights are fixed by backpropagating the optimizer to update the model parameters until convergence.
[0030] The third technical solution adopted is to provide a control graph anomaly recognition system based on time-series equal-length CNN and a customized Transformer, which adopts an edge-cloud collaborative architecture, including cloud servers and edge computing devices:
[0031] The cloud server is used to execute the offline training method described in the second technical solution, and to send the lightweight model parameters and preprocessed mean and standard deviation, which are solidified after optimization and convergence, to the edge computing device.
[0032] The edge computing device is used to execute the online inference steps described in the first technical solution, specifically including:
[0033] The online data preprocessing module is used to acquire real-time signals and obtain data of length based on the sent mean and standard deviation. Real-time standardized sequence data;
[0034] The local feature extraction module is used to extract local spatiotemporal feature maps through forced equal-length one-dimensional depthwise separable parallel convolutions;
[0035] The feature embedding module is used to concatenate category labels at the beginning of the feature sequence and fuse the device baseline period. The generated customized sine position code;
[0036] The global feature extraction module is used to extract global long-distance dependency features through a multi-head self-attention mechanism;
[0037] The classification output module is used to extract feature vectors only from the category marker locations, reduce the dimensionality based on the global average pooling layer, and output the classification results of the abnormal patterns in the control graph.
[0038] The fourth technical solution is to provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of either the first technical solution (online inference method) or the second technical solution (offline training method) described above.
[0039] The fifth technical solution is to provide a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of either the first technical solution (online inference method) or the second technical solution (offline training method) described above.
[0040] Compared with the prior art, the beneficial effects of the present invention are:
[0041] 1. This invention, through its unique "equal-length, non-dimensionality-reduction" multi-scale CNN structure, completely solves the feature annihilation problem caused by traditional downsampling, achieving precise locking of weak transient anomaly timestamps. Overcoming the technical bias of blind pooling dimensionality reduction in general models, this invention employs parallel convolutions with a stride of 1, forcibly maintaining the sequence length while extracting multi-scale local features. This allows the model to not only keenly capture extremely short-term abrupt anomalies such as minor chipping of a tool, but also seamlessly connect with subsequent Transformers, improving the classification accuracy of complex mixed anomaly patterns to over 98.5% while ensuring the recognition rate of single patterns.
[0042] 2. Through an innovative design of "dimensionality reduction by extracting only class tokens" and an edge-cloud collaborative architecture, extreme lightweighting is achieved, breaking down the computing power barrier for deployment at the industrial edge. Unlike traditional models that perform full sequence flattening or complex 2D spatial reconstruction at the classification stage, this invention cleverly utilizes a self-attention mechanism to aggregate global long-distance dependencies using the Class Token at the beginning of the sequence, and then extracts only this single vector to directly reduce dimensionality through a pooling layer. This structural reorganization completely eliminates the redundancy of tens of millions of parameters brought by fully connected layers, compressing the model parameter size by nearly 80% (down to approximately 1.5MB) with almost no loss of accuracy. This allows the model to be smoothly deployed in computing-constrained workshop gateways, with a single-sample inference latency of less than 15ms.
[0043] 3. By integrating the "physical reference cycle" The customized position coding and wavelet threshold denoising of this invention bridge the gap between pure mathematical models and physical entities, significantly enhancing the model's robustness under strong noise. This invention abandons the common mathematical absolute position or spatial coordinate coding, instead reconstructing the base of the sinusoidal position coding based on the actual physical rhythm of the equipment's operation. This imbues the model with industrial-grade common sense, enabling it to clearly distinguish between "normal equipment periodic fluctuations" and "true periodic abnormal signals" from the underlying logic. Combined with pre-processed wavelet high-frequency noise reduction, it maintains an effective recognition rate of over 92% even in harsh electromagnetic noise environments with a signal-to-noise ratio as low as 10dB.
[0044] 4. By employing SMOTE in conjunction with Focal Loss for edge-cloud collaborative offline training, the problem of missed detections due to extreme imbalance in industrial samples is effectively addressed from both data and algorithmic perspectives. During offline training, oversampling balances the distribution of historical data, while Focal Loss forces the model to dynamically increase its focus on "difficult-to-distinguish minority class samples," significantly reducing the missed detection rate of scarce and critical anomalies such as subtle trend anomalies during online real-time inference, thus comprehensively ensuring the production quality and safety of the digital workshop. Attached Figure Description
[0045] Figure 1 This is a schematic diagram of the overall process of a control graph anomaly recognition method based on temporally equal-length CNN and customized Transformer provided by an embodiment of the present invention;
[0046] Figure 2 This is a module logic block diagram of the control graph anomaly recognition system based on an edge-cloud collaborative architecture provided in this embodiment of the invention;
[0047] Figure 3 This is the network data flow and topology diagram of the customized CNN-Transformer serial cascaded architecture in this embodiment of the invention;
[0048] Figure 4 This is a schematic diagram of the internal structure of the time-equal-length lightweight multi-scale convolutional neural network module in an embodiment of the present invention;
[0049] Figure 5 This is a hardware structure block diagram of the electronic device provided in the embodiments of the present invention. Detailed Implementation
[0050] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0051] Example 1: A Control Graph Anomaly Detection Method Based on Temporally Equal-Length CNN and Custom Transformer
[0052] like Figure 1 and Figure 3 As shown, this embodiment provides a control graph anomaly identification method based on time-series equal-length CNN and a customized Transformer. To adapt to the objective reality in practical industrial applications that "cloud computing power is strong but latency is high, while edge computing power is weak but real-time requirements are needed," the method in this embodiment is strictly divided into "first stage: offline model training" and "second stage: online real-time inference."
[0053] Phase 1: Offline model training phase (deployed on cloud servers or local high-performance computing nodes)
[0054] (1) Offline preprocessing and class balancing of historical data
[0055] Specifically, we acquire a one-dimensional time-series dataset of vibration sensors from CNC machine tool spindles accumulated throughout the workshop's history (sampling frequency of 1000Hz). , where is a time series, For the corresponding category label. This is divided into three sub-steps:
[0056] ① Noise Reduction: A wavelet denoising algorithm with a soft threshold function is adopted. The db4 wavelet basis function is selected to perform a 3-level discrete wavelet decomposition on the original signal. The high-frequency coefficients are shrunk using the soft threshold rule, and the signal is reconstructed to filter out high-frequency electromagnetic noise in the workshop environment.
[0057] ② Class balancing: In actual production, the ratio of normal samples to various abnormal samples (such as trend anomalies caused by tool wear) is usually as high as 100:1. This embodiment uses SMOTE (Synthetic Minority Oversampling) to perform class balancing.
[0058] For a certain sample in the minority class sample set In its feature space, the K-nearest neighbor algorithm (with K=5) is used to find the nearest neighbor samples. New samples are synthesized by random interpolation along the line connecting these two points. Its mathematical expression is:
[0059]
[0060] in, for Uniformly distributed random numbers within the interval. Oversampling is performed to ensure that the ratio of normal samples to abnormal samples reaches 1:1.
[0061] ③ Normalization: The Z-score standardization method is used, through the formula...
[0062]
[0063] Map the data to a balanced and standardized dataset with a mean of 0 and a variance of 1. ,in To train the system, the global mean of historical data is used. The standard deviation is denoted as .
[0064] (2) Joint parameter optimization based on focus loss function
[0065] Dataset The initial input consists of a lightweight, multi-scale, temporally equal-length CNN and a custom Transformer cascade network. The forward propagation structure of the cascade network is strictly consistent with the subsequent online inference steps (S2 to S5), namely, initializing and concatenating learnable class tokens to collect global features during the feature embedding stage, and fusing customized positional encodings based on physical cycles. The forward propagation outputs the predicted probability. Then, the classification error loss is calculated using the Focal Loss function. To address the issue of easily separable samples dominating the gradient in traditional cross-entropy loss, a modulation coefficient is introduced. Its formula is:
[0066]
[0067] In this embodiment, a category balance factor is set. Difficulty of sample adjustment factor When a sample is misclassified and When the value is extremely small, the modulation coefficient tends to 1, and the loss is almost negligible; when When the modulation coefficient approaches 1 (easily separable samples), it approaches 0, dynamically increasing the penalty weight for difficult-to-separate weak anomaly samples. The network parameters are updated through backpropagation using the Adam optimizer until convergence, and finally, the optimal network weight matrix containing the fixed weights is extracted and saved. (The total number of parameters in the model is compressed to approximately 1.5MB).
[0068] Phase Two: Online Real-Time Inference Phase (Deployed on Edge Computing Devices in the Workshop)
[0069] During the factory production process, edge computing devices (such as ARM-based industrial gateways or Nvidia Jetson Nano) load pre-trained models. and parameters And execute the following steps S1 to S5 at high speed:
[0070] Step S1: Acquire one-dimensional time series data collected in real time by sensors in the digital manufacturing workshop, and perform online data preprocessing to obtain real-time standardized sequence data 10 with a sequence length of L.
[0071] For the raw signals of the sliding window acquired in real time (dimension is) At this stage, the time-consuming class balancing process is no longer performed. High-frequency wavelet coefficients are obtained through three-level discrete wavelet decomposition using the db4 wavelet basis function. Denoising is performed using soft thresholding rules, by setting threshold parameters. The noise reduction formula is:
[0072]
[0073] The denoised sequence is obtained by inverse wavelet transform. Then call the offline phase. and Perform Z-score normalization quickly:
[0074]
[0075] Output real-time standardized sequence data (10).
[0076] Step S2: Input the real-time standardized sequence data 10 into the pre-trained lightweight multi-scale convolutional neural network module 20 to extract the local spatiotemporal feature map 21 of the data; the convolutional neural network module 20 adopts a one-dimensional parallel convolutional structure with a stride of 1 and equal-length padding, and forces the time series length of the output local spatiotemporal feature map 21 to remain unchanged at L, so as to avoid the loss of high-frequency transient abnormal timestamp information caused by downsampling.
[0077] Traditional visual CNNs are prone to burying transient features of one-dimensional temporal signals due to pooling operations. For example... Figure 4 As shown, the lightweight multi-scale convolutional neural network module 20 in this embodiment employs three parallel feature extraction branches, each configured with a size of [size missing]. The system uses a one-dimensional convolutional kernel, with a strictly set stride of 1 for each branch convolution, and employs equal-length padding (Padding='same') to ensure the sequence length. Unchanged. Each branch employs depthwise separable convolution, with the number of output channels set to 16 for each branch to significantly reduce the number of parameters. The computational expression for each branch is as follows:
[0078]
[0079] Output three feature branches .
[0080] Then, feature concatenation is performed along the channel dimension: .
[0081] pass Convolution maps dimensions and introduces residual connections to prevent gradient vanishing:
[0082]
[0083] The final output dimension is Local spatiotemporal feature map (twenty one).
[0084] Step S3: Input the local spatiotemporal feature map 21 into the feature embedding layer 30, and concatenate a learnable class token at the beginning of the sequence by mapping the dimension through linear projection; at the same time, extract the reference period T corresponding to the current physical operating condition of the equipment in the manufacturing workshop, thereby constructing a customized sinusoidal position code and embedding it into the feature sequence to generate a feature sequence vector 31 with long and short time series and equipment cycle information.
[0085] Specifically, utilizing Convolutional or fully connected layers will convert feature maps Linear mapping to Transformer hidden layer dimensions :
[0086]
[0087] Subsequently, a learnable class token with a dimension of 128 is appended to the beginning of the mapped feature sequence. This category is labeled as the weight vector initialized internally by the model. In the subsequent Transformer self-attention mechanism, it is used to interact with features from all time steps globally to absorb and aggregate the global contextual features of the entire time-series signal, serving as a dedicated global feature container; thus obtaining... .
[0088] Considering the strict physical periodicity of machine tool spindle rotation and workpiece machining, this embodiment abandons the traditional purely mathematical absolute position coding. Instead, it generates a customized sinusoidal position coding matrix based on the current physical conditions of the equipment (e.g., the reference period T corresponding to the spindle speed). The specific formula is as follows:
[0089]
[0090]
[0091] in, For time step index, This is the feature dimension index. It is then added to the feature and embedded: Output feature sequence vectors containing both long and short time-series information. (31) not only includes the local mutation features extracted by CNN, but also deeply binds the physical working condition period information, enabling the model to effectively distinguish between normal periodic fluctuations and periodic abnormal patterns.
[0092] Step S4: Input the feature sequence vector 31 into the pre-trained Transformer encoder module 40, and extract the global long-distance dependency features 41 of the data through the multi-head self-attention mechanism.
[0093] The Transformer encoder module 40 in this embodiment includes The encoder layers are stacked. The core of each encoder layer is a multi-head self-attention mechanism. This embodiment sets the number of attention heads. Each head dimension The single-head self-attention mechanism calculates scaled dot-product attention by computing the query, key, and value vectors corresponding to any two time steps in the sequence, and globally computes feature-dependent weights. :
[0094]
[0095] This allows the model to span an extremely long distance of 1025 time steps, accurately capturing extremely slow systematic degradation or long-range trend anomalies. After multi-head concatenation, network forward pass and LayerNorm (LN) residual updates are performed.
[0096]
[0097]
[0098] The final output is a global long-range dependent feature sequence with the dimension remaining unchanged. (41).
[0099] Step S5: Extract only the feature vector corresponding to the category label position in the global long-distance dependency feature 41, reduce the dimensionality of the single vector based on the global average pooling layer, and output the abnormal pattern classification result 50 of the control graph through the classifier, thereby eliminating the parameter redundancy caused by the flattening of the whole sequence.
[0100] To eliminate the millions of redundant parameters introduced by the flattening operation of fully connected layers in traditional visual models, this step directly extracts... The Class Token feature vector at index 0 has, after passing through multiple layers of self-attention mechanisms, fully aggregated the global feature information of the entire 1024-length sequence. This operation is equivalent to a simplified global pooling dimensionality reduction in a specific dimension.
[0101]
[0102] The dimensionality-reduced features are directly passed through a fixed Softmax classifier (using offline weights). With bias Calculate the probability distribution:
[0103]
[0104] The output corresponds to the probability distribution P of 6 control chart modes (normal, step-like offset, trend-like offset, periodic fluctuation, systematic anomaly, and mixed mode).
[0105] If the classifier outputs a non-"normal" category as the highest probability category, the edge device will immediately trigger an abnormal alarm signal in the workshop within a millisecond delay.
[0106] Example 2: A Control Graph Anomaly Detection System Based on Temporal Equal-Length CNN and Customized Transformer, and its Edge-Cloud Collaborative Application
[0107] like Figure 2 and Figure 5 As shown, this embodiment also provides a system that is deployed using an edge-cloud collaborative architecture:
[0108] (1) Cloud server: Includes massive storage and high-performance GPU cluster. Used to receive historical large-scale data gathered from various workshops. Run the model training process in Example 1 in the cloud, and use powerful computing power to perform hyperparameter optimization and Focal Loss model iteration. After training convergence, the extracted lightweight parameters (parameter size less than 1.5MB) and the preprocessed global mean and standard deviation obtained offline are packaged and distributed as offline model files.
[0109] (2) Edge computing nodes (i.e., execution entities): deployed on the workshop production line. Their internal operation includes:
[0110] The online data preprocessing module 100 executes the logic of step S1 above, performs online wavelet denoising on the real-time signal, and calls the mean and standard deviation sent from the cloud to complete Z-score normalization;
[0111] The local feature extraction module 200 executes the logic of the above S2 step, and extracts local spatiotemporal feature maps that retain accurate timestamps by forcing equal-length and non-dimensionality-reduced multi-scale depth separable parallel convolutions.
[0112] The feature embedding module 300 executes the logic of the above S3 step, completes linear projection, splices a class token at the beginning of the sequence, and generates a customized sinusoidal position code that incorporates the device physical reference period T.
[0113] The global feature extraction module 400 executes the multi-head self-attention mechanism derivation logic of the above S4 step to extract global features across long distances;
[0114] The classification output module 500 executes the logic of step S5 above, extracting only the class token vector that absorbs global features, performing minimal dimensionality reduction based on the global average pooling layer, and outputting the classification result through Softmax logic.
[0115] Edge nodes collect machine tool PLC data in real time via the OPC-UA protocol, call the lightweight model distributed from the cloud to execute the S1-S5 inference process described in Example 1, directly output the abnormal mode classification results on site and link the production line to emergency stop or audible and visual alarms, achieving a perfect combination of global vision in the cloud and low latency at the edge.
[0116] All or part of the steps in the methods of the above embodiments are implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it includes the steps of the methods described in the embodiments. The storage medium includes ROM / RAM, magnetic disks, optical disks, etc.
[0117] Example 3: Model Comparison Experiment and Effect Verification
[0118] To further verify the technical advantages and significant progress of the "control graph anomaly identification method based on time-series equal-length CNN and customized Transformer" in a real industrial environment, this embodiment provides a set of comparative experiments.
[0119] The experiment used a real tool spindle vibration dataset collected in a CNC workshop, which contained a large amount of strong background noise and severely unbalanced samples with a ratio of 100:1 (a large number of normal samples and a very small number of tool micro-chipping transient anomalies and weak wear trend anomalies).
[0120] (1) Ablation experiment for “equal length non-dimensionality reduction CNN” (to verify the ability to capture transient anomalies)
[0121] Set up a control group model A (which uses a pooling downsampling strategy of general visual CNN to gradually reduce the sequence length from 1024 to 64) and this model (which uses convolution with stride of 1 and padding of the same length).
[0122] Experimental results show that the control group model A, due to the loss of timestamp information caused by downsampling, had a false negative rate of up to 43% for transient step anomalies such as "minor chipping of the cutting tool" that lasts only a few milliseconds; while the model, due to the forced maintenance of equal time length, achieved a transient anomaly detection rate of 98.7%, completely overcoming the feature annihilation problem caused by the general dimensionality reduction mechanism.
[0123] (2) Ablation experiment for “customized physical period position coding” (to verify robustness under complex working conditions)
[0124] A control group model B (using the standard pure mathematical absolute position encoding of the general Transformer) and this model (fusion equipment baseline operating cycle) were set up. (sine position encoding).
[0125] Experimental results show that under the periodic vibration conditions of normal machine tool processing, the control group model B is highly prone to misjudging normal physical periodic fluctuations as "periodic abnormal patterns," with a false positive rate (false alarm rate) reaching 18%. In contrast, this model, by injecting physical entity cycles into its self-attention mechanism, demonstrates a different approach. Based on common sense, the false alarm rate was reduced to 1.2%, significantly improving the model's accuracy in complex implementation conditions.
[0126] (3) Performance verification of edge deployment for "only extracting Class Token for dimensionality reduction":
[0127] Set up a control group model C (using traditional full-sequence Flatten flattening and connecting the output of the fully connected layer at the Transformer output).
[0128] Experimental results show that the control group model C has as many as 25MB of parameters, and its single inference time exceeds 120ms in an ARM-based industrial edge gateway, which cannot meet the real-time control requirements of the production line. In contrast, this new model, by extracting only a single Class Token from the header and performing global average pooling (GAP) dimensionality reduction, completely eliminates the parameters of the fully connected layer, compressing the overall parameter size to 1.5MB. Under the same edge hardware, the single-sample inference latency is only 12ms, perfectly achieving millisecond-level real-time online detection on edge devices with limited computing power.
[0129] The experimental data in summary confirms that the dedicated network structure reconstruction of the present invention not only overcomes the technical bias of cross-domain application of general large models, but also achieves technical effects that are significantly better than those of the prior art.
[0130] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0131] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A control graph anomaly identification method based on time-series equal-length CNN and a customized Transformer, characterized in that: Includes the following online reasoning steps: Step 1: Acquire one-dimensional time series signals collected in real time by sensors in the digital manufacturing workshop, and perform online data preprocessing. The online data preprocessing includes noise reduction processing and normalization processing to obtain real-time standardized sequence data (10) with a sequence length of L. Step 2: Input the real-time standardized sequence data (10) into the pre-trained lightweight multi-scale convolutional neural network module (20) to extract the local spatiotemporal feature map (21) of the data; the convolutional neural network module (20) adopts a one-dimensional parallel convolutional structure with a stride of 1 and equal length padding, and forces the time series length of the output local spatiotemporal feature map (21) to remain unchanged at L, so as to avoid the loss of high-frequency transient abnormal timestamp information caused by downsampling; Step 3: Input the local spatiotemporal feature map (21) into the feature embedding layer (30), and concatenate a learnable class token at the beginning of the sequence by linear projection mapping the dimension; at the same time, extract the reference period T corresponding to the current physical operating condition of the equipment in the manufacturing workshop, and construct a customized sinusoidal position code and embed it into the feature sequence to generate a feature sequence vector (31) with long and short time series and equipment cycle information; the base of the formula of the customized sinusoidal position code is the reference period T, which is used to enable the model to distinguish between normal operating condition cycle fluctuations and periodic abnormal patterns; Step 4: Input the feature sequence vector (31) into the pre-trained Transformer encoder module (40) and extract the global long-distance dependency features (41) of the data through the multi-head self-attention mechanism. Step 5: Extract only the feature vector corresponding to the category label position in the global long-distance dependency feature (41), reduce the dimensionality of the single vector based on the global average pooling layer, and output the control graph abnormal pattern classification result (50) through the classifier to eliminate the parameter redundancy caused by the flattening of the whole sequence; The pre-trained model parameters are obtained by acquiring historical data during the offline training phase, performing class balancing, and optimizing parameters based on the focus loss function.
2. The method according to claim 1, characterized in that, The lightweight multi-scale convolutional neural network module (20) in step two is specifically configured as follows: Three parallel feature extraction branches are used, each configured with a one-dimensional convolutional kernel of size 1×3, 1×5, and 1×7 respectively; Each branch convolutional layer uses depthwise separable convolution to extract features. The number of output channels of each branch is set to a preset dimension, and the dimension is mapped by 1×1 convolution after concatenation along the channel dimension. A residual connection structure is set between the branch convolutional layers, and the real-time standardized sequence data (10) is directly superimposed on the output to obtain the local spatiotemporal feature map (21).
3. The method according to claim 1, characterized in that, The specific mathematical model for constructing the customized sinusoidal position code in step three is as follows: ; ; in, For time step index, Indexed by feature dimensions, is the dimension of the Transformer hidden layer; the generated customized sinusoidal positional encoding is added element-wise to the feature sequence.
4. The method according to claim 1, characterized in that, The online data preprocessing in step one specifically includes: The wavelet thresholding denoising algorithm is used to perform discrete wavelet decomposition on the one-dimensional time series signal and remove high-frequency electromagnetic and mechanical coupling noise interference based on the soft thresholding rule; The global mean and standard deviation saved during the offline training phase are retrieved, and the processed data is mapped to a standard normal distribution using the Z-score standardization method.
5. An offline training method for a control chart anomaly detection model, used to generate the online inference method according to any one of claims 1 to 4, characterized in that, The pre-trained model includes the following steps: Historical one-dimensional time series data is acquired, and after denoising using wavelet thresholding algorithm, minority class oversampling technology is used to generate minority class abnormal samples to balance the ratio of normal samples to abnormal samples. Global normalization is then performed to obtain an offline standardized dataset. The offline standardized dataset is input into the initial network model, and the forward propagation structure of the initial network model is strictly consistent with the online inference steps two to five described in claim 1, including the initialization of category labels and forward propagation calculation; The classification error is calculated using the Focal Loss function, which incorporates dynamic modulation coefficients. To dynamically reduce the weight of easily distinguishable samples and increase the penalty weight of difficult-to-distinguish weakly anomalous samples, among which... To predict probabilities, As a regulating factor; The network weights are fixed by backpropagating the optimizer to update the model parameters until convergence.
6. A control graph anomaly recognition system based on time-series equal-length CNN and a custom Transformer, characterized in that, It adopts an edge-cloud collaborative architecture, including cloud servers and edge computing devices: The cloud server is used to execute the offline training method as described in claim 5, and to send the lightweight model parameters and preprocessed mean and standard deviation, which are solidified after optimization and convergence, to the edge computing device. The edge computing device is used to perform the online inference steps as described in any one of claims 1 to 4, specifically including: An online data preprocessing module (100) is used to acquire real-time signals and obtain real-time standardized sequence data (10) based on the sent mean and standard deviation. Local feature extraction module (200) is used to extract local spatiotemporal feature maps (21) by forced equal-length one-dimensional depthwise separable parallel convolution. Feature embedding module (300) is used to splice category tags and fuse customized sinusoidal position codes generated by the device reference period T; A global feature extraction module (400) is used to extract global long-distance dependency features (41) through a multi-head self-attention mechanism. The classification output module (500) is used to extract the feature vectors of the category marker locations for dimensionality reduction and output the control graph anomaly pattern classification results (50).
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 5.