FIR filter method based on multi-scale convolutional neural network and multi-head attention mechanism

CN122951619APending Publication Date: 2026-10-20GUANGXI NORMAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611111582.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-24
Publication Date
2026-10-20

AI Technical Summary

Technical Problem

[0010]本发明针对机械振动和冲击应力测量领域的数据特征,因其高敏感性导致获取的压力数据存在瞬态脉冲、周期性波动与噪声混杂等非平稳特性以及训练不稳定等问题,考虑到压力监测场景的高响应以及嵌入式适配等要求,提出一种基于多尺度卷积神经网络和多头注意力机制的FIR滤波器方法

Benefits of technology

[0077]1.本技术方案将FIR数字滤波器与多尺度卷积神经网络结合,针对压电晶体传感器信号存在瞬态脉冲、周期性波动与噪声混杂等非平稳特性,多尺度卷积神经网络通过设置不同的卷积核,可精准提取复杂信号的多尺度特征。在本技术方案中小尺度卷积核可提取端子受到瞬间冲击产生的压力突变,中尺度卷积核提取一个振动周期内压力信号变化的局部趋势;大尺度卷积提取信号周期性波动的整体趋势。通过多尺度特征的同步提取和融合,构建从瞬态细节、局部趋势,到全局周期的层次化特征表示,突破传统卷积神经网络特征提取单、有效信息不足、聚焦细节丢失全局,易陷入局部最优的局限;多尺度卷积神经网络还具有良好的自适应能力,可以根据实际的压力数据自动地调整和优化滤波器系数,克服对经验的依赖,减少误差。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure FT_3
    Figure FT_3
Patent Text Reader

Abstract

This invention discloses an FIR filter method based on a multi-scale convolutional neural network and a multi-head attention mechanism, comprising the following steps: Step 1: Removing outliers from piezoelectric crystal sensors; Step 2: Preprocessing pressure data; Step 3: Separating noise from valid data in the pressure data; Step 4: Designing an FIR filter; Step 5: Training the model and learning the optimal filter parameters by minimizing the prediction error; Step 6: Determining whether the number of iterations has reached a specified number or whether the loss has converged; Step 7: Implementing FIR filtering. This method has significant advantages in processing non-stationary pressure data, while meeting the requirements of high response and embedded adaptation in pressure monitoring scenarios. It features controllable implementation complexity, supports model quantization and compression, has low memory usage, and fast processing speed, meeting the requirements of embedded instrument pressure detection scenarios and achieving rapid and accurate pressure data processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to filtering optimization techniques for FIR filter methods in the field of data processing, specifically an FIR filter method based on multi-scale convolutional neural networks and multi-head attention mechanisms. Background Technology

[0002] Piezoelectric crystal sensors are widely used in the field of mechanical vibration and impact stress measurement. Based on the piezoelectric effect of crystals, piezoelectric crystal sensors can accurately convert the pressure experienced by a workpiece during processing into an electrical signal. With its high sensitivity, excellent dynamic characteristics, and wide frequency response range, it has become a core sensing device in high-precision pressure data acquisition systems. However, during the production process, the workpiece is subjected to continuous impact from external forces, mechanical vibration, and electromagnetic interference. This causes the signal output by the piezoelectric crystal sensor to exhibit significant time-domain non-stationary characteristics and spectral overlap. Mechanical impact introduces transient pulse noise, mechanical vibration easily induces low-frequency noise fluctuations, and electromagnetic interference generates high-frequency harmonic pollution. This type of noise has wide-band overlap and time-varying amplitude-frequency response characteristics. Especially in the automatic crimping production of cable terminals, the transient pulse noise and low-frequency noise generated by high-speed impact and mechanical vibration exacerbate the time-varying amplitude-frequency response characteristics and nonlinear coupling effects of the noise, severely damaging the integrity of the effective signal. This leads to significant deviations in the real-time monitoring of key crimping quality parameters, greatly increasing the risk of misjudgment when determining the quality of cable terminals.

[0003] Previously, the industry typically used traditional finite-length unit impulse response (FIR) digital filters as the primary means of noise reduction and signal extraction. Finite-length impulse response (FIR) filters are general-purpose digital filters with strict linear phase characteristics, strong anti-interference capabilities, and good stability, playing a crucial role in noise removal, selection or suppression of specific frequency components, and improving system performance. However, in the field of mechanical vibration and impact stress measurement, more stringent requirements are placed on the performance of FIR filters used to process signals acquired by piezoelectric crystal sensors: In terms of accuracy, real-time industrial quality monitoring relies on sensors to sample key parameters such as pressure, vibration, and displacement at high frequencies, and subtle changes in signal characteristics often affect product quality judgment. This requires FIR filters to possess high precision matched to high-resolution sensors. In terms of real-time performance, the high speed of industrial production necessitates that FIR filters also possess extremely low processing latency and high data throughput.

[0004] Currently, there are four main design methods for FIR digital filters. [1] : Window function method, frequency sampling method, equiripple best approximation method and machine learning-based optimization design method.

[0005] Traditional window function design methods are based on a time-domain perspective. For infinitely long impulse responses, they employ a sequence of finite-length window functions to truncate the impulse response, thus obtaining a finite-length impulse response. However, when designing digital FIR filters using the window function method, the problem of an excessively wide main lobe often arises. In scenarios requiring high signal suppression capabilities, filters designed using this method may not meet practical application requirements.

[0006] Frequency sampling design is approached from a frequency domain perspective. Its operation is relatively simple: it involves sampling a given ideal frequency response at equal intervals, and then using an inverse discrete Fourier transform to obtain the corresponding impulse response. However, this method has certain limitations. Frequency sampling can only obtain the desired frequency response at the sampling points; errors still exist at other points. While this method can control stopband attenuation, passband ripple is not easily controlled.

