A method for extracting and visualizing the sound spectrum of an electric motor
By segmenting, framing, adding windows and zeroing, Fourier transform and filtering, the spectrum diagram that conforms to the motor characteristics is obtained, and the problem of poor motor fault recognition effect in the existing technology is solved, and effective recognition and fault detection of motor sound is realized.
Patent Information
- Application Number
- CN202310392106.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-13
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2043-04-13
AI Technical Summary
In the prior art, the motor sound spectrum extraction method fails to effectively consider the characteristics of the motor sound, resulting in poor motor fault recognition effect.
By collecting the motor sound, segmenting, framing, adding windows and zeroing, Fourier transform and filtering operations, the spectrum diagram that conforms to the motor characteristics is obtained and visualized to form a three-channel image for deep learning classification model.
It realizes effective identification of motor sound and improves the accuracy and efficiency of fault detection.
Smart Images

Figure CN116469408B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of motor signal extraction, and more precisely, it relates to a method for extracting and visualizing the sound spectrum of a motor. Background Art
[0002] With the rapid development of the new energy industry, motors have been applied in multiple fields. Once a motor fails, it will pose a threat to production and personal safety. Therefore, it is necessary to detect the sound of the motor to determine whether the motor has failed in a timely manner. Usually, the abnormal sound detection method is to extract the spectrogram of a section of sound and then use the deep learning image classification algorithm to identify whether the sound is an abnormal sound.
[0003] The current spectrum extraction methods generally extract the short-time Fourier transform spectrum, Mel spectrum, and Mel cepstrum. Among them, the short-time Fourier transform spectrum converts the time-domain sound signal to the frequency domain, and its frequency is linearly distributed, without considering the frequency characteristics of the motor sound itself; the Mel spectrum takes into account that the human ear's perception of sound frequency is logarithmic, is sensitive to low-frequency signal changes, and is insensitive to high-frequency signal changes, and it takes into account the characteristics of the human ear; the Mel cepstrum is to perform a discrete cosine transform on the Mel spectrum and then select a part of the coefficients.
[0004] None of the above several spectra consider the frequency characteristics of the motor sound, which is not conducive to the identification of the motor sound. Summary of the Invention
[0005] The object of the present invention is to overcome the deficiencies in the prior art and propose a method for extracting and visualizing the sound spectrum of a motor. By performing operations such as collecting, segmenting, framing, windowing and zero-padding, Fourier transform, filtering, and visualization on the motor sound, a spectrogram and visualization result that conform to the motor characteristics can be obtained, which is convenient for using the deep learning image classification algorithm to identify the motor sound.
[0006] In a first aspect, a method for extracting and visualizing the sound spectrum of a motor is provided, including:
[0007] S1. Collect the motor sound; the motor sound includes normal sound and abnormal sound;
[0008] S2. Perform segmentation processing on the motor sound;
[0009] S3. Perform framing processing and zero-padding and windowing processing on the segmented motor sound in sequence;
[0010] S4. Perform Fourier transform on the framed and zero-padded and windowed motor sound to obtain the short-time Fourier transform spectrum Spec;
[0011] S5. Filter the short-time Fourier transform spectrum Spec to obtain a spectrum ESpec that conforms to the motor spectrum characteristics;
[0012] S6. Visualize the spectrum ESpec to obtain a three-channel image for training a deep learning classification model.
[0013] Preferably, in S2, the segmentation process includes: dividing the collected long-time motor sound into segments every 10 seconds.
[0014] Preferably, S3 includes:
[0015] S301. Divide each segment of motor sound into several frames, where the frame length is represented as Win_Length, the step size is represented as Hop_Length, and the frame signal is represented as F[n];
[0016] S302. After frame division, if Win_Length is not a power of 2, pad each frame with zeros to transform Win_Length into a power of 2; and perform a windowing operation on each padded frame to smooth the signals at both ends of the frame.
[0017] Preferably, in S302, the window function for the windowing operation is expressed as:
[0018]
[0019] where n is the index of the data in the window function, N is the size of the window, 0 ≤ n ≤ N - 1, and N = Win_Length; and multiply ω[n] and F[n] point by point to obtain the smoothed frame signal P_F[n].
[0020] Preferably, in S4, perform a Fourier transform on the signal of length Win_Length on P_F[n] to obtain a spectrum, and obtain its power spectrum. The formula is as follows:
[0021] FFT(i) = fft(P_F[n] i )
[0022] where i is the frame number, 0 ≤ i ≤ M, where M = 10 * SampleRate / Hop_Length, and SampleRate is the sampling rate; the FFT(i) of each segment of sound is stacked in the time dimension to obtain an M * N spectrum, take the non-negative (N / 2 + 1) columns as the spectrum, and square this spectrum to obtain the power spectrum Spec, with a size of M * (N / 2 + 1).
[0023] Preferably, in S5, use a set of filters that conform to the motor characteristics to filter the power spectrum Spec. The formula for the filter is as follows:
[0024]
[0025]
[0026]
[0027]
[0028] Among them, k represents the filter number, 0 ≤ k < P, P is the number of filters, 0 ≤ i ≤ (N / 2 + 1), and Fb is an array formed by equally dividing the interval between the lowest frequency and the highest frequency into P + 2 parts; n0, n1, and n2 respectively represent the positions of the starting frequency, center frequency, and ending frequency of the filter in the frequency array; the finally obtained H k (i) has a size of P * (N / 2 + 1), and H k (i) represents the weighting value of the k-th filter in terms of frequency; multiplying H k (i) by the transpose of Spec through matrix multiplication can obtain ESpec = H k (i) * Spec, with a size of P * M.
[0029] Preferably, in S6, the size of ESpec is adjusted to (H, W), and according to the numerical color mapping rule, the color spectrum CESpec corresponding to Espec is obtained.
[0030] In a second aspect, a device for extracting and visualizing the motor sound spectrum is provided, which is used to execute the method for extracting and visualizing the motor sound spectrum according to any one of the first aspects, and includes:
[0031] An acquisition module for acquiring the motor sound; the motor sound includes normal sound and abnormal sound;
[0032] A segmentation module for segmenting the motor sound;
[0033] A framing module for successively performing framing processing and zero-padding and windowing processing on the segmented motor sound;
[0034] A transformation module for performing Fourier transform on the framed and zero-padded and windowed motor sound to obtain the short-time Fourier transform spectrum Spec;
[0035] A filtering module for filtering the short-time Fourier transform spectrum Spec to obtain a spectrum ESpec that conforms to the motor spectrum characteristics;
[0036] A visualization module for visualizing the spectrum ESpec to obtain a three-channel image for training a deep learning classification model.
[0037] The beneficial effects of the present invention are as follows: The present invention proposes a method for extracting and visualizing the motor sound spectrum. By performing operations such as motor sound acquisition, segmentation, framing, windowing and zero-padding, Fourier transform, filtering, and visualization, a spectrogram and visualization results conforming to the motor characteristics can be obtained, which facilitates the recognition of motor sounds using the image classification algorithm of deep learning. Description of the Drawings
[0038] Figure 1 It is a flowchart of a method for extracting and visualizing the motor sound spectrum provided by the present invention;
[0039] Figure 2 It is a filter diagram used in the present invention;
[0040] Figure 3 It is a window function diagram used in the present invention;
[0041] Figure 4 It is a schematic diagram of the visualization result obtained by the present invention;
[0042] Figure 5 It is a schematic structural diagram of a device for extracting and visualizing the motor sound spectrum provided by the present invention. Detailed Embodiments
[0043] The following further describes the present invention in conjunction with embodiments. The description of the following embodiments is only for helping to understand the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several modifications can still be made to the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
[0044] Embodiment 1:
[0045] A method for extracting and visualizing the motor sound spectrum, as Figure 1 shown, includes:
[0046] S1. Collect the motor sound; the motor sound includes normal sound and abnormal sound.
[0047] In S1, a microphone is used in this application to collect the motor sound.
[0048] S2. Perform segmentation processing on the motor sound.
[0049] In S2, the segmentation processing includes: dividing the collected long-time motor sound into segments every 10 seconds. There are two reasons for segmentation. On the one hand, calculating the spectrogram every 10 seconds can ensure the stability of the frequency within a short time, and on the other hand, it can improve the calculation speed.
[0050] S3. Perform framing processing and zero-padding and windowing processing on the segmented motor sound in sequence.
[0051] S3 includes:
[0052] S301. Divide each segment of the motor sound into several frames.
[0053] The principle of this step is that the frequency in the motor sound changes with time. Therefore, in most cases, it is meaningless to perform Fourier transform on the entire signal because the frequency profile of the signal will be lost over time. To avoid this situation, it can be assumed that the frequency in the signal is fixed within a very short time. Therefore, the frequency characteristics of the motor sound signal can be obtained by performing Fourier transform on adjacent frames.
[0054] Specifically, frame division divides the sound signal into short-time segments, and each time segment is called a frame. Within each frame, the frequency characteristics of the signal can be regarded as stable, so frequency-domain analysis can be performed within this frame. In the present invention, the frame length Win_Length is set to 1024, the step length Hop_Length is set to 512, and the frame signal is represented as F[n], where 0 ≤ n ≤ N - 1 and N = Win_Length.
[0055] S302. After frame division, if Win_Length is not an integer power of 2, pad zeros to each frame to transform Win_Length into an integer power of 2; and perform windowing operation on each frame after padding zeros to smooth the signals at both ends of the frame.
[0056] Generally, Win_Length is set to an integer power of 2. If Win_Length is not an integer power of 2, pad zeros to the smallest integer power of 2 greater than Win_Length. In addition, to reduce the discontinuity at the edges and make the signal transition more smoothly at the edges, thereby reducing spectral leakage and the reduction of frequency resolution, this application performs windowing on each frame signal.
[0057] In S302, as Figure 3 shown, the window function of the windowing operation is expressed as:
[0058]
[0059] where n is the index of the data in the window function, N is the size of the window, 0 ≤ n ≤ N - 1, and N = Win_Length; and multiply ω[n] and F[n] point by point to obtain the frame signal P_F[n] after smoothing processing, avoiding spectral leakage during Fourier transform. The window function proposed in the present invention not only smooths the signals at both ends compared with the Hanning window commonly used in extracting the spectrum, but also retains the intermediate signals, retaining more details of the motor sound.
[0060] S4. Perform Fourier transform on the motor sound after frame splitting processing and zero-padding and windowing processing to obtain the frequency domain results of each frame. Combine each frame in the time dimension of a segment of sound to obtain the short-time Fourier transform spectrum Spec.
[0061] In S4, perform Fourier transform on the signal with a length of Win_Length on P_F[n] to obtain the spectrum, and obtain its power spectrum. The formula is as follows:
[0062] FFT(i) = fft(P_F[n] i )
[0063] where i is the frame number, 0 ≤ i ≤ M, where M = 10 * SampleRate / Hop_Length, and SampleRate is the sampling rate; Stack the FFT(i) of a 10-second sound in the time dimension to obtain a spectrum of M * N. Take the non-negative (N / 2 + 1) columns as the spectrum, and square this spectrum to obtain the power spectrum Spec, with a size of M * (N / 2 + 1).
[0064] S5. Filter the short-time Fourier transform spectrum Spec to obtain a spectrum Espec that conforms to the motor spectrum characteristics.
[0065] In S5, as Figure 2 shown, use a set of filters that conform to the motor characteristics to filter the power spectrum Spec. The formula of the filter is as follows:
[0066]
[0067]
[0068]
[0069]
[0070] where k represents the filter number, P is the number of filters, 0 ≤ k < P, 0 ≤ i ≤ (N / 2 + 1), Fb is an array formed by equally dividing the interval between the lowest frequency and the highest frequency into P + 2 parts; n0, n1, and n2 respectively represent the positions of the starting frequency, center frequency, and ending frequency of the filter in the frequency array; The finally obtained H k (i) has a size of P * (N / 2 + 1), and H k (i) represents the weighting value of the kth filter in the frequency domain; Multiply H k (i) with the transpose of Spec to obtain ESpec = H k(i) *Spec*, with a size of P * M. The reason for not using Mel filters like other methods is that converting the Mel filter frequencies to the Mel scale makes them more in line with the human ear's auditory characteristics. However, since the motor sound does not need to be distinguished by the human ear, only the frequency characteristics of the motor need to be considered.
[0071] S6. As Figure 4 shown, visualize the spectrum ESpec to obtain a three-channel image for training a deep learning classification model.
[0072] In S6, for the convenience of use by the deep learning model, resize ESpec to (H, W), where H is the image height and W is the image width. According to the numerical color mapping rule, obtain the color spectrum CESpec corresponding to ESpec. In the present invention, the mapping rule "magma" between numerical values and colors is used, which has good visualization effects and is convenient for model training.
[0073] Example 2:
[0074] A device for extracting and visualizing the spectrum of motor sound, as Figure 5 shown, includes:
[0075] An acquisition module for acquiring motor sound; the motor sound includes normal sound and abnormal sound;
[0076] A segmentation module for segmenting the motor sound;
[0077] A framing module for successively framing and zero-padding and windowing the segmented motor sound;
[0078] A transformation module for performing Fourier transform on the framed and zero-padded and windowed motor sound to obtain the short-time Fourier transform spectrum Spec;
[0079] A filtering module for filtering the short-time Fourier transform spectrum Spec to obtain a spectrum ESpec that conforms to the motor spectrum characteristics;
[0080] A visualization module for visualizing the spectrum ESpec to obtain a three-channel image for training a deep learning classification model.
Claims
1. A method for extracting and visualizing the sound spectrum of an electric motor, characterized in that, Including: S1. Collect the motor sound; the motor sound includes normal sound and abnormal sound; S2. Perform segmentation processing on the motor sound; S3. Perform frame division processing and zero-padding and windowing processing on the segmented motor sound in sequence; S4. Perform Fourier transform on the motor sound after frame division processing and zero-padding and windowing processing to obtain the short-time Fourier transform spectrum Spec; S5. Filter the short-time Fourier transform spectrum Spec to obtain the spectrum ESpec that conforms to the motor spectrum characteristics; S6. Visualize the spectrum ESpec to obtain a three-channel image for training the deep learning classification model; In S5, use a set of filters that conform to the motor characteristics to filter the power spectrum Spec, and the formula of the filter is as follows: Among them, k represents the filter number, where 0 ≤ k < P, P is the number of filters, 0 ≤ i ≤ (N / 2 + 1), and Fb is an array formed by equally dividing the interval between the lowest frequency and the highest frequency into P + 2 parts; n0, n1, and n2 respectively represent the positions of the starting frequency, the center frequency, and the ending frequency of the filter in the frequency array; finally, the size of H k (i) is P * (N / 2 + 1), and H k (i) represents the weighting value of the k-th filter in terms of frequency; multiplying H k (i) by the transpose of Spec through matrix multiplication can obtain ESpec = H k (i) * Spec, with a size of P * M.
2. The method for extracting and visualizing the motor sound spectrum according to claim 1, characterized in that In S2, the segmentation processing includes: dividing the collected long-time motor sound into segments every 10 seconds.
3. The method for extracting and visualizing the motor sound spectrum according to claim 1, wherein S3 Including: S301. Divide each segment of the motor sound into several frames, the frame length is represented as Win_Length, the step length is represented as Hop_Length, and the frame signal is represented as F[n]; S302. After frame division, if Win_Length is not an integer power of 2, zero-padding is performed on each frame to transform Win_Length into an integer power of 2; and a windowing operation is performed on each zero-padded frame to smooth the signals at both ends of the frame.
4. The method for extracting and visualizing the motor sound spectrum according to claim 3, characterized in that In S302, the window function of the windowing operation is represented as: where n is the index of the data in the window function, N is the size of the window, 0 ≤ n ≤ N - 1, N = Win_Length; and ω[n] is multiplied by F[n] point by point to obtain the smoothed frame signal P_F[n].
5. The method for extracting and visualizing the motor sound spectrum according to claim 4, characterized in that In S4, perform Fourier transform on the signal with a length of Win_Length on P_F[n] to obtain the spectrum, and obtain its power spectrum. The formula is as follows: FFT(i) = fft(P_F[n] i ) where i is the frame number, 0 ≤ i ≤ M, where M = 10 * SampleRate / Hop_Length, and SampleRate is the sampling rate; the FFT(i) of each segment of sound is stacked in the time dimension to obtain an M * N spectrum, and the non-negative (N / 2 + 1) columns are taken as the spectrum, and then the spectrum is squared to obtain the power spectrum Spec with a size of M * (N / 2 + 1).
6. The method for extracting and visualizing the motor sound spectrum according to claim 5, characterized in that, In S6, resize ESpec to (H, W), where H is the image height and W is the image width, and according to the numerical color mapping rule, obtain the color spectrum CESpec corresponding to Espec.
7. A device for extracting and visualizing the sound spectrum of an electric motor, characterized in that, For implementing the motor sound spectrum extraction and visualization method according to any one of claims 1 to 6, including: An acquisition module for acquiring the motor sound; the motor sound includes normal sound and abnormal sound; A segmentation module for performing segmentation processing on the motor sound; A frame division module for performing frame division processing and zero-padding and windowing processing on the segmented motor sound in sequence; A transformation module for performing Fourier transform on the motor sound after frame division processing and zero-padding and windowing processing to obtain the short-time Fourier transform spectrum Spec; A filtering module, configured to filter the short-time Fourier transform spectrum Spec to obtain a spectrum ESpec that conforms to the motor spectrum characteristics; A visualization module, configured to visualize the spectrum ESpec to obtain a three-channel image for training a deep learning classification model.
Citation Information
Patent Citations
Failure prediction model establishing method and system as well as fan monitoring pre-warning system and method
CN102778358A
Depression detection method based on microphone array
CN112349297A