Loudspeaker abnormal sound detection method and system based on machine learning, and storage medium
Patent Information
- Application Number
- CN202411172780.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-12-06
AI Technical Summary
The existing speaker antonym detection method relies on human ear judgment, has subjectivity and uncertainty, and is difficult to automate, resulting in high labor costs and low production efficiency.
Using a machine learning-based method, a speaker audio signal is collected for preprocessing, a multi-view data set is formed, unsupervised feature selection and classifier training is carried out to realize automated antonym detection.
It improves the accuracy and efficiency of abnormal sound detection, reduces manual intervention, reduces production costs, and improves product quality and production efficiency.
Smart Images

Figure CN119091918A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of audio signal processing, and in particular to a method, system and storage medium for detecting abnormal sound of a loudspeaker based on machine learning. Background Art
[0002] With the popularity of electronic devices such as smartphones, smart speakers, car audio and home theaters, the demand for speakers has surged, and my country has become a major speaker producer and exporter. Faced with the market's increasing demand for high-quality audio experience, speaker manufacturers are faced with the challenge of increasing production while improving product quality. However, during the speaker manufacturing process, structural and mechanical failures that affect sound quality often occur, which directly affect user experience.
[0003] At present, the detection of abnormal sound of loudspeakers mainly relies on traditional methods, that is, professional listeners use human ears to judge whether the sound of the loudspeaker is normal in a soundproof environment. This method has significant disadvantages: first, it is highly dependent on the subjective feelings of the listeners, and is easily affected by individual factors such as age, health status and fatigue, resulting in subjectivity and uncertainty in the test results; second, there is a lack of unified evaluation standards, which is difficult to be replaced by automated devices; third, for large-scale production, not only is the labor cost high, but long-term repetitive work is prone to fatigue and misjudgment of personnel, increasing the risk of product failure.
[0004] Therefore, it is particularly urgent to explore a more accurate, efficient, objective and standardized method for detecting abnormal noise of loudspeakers in order to meet the market demand for high-quality loudspeakers while reducing production costs and improving production efficiency. Summary of the invention
[0005] In order to solve the above technical problems, the present invention provides a method for detecting abnormal sound of a loudspeaker based on machine learning, comprising the following steps:
[0006] S1: Collecting a speaker audio signal, and preprocessing the audio signal to obtain a multi-view data set;
[0007] S2: performing unsupervised feature selection on the multi-view dataset to obtain a dataset after feature selection;
[0008] S3: dividing the feature-selected data set into a training set and a test set, and iteratively training the classifier using the training set to obtain a trained classifier;
[0009] S4: Performing abnormal sound detection on the speaker to be tested based on the trained classifier to obtain a detection result.
[0010] In one embodiment of the present invention, in S1, the method for obtaining the multi-view dataset is as follows:
[0011] S11: normalize the audio signal x(t), scale the amplitude of the audio signal x(t) to within a specified range, and obtain a normalized audio signal x′(t):
[0012]
[0013] S12: performing pre-emphasis frame division and windowing processing on the normalized audio signal to obtain a plurality of windowed frame signals;
[0014] S13: performing short-time Fourier transform on the windowed frame signal to obtain a linear spectrum X(k) of the audio signal, taking the square of the modulus of the linear spectrum X(k) of the audio signal to obtain a power spectrum of each frame; wherein the linear spectrum X(k) of the audio signal is calculated by the following formula:
[0015]
[0016] Wherein, k≤N-1, N represents the total number of frame signals after windowing, j represents an imaginary unit, and x(n) represents the nth frame signal after windowing;
[0017] S14: Based on the linear spectrum X(k) of the audio signal, weighted summation is performed through a Mel filter bank to convert a given frequency f into a corresponding Mel-scale spectrum Mel(f):
[0018]
[0019] S15: taking the logarithm of the Mel-scale spectrum Mel(f) to obtain a logarithmic spectrum, performing discrete cosine transform on the logarithmic spectrum to obtain a Mel-frequency cepstrum coefficient feature; dividing the square of the modulus of the linear spectrum X(k) of the audio signal by the frame length to obtain a power spectrum, and taking the square of the power spectrum to obtain a spectrogram feature;
[0020] S16: performing mean normalization processing on the Mel-frequency cepstral coefficient features and the spectrogram features, and then combining them to obtain the multi-view dataset.
[0021] In one embodiment of the present invention, in S2, the method for obtaining the feature-selected data set is as follows:
[0022] S21: for each view in the multi-view dataset, a similarity matrix between data points is calculated, the similarity matrices of multiple views are fused into one similarity matrix, a spectral clustering algorithm is applied to the fused similarity matrix to obtain clustering results, the clustering results are used as pseudo labels of data points, and pseudo labels are assigned to each data point to generate a pseudo label matrix;
[0023] S22: Based on the pseudo label matrix, L of the feature selection matrix 2,1 The sparse regularization term constructs a feature selection loss function, integrates the training process of the pseudo label matrix and the training process of the feature selection matrix into the same learning framework, and constructs an unsupervised feature selection objective function;
[0024] S23: solving the unsupervised feature selection objective function with the goal of minimizing the unsupervised feature selection objective function value, and obtaining the optimal solution of the pseudo label matrix and the feature selection matrix;
[0025] S24: Based on the optimal solution of the feature selection matrix, the importance value of each feature is calculated, that is, the L2 norm of each row of the feature selection matrix is calculated, and the importance value of each feature is sorted, and the top k features are selected to form a multi-view feature subset. A plurality of the multi-view feature subsets are combined to obtain the data set after feature selection.
[0026] In one embodiment of the present invention, the unsupervised feature selection objective function F loss Including the loss term Loss1 of pseudo label learning and the loss term Loss2 of feature selection matrix learning, its expression is as follows:
[0027]
[0028] Among them, α (v) are all iterable weight parameters, v is the index number of the view, v takes an integer between 1 and V, and V is the total number of views of each sample in the multi-view dataset.
[0029] In one embodiment of the present invention, the loss term Loss1 of the pseudo-label learning is constructed based on the non-negative constraint condition, and its expression is:
[0030]
[0031] Among them, P (v) ∈R N×c Represents the pseudo label matrix of the vth view, v is an integer between 1 and V, V is the total number of views of each sample in the multi-view dataset, I∈R c×c is the identity matrix, c is the number of categories, Tr(·) is the operation to obtain the trace of the matrix; L (v) represents the Laplacian matrix.
[0032] In one embodiment of the present invention, the expression of the loss term Loss2 of the feature selection matrix learning is:
[0033]
[0034] Among them, β (v)is an iterable weight parameter, is the audio dataset of the vth view, d v represents the dimension of the vth view, P (v) ∈R N×c represents the pseudo label matrix of the vth view, N is the number of samples in the multi-view dataset, c is the number of categories, Q (v) is the feature selection matrix for the v-th view, To obtain the square of the F norm, ||Q (v) || 2,1 Indicates Q (v) L 2,1 norm, λ is the preset parameter.
[0035] In one embodiment of the present invention, the method for obtaining the optimal solution of the pseudo label matrix and the feature selection matrix is as follows:
[0036] Since the loss term Loss2 of the feature selection matrix learning is not differentiable, the expression of the loss term LoSs2 of the feature selection matrix learning is converted into the following equivalent expression:
[0037]
[0038] Among them, D (v) represents a diagonal matrix, the i-th diagonal element is Denotes the diagonal matrix D (v) The i-th sample of
[0039] Fixed P (v) , α (v) , β (v) The value of Q is obtained by taking the derivative of the equivalent expression and setting the derivative to 0. (v) The solution formula is:
[0040]
[0041] Fixed Q (v) , α (v) , β (v) The value of , converts the loss term Loss1 of the pseudo-label learning into the following equivalent expression:
[0042]
[0043] Among them, ρ represents the weight parameter;
[0044] According to the Q (v) The solution formula of , the equivalent expression (9) can be converted into the following expression:
[0045]
[0046] in, I represents the identity matrix;
[0047] The Lagrangian function of formula (10) is:
[0048]
[0049] Among them, ψ (v) is the Lagrange multiplier. According to the Kalush-Kuhn-Tucker condition, we can get Derivative formula (11) and set the derivative to 0 to obtain the updated pseudo-label matrix P (v) The element in row i and column j in The formula is as follows:
[0050]
[0051] Fixed P (v) , Q (v) , β (v) The value of α is updated (v) The formula is:
[0052]
[0053] Fixed P (v) , Q (v) , α (v) The value of β is updated (v) The formula is:
[0054]
[0055] With the goal of minimizing the unsupervised feature selection objective function value, the elements of the pseudo label matrix and the feature selection matrix are continuously adjusted to obtain the optimal solutions of the pseudo label matrix and the feature selection matrix.
[0056] In one embodiment of the present invention, in S3, the method for obtaining the trained classifier is as follows:
[0057] Using the linear support vector machine as the basic framework of the classifier, the classification function used by its hyperplane is:
[0058] f(x)=ω·x+b (15)
[0059] Wherein, ω represents the normal vector of the hyperplane, b is the classification bias, and x is the training set divided from the data set after the feature selection;
[0060] The Lagrangian multiplier α is introduced to solve ω and b in formula (15), and the Lagrangian function is defined as:
[0061]
[0062] Among them, x i is the i-th sample in the data set after the feature selection, i is an integer between 1 and N, and N is the total number of samples in the data set after the feature selection;
[0063] Fixing the value of the Lagrange multiplier α, calculating the partial derivatives of formula (16) with respect to ω and b respectively, and setting the results to 0, we can obtain the following formula:
[0064]
[0065] Substituting formula (17) into formula (16), we can obtain the following after simplification:
[0066]
[0067] Transform formula (18) into a dual problem and solve the following formula (19) to obtain α i The optimal solution is:
[0068]
[0069]
[0070] Based on the α i The optimal solution of can be substituted into formula (16) and solved in sequence to obtain the optimal solution of ω and b. i , ω, and b, and finally obtain an optimal classification plane and classification function.
[0071] Based on the same inventive concept, the present invention also provides a speaker abnormal sound detection system based on machine learning, which is used in the speaker abnormal sound detection method based on machine learning, and includes the following modules:
[0072] A data preprocessing module, the data preprocessing module is used to collect a loudspeaker audio signal, preprocess the audio signal, and obtain a multi-view data set;
[0073] A feature selection module, wherein the feature selection module is used to perform unsupervised feature selection on the multi-view dataset to obtain a dataset after feature selection;
[0074] A classifier training module, wherein the classifier training module is used to divide the feature-selected data set into a training set and a test set, and iteratively train the classifier through the training set to obtain a trained classifier;
[0075] The abnormal sound detection module is used to perform abnormal sound detection on the speaker to be tested based on the trained classifier to obtain a detection result.
[0076] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the speaker abnormal sound detection method based on machine learning are implemented.
[0077] The above technical solution of the present invention has the following advantages compared with the prior art:
[0078] 1. Multi-view data processing: By extracting multiple features such as Mel frequency cepstral coefficients and spectrograms from audio signals to form a multi-view dataset, this method can more comprehensively capture the information in the audio signal and improve the accuracy and robustness of foreign sound detection. The combination of multi-view features helps to analyze audio signals from different angles and reduce the information loss or misleading that may be caused by a single feature.
[0079] 2. Unsupervised feature selection: Pseudo-label learning and feature selection are integrated into the same learning framework. Unsupervised feature selection methods can automatically select the most useful features for classification tasks without label information. This aims to retain the discriminant information in the original data and eliminate redundant and low-information features to improve the performance and training speed of subsequent classification models.
[0080] 3. High degree of automation and low manual intervention: The entire detection process is highly automated. From data preprocessing, feature extraction to classifier training, most detection steps can be completed automatically, reducing the need for manual intervention and improving detection efficiency and reliability. BRIEF DESCRIPTION OF THE DRAWINGS
[0081] In order to make the content of the present invention more clearly understood, the present invention is further described in detail below according to specific embodiments of the present invention in conjunction with the accompanying drawings, wherein
[0082] Figure 1 is a flowchart of a method for detecting abnormal sound of a loudspeaker based on machine learning provided by an embodiment of the present invention;
[0083] Figure 2 is a specific implementation flow chart of a speaker abnormal sound detection method based on machine learning provided by an embodiment of the present invention;
[0084] Figure 3 is a flowchart of a method for obtaining a multi-view data set provided by an embodiment of the present invention;
[0085] Figure 4 is a flowchart of a method for obtaining a feature-selected data set provided by an embodiment of the present invention;
[0086] Figure 5is a structural schematic diagram of a speaker abnormal sound detection system based on machine learning provided by an embodiment of the present invention;
[0087] Description of the accompanying drawings in the specification: 100, data preprocessing module; 200, feature selection module; 300, classifier training module; 400, abnormal sound detection module. DETAILED DESCRIPTION
[0088] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0089] Embodiment 1
[0090] Reference Figures 1-2 As shown, the present invention provides a method for detecting abnormal sound of a loudspeaker based on machine learning, comprising the following steps:
[0091] S1: Collecting a speaker audio signal, and preprocessing the audio signal to obtain a multi-view data set;
[0092] S2: performing unsupervised feature selection on the multi-view dataset to obtain a dataset after feature selection;
[0093] S3: dividing the feature-selected data set into a training set and a test set, iteratively training the classifier through the training set to obtain a trained classifier; selecting accuracy and confusion matrix as evaluation indicators, and evaluating the performance of the trained classifier through the test set;
[0094] S4: Performing abnormal sound detection on the speaker to be tested based on the trained classifier to obtain a detection result.
[0095] In S1, the speaker is connected to hardware devices such as a computer USB interface, a sound card, a microphone, and a speaker, and the hardware parameters required for collecting audio signals are set, including: the sampling channel is set to IN1, the sampling rate is 48000 Hz, the bit depth is 32 bits, the recording time is 3 seconds, the playback time is 3 seconds, the signal type is logarithmic chirp, the signal amplitude is 7 volts, the upper limit of the sampling frequency is 60 Hz, and the lower limit of the sampling frequency is 2500 Hz, and the audio signal x(t) is collected.
[0096] like Figure 3 As shown, in S1, the method for obtaining the multi-view dataset is as follows:
[0097] S11: normalize the audio signal x(t), scale the amplitude of the audio signal x(t) to a specified range [-1, 1], and obtain a normalized audio signal x'(t):
[0098]
[0099] S12: Perform pre-emphasis, frame division and windowing processing on the normalized audio signal, which includes: using a Hamming window, the pre-emphasis filter is y(t)=x(t)-κx(t-1), wherein the pre-emphasis coefficient κ is set to 0.97, x(t) represents the original audio signal, that is, the normalized audio signal obtained by formula (1), and y(t) is the pre-emphasized signal. Set the frame length L to 128, the overlap length M of two adjacent frames to 128, the number of filter channels to 18, divide the audio signal into N frame signals, and obtain N windowed frame signals;
[0100] S13: performing short-time Fourier transform on the windowed frame signal to obtain a linear spectrum X(k) of the audio signal, taking the square of the modulus of the linear spectrum X(k) of the audio signal to obtain a power spectrum of each frame; wherein the linear spectrum X(k) of the audio signal is calculated by the following formula:
[0101]
[0102] Wherein, k≤N-1, N represents the total number of frame signals after windowing, j represents an imaginary unit, and x(n) represents the nth frame signal after windowing;
[0103] S14: Based on the linear spectrum X(k) of the audio signal, weighted summation is performed through a Mel filter bank to convert a given frequency f into a corresponding Mel-scale spectrum Mel(f):
[0104]
[0105] S15: taking the logarithm of the Mel-scale spectrum Mel(f) to obtain a logarithmic spectrum S(p), performing discrete cosine transform on the logarithmic spectrum to obtain Mel-frequency cepstral coefficient (MFCC) features, and obtaining the maximum value, minimum value, and standard deviation of the MFCC; in addition, squaring the power spectrum to obtain a spectrogram feature;
[0106] S16: performing mean normalization processing on the Mel-frequency cepstral coefficient feature and the spectrogram feature and then combining them to obtain the multi-view dataset;
[0107] Among them, the specific design of the Mel filter bank is as follows:
[0108]
[0109] Where p represents the number of filters, H p (k) is the weight function of the Mel filter.
[0110] like Figure 4 As shown, in S2, the method for obtaining the data set after feature selection is as follows:
[0111] S21: for each view in the multi-view dataset, a similarity matrix between data points is calculated, the similarity matrices of multiple views are fused into one similarity matrix, a spectral clustering algorithm is applied to the fused similarity matrix to obtain clustering results, the clustering results are used as pseudo labels of data points, and pseudo labels are assigned to each data point to generate a pseudo label matrix;
[0112] S22: Introducing L 2,1 The norm helps the feature selection matrix to remove redundant and noisy features more effectively. Based on the pseudo label matrix, the feature selection matrix L 2,1 The sparse regularization term constructs a feature selection loss function, integrates the training process of the pseudo label matrix and the training process of the feature selection matrix into the same learning framework, learns a feature selection matrix with row sparsity under the guidance of the pseudo label, and constructs an unsupervised feature selection objective function;
[0113] S23: solving the unsupervised feature selection objective function with the goal of minimizing the unsupervised feature selection objective function value, and obtaining the optimal solution of the pseudo label matrix and the feature selection matrix;
[0114] S24: Based on the optimal solution of the feature selection matrix, the importance value of each feature is calculated, that is, the L2 norm of each row of the feature selection matrix is calculated, and each feature importance value is sorted from large to small, and the top k features are selected to form a multi-view feature subset. A plurality of the multi-view feature subsets are combined to obtain the data set after feature selection.
[0115] Furthermore, the unsupervised feature selection objective function F loss Including the loss term LoSs1 of pseudo label learning and the loss term Loss2 of feature selection matrix learning, its expression is as follows:
[0116]
[0117] Among them, α(v) is an iterable weight parameter, v is the index number of the view, v is an integer between 1 and V, and V is the total number of views of each sample in the multi-view dataset.
[0118] Among them, the loss term Loss1 of the pseudo-label learning is constructed based on the non-negative constraint condition, and its expression is:
[0119]
[0120] Among them, P (v) ∈RN×c represents the pseudo label matrix of the vth view, N is the number of samples in the multi-view dataset, I represents the identity matrix, c is the number of categories, and Tr(·) is the operation of obtaining the trace of the matrix; L (v) represents the Laplacian matrix.
[0121] The expression of the loss term Loss2 of the feature selection matrix learning is:
[0122]
[0123] Among them, β (v) is an iterable weight parameter, is the audio dataset of the vth view, d v represents the dimension of the vth view, P (v) ∈R N×c represents the pseudo label matrix of the vth view, N is the number of samples in the multi-view dataset, I represents the identity matrix, c is the number of categories, Q (v) is the feature selection matrix for the v-th view, represents the square of the F norm, ||Q (v) || 2,1 Indicates Q (v) L 2,1 norm, λ is the preset parameter.
[0124] In S23, the method for obtaining the optimal solution of the pseudo label matrix and the feature selection matrix is as follows:
[0125] The unsupervised feature selection objective function F loss The corresponding Lagrangian function is as follows:
[0126]
[0127] Since the loss term Loss2 of the feature selection matrix learning is not differentiable, the expression of the loss term Loss2 of the feature selection matrix learning is converted into the following equivalent expression:
[0128]
[0129] Among them, D (v) represents a diagonal matrix, the i-th diagonal element is Denotes the diagonal matrix D (v) The i-th sample of
[0130] Fixed P (v) , α (v) , β (v) The value of Q is obtained by taking the derivative of the equivalent expression and setting the derivative to 0. (v) The solution formula is:
[0131]
[0132] Fixed Q (v) , α (v) , β (v) The value of , converts the loss term Loss1 of the pseudo-label learning into the following equivalent expression:
[0133]
[0134] Among them, ρ represents the weight parameter, and the model parameter ρ is adjusted to ensure that the pseudo label matrix P (v) orthogonality.
[0135] According to the Q (v) The solution formula of , the equivalent expression (10) can be converted into the following expression:
[0136]
[0137] in, I represents the identity matrix;
[0138] The Lagrangian function of formula (11) is:
[0139]
[0140] Among them, ψ (v) is the Lagrange multiplier. According to the Kalusch-Kuhn-Tucker (KKT) condition, we can get Derivative formula (12) and set the derivative to 0 to obtain the updated pseudo-label matrix P (v) The element in row i and column j in The formula is as follows:
[0141]
[0142] Fixed P (v) , Q (v) , β (v) The value of α is updated (v) The formula is:
[0143]
[0144] Fixed P (v) , Q (v) , α (v) The value of β is updated (v) The formula is:
[0145]
[0146] With the goal of minimizing the unsupervised feature selection objective function value, the elements of the pseudo label matrix and the feature selection matrix are continuously adjusted to obtain the optimal solutions of the pseudo label matrix and the feature selection matrix.
[0147] In S3 of this embodiment, the method for obtaining the trained classifier is as follows:
[0148] Using the linear support vector machine as the basic framework of the classifier, the classification function used by its hyperplane is:
[0149] f(x)=ω·x+b (16)
[0150] Wherein, ω represents the normal vector of the hyperplane, b is the classification bias, and x is the training set divided from the data set after the feature selection;
[0151] The Lagrangian multiplier α is introduced to solve ω and b in formula (16), and the Lagrangian function is defined as:
[0152]
[0153] Among them, x i is the i-th sample in the data set after the feature selection, i is an integer between 1 and N, and N is the total number of samples in the data set after the feature selection;
[0154] Formula (17) is difficult to solve directly. By fixing the value of the Lagrange multiplier α, calculating the partial derivatives of formula (16) with respect to ω and b respectively, and setting the results to 0, we can obtain the following formula:
[0155]
[0156] Substituting formula (18) into formula (17), we can obtain the following after simplification:
[0157]
[0158] According to Largrange's theorem, formula (18) is transformed into a dual problem. By solving the following formula (20), we can get α i The optimal solution is:
[0159]
[0160]
[0161] Based on the α i The optimal solution of can be substituted into formula (17) and solved in sequence to obtain the optimal solution of ω and b. i , ω, and b, and finally obtain an optimal classification plane and classification function.
[0162] Embodiment 2
[0163] Based on the same inventive concept, the present invention also provides a speaker abnormal sound detection system based on machine learning, which is used in the speaker abnormal sound detection method based on machine learning described in the first embodiment, such as Figure 5 As shown, the system includes the following modules:
[0164] A data preprocessing module 100, the data preprocessing module 100 is used to collect a loudspeaker audio signal, preprocess the audio signal, and obtain a multi-view data set;
[0165] A feature selection module 200, wherein the feature selection module 200 is used to perform unsupervised feature selection on the multi-view dataset to obtain a dataset after feature selection;
[0166] A classifier training module 300, wherein the classifier training module 300 is used to divide the feature-selected data set into a training set and a test set, and iteratively train the classifier using the training set to obtain a trained classifier;
[0167] The abnormal sound detection module 400 is used to perform abnormal sound detection on the speaker to be tested based on the trained classifier to obtain a detection result.
[0168] The present embodiment proposes a speaker abnormal sound detection system based on machine learning, which is used to implement the aforementioned speaker abnormal sound detection method based on machine learning. Therefore, the specific implementation method of the speaker abnormal sound detection system based on machine learning can be seen in the embodiment part of the aforementioned speaker abnormal sound detection method based on machine learning. For example, the data preprocessing module 100, the feature selection module 200, the classifier training module 300 and the abnormal sound detection module 400 are respectively used to implement the steps S1, S2, S3 and S4 of the speaker abnormal sound detection method based on machine learning in the first embodiment. Therefore, its specific implementation method can refer to the description of the corresponding embodiments of each part. In order to avoid redundancy, it will not be repeated here.
[0169] Embodiment 3
[0170] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the speaker abnormal sound detection method based on machine learning described in Example 1 are implemented.
[0171] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0172] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0173] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0174] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0175] Obviously, the above embodiments are merely examples for clear explanation and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived from these are still within the protection scope of the invention.
Claims
1. A method for detecting abnormal sound of a loudspeaker based on machine learning, characterized in that: The following steps are involved: S1: Collecting a speaker audio signal, and preprocessing the audio signal to obtain a multi-view data set; S2: performing unsupervised feature selection on the multi-view dataset to obtain a dataset after feature selection; S3: dividing the feature-selected data set into a training set and a test set, and iteratively training the classifier using the training set to obtain a trained classifier; S4: Performing abnormal sound detection on the speaker to be tested based on the trained classifier to obtain a detection result.
2. The method for detecting abnormal sound of a loudspeaker based on machine learning according to claim 1, characterized in that: In S1, the method for obtaining the multi-view dataset is as follows: S11: normalize the audio signal x(t), scale the amplitude of the audio signal x(t) to within a specified range, and obtain a normalized audio signal x'(t): S12: performing pre-emphasis frame division and windowing processing on the normalized audio signal to obtain a plurality of windowed frame signals; S13: Performing short-time Fourier transform on the windowed frame signal to obtain a linear spectrum C(k) of the audio signal, taking the square of the modulus of the linear spectrum X(k) of the audio signal to obtain a power spectrum of each frame; wherein the linear spectrum X(k) of the audio signal is calculated by the following formula: Wherein, k≤N-1, N represents the total number of frame signals after windowing, j represents an imaginary unit, and x(n) represents the nth frame signal after windowing; S14: Based on the linear spectrum X(k) of the audio signal, weighted summation is performed through a Mel filter bank to convert a given frequency f into a corresponding Mel-scale spectrum Mel(f): S15: taking the logarithm of the Mel-scale spectrum Mel(f) to obtain a logarithmic spectrum, performing discrete cosine transform on the logarithmic spectrum to obtain a Mel-frequency cepstrum coefficient feature; squaring the power spectrum to obtain a spectrogram feature; S16: performing mean normalization processing on the Mel-frequency cepstral coefficient features and the spectrogram features, and then combining them to obtain the multi-view dataset.
3. The method for detecting abnormal sound of a loudspeaker based on machine learning according to claim 1, characterized in that: In S2, the method for obtaining the data set after feature selection is as follows: S21: for each view in the multi-view dataset, a similarity matrix between data points is calculated, the similarity matrices of multiple views are fused into one similarity matrix, a spectral clustering algorithm is applied to the fused similarity matrix to obtain clustering results, the clustering results are used as pseudo labels of data points, and pseudo labels are assigned to each data point to generate a pseudo label matrix; S22: Based on the pseudo label matrix, L of the feature selection matrix 2,1 The sparse regularization term constructs a feature selection loss function, integrates the training process of the pseudo label matrix and the training process of the feature selection matrix into the same learning framework, and constructs an unsupervised feature selection objective function; S23: solving the unsupervised feature selection objective function with the goal of minimizing the unsupervised feature selection objective function value, and obtaining the optimal solution of the pseudo label matrix and the feature selection matrix; S24: Based on the optimal solution of the feature selection matrix, the importance value of each feature is calculated, that is, the L2 norm of each row of the feature selection matrix is calculated, and the importance value of each feature is sorted, and the top k features are selected to form a multi-view feature subset. A plurality of the multi-view feature subsets are combined to obtain the data set after feature selection.
4. The method for detecting abnormal sound of a loudspeaker based on machine learning according to claim 3, characterized in that: The unsupervised feature selection objective function F loss Including the loss term Loss1 of pseudo label learning and the loss term Loss2 of feature selection matrix learning, its expression is as follows: Among them, α (v) are all iterable weight parameters, v is the index number of the view, v takes an integer between 1 and V, and V is the total number of views of each sample in the multi-view dataset.
5. The method for detecting abnormal sound of a loudspeaker based on machine learning according to claim 4, characterized in that: The loss term Loss1 of the pseudo-label learning is constructed based on the non-negative constraint condition, and its expression is: Among them, P (v) ∈R N×c represents the pseudo label matrix of the vth view, N is the number of samples in the multi-view dataset, I∈R c×c is the identity matrix, c is the number of categories, Tr(·) is the operation to obtain the trace of the matrix; L (v) represents the Laplacian matrix.
6. The method for detecting abnormal sound of a loudspeaker based on machine learning according to claim 5, characterized in that: The expression of the loss term Loss2 of the feature selection matrix learning is: Among them, β (v) is an iterable weight parameter, is the audio dataset of the vth view, d v represents the dimension of the vth view, P (v) ∈R N×c represents the pseudo label matrix of the vth view, N is the number of samples in the multi-view dataset, c is the number of categories, Q (v) is the feature selection matrix for the v-th view, To obtain the square of the F norm, ||Q (v) || 2,1 Indicates Q (v) L 2,1 norm, λ is the preset parameter.
7. The method for detecting abnormal sound of a loudspeaker based on machine learning according to claim 6, characterized in that: The method for obtaining the optimal solution of the pseudo label matrix and the feature selection matrix is as follows: Since the loss term Loss2 of the feature selection matrix learning is not differentiable, the expression of the loss term Loss2 of the feature selection matrix learning is converted into the following equivalent expression: Among them, D (v) represents a diagonal matrix, the i-th diagonal element is Denotes the diagonal matrix D (v) The i-th sample of Fixed P (v) , α (v) , β (v) The value of Q is obtained by taking the derivative of the equivalent expression and setting the derivative to 0. (v) The solution formula is: Fixed Q (v) , α (v) , β (v) The value of , converts the loss term Loss1 of the pseudo-label learning into the following equivalent expression: Among them, ρ represents the weight parameter; According to the Q (v) The solution formula of , the equivalent expression (9) can be converted into the following expression: in, I represents the identity matrix; The Lagrangian function of formula (10) is: Among them, ψ(v ) is the Lagrange multiplier. According to the Kalush-Kuhn-Tucker condition, we can get Derivative formula (11) and set the derivative to 0 to obtain the updated pseudo-label matrix P ( v ) The element in row i and column j in The formula is as follows: Fix the values of P(v), Q(v), and β(v), and update the formula of α(v): Fixed P(v), Q ( v ) , α ( v ) The value of β is updated ( v ) The formula is: With the goal of minimizing the unsupervised feature selection objective function value, the elements of the pseudo label matrix and the feature selection matrix are continuously adjusted to obtain the optimal solutions of the pseudo label matrix and the feature selection matrix.
8. The method for detecting abnormal speaker sound based on machine learning according to claim 1, characterized in that: In S3, the method for obtaining the trained classifier is as follows: Using the linear support vector machine as the basic framework of the classifier, the classification function used by its hyperplane is: f(x)=ω·x+b (15) Wherein, ω represents the normal vector of the hyperplane, b is the classification bias, and x is the training set divided from the data set after the feature selection; The Lagrangian multiplier α is introduced to solve ω and b in formula (15), and the Lagrangian function is defined as: Among them, x i is the i-th sample in the data set after the feature selection, i is an integer between 1 and N, and N is the total number of samples in the data set after the feature selection; Fixing the value of the Lagrange multiplier α, calculating the partial derivatives of formula (16) with respect to ω and b respectively, and setting the results to 0, we can obtain the following formula: Substituting formula (17) into formula (16), we can obtain the following after simplification: Transform formula (18) into a dual problem and solve the following formula (19) to obtain α i The optimal solution is: Based on the α i The optimal solution of can be substituted into formula (16) and solved in sequence to obtain the optimal solution of ω and b. i , ω, and b, and finally obtain an optimal classification plane and classification function.
9. A speaker abnormal sound detection system based on machine learning, used in the speaker abnormal sound detection method based on machine learning as claimed in any one of claims 1 to 8, characterized in that: Includes the following modules: A data preprocessing module, the data preprocessing module is used to collect a loudspeaker audio signal, preprocess the audio signal, and obtain a multi-view data set; A feature selection module, wherein the feature selection module is used to perform unsupervised feature selection on the multi-view dataset to obtain a dataset after feature selection; A classifier training module, wherein the classifier training module is used to divide the feature-selected data set into a training set and a test set, and iteratively train the classifier through the training set to obtain a trained classifier; The abnormal sound detection module is used to perform abnormal sound detection on the speaker to be tested based on the trained classifier to obtain a detection result.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the speaker abnormal sound detection method based on machine learning as described in any one of claims 1 to 8 are implemented.