[0007] The equiripple approximation method is a design approach based on the best uniform approximation theory. Its goal is to minimize the maximum error between the frequency response of the actual filter and the frequency response of the ideal filter within both the passband and stopband. Filters designed using this method exhibit equiripple characteristics in both the passband and stopband, achieving good frequency responses. However, its design process is complex, requiring iterative algorithms and incurring significant computational costs.

[0008] Machine learning-based optimization design methods essentially minimize the error between the actual and ideal frequency responses of a digital filter through learning algorithms, thereby obtaining the optimal filter coefficients. (Sun) [2] Based on support vector regression, researchers designed linear-phase FIR filters, transforming the approximation problem of the filter's amplitude-frequency response into a regression optimization problem, thus achieving high-precision fitting of the ideal frequency characteristics. However, this method has certain limitations. The selection of kernel function type and parameters relies on experience or experimental tuning, lacking unified theoretical guidance, requiring repeated trial and error to balance fitting accuracy and generalization ability; solving large-scale convex quadratic programming problems has high computational complexity, especially in high-order filter design, which is significantly time-consuming and may affect real-time performance. (Yang Jiyao) [3]In digital signal processing research, mathematical models are constructed to analyze the errors of FIR filters. A BPNN model is then built, and the optimized filter coefficients are obtained by minimizing the estimation error between the actual and ideal frequency responses. Compared to traditional window functions, the BPNN optimization design method achieves smaller passband peak-to-peak values ​​and lower maximum and minimum stopband attenuation. However, it requires more runtime. In real-time monitoring in industrial engineering production, the real-time requirements for signal processing are extremely high, necessitating the processing and analysis of large amounts of data in a short time. This design, with its high computational complexity and long runtime, cannot meet the demands of rapid data processing in real-time monitoring. Sun et al. used time-audio data when testing a linear-phase FIR filter based on support vector regression, and Yang Jiyao used data generated by a simulator according to a predefined filter type when testing a BPNN-optimized FIR filter. Neither of these data possesses characteristics such as transient pulses or periodic fluctuations. Dengfeng Z et al. [4] This paper proposes a multi-scale convolutional neural network method combining BiLSTM and an attention mechanism. This method is primarily used for bearing fault diagnosis under various operating conditions. It utilizes the first and second convolutional layers of the neural network to simultaneously extract and fuse the spatiotemporal features of the bearing vibration signal, obtaining multi-scale spatiotemporal features. However, this method suffers from strong dependence on data quality and labeling, high computational complexity leading to time-consuming training, and high memory consumption due to the need to store forward and backward hidden states when using the BiLSTM bidirectional recurrent structure, making it unsuitable for embedded devices. (Jie et al.) [5] This paper proposes a parameter prediction method for a microstrip bandpass filter based on a convolutional neural network, specifically for a three-band bandpass filter. However, this algorithm struggles to remove noise generated by mechanical vibration and impact stress, as well as pressure superposition bias caused by short impact intervals, when applied to FIR filters. Furthermore, the algorithm requires a large amount of pressure data for training, but embedded devices, limited by storage and computing resources, cannot meet the data requirements of this algorithm and the high response demands of pressure monitoring scenarios, resulting in poor data processing performance and device response delays. Different machine learning algorithms exhibit varying training effects and convergence speeds in different scenarios. Therefore, it is necessary to select accurate and efficient machine learning algorithms for data processing based on the characteristics of the application scenario.

[0009] In the field of mechanical vibration and impact stress measurement, piezoelectric crystal sensors are widely used. Due to their high sensitivity, the acquired pressure data exhibits non-stationary characteristics such as transient pulses, periodic fluctuations, and noise contamination. This makes it difficult for FIR filters designed based on traditional machine learning algorithms to meet the requirements, resulting in significant shortcomings. On the one hand, traditional machine learning algorithms cannot effectively extract the features of impact stress data, leading to large prediction errors in the parameters of the designed FIR filters. The processed pressure data still carries considerable noise, failing to meet the high-precision requirements of quality inspection. On the other hand, traditional machine learning algorithms require large amounts of data for training. Embedded devices, limited by storage and computing resources, struggle to meet the data requirements of traditional machine learning algorithms and the high response requirements of pressure monitoring scenarios, resulting in poor data processing performance and device response delays. Summary of the Invention

[0010] This invention addresses the data characteristics of mechanical vibration and impact stress measurement. Due to the high sensitivity of these data, the acquired pressure data exhibits non-stationary characteristics such as transient pulses, periodic fluctuations, and noise contamination, as well as training instability. Considering the high response requirements and embedded system adaptation needs of pressure monitoring scenarios, this invention proposes an FIR filter method based on multi-scale convolutional neural networks and multi-head attention mechanisms. This method offers significant advantages in processing non-stationary pressure data while meeting the high response and embedded system adaptation requirements of pressure monitoring scenarios. It boasts controllable implementation complexity, supports model quantization and compression, consumes less memory, and accelerates processing speed, meeting the requirements of embedded instrument pressure detection scenarios and achieving fast and accurate pressure data processing.

[0011] The technical solution to achieve the objective of this invention is:

[0012] An FIR filter method based on multi-scale convolutional neural networks and multi-head attention mechanism includes the following steps:

[0013] Step 1: Piezoelectric crystal sensors are highly sensitive and generate pressure data even with slight friction or vibration. To eliminate pressure data generated by slight friction or vibration of the piezoelectric crystal sensor, an effective threshold for the pressure signal is set to remove abnormal values ​​from the piezoelectric crystal sensor.

[0014]

[0015] in To determine the upper limit of the piezoelectric crystal sensor's range, pressure data that do not exceed 10% of the upper limit and exceed 90% of the upper limit are discarded. The lower limit is set to... This is to ensure that the electrical signal generated by the pressure is strong and clear enough to reliably overcome the inherent noise of the circuit itself, and is unaffected by slight zero-point shifts; the upper limit is set to... This is to prevent amplifier saturation, maintain linearity, provide a safety margin, and avoid overload damage;

[0016] Step 2: To facilitate subsequent frequency domain feature extraction, the pressure data retained after Step 1 is normalized, that is, the pressure data is mapped to... :

[0017]

[0018] in The normalized pressure data corresponds to time n. For time window The median of internal pressure data, For time window The absolute median of internal pressure data;

[0019] Step 3: Analyze the pressure data Perform FFT transformation and design a bandpass filter to allow only pressure signals within a specific frequency range to pass through, while signals in other frequency ranges are filtered out as noise.

[0020] Step 3.1: First, collect the pressure data. Perform FFT transformation, Transform from the time domain to the frequency domain and calculate the single-sided amplitude spectrum:

[0021]

[0022] in This represents the amplitude of the single-sided amplitude spectrum at frequency index k. The number of sampling points. It is a complex exponential function. The imaginary unit, For the frequency index of the corresponding frequency domain;

[0023] Step 3.2: Based on the amplitude obtained in Step 3.1 This allows for the identification of the dominant frequency, quickly locating the main vibration frequency in the signal, i.e., the frequency of periodic pressure fluctuations; simultaneously, if it manifests as discrete peaks or broadband energy in the frequency domain, it is identified as noise, causing the amplitude to... With stress data Compared to other methods, it is easier to distinguish; the basis for determining the main frequency band is based on the characteristic frequency band identification of pressure data:

[0024] ,in For a set of frequencies, For frequency values, For frequency The corresponding amplitude;

[0025] Step 4: Design an FIR filter based on multi-scale convolutional neural networks and multi-head attention mechanism. Based on step 3, for the interference components with the same frequency as the target signal that still remain in the specific frequency range of the pressure signal that is allowed to pass in step 3, the amplitude attenuation is achieved by designing an FIR filter based on multi-scale convolutional neural networks and multi-head attention mechanism without affecting the integrity of the time-domain waveform of the target pressure signal.

[0026] Step 4.1: Window the pressure data processed in Step 3.1 to create a dataset. Determine the characteristic frequency period based on the periodic pressure fluctuation frequency identified in Step 3.2, and use it as the window length value L. L determines the key period of the signal to be covered. Divide the continuous pressure data signal into training samples of fixed length.

[0027]

[0028] in This is the window length value. For the first Pressure data values ​​collected at all times, For input number Data for each window, For the first Data windows The target output is the first The center point value of each data window;

[0029] Step 4.2: Train the optimal FIR filter coefficients using a multi-scale convolutional neural network;

[0030] Step 4.2.1: Automatically extract amplitude using the first one-dimensional convolutional layer of a multi-scale convolutional neural network. Local features;

[0031]

[0032] in This represents the dot product between the convolution kernel and a local part of the signal. Indicates the first The first in the layer The output of each neuron It is the first Layer The first neuron to the second The first in the layer The weights between neurons It is the first The first in the layer Bias of each neuron It is the first kernel size of convolutional layers It is a non-linear activation function; the ReLU function is chosen as the activation function to accelerate convergence. This represents the output value of the convolution operation;

[0033] Step 4.2.2: Use a max pooling layer to downsample the local features from step 4.2.1;

[0034]

[0035] in For the first Layer The first channel Neuron value, Indicates the width of the pooling region;

[0036] Step 4.2.3: Globally integrate the feature data obtained after extraction by the one-dimensional convolutional layer and downsampling by the max pooling layer through a fully connected layer;

[0037]

[0038] in After flattening The feature is passed to the fully connected layer. The weights of each neuron, For the fully connected layer The weights of each neuron, The total number of neurons in the fully connected layer is [number]. Flattened into a one-dimensional vector , For the flattened feature dimensions, represent The Each element corresponds to the maximum feature value of a local region after pooling;

[0039] Step 4.3: Design a channel attention mechanism to enhance the frequency band containing the dominant frequency component and suppress noise-dominated channels;

[0040] Step 4.3.1: Process the local feature encoding, i.e., the feature map, of the pressure data in Step 4.2. Considering the data characteristics in the fields of mechanical vibration and impact stress measurement, the high sensitivity of piezoelectric crystal sensors leads to transient pulses, periodic fluctuations, and noise-induced non-stationary characteristics in the acquired pressure data. Therefore, the input feature map exhibits transient pulse characteristics, periodic fluctuation characteristics, and noise-induced characteristics. Specifically, the transient pulse characteristic is characterized by frequency domain energy concentrated in the high-frequency band, while the spatial distribution shows local abrupt changes; the periodic fluctuation characteristic is characterized by the fundamental frequency of rotating machinery vibration and its harmonics; the noise-induced characteristics are characterized by Gaussian white noise, power frequency interference, and quantization noise. Using this feature map as input to the multi-head attention mechanism, the input feature map, based on the characteristics of the above-mentioned input feature map, is as follows:

[0041]

[0042] Where F is the input feature map, C is the number of channels, H is the height of the feature map in the spatial dimension, and W is the width of the feature map in the spatial dimension. The dimension space representing the feature map F is a three-dimensional matrix belonging to the real number field R;

[0043] Step 4.3.2: For To prevent the loss of transient pulse features and confusion of periodic features in traditional pooling methods during mechanical vibration signal processing, global average pooling and global max pooling are performed. Improvements are made to traditional pooling methods: First, for traditional GAP averaging of impact signals, the improved method retains key pulse components through a threshold adaptive mechanism. Second, to address the sensitivity of traditional GMP to single-point noise, the improved method introduces frequency domain weighting to suppress high-frequency noise. Finally, time-frequency joint analysis avoids distortion of periodic fluctuation features during pooling. These improvements enhance the accuracy of mechanical vibration feature extraction, making it more suitable for impact stress monitoring scenarios.

[0044]

[0045]

[0046] These are the features after global average pooling. For position The original feature value at that location, and These are the mean and standard deviation of the feature map, respectively. For adaptive threshold coefficients, The features are those obtained after global max pooling. for Related frequency information, The cutoff frequency, The inhibition coefficient;

[0047] Step 4.3.3: Generate weights through a fully connected layer. and nonlinear activation to generate channel attention weights :

[0048]

[0049] Step 4.3.4: Pixel-by-pixel multiplication to obtain the feature map :

[0050]

[0051] in For the generated channel attention weights;

[0052] Step 4.4: Design a spatial attention mechanism as a supplement to the channel attention mechanism to further refine the selection of features, highlight key signal regions such as pressure change points, and smooth noise interference regions.

[0053] Step 4.4.1: Perform spatial feature aggregation along the channel dimension. Perform average pooling and max pooling, and then concatenate the results:

[0054]

[0055] This represents the features after average pooling. Represents the features after max pooling. Indicates will and The result after stitching along the channel dimension;

[0056] Step 4.4.2: Generate weights through convolutional layers. Generate spatial attention map :

[0057]

[0058] This represents the generated spatial attention weight map;

[0059] Step 4.4.3: Pixel-by-pixel multiplication to obtain the feature map :

[0060]

[0061] Step 4.5: To prevent excessively large weight coefficients in multi-scale convolutional neural networks from causing gradient explosion or filtering distortion, and to improve processing stability, the weight coefficients are normalized:

[0062]

[0063] Indicates the first The original unnormalized weight values ​​at time 1. This represents the normalized weight coefficients;

[0064] Step 5: Train the model and learn the optimal filter parameters by minimizing the prediction error;

[0065] Mean squared error loss function:

[0066]

[0067] Indicates the number of samples;

[0068] Because a fixed learning rate may lead to slow convergence or oscillations in the processing due to the non-stationarity of the pressure data, and because the gradient distribution of noise and effective components in the pressure signal is uneven, making it prone to getting trapped in local optima and affecting the processing effect of the pressure data, the FIR filter coefficients are adjusted and the Adam optimizer is updated to minimize the filtering error.

[0069]

[0070] and These are the estimates of the first and second moments of the gradient, respectively. It is a very small number to prevent division by zero. (On the order of 1e-8 to 1e-7) It is the current iteration number. It is the learning rate of the convolutional neural network;

[0071] By updating the Adam optimizer, the step size is increased in the signal flat section and decreased in the signal abrupt section, thus accelerating convergence. At the same time, the Adam optimizer is compatible with the attention mechanism, which can speed up the speed at which the attention mechanism focuses on the main frequency band.

[0072] Step 6: Determine whether the number of iterations has reached the specified number or whether the loss has converged. That is, if the loss value has not decreased after 10 consecutive training rounds, the training ends and the subsequent steps are executed if either the number of iterations has reached the specified number or the loss has converged. Otherwise, return to step 4.2.

[0073] Step 7: Implement FIR filtering based on multi-scale convolutional neural networks and multi-head attention mechanisms to eliminate residual interference components of the same frequency within the passband without losing the amplitude and spectral characteristics of the target pressure signal.

[0074]

[0075] It is a unit impulse response. The time index representing the unit impulse response.

[0076] Compared with existing research, this technical solution has the following characteristics:

[0077] 1. This technical solution combines an FIR digital filter with a multi-scale convolutional neural network. Addressing the non-stationary characteristics of piezoelectric crystal sensor signals, such as transient pulses, periodic fluctuations, and noise interference, the multi-scale convolutional neural network, by setting different convolutional kernels, can accurately extract multi-scale features of complex signals. In this solution, small-scale convolutional kernels extract pressure surges caused by instantaneous impacts on the terminals; medium-scale convolutional kernels extract the local trend of pressure signal changes within a vibration cycle; and large-scale convolutions extract the overall trend of periodic fluctuations in the signal. Through the simultaneous extraction and fusion of multi-scale features, a hierarchical feature representation is constructed, from transient details and local trends to the global cycle. This overcomes the limitations of traditional convolutional neural networks, such as single feature extraction, insufficient effective information, loss of global information when focusing on details, and susceptibility to local optima. Furthermore, the multi-scale convolutional neural network has excellent adaptive capabilities, automatically adjusting and optimizing filter coefficients based on actual pressure data, overcoming reliance on experience and reducing errors.

[0078] 2. To address the limitations of memory resources in embedded devices and the need for extremely low processing latency in FIR filters required for high-speed industrial production, this technical solution introduces depthwise separable convolution. Depthwise separable convolution achieves lightweighting through a two-stage architecture that decouples spatial-channel coupling computation: First, depthwise convolution assigns an independent spatial convolution kernel to each input channel, extracting local spatial features in a single channel while preserving multi-scale perception capabilities; second, pointwise convolution completes cross-channel feature fusion and dimensionality adjustment. This mechanism overcomes the redundancy problem of "strong coupling between cross-channel correlation and spatial convolution" in standard convolution, reducing computational and parameter counts to a significantly lower level. Quantity, of which Input the number of channels. The convolution space size maintains the ability to represent multi-scale features while processing pressure signals more efficiently, meeting the high-speed requirements of industrial production; the reduction in the number of parameters reduces the model's memory usage, meeting the resource constraints of embedded devices.

[0079] 3. To address the issues of potentially large amounts of redundant data and diluted key features in multi-scale convolutional neural networks, this technical solution introduces a multi-head attention mechanism. The multi-head attention mechanism focuses the network on features more relevant to the task through weight allocation. Channel attention and spatial self-attention are inserted into the multi-scale convolutional neural network algorithm structure. By combining receptive fields at different scales with self-attention, the algorithm can simultaneously capture the dependence on local details (transient impulses in pressure data) and the dependence on global structure (periodicity in pressure data), improving its data processing capabilities for mechanical vibration and impact stress measurement scenarios. Introducing a multi-head attention mechanism into the multi-scale neural network enables it to more efficiently fuse cross-scale information when processing real-time pressure data, overcoming the limitations of traditional fixed structures. This combination is particularly suitable for mechanical vibration and impact stress measurement scenarios, effectively handling pressure data with non-stationary characteristics.

[0080] This method accurately extracts pressure data features, achieves rapid convergence, and has strong generalization ability, meeting the requirements of high response and embedded adaptation in pressure monitoring scenarios. The FIR filter method based on multi-scale convolutional neural networks and multi-head attention mechanisms is suitable for non-stationary, noisy pressure signal scenarios, enabling accurate and rapid pressure data processing. Attached Figure Description

[0081] Figure 1 Flowchart for an embodiment;

[0082] Figure 2 This is a diagram of the multi-scale convolutional neural network structure in the embodiment;

[0083] Figure 3 This is a schematic diagram of the attention mechanism module in the embodiment. Detailed Implementation

[0084] The present invention will be further described below with reference to the accompanying drawings and embodiments, but this is not intended to limit the scope of the invention.

[0085] Example:

[0086] Reference Figure 1 A method for creating an FIR filter based on a multi-scale convolutional neural network and a multi-head attention mechanism includes the following steps:

[0087] Step 1: Piezoelectric crystal sensors are highly sensitive and generate pressure data even with slight friction or vibration. To eliminate pressure data generated by slight friction or vibration of the piezoelectric crystal sensor, an effective threshold for the pressure signal is set to remove abnormal values ​​from the piezoelectric crystal sensor.

[0088] ; (1-1)

[0089] in To determine the upper limit of the piezoelectric crystal sensor's range, pressure data that do not exceed 10% of the upper limit and exceed 90% of the upper limit are discarded.

[0090] Step 2: To facilitate subsequent frequency domain feature extraction, the pressure data retained after Step 1 is normalized, that is, the pressure data is mapped to... :

[0091] (2-4)

[0092] in The normalized pressure data corresponds to time n. For time window The median of internal pressure data, For time window The absolute median of internal pressure data;

[0093] Step 3: Analyze the pressure data Perform FFT transformation and design a bandpass filter to allow only pressure signals within a specific frequency range to pass through, while signals in other frequency ranges are filtered out as noise.

[0094] Step 3.1: First, collect the pressure data. Perform FFT transformation, Transform from the time domain to the frequency domain and calculate the single-sided amplitude spectrum:

[0095] ; (3-1)

[0096] in This represents the amplitude of the single-sided amplitude spectrum at frequency index k. The number of sampling points. It is a complex exponential function. The imaginary unit, For the frequency index of the corresponding frequency domain;

[0097] Step 3.2: Based on the amplitude obtained in Step 3.1 This allows for the identification of the dominant frequency, quickly locating the main vibration frequency in the signal, i.e., the frequency of periodic pressure fluctuations; simultaneously, if it manifests as discrete peaks or broadband energy in the frequency domain, it is identified as noise, causing the amplitude to... With stress data Compared to other methods, it is easier to distinguish; the basis for determining the main frequency band is based on the characteristic frequency band identification of pressure data:

[0098] (3-2)

[0099] in For a set of frequencies, For frequency values, For frequency The corresponding amplitude;

[0100] Step 4: Based on Step 3, for the interference components that remain at the same frequency as the target signal within a specific frequency range of the pressure signal that are allowed to pass in Step 3, such as specific frequency noise introduced by mechanical resonance, structural self-excited oscillation or periodic environmental disturbances, an FIR filter based on multi-scale convolutional neural network and multi-head attention mechanism is designed to attenuate the amplitude of the above-mentioned noise at the same frequency without affecting the integrity of the time-domain waveform of the target pressure signal.

[0101] Step 4.1: Window the pressure data processed in Step 3.1 to create a dataset. Determine the characteristic frequency period based on the periodic pressure fluctuation frequency identified in Step 3.2, and use it as the window length value L. L determines the key period of the signal to be covered. Divide the continuous pressure data signal into training samples of fixed length.

[0102] ; (4-1)

[0103] ; (4-2)

[0104] in This is the window length value. For the first Pressure data values ​​collected at all times, For input number Data for each window, For the first Data windows The target output is the first The center point value of each data window;

[0105] Step 4.2: Train the optimal FIR filter coefficients using a multi-scale convolutional neural network, such as... Figure 2 As shown;

[0106] Step 4.2.1: Automatically extract amplitude using the first one-dimensional convolutional layer of a multi-scale convolutional neural network. Local features;

[0107] (4-3)

[0108] (4-4)

[0109] in This represents the dot product between the convolution kernel and a local part of the signal. Indicates the first The first in the layer The output of each neuron It is the first Layer The first neuron to the second The first in the layer The weights between neurons It is the first The first in the layer Bias of each neuron It is the first kernel size of convolutional layers It is a non-linear activation function; the ReLU function is chosen as the activation function to accelerate convergence. This represents the output value of the convolution operation;

[0110] Step 4.2.2: Use a max pooling layer to downsample the local features from step 4.2.1;

[0111] (4-5)

[0112] in For the first Layer The first channel Neuron value, Indicates the width of the pooling region;

[0113] Step 4.2.3: Globally integrate the feature data obtained after extraction by the one-dimensional convolutional layer and downsampling by the max pooling layer through a fully connected layer;

[0114] (4-6)

[0115] in After flattening The feature is passed to the fully connected layer. The weights of each neuron, For the fully connected layer The weights of each neuron, The total number of neurons in the fully connected layer is [number]. Flattened into a one-dimensional vector , For the flattened feature dimensions, represent The Each element corresponds to the maximum feature value of a local region after pooling;

[0116] Step 4.3: As Figure 3 As shown, a channel attention mechanism is designed to enhance the frequency band containing the dominant frequency component and suppress noise-dominated channels.

[0117] Step 4.3.1: Process the local feature encoding, i.e., the feature map, of the pressure data in Step 4.2. Considering the data characteristics in the fields of mechanical vibration and impact stress measurement, the high sensitivity of piezoelectric crystal sensors leads to transient pulses, periodic fluctuations, and noise-induced non-stationary characteristics in the acquired pressure data. Therefore, the input feature map exhibits transient pulse characteristics, periodic fluctuation characteristics, and noise-induced characteristics. Specifically, the transient pulse characteristic is characterized by frequency domain energy concentrated in the high-frequency band, while the spatial distribution shows local abrupt changes; the periodic fluctuation characteristic is characterized by the fundamental frequency of rotating machinery vibration and its harmonics; the noise-induced characteristics are characterized by Gaussian white noise, power frequency interference, and quantization noise. As the input to the multi-head attention mechanism, based on the characteristics of the above-mentioned input feature map, the input feature map is as follows:

[0118] (4-7)

[0119] Where F is the input feature map, C is the number of channels, H is the height of the feature map in the spatial dimension, and W is the width of the feature map in the spatial dimension. The dimension space representing the feature map F is a three-dimensional matrix belonging to the real number field R;

[0120] Step 4.3.2: For To prevent the loss of transient pulse features and confusion of periodic features in traditional pooling methods during mechanical vibration signal processing, global average pooling and global max pooling are performed. Improvements are made to traditional pooling methods: First, for traditional GAP (Global Average Pooling) of impact signals, the improved method retains key pulse components through a threshold adaptive mechanism. Second, to address the sensitivity of traditional GMP to single-point noise, the improved method introduces frequency domain weighting to suppress high-frequency noise. Finally, time-frequency joint analysis is used to avoid distortion of periodic fluctuation features during pooling. After these improvements, the extraction accuracy of mechanical vibration features is enhanced, making it more suitable for impact stress monitoring scenarios. The time-frequency joint analysis also helps to prevent distortion of periodic fluctuation features during pooling. (4-8)

[0121] (4-9)

[0122] (4-10)

[0123] (4-11)

[0124] These are the features after global average pooling. For position The original feature value at that location, and These are the mean and standard deviation of the feature map, respectively. For adaptive threshold coefficients, The features are those obtained after global max pooling. for Related frequency information, The cutoff frequency, The inhibition coefficient;

[0125] Step 4.3.3: Generate weights through a fully connected layer. and nonlinear activation to generate channel attention weights :

[0126] (4-12) Step 4.3.4: Pixel-by-pixel multiplication to obtain the feature map :

[0127] (4-13)

[0128] in For the generated channel attention weights;

[0129] Step 4.4: Design a spatial attention mechanism as a supplement to the channel attention mechanism to further refine the selection of features, highlight key signal regions such as pressure change points, and smooth noise interference regions.

[0130] Step 4.4.1: Perform spatial feature aggregation along the channel dimension. Perform average pooling and max pooling, and then concatenate the results:

[0131] (4-14)

[0132] (4-15)

[0133] (4-16)

[0134] This represents the features after average pooling. Represents the features after max pooling. Indicates will and The result after stitching along the channel dimension;

[0135] Step 4.4.2: Generate weights through convolutional layers. Generate spatial attention map :

[0136] (4-17)

[0137] This represents the generated spatial attention weight map;

[0138] Step 4.4.3: Pixel-by-pixel multiplication to obtain the feature map :

[0139] (4-18)

[0140] Step 4.5: To prevent excessively large weight coefficients in multi-scale convolutional neural networks from causing gradient explosion or filtering distortion, and to improve processing stability, the weight coefficients are normalized:

[0141] (4-19)

[0142] Indicates the first The original unnormalized weight values ​​at time 1. This represents the normalized weight coefficients;

[0143] Step 5: Train the model and learn the optimal filter parameters by minimizing the prediction error;

[0144] Mean squared error loss function:

[0145] (5-1)

[0146] Indicates the number of samples;

[0147] Because a fixed learning rate may lead to slow convergence or oscillations in the processing due to the non-stationarity of the pressure data, and because the gradient distribution of noise and effective components in the pressure signal is uneven, making it prone to getting trapped in local optima and affecting the processing effect of the pressure data, the FIR filter coefficients are adjusted and the Adam optimizer is updated to minimize the filtering error.

[0148] (5-2)

[0149] and These are the estimates of the first and second moments of the gradient, respectively. It is a number on the order of 1e-8 to 1e-7 to prevent division by zero. It is the current iteration number. It is the learning rate of the convolutional neural network;

[0150] By updating the Adam optimizer, the step size is increased in the signal flat section and decreased in the signal abrupt section, thus accelerating convergence. At the same time, the Adam optimizer is compatible with the attention mechanism, which can speed up the speed at which the attention mechanism focuses on the main frequency band.

[0151] Step 6: Determine whether the number of iterations has reached the specified number or whether the loss has converged. That is, if the loss value has not decreased after 10 consecutive training rounds, training ends and the subsequent steps are executed if either the number of iterations has reached the specified number or the loss has converged. Otherwise, return to step 4.2.

[0152] Step 7: Implement FIR filtering based on multi-scale convolutional neural networks and multi-head attention mechanisms to eliminate residual interference components of the same frequency within the passband without losing the amplitude and spectral characteristics of the target pressure signal.

[0153] (7-1)

[0154] It is a unit impulse response. The time index representing the unit impulse response.

[0155] This example uses a lightweight multi-scale deep separable convolutional neural network (DSP) algorithm, treating the coefficients of the FIR filter as learnable parameters. The optimal FIR filter coefficients are automatically learned through training stress data. Because multi-scale convolutional neural networks have powerful feature extraction capabilities, they can be used in FIR filters to extract features from the input signal. By setting convolutional kernels of different sizes in the neural network, it can automatically extract features at different scales from the data, helping to better analyze and process signals. However, traditional multi-scale convolution has a high number of parameters and computational cost, and contains redundant data, requiring significant storage space. Embedded devices are limited by storage and computing resources, making it difficult to meet the storage and computational requirements of traditional multi-scale convolutional neural network algorithms. Therefore, a depthwise separable convolution is added to the traditional multi-scale convolutional neural network algorithm, replacing the standard convolution in the multi-scale branch. This lightweight architecture, achieved by decoupling the two-stage spatial-channel coupled computation, retains the multi-scale perception capability while reducing the computational burden. The lightweight multi-scale convolutional neural network algorithm is better suited for embedded scenarios. To address the non-stationary characteristics of piezoelectric crystal sensor signals, such as transient pulses, periodic fluctuations, and noise interference, a multi-scale convolutional neural network (CNN) and multi-head attention mechanism are used, divided into three branches to extract data features at different scales. Each branch includes three convolutional layers and two pooling layers, with each layer containing a uniformly sized kernel to extract features at a specific fixed scale. The kernel sizes within each branch are as follows: , , The convolutional neural networks (CNNs) are categorized into small-scale, medium-scale, and large-scale convolutions. Small-scale convolutions have fewer parameters, are computationally fast, and excel at extracting local features, such as sudden pressure changes caused by instantaneous impacts on terminals. Medium-scale convolutions have a larger receptive field, used to extract local patterns of periodic fluctuations, such as the local trend of pressure signal changes within a vibration cycle. Large-scale convolutions have a wide coverage and can capture the overall pattern of periodic fluctuations in pressure data, such as the overall trend of periodic signal fluctuations. By setting three identical convolutional layers within each branch, a hierarchical progression can be used to deeply mine single-scale features from basic details to correlation patterns, improving the feature abstraction capabilities based on multi-scale convolutional neural networks and multi-head attention mechanisms. Pooling layers downsample the pressure data features extracted by the convolutional layers, reducing computational cost and overfitting risk, and highlighting the salient features of the signal. A multi-head attention mechanism is introduced, the core idea of ​​which is to map the input to multiple subspaces, i.e., heads. Each head learns different attention patterns, independently calculates attention weights, and filters important information. The outputs of each head are concatenated and passed through a linear layer to obtain the final result, reducing the model's dependence on large amounts of labeled data. In this example, the method automatically learns and assigns different weights based on different components of the input pressure signal. In the FIR filter, it can give different levels of attention to pressure signal components of different frequencies or pressure signals of different time segments, enabling the FIR filter to automatically focus on the sudden pressure rise point or the periodic main frequency band, suppressing irrelevant noise. Simultaneously, it establishes a global time correlation, linking the starting point and reflection point of the pressure wave and capturing similar patterns across periods in the periodic signal, achieving global interaction. Furthermore, the multi-head attention mechanism, based on the time-frequency features extracted by the multi-scale convolutional neural network algorithm, can dynamically adjust the weights of different frequency components. By focusing on different key features of the pressure data in parallel, the multi-head attention mechanism significantly improves the effectiveness of pressure data processing. In summary, introducing a multi-head attention mechanism on top of the multi-scale convolutional neural network algorithm when processing pressure signals has significant advantages for handling non-stationary, noisy, and long-distance pressure signal scenarios.

[0156] References:

[0157] [1] Zhang Shuyu, Wang Ting. A review of intelligent optimization algorithm design for FIR digital filters [J]. Electronic Technology Application, 2021, 47 (05): 29-34. DOI:10.16157 / j.issn.0258-7998.201003.

[0158] [2] Sun Fengkuo, Xi Bin. Design of linear phase FIR filter based on support vector regression (SVR) [J]. Journal of Fuzhou University (Natural Science Edition), 2008, (S1): 143-145.

[0159] [3] Yang Jiyao. Research on key issues in the optimization design of digital FIR filters based on machine learning [D]. Guizhou University, 2024. DOI:10.27047 / d.cnki.ggudu.2024.001997.

[0160] [4]Dengfeng Z ,Chaoyang T ,Zhijun F , et al. Multi scaleconvolutional neural network combining BiLSTM and attention mechanism forbearing fault diagnosis under multiple working conditions [J]. ScientificReports, 2025, 15 (1): 13035-13035.

[0161] [5] Jie Zhihang, Yang Weiming, Li Jin. Parameter prediction of microstrip filter based on convolutional neural network [J]. Electronic Devices, 2024, 47 (02): 490-495.

Claims

1. A FIR filter method based on multi-scale convolutional neural networks and multi-head attention mechanism, characterized in that, Includes the following steps: Step 1: Piezoelectric crystal sensors are highly sensitive and generate pressure data even with slight friction or vibration. To eliminate pressure data generated by slight friction or vibration of the piezoelectric crystal sensor, an effective threshold for the pressure signal is set to remove abnormal values ​​from the piezoelectric crystal sensor. ; in To determine the maximum range of the piezoelectric crystal sensor, pressure data that does not reach 10% of the maximum range of the piezoelectric crystal sensor or exceeds 90% of the maximum range of the piezoelectric crystal sensor are discarded. Step 2: To facilitate subsequent frequency domain feature extraction, the pressure data retained after Step 1 is normalized, that is, the pressure data is mapped to... : in The normalized pressure data corresponds to time n. For time window The median of internal pressure data, For time window The absolute median of internal pressure data; Step 3: Analyze the pressure data Perform FFT transformation and design a bandpass filter to allow only pressure signals within a specific frequency range to pass through, while signals in other frequency ranges are filtered out as noise. Step 3.1: First, collect the pressure data. Perform FFT transformation, Transform from the time domain to the frequency domain and calculate the single-sided amplitude spectrum: ; in This represents the amplitude of the single-sided amplitude spectrum at frequency index k. The number of sampling points. It is a complex exponential function. The imaginary unit, For the frequency index of the corresponding frequency domain; Step 3.2: Based on the amplitude obtained in Step 3.1 This allows for the identification of dominant frequencies, quickly locating the main vibration frequencies in a signal, i.e., the frequencies exhibiting periodic pressure fluctuations; simultaneously, discrete peaks or broadband energy in the frequency domain are identified as noise, thus reducing the amplitude... With stress data Compared to easily distinguishable data, pressure data characteristic frequency band identification determines the main frequency band based on the following criteria: ;in For a set of frequencies, For frequency values, For frequency The corresponding amplitude; Step 4: For the interference components with the same frequency as the target signal that still remain within the specific frequency range of the pressure signal that is allowed to pass in Step 3, the amplitude is attenuated without affecting the integrity of the time-domain waveform of the target pressure signal, based on the design of an FIR filter based on a multi-scale convolutional neural network and a multi-head attention mechanism. Step 4.1: Window the pressure data processed in Step 3.1 to create a dataset. Determine the characteristic frequency period based on the periodic pressure fluctuation frequency identified in Step 3.2, and use it as the window length value L. L determines the period of the signal to be covered. Divide the continuous pressure data signal into training samples of fixed length. ; ; in This is the window length value. For the first Pressure data values ​​collected at all times, For input number Data for each window, For the first Data windows The target output is the first The center point value of each data window; Step 4.2: Train the optimal FIR filter coefficients using a multi-scale convolutional neural network; Step 4.3: Design a channel attention mechanism to enhance the frequency band containing the dominant frequency component and suppress noise-dominated channels; Step 4.4: Design a spatial attention mechanism as a supplement to the channel attention mechanism; Step 4.5: To prevent excessively large weight coefficients in multi-scale convolutional neural networks from causing gradient explosion or filtering distortion, normalize the weight coefficients: ; Indicates the first The original unnormalized weight values ​​at time 1. This represents the normalized weight coefficients; Step 5: Train the model and learn the optimal filter parameters by minimizing the prediction error; Mean squared error loss function: ; Indicates the number of samples; To adjust the FIR filter coefficients, the Adam optimizer is updated to minimize the filtering error: ; and These are the estimates of the first and second moments of the gradient, respectively. It is a number on the order of 1e-8 to 1e-7 to prevent division by zero. It is the current iteration number. It is the learning rate of the convolutional neural network; Step 6: Determine whether the number of iterations has reached the specified number or whether the loss has converged. That is, if the loss value has not decreased after 10 consecutive training rounds, training ends and the subsequent steps are executed if either the number of iterations has reached the specified number or the loss has converged. Otherwise, return to step 4.

2. Step 7: Implement FIR filtering based on multi-scale convolutional neural networks and multi-head attention mechanisms to eliminate residual interference components of the same frequency within the passband without losing the amplitude and spectral characteristics of the target pressure signal. ; It is a unit impulse response. The time index representing the unit impulse response.

2. The FIR filter method based on multi-scale convolutional neural networks and multi-head attention mechanism according to claim 1, characterized in that, The specific steps in step 4.2 of training the optimal FIR filter coefficients using a multi-scale convolutional neural network are as follows: Step 4.2.1: Automatically extract amplitude using the first one-dimensional convolutional layer of a multi-scale convolutional neural network. Local features; in This represents the dot product between the convolution kernel and a local part of the signal. Indicates the first The first in the layer The output of each neuron It is the first Layer The first neuron to the second The first in the layer The weights between neurons It is the first The first in the layer Bias of each neuron It is the first kernel size of convolutional layers It is a non-linear activation function; the ReLU function is chosen as the activation function to accelerate convergence. This represents the output value of the convolution operation; Step 4.2.2: Use a max pooling layer to downsample the local features from step 4.2.1; in For the first Layer The first channel Neuron value, Indicates the width of the pooling region; Step 4.2.3: Globally integrate the feature data obtained after extraction by the one-dimensional convolutional layer and downsampling by the max pooling layer through a fully connected layer; in After flattening The feature is passed to the fully connected layer. The weights of each neuron, For the fully connected layer The weights of each neuron, The total number of neurons in the fully connected layer is [number]. Flattened into a one-dimensional vector , For the flattened feature dimensions, represent The Each element corresponds to the maximum feature value of a local region after pooling.

3. The FIR filter method based on multi-scale convolutional neural networks and multi-head attention mechanism according to claim 1, characterized in that, The specific steps in step 4.3 to design the channel attention mechanism to enhance the frequency band containing the dominant frequency component and suppress noise-dominated channels are as follows: Step 4.3.1: Process the local feature encoding, i.e., the feature map, of the stress data in Step 4.

2. This feature map serves as the input to the multi-head attention mechanism. The input feature map is: Where F is the input feature map, C is the number of channels, H is the height of the feature map in the spatial dimension, and W is the width of the feature map in the spatial dimension. The dimension space representing the feature map F is a three-dimensional matrix belonging to the real number field R; Step 4.3.2: For Perform global average pooling and global max pooling, and then use joint time-frequency analysis to avoid distortion of periodic fluctuations during the pooling process: These are the features after global average pooling. For position The original feature value at that location, and These are the mean and standard deviation of the feature map, respectively. For adaptive threshold coefficients, The features are those obtained after global max pooling. for Related frequency information, The cutoff frequency, The inhibition coefficient; Step 4.3.3: Generate weights through a fully connected layer. and nonlinear activation to generate channel attention weights : Step 4.3.4: Pixel-by-pixel multiplication to obtain the feature map : in The generated channel attention weights.

4. The FIR filter method based on multi-scale convolutional neural networks and multi-head attention mechanism according to claim 1, characterized in that, The specific steps for designing the spatial attention mechanism in step 4.4, as a supplement to the channel attention mechanism, are as follows: Step 4.4.1: Perform spatial feature aggregation along the channel dimension. Perform average pooling and max pooling, and then concatenate the results: This represents the features after average pooling. Represents the features after max pooling. Indicates will and The result after stitching along the channel dimension; Step 4.4.2: Generate weights through convolutional layers. Generate spatial attention map : This represents the generated spatial attention weight map; Step 4.4.3: Pixel-by-pixel multiplication to obtain the feature map : 。