Speech recognition and analysis method based on MFCC algorithm and VQ-HMM algorithm
By using the MFCC algorithm and VQ-HMM algorithm in the speech recognition system, the spectrum characteristics of the speech signal are extracted and speech recognition is performed, and the problems of low accuracy and high resource utilization in the prior art are solved, thereby achieving a more efficient and robust speech recognition effect.
Patent Information
- Application Number
- CN202311616365.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-29
- Publication Date
- 2025-05-30
AI Technical Summary
In the prior art, the accuracy of speech recognition is low, especially in noisy environments and when processing non-native language or speech with obvious accents; at the same time, the system resource occupies too high, making it difficult to effectively process long-term serial speech.
The speech recognition and analysis method based on the MFCC algorithm and VQ-HMM algorithm is adopted, and the spectrum characteristics of the speech signal are extracted and speech recognition is performed through audio preprocessing, feature extraction, vector quantization and hidden Markov model modeling.
Improves the accuracy and robustness of speech recognition, reduces the need for resources, and is suitable for small-scale data sets and scenarios where interpretability is required.
Smart Images

Figure CN120071905A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of speech recognition and analysis, and particularly to a speech recognition and analysis method based on MFCC algorithm and VQ-HMM algorithm. Background Art
[0002] Speech recognition has important applications in many fields. Among them, voice assistants and voice control systems are the most well-known applications. The development of speech recognition benefits from the improvement of computing power, the support of big data, and the development of machine learning algorithms. In recent years, the rise of deep learning technology, especially the application of recurrent neural networks (RNNs) and variants (such as long short-term memory networks, LSTMs), has significantly improved the accuracy of speech recognition.
[0003] Although great progress has been made in speech recognition, there are still some challenges. For example, in a noisy environment, the recognition accuracy may decrease; when there are individual differences and speaker changes, it is still a challenge to build a model with good generalization performance; dealing with multi-lingual and multi-dialect speech is also a complex problem.
[0004] Current speech recognition systems still have relatively low accuracy when recognizing non-native languages and speech with obvious accents. This is because non-standard pronunciations and accents introduce additional variability and increase the difficulty of recognition. Modern speech recognition systems usually require a large amount of labeled data to achieve good performance. However, obtaining large-scale high-quality labeled data is a time-consuming and laborious task. Speech recognition systems are very sensitive to background noise and environmental changes, which may lead to a decline in system performance in complex noise environments. There are still challenges in noise suppression and environmental adaptation for practical applications. For long speech segments, speech recognition systems may face limitations in memory and computing resources. The problem of processing long sequences has not been completely solved yet. Summary of the Invention
[0005] The purpose of the present invention is to provide a speech recognition and analysis method based on MFCC algorithm and VQ-HMM algorithm to solve the problems of relatively low speech recognition accuracy and excessive system resource occupation in the prior art.
[0006] The present invention provides a speech recognition and analysis method based on MFCC algorithm and VQ-HMM algorithm, including the following steps:
[0007] Step 1: Audio preprocessing: First, preprocess the input speech signal; this includes operations such as removing noise, reducing background noise, and adjusting the gain of the speech signal to improve the quality of subsequent feature extraction;
[0008] Step 1 includes:
[0009] Pre-emphasis: Pre-emphasize the original speech signal to enhance the high-frequency part;
[0010] y[n] = x[n] - a * x[n - 1]; where x[n] is the input speech signal, y[n] is the pre-emphasized signal, and a is the pre-emphasis coefficient (usually taken as 0.95 or 0.97).
[0011] Step 2: Feature extraction: Use the MFCC algorithm to extract features from the preprocessed speech signal; The MFCC algorithm frames the speech signal, filters each frame using a Mel filter bank, then converts the filtered result to the Mel frequency scale, and finally extracts the cepstral coefficients through the discrete cosine transform (DCT); These cepstral coefficients represent the spectral characteristics of the speech signal and are used for subsequent classification and recognition;
[0012] Step 2 includes:
[0013] 1) Framing: Divide the pre-emphasized signal into short-time frames, usually each frame lasting 20 - 40 milliseconds;
[0014] The framing formula is: x(n,m) = y(n * R + m), where x(n,m) is the nth sample point of the mth frame, and R is the frame shift (usually half of the frame length);
[0015] 2) Windowing: Apply a window function to each frame of the speech signal;
[0016] The window function usually uses the Hamming Window, and the specific formula is:
[0017] w[n] = 0.54 - 0.46 * cos(2 * π * n / (N - 1)); where w[n] is the window function, N is the window length, and n is the sample index within the window;
[0018] 3) Fourier Transform: Perform the discrete Fourier transform (DFT) on each windowed frame of the speech signal;
[0019] The specific formula is:
[0020] X(k) = ∑[n = 0 to N - 1](x[n] * e^(-j * 2 * π * k * n / N)); where X(k) is the spectrum, x[n] is the windowed frame signal, N is the window length, and k is the frequency index; The length of the input sequence x[n] should be N, otherwise zero-padding or truncation is required;
[0021] 4) Mel Filter Bank: Divide the spectrum into a series of Mel filter banks;
[0022] The output of the Mel filter bank can be calculated by the following formula:
[0023] H_m(k) = ∑[i = 0 to N - 1](X(i) * W_m(i,k)); where H_m(k) is the output of the m-th filter, X(i) is the i-th element of the spectrum, and W_m(i,k) is the response of the m-th filter at frequency k;
[0024] 5) Take logarithm: Take the logarithm of the output of each filter to obtain the Mel spectrum;
[0025] S_m = log(H_m); where S_m is the output of the m-th filter, i.e., the Mel spectrum;
[0026] 6) Cepstral Transform: Perform cepstral transform on the Mel spectrum to obtain cepstral coefficients;
[0027] C_n = ∑[m = 0 to M - 1](S_m * cos((n * π * (m + 0.5)) / M)); where C_n is the n-th cepstral coefficient, S_m is the Mel spectrum, and M is the number of cepstral coefficients.
[0028] Step 3: Train the model: It is divided into vector quantization, model establishment, model training, decoding and recognition, and uses the VQ-HMM algorithm to train the speech recognition model; The VQ-HMM algorithm maps the continuous sequence of MFCC feature vectors to a discrete symbol sequence by vector quantization of the MFCC feature vectors, and then uses the hidden Markov model to model these symbol sequences;
[0029] The vector quantization in Step 3 is specifically as follows:
[0030] Suppose we have a set of MFCC feature vectors X = {x1, x2,..., xn} containing N training samples, and each feature vector xi belongs to a d-dimensional feature space.
[0031] Vector Quantization: Map each extracted MFCC feature vector to the nearest neighbor vector in a discrete codebook to achieve vector compression and representation.
[0032] The specific vector quantization formula is: vq(x) = argmin||x - c_j||. Where vq(x) is the nearest neighbor vector of the feature vector x in the codebook, c_j is the j-th vector in the codebook, and ||.|| represents the distance metric.
[0033] The goal of vector quantization is to divide the d-dimensional feature space into K regions and define a representative prototype vector for each region, denoted as C = {c1, c2,..., cK}.
[0034] Specifically, the model establishment in Step 3 is as follows:
[0035] Establish an HMM model and use the sequence of MFCC feature vectors after vector quantization for speech modeling and recognition
[0036] 1) Prepare training data
[0037] Collect training data containing a large number of different speech samples, and extract MFCC feature vectors for each speech sample. Quantize these feature vectors to map the continuous MFCC feature vectors to discrete codebook indices.
[0038] 2) Initialize the HMM model parameters
[0039] Randomly initialize the transition probability matrix A, the observation probability matrix B, and the initial state probability vector π of the HMM model. There are N states and M observations, and the model parameters are Λ = (A, B, π).
[0040] A is the state transition matrix, representing the probability of transitioning from one state to another. The probability of transitioning from state i to state j can be denoted as A(i, j).
[0041] B is the observation probability matrix, representing the probability distribution of generating different observations in each state. The probability of observing observation k in state j can be denoted as B(j, k).
[0042] π is the initial state probability vector, representing the probability of being in each state initially. The probability of being in state i initially can be denoted as π(i).
[0043] Specifically, the model training in Step 3 is as follows:
[0044] Train the model (parameter estimation)
[0045] Use the Baum-Welch algorithm or other statistical learning algorithms to estimate the parameters of the HMM model.
[0046] E step:
[0047] - According to the current model parameters and training data, use the forward-backward algorithm to calculate the probability of being in each hidden state at each time given the observation sequence.
[0048] - Calculate the updated value of the observation probability matrix B: B(j, k) = sum(γ(t, j) * δ(o_t = k)) / sum(γ(t, j)), where γ(t, j) represents the posterior probability of being in state j at time t, and δ(o_t = k) represents the indicator function of observing the observation value o_t = k at time t.
[0049] M step:
[0050] - Update the value of the transition probability matrix A: A(i, j) = sum(a(i, j)) / sum(γ(t, i)), where a(i, j) represents the probability of transitioning from state i to state j given the training data.
[0051] - Update the value of the initial state probability vector π: π(i) = γ(1, i), that is, the probability of being in state i at the initial time given the training data.
[0052] Repeat the E step and the M step until the model parameters converge or reach the preset number of iterations.
[0053] The decoding and recognition in Step 3 are specifically as follows:
[0054] Decoding and Recognition
[0055] Extract the MFCC feature vectors from the speech to be recognized and convert them into a discrete codebook index sequence. Use the Viterbi algorithm to find the most likely hidden state sequence according to the trained HMM model and the observation sequence, that is, perform speech recognition.
[0056] 1) State transition probability matrix A:
[0057] A(i, j) = P(q_t = j | q_{t - 1} = i), representing the probability of transitioning from state i to state j.
[0058] 2) Observation probability matrix B:
[0059] B(j, k) = P(o_t = k | q_t = j), representing the probability of observing the observation value o_t = k in state j.
[0060] 3) Initial state probability vector π:
[0061] π(i) = P(q_1 = i), representing the probability of the state being i at the initial time.
[0062] Where q_t represents the hidden state at the t-th time, and o_t represents the observation value at the t-th time.
[0063] In the E step, use the forward-backward algorithm to calculate the forward probability α and the backward probability β:
[0064] - Forward probability α(t, j): Represents the probability of being in state j at time t and observing the observation sequence o_{1:t}.
[0065] - Backward probability β(t, j): Represents the probability of being in state j at time t and under the condition of the subsequent observation sequence o_{t + 1:T}.
[0066] In the M step, according to the calculated forward probability α and backward probability β, update the model parameters A, B, and π:
[0067] - Update the transition probability matrix A:
[0068] A(i, j) = sum(α(t, i) * A(i, j) * B(j, o_{t + 1}) * β(t + 1, j)) / sum(α(t, i))
[0069] - Update the observation probability matrix B:
[0070] B(j, k) = sum(γ(t, j) * δ(o_t, k)) / sum(γ(t, j))
[0071] - Update the initial state probability vector π:
[0072] π(i) = γ(1, i)
[0073] Where γ(t, j) represents the posterior probability of being in state j at time t, and δ(o_t, k) represents the indicator function of observing the observation value o_t = k at time t.
[0074] By iteratively executing the E step and the M step, continuously update the model parameters until the model converges or reaches the preset number of iterations.
[0075] Finally, in the decoding and recognition stage, use the Viterbi algorithm to find the most likely hidden state sequence according to the trained HMM model and the observation sequence, and then perform speech recognition.
[0076] Step 4: Feature matching and recognition: For the speech signal to be recognized, also use the MFCC algorithm for feature extraction; then, use the trained VQ - HMM model to calculate the probability of the given observation sequence through the forward - backward algorithm, so as to determine which hidden state (i.e., word / phoneme) the input speech signal belongs to; finally, make a classification and recognition decision according to the score;
[0077] The specific calculation method of Step 4 is as follows:
[0078] Suppose we have a VQ - HMM model that contains K hidden states (represented by the prototype vector C), and the observation sequence is O = {o1, o2,..., oT}.
[0079] 1) Forward probability calculation: Use the forward algorithm to calculate the forward probability α of the given observation sequence. The forward probability represents the probability of being in state j at time t and observing the observation value sequence o_{1:t}.
[0080] α(t,j) = P(o_1,o_2,...,o_t,s_t = j) = ∑[α(t - 1,i)·A(i,j)·B(j,o_t)], where i represents the hidden state at the previous time.
[0081] Initial condition: α(1,j) = π(j)·B(j,o_1), which represents the probability of being in state j at the initial time and observing the first observation value o_1.
[0082] Recursive calculation: αt(j) = Σ[αt - 1(i)*aij*b(ot|cj)], where aij is the transition probability from hidden state i to hidden state j, and b(ot|cj) is the probability of observing value ot when in hidden state j.
[0083] Termination: P(O) = ΣαT(j), where P(O) represents the probability of the given observation sequence O.
[0084] 2) Backward probability calculation: Use the backward algorithm to calculate the backward probability β of the given observation sequence. The backward probability represents the probability of being in state j at time t and under the condition of the subsequent observation value sequence o_{t + 1:T}.
[0085] β(t,j) = P(o_{t + 1},o_{t + 2},...,o_T|s_t = j) = ∑[A(i,j)·B(j,o_{t + 1})·β(t + 1,i)], where i represents the hidden state at the next time.
[0086] Initial condition: β(T,j) = 1, which represents that the state probability at the last time is 1.
[0087] Recursive calculation: βt(i) = Σ[aij*b(ot + 1|cj)*βt + 1(j)], where aij is the transition probability from hidden state i to hidden state j, and b(ot + 1|cj) is the probability of observing value ot + 1 when in hidden state j.
[0088] 3) Decision rule: Calculate the posterior probability γt(j) of each hidden state j under the given observation sequence O: γt(j) = (αt(j)*βt(j)) / P(O), where αt(j) is the forward probability, βt(j) is the backward probability, and P(O) is the probability of the observation sequence.
[0089] By comparing the posterior probabilities γt(j) of all hidden states, the hidden state with the maximum posterior probability is found as the recognition result. That is: j* = argmax(γt(j))
[0090] 4) Probability calculation: Calculate the overall probability P(O) of the given observation sequence.
[0091] P(O) = ∑[α(T,i)], where i represents the hidden state at the last moment.
[0092] 5) Score calculation: According to the forward probability α and the backward probability β, the score of each hidden state can be calculated. A common method is to multiply or take the logarithm of the forward probability and the backward probability.
[0093] Score(j) = α(T,j)·β(T,j) or Score(j) = log(α(T,j)·β(T,j))
[0094] The classification and recognition decision in Step Four is specifically as follows:
[0095] Classification and recognition decision: By comparing the scores of each hidden state, the input speech signal is classified into the hidden state with the highest score, that is, the word / phoneme. According to the predefined threshold or by adopting other decision rules, the final recognition result can be determined.
[0096] Step Five: Decoding and recognition: For the recognition result, some post-processing operations can be performed to improve accuracy and robustness; for example, a language model can be applied for statistical language modeling to enhance the coherence and semantic accuracy of the recognition result.
[0097] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0098] 1. Strong feature representation ability: The MFCC algorithm can effectively extract the spectral characteristics of the speech signal and express the spectral contour of the speech through the cepstral coefficients. This feature representation method is relatively compact and can better describe the spectral information of the speech signal, having a high discrimination ability for the recognition and analysis of sounds.
[0099] 2. Powerful modeling ability: The VQ-HMM algorithm can perform vector quantization and modeling on the MFCC feature vector sequence and describe the statistical characteristics of the speech signal by learning the parameters of the HMM model. Compared with other pure deep learning-based end-to-end models, the VQ-HMM algorithm has an advantage in modeling the temporal characteristics of the speech signal and can better capture the context information in the speech signal.
[0100] 3. Low training data requirements: Compared with existing large-scale data-driven deep learning methods, the speech recognition method based on MFCC and VQ-HMM has relatively low requirements for training data. Generally, only a small-scale labeled dataset is needed to train a good recognition model. This is an advantage in resource-constrained situations.
[0101] 4. High robustness: The speech recognition method based on MFCC and VQ-HMM has a certain degree of robustness to noise and speech variations. MFCC feature extraction can help weaken the interference of noise, while the VQ-HMM model can resist speech variations and inexact matches to a certain extent.
[0102] 5. Good interpretability: Compared with black-box models such as deep neural networks, the VQ-HMM algorithm has good interpretability. The parameters of the HMM model represent the statistical characteristics of speech signals, and can better understand the probability distribution and temporal relationship in speech data.
[0103] Although existing deep learning methods have made significant progress in some scenarios, the speech recognition and analysis method based on MFCC algorithm and VQ-HMM algorithm still has certain advantages, especially suitable for small-scale datasets and scenarios with high requirements for interpretability. BRIEF DESCRIPTION OF THE DRAWINGS
[0104] In order to more clearly illustrate the technical solutions of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0105] Figure 1 It is a schematic flow chart of a speech recognition and analysis method based on MFCC algorithm and VQ-HMM algorithm of the present invention;
[0106] Figure 2 It is a schematic flow chart of step two of a speech recognition and analysis method based on MFCC algorithm and VQ-HMM algorithm of the present invention;
[0107] Figure 3 It is a schematic flow chart of step three of a speech recognition and analysis method based on MFCC algorithm and VQ-HMM algorithm of the present invention;
[0108] Figure 4 It is a schematic flow chart of step four of a speech recognition and analysis method based on MFCC algorithm and VQ-HMM algorithm of the present invention; DETAILED DESCRIPTION OF THE EMBODIMENTS
[0109] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0110] The technical problem to be solved by the present invention is to provide a speech recognition and analysis method using the MFCC (Mel Frequency Cepstral Coefficient) algorithm and the VQ-HMM (Segmented Fuzzy Clustering) algorithm, and solve the following existing pain points:
[0111] Speech diversity: The MFCC algorithm can extract the characteristic parameters of the speech signal, including spectral characteristics and cepstral coefficients, etc. With the help of the Mel filter bank, MFCC distributes the sounds of different frequencies to different characteristic dimensions, thereby overcoming to a certain extent the differences in pronunciation and accent of different people and improving the robustness of the speech recognition system to speech diversity.
[0112] Noise environment: The MFCC algorithm usually includes steps such as pre-emphasis and short-time Fourier transform, which can suppress the noise in the speech signal to a certain extent. Through pre-emphasis processing, the high-frequency components can be emphasized and the energy loss of the low-frequency part can be reduced. The short-time Fourier transform decomposes the speech signal into sub-bands of different frequencies, which can better filter out noise interference.
[0113] Data scarcity and diversity: The VQ-HMM algorithm is a classic speech recognition method. It vectorizes the speech signal and uses the hidden Markov model for modeling. By mapping the continuous speech frame vectors to discrete codewords, the VQ-HMM algorithm can effectively reduce the data dimension and the computational complexity. This coding method helps to solve the problems of data scarcity and insufficient diversity.
[0114] Real-time performance and latency: The VQ-HMM algorithm has low computational complexity and memory consumption and is suitable for use in real-time applications. This algorithm usually uses very short speech frames (such as 10 ms) for modeling to achieve low-latency processing, thereby meeting the requirements for the real-time performance of speech recognition.
[0115] The basic idea of the present invention is considered from two different basic points.
[0116] Among them, the basic idea of the MFCC algorithm is that the speech signal is composed of the temporal variation of sound, and the spectral features are of great significance for describing the content of the sound. The MFCC algorithm converts the continuous speech signal into more compact and discriminative spectral features through a series of steps. The speech signal is framed, that is, the continuous time-domain speech signal is cut into short time periods, and the spectral features of each frame are calculated. A Mel filter bank is used to filter each frame to extract the energy information on the Mel frequency scale that better matches the human auditory characteristics. The discrete cosine transform (DCT) is performed on the filtered result to extract the cepstral coefficients as the vector representing the speech features of this frame. In this way, the obtained MFCC feature vector can be used to represent the spectral characteristics of the speech signal and has good discrimination.
[0117] The basic idea of the VQ-HMM algorithm is a speech recognition method based on vector quantization (VQ) and hidden Markov model (HMM). First, vector quantization (VQ) is performed on the MFCC feature vectors, mapping the continuous sequence of feature vectors into a discrete symbol sequence. Vector quantization is a data compression technique that approximately represents the input vector by finding the nearest neighbor prototype vector. Then, the hidden Markov model (HMM) is used to model and recognize these discrete symbol sequences. The hidden Markov model is a class of probability models used to describe random processes with hidden states. The HMM model includes a state transition matrix, emission probabilities, and initial state probabilities. Through the training data, the parameters of the HMM model can be estimated so that the model can better describe the statistical characteristics of the speech signal. In the recognition stage, according to the given observation sequence (i.e., the MFCC feature vector sequence), the forward-backward algorithm is used to calculate the probability of the given observation sequence, and recognition decisions are made based on these probabilities.
[0118] By combining the MFCC algorithm to extract the spectral features of the speech signal and the VQ-HMM algorithm to perform vector quantization and modeling on the features, the recognition and analysis of the speech signal can be achieved. This method utilizes the spectral characteristics of the speech signal and the modeling ability of the hidden Markov model to extract and decode the information in the speech.
[0119] Please refer to Figure 1 — Figure 4 A speech recognition and analysis method based on the MFCC algorithm and the VQ-HMM algorithm as shown. The present invention provides a speech recognition and analysis method based on the MFCC algorithm and the VQ-HMM algorithm, including the following steps:
[0120] Step 1: Audio preprocessing: First, preprocess the input speech signal; this includes operations such as removing noise, reducing background noise, and performing speech signal gain adjustment to improve the quality of subsequent feature extraction;
[0121] Step 1 includes:
[0122] Pre-emphasis: Pre-emphasize the original speech signal to enhance the high-frequency part;
[0123] y[n] = x[n] - a * x[n - 1]; where x[n] is the input speech signal, y[n] is the pre-emphasized signal, and a is the pre-emphasis coefficient (usually taken as 0.95 or 0.97).
[0124] Step 2: Feature extraction: Use the MFCC algorithm to extract features from the preprocessed speech signal; The MFCC algorithm frames the speech signal, filters each frame using a Mel filter bank, then converts the filtered result to the Mel frequency scale, and finally extracts the cepstral coefficients through the discrete cosine transform (DCT); These cepstral coefficients represent the spectral characteristics of the speech signal and are used for subsequent classification and recognition;
[0125] Step 2 includes:
[0126] 1) Framing: Divide the pre-emphasized signal into short-time frames, usually each frame lasting 20 - 40 milliseconds;
[0127] The framing formula is: x(n, m) = y(n * R + m), where x(n, m) is the nth sample point of the mth frame, and R is the frame shift (usually half of the frame length);
[0128] 2) Windowing: Apply a window function to each frame of the speech signal;
[0129] The window function usually uses the Hamming Window, and the specific formula is:
[0130] w[n] = 0.54 - 0.46 * cos(2 * π * n / (N - 1)); where w[n] is the window function, N is the window length, and n is the sample index within the window;
[0131] 3) Fourier Transform: Perform the discrete Fourier transform (DFT) on each windowed frame of the speech signal;
[0132] The specific formula is:
[0133] X(k) = ∑[n = 0 to N - 1](x[n] * e^(-j * 2 * π * k * n / N)); where X(k) is the spectrum, x[n] is the windowed frame signal, N is the window length, and k is the frequency index; The length of the input sequence x[n] should be N, otherwise zero-padding or truncation is required;
[0134] 4) Mel Filter Bank: Divide the spectrum into a series of Mel filter banks;
[0135] The output of the Mel filter bank can be calculated by the following formula:
[0136] H_m(k) = ∑[i = 0 to N - 1](X(i) * W_m(i,k)); where, H_m(k) is the output of the m-th filter, X(i) is the i-th element of the spectrum, and W_m(i,k) is the response of the m-th filter at frequency k;
[0137] 5) Logarithm: Take the logarithm of each filter output to obtain the Mel spectrum;
[0138] S_m = log(H_m); where, S_m is the output of the m-th filter, i.e., the Mel spectrum;
[0139] 6) Cepstral Transform: Perform cepstral transform on the Mel spectrum to obtain cepstral coefficients;
[0140] C_n = ∑[m = 0 to M - 1](S_m * cos((n * π * (m + 0.5)) / M)); where, C_n is the n-th cepstral coefficient, S_m is the Mel spectrum, and M is the number of cepstral coefficients.
[0141] Step 3: Train the model: It is divided into vector quantization, model establishment, model training, decoding, and recognition. Use the VQ-HMM algorithm to train the speech recognition model; The VQ-HMM algorithm maps the continuous feature vector sequence to a discrete symbol sequence by vector quantization of the MFCC feature vectors, and then uses the hidden Markov model to model these symbol sequences;
[0142] The vector quantization in Step 3 is specifically as follows:
[0143] Suppose we have a set of MFCC feature vectors X = {x1, x2,..., xn} containing N training samples, and each feature vector xi belongs to a d-dimensional feature space.
[0144] Vector Quantization: Map each extracted MFCC feature vector to the nearest neighbor vector in a discrete codebook to achieve vector compression and representation.
[0145] The specific vector quantization formula is: vq(x) = argmin||x - c_j||. Where, vq(x) is the nearest neighbor vector of the feature vector x in the codebook, c_j is the j-th vector in the codebook, and ||.|| represents the distance metric.
[0146] The goal of vector quantization is to divide the d-dimensional feature space into K regions and define a representative prototype vector for each region, denoted as C = {c1, c2,..., cK}.
[0147] Specifically, the model establishment in Step 3 is as follows:
[0148] Establish an HMM model and use the MFCC feature vector sequence after vector quantization for speech modeling and recognition
[0149] 1) Prepare training data
[0150] Collect training data containing a large number of different speech samples, and extract MFCC feature vectors for each speech sample. Quantize these feature vectors, and map the continuous MFCC feature vectors to discrete codebook indices.
[0151] 2) Initialize the HMM model parameters
[0152] Randomly initialize the transition probability matrix A, the observation probability matrix B, and the initial state probability vector π of the HMM model. There are N states and M observations, and the model parameters are Λ = (A, B, π).
[0153] A is the state transition matrix, representing the probability of transitioning from one state to another. The probability of transitioning from state i to state j can be represented by A(i, j).
[0154] B is the observation probability matrix, representing the probability distribution of generating different observations in each state. The probability of observing observation value k in state j can be represented by B(j, k).
[0155] π is the initial state probability vector, representing the probability of being in each state initially. The probability of being in state i initially can be represented by π(i).
[0156] Specifically, the model training in Step 3 is as follows:
[0157] Train the model (parameter estimation)
[0158] Use the Baum-Welch algorithm or other statistical learning algorithms to estimate the parameters of the HMM model.
[0159] E step:
[0160] - According to the current model parameters and training data, use the forward-backward algorithm to calculate the probability of being in each hidden state at each moment given the observation sequence.
[0161] - Calculate the updated value of the observation probability matrix B: B(j, k) = sum(γ(t, j) * δ(o_t = k)) / sum(γ(t, j)), where γ(t, j) represents the posterior probability of being in state j at time t, and δ(o_t = k) represents the indicator function of observing the observation value o_t = k at time t.
[0162] M step:
[0163] - Update the value of the transition probability matrix A: A(i, j) = sum(a(i, j)) / sum(γ(t, i)), where a(i, j) represents the probability of transitioning from state i to state j given the training data.
[0164] - Update the value of the initial state probability vector π: π(i) = γ(1, i), that is, the probability of being in state i at the initial time given the training data.
[0165] Repeat the E step and the M step until the model parameters converge or reach the preset number of iterations.
[0166] The decoding and recognition in Step 3 are specifically as follows:
[0167] Decoding and Recognition
[0168] Extract the MFCC feature vectors from the speech to be recognized and convert them into a discrete codebook index sequence. Use the Viterbi algorithm to find the most likely hidden state sequence based on the trained HMM model and the observation sequence, that is, perform speech recognition.
[0169] 1) State transition probability matrix A:
[0170] A(i, j) = P(q_t = j | q_{t - 1} = i), representing the probability of transitioning from state i to state j.
[0171] 2) Observation probability matrix B:
[0172] B(j, k) = P(o_t = k | q_t = j), representing the probability of observing the observation value o_t = k in state j.
[0173] 3) Initial state probability vector π:
[0174] π(i) = P(q_1 = i), representing the probability of the state being i at the initial time.
[0175] Where q_t represents the hidden state at the t-th time, and o_t represents the observation value at the t-th time.
[0176] In the E step, use the forward-backward algorithm to calculate the forward probability α and the backward probability β:
[0177] - Forward probability α(t, j): Represents the probability of being in state j at time t and observing the observation sequence o_{1:t}.
[0178] - Backward probability β(t, j): Represents the probability of being in state j at time t and under the condition of the subsequent observation sequence o_{t + 1:T}.
[0179] In the M step, according to the calculated forward probability α and backward probability β, update the model parameters A, B, and π:
[0180] - Update the transition probability matrix A:
[0181] A(i, j) = sum(α(t, i) * A(i, j) * B(j, o_{t + 1}) * β(t + 1, j)) / sum(α(t, i))
[0182] - Update the observation probability matrix B:
[0183] B(j, k) = sum(γ(t, j) * δ(o_t, k)) / sum(γ(t, j))
[0184] - Update the initial state probability vector π:
[0185] π(i) = γ(1, i)
[0186] Where γ(t, j) represents the posterior probability of being in state j at time t, and δ(o_t, k) represents the indicator function of observing the observation value o_t = k at time t.
[0187] By iteratively executing the E step and the M step, continuously update the model parameters until the model converges or reaches the preset number of iterations.
[0188] Finally, in the decoding and recognition stage, use the Viterbi algorithm to find the most likely hidden state sequence based on the trained HMM model and the observation sequence, and then perform speech recognition.
[0189] Step 4: Feature matching and recognition: For the speech signal to be recognized, also use the MFCC algorithm for feature extraction; then, use the trained VQ - HMM model to calculate the probability of the given observation sequence through the forward - backward algorithm, so as to determine which hidden state (i.e., word / phoneme) the input speech signal belongs to; finally, make a classification and recognition decision based on the score;
[0190] The calculation method of Step 4 is specifically as follows:
[0191] Suppose we have a VQ - HMM model that contains K hidden states (represented by the prototype vector C), and the observation sequence is O = {o1, o2,..., oT}.
[0192] 1) Forward probability calculation: Use the forward algorithm to calculate the forward probability α of the given observation sequence. The forward probability represents the probability of being in state j at time t and observing the observation value sequence o_{1:t}.
[0193] α(t,j) = P(o_1, o_2,..., o_t, s_t = j) = ∑[α(t - 1, i)·A(i, j)·B(j, o_t)], where i represents the hidden state at the previous time.
[0194] Initial condition: α(1, j) = π(j)·B(j, o_1), which represents the probability of being in state j at the initial time and observing the first observation value o_1.
[0195] Recursive calculation: αt(j) = Σ[αt - 1(i)*aij*b(ot|cj)], where aij is the transition probability from hidden state i to hidden state j, and b(ot|cj) is the probability of observing value ot when in hidden state j.
[0196] Termination: P(O) = ΣαT(j), where P(O) represents the probability of the given observation sequence O.
[0197] 2) Backward probability calculation: Use the backward algorithm to calculate the backward probability β of the given observation sequence. The backward probability represents the probability of being in state j at time t and under the condition of the subsequent observation value sequence o_{t + 1:T}
[0198] β(t, j) = P(o_{t + 1}, o_{t + 2},..., o_T|s_t = j) = ∑[A(i, j)·B(j, o_{t + 1})·β(t + 1, i)], where i represents the hidden state at the next time.
[0199] Initial condition: β(T, j) = 1, which represents that the state probability at the last time is 1.
[0200] Recursive calculation: βt(i) = Σ[aij*b(ot + 1|cj)*βt + 1(j)], where aij is the transition probability from hidden state i to hidden state j, and b(ot + 1|cj) is the probability of observing value ot + 1 when in hidden state j.
[0201] 3) Decision rule: Calculate the posterior probability γt(j) of each hidden state j under the given observation sequence O: γt(j) = (αt(j)*βt(j)) / P(O), where αt(j) is the forward probability, βt(j) is the backward probability, and P(O) is the probability of the observation sequence.
[0202] By comparing the posterior probabilities γt(j) of all hidden states, the hidden state with the maximum posterior probability is found as the recognition result. That is: j* = argmax(γt(j))
[0203] 4) Probability calculation: Calculate the overall probability P(O) of the given observation sequence.
[0204] P(O) = ∑[α(T,i)], where i represents the hidden state at the last moment.
[0205] 5) Score calculation: Based on the forward probability α and the backward probability β, the score of each hidden state can be calculated. A common method is to multiply or take the logarithm of the forward probability and the backward probability.
[0206] Score(j) = α(T,j)·β(T,j) or Score(j) = log(α(T,j)·β(T,j))
[0207] The classification and recognition decision in Step Four is specifically as follows:
[0208] Classification and recognition decision: By comparing the scores of each hidden state, the input speech signal is classified into the hidden state with the highest score, that is, the word / phoneme. According to a predefined threshold or by using other decision rules, the final recognition result can be determined.
[0209] Step Five: Decoding and recognition: For the recognition result, some post-processing operations can be performed to improve accuracy and robustness; for example, a language model can be applied for statistical language modeling to enhance the coherence and semantic accuracy of the recognition result.
[0210] Embodiment 1
[0211] A speech recognition and analysis method based on the MFCC algorithm and the VQ-HMM algorithm, including the following steps:
[0212] Step One: Audio preprocessing: First, preprocess the input speech signal; this includes operations such as removing noise, reducing background noise, and adjusting the gain of the speech signal to improve the quality of subsequent feature extraction;
[0213] Step Two: Feature extraction: Use the MFCC algorithm to extract features from the preprocessed speech signal; the MFCC algorithm frames the speech signal and filters each frame using a Mel filter bank, then converts the filtered result to the Mel frequency scale, and finally extracts the cepstral coefficients through the discrete cosine transform (DCT); these cepstral coefficients represent the spectral characteristics of the speech signal and are used for subsequent classification and recognition;
[0214] Step 3: Training the model: It is divided into vector quantization, model establishment, model training, decoding and recognition. The VQ-HMM algorithm is used to train the speech recognition model; the VQ-HMM algorithm vector quantizes the MFCC feature vectors, maps the continuous feature vector sequence into a discrete symbol sequence, and then uses the hidden Markov model to model these symbol sequences;
[0215] The process of a speech recognition and analysis method based on the MFCC algorithm and the VQ-HMM algorithm in Embodiment 1 is as follows:
[0216] Step 1: Pre-emphasis: Perform pre-emphasis on the original speech signal to enhance the high-frequency part;
[0217] y[n] = x[n] - a * x[n - 1]; where x[n] is the input speech signal, y[n] is the pre-emphasized signal, and a is the pre-emphasis coefficient (usually taken as 0.95 or 0.97).
[0218] Step 2:
[0219] 1) Framing: Divide the pre-emphasized signal into short-time frames, usually with each frame lasting 20 - 40 milliseconds;
[0220] The framing formula is: x(n, m) = y(n * R + m), where x(n, m) is the nth sampling point of the mth frame, and R is the frame shift (usually half of the frame length);
[0221] 2) Windowing: Apply a window function to each frame of the speech signal;
[0222] The window function usually uses the Hamming Window, and the specific formula is:
[0223] w[n] = 0.54 - 0.46 * cos(2 * π * n / (N - 1)); where w[n] is the window function, N is the window length, and n is the sample index within the window;
[0224] 3) Fourier Transform: Perform discrete Fourier transform (DFT) on each frame of the windowed speech signal;
[0225] The specific formula is:
[0226] X(k) = ∑[n = 0 to N - 1](x[n] * e^(-j * 2 * π * k * n / N)); where X(k) is the spectrum, x[n] is the windowed frame signal, N is the window length, and k is the frequency index; the length of the input sequence x[n] should be N, otherwise zero-padding or truncation is required;
[0227] 4) Mel Filter Bank: Divide the spectrum into a series of Mel filter banks;
[0228] The output of the Mel filter bank can be calculated by the following formula:
[0229] H_m(k) = ∑[i = 0 to N - 1](X(i) * W_m(i,k)); where H_m(k) is the output of the m-th filter, X(i) is the i-th element of the spectrum, and W_m(i,k) is the response of the m-th filter at frequency k;
[0230] 5) Logarithm: Take the logarithm of each filter output to obtain the Mel spectrum;
[0231] S_m = log(H_m); where S_m is the output of the m-th filter, i.e., the Mel spectrum;
[0232] 6) Cepstral Transform: Perform cepstral transform on the Mel spectrum to obtain cepstral coefficients;
[0233] C_n = ∑[m = 0 to M - 1](S_m * cos((n * π * (m + 0.5)) / M)); where C_n is the n-th cepstral coefficient, S_m is the Mel spectrum, and M is the number of cepstral coefficients.
[0234] Step Three:
[0235] Suppose we have a set of MFCC feature vectors X = {x1, x2,..., xn} containing N training samples, and each feature vector xi belongs to a d-dimensional feature space.
[0236] Vector Quantization: Map each extracted MFCC feature vector to the nearest neighbor vector in a discrete codebook to achieve vector compression and representation.
[0237] The specific vector quantization formula is: vq(x) = argmin||x - c_j||. Where vq(x) is the nearest neighbor vector of the feature vector x in the codebook, c_j is the j-th vector in the codebook, and ||.|| represents the distance metric.
[0238] The goal of vector quantization is to divide the d-dimensional feature space into K regions and define a representative prototype vector for each region, denoted as C = {c1, c2,..., cK}.
[0239] Build an HMM model and use the sequence of vector-quantized MFCC feature vectors for speech modeling and recognition
[0240] 1) Prepare training data
[0241] Collect training data containing a large number of different speech samples, and extract MFCC feature vectors for each speech sample. Quantize these feature vectors, and map the continuous MFCC feature vectors to discrete codebook indices.
[0242] 2) Initialize HMM model parameters
[0243] Randomly initialize the transition probability matrix A, the observation probability matrix B, and the initial state probability vector π of the HMM model. There are N states and M observations, and the model parameters are Λ=(A, B, π).
[0244] A is the state transition matrix, representing the probability of transitioning from one state to another. The probability of transitioning from state i to state j can be represented by A(i, j).
[0245] B is the observation probability matrix, representing the probability distribution of generating different observations in each state. The probability of observing observation k in state j can be represented by B(j, k).
[0246] π is the initial state probability vector, representing the probability of being in each state initially. The probability of being in state i initially can be represented by π(i).
[0247] Train the model (parameter estimation)
[0248] Use the Baum-Welch algorithm or other statistical learning algorithms to estimate the parameters of the HMM model.
[0249] E step:
[0250] - According to the current model parameters and training data, use the forward-backward algorithm to calculate the probability of being in each hidden state at each moment given the observation sequence.
[0251] - Calculate the updated value of the observation probability matrix B: B(j, k)=sum(γ(t, j)*δ(o_t = k)) / sum(γ(t, j)), where γ(t, j) represents the posterior probability of being in state j at time t, and δ(o_t = k) represents the indicator function that observes the observation value o_t = k at time t.
[0252] M step:
[0253] - Update the value of the transition probability matrix A: A(i, j)=sum(a(i, j)) / sum(γ(t, i)), where a(i, j) represents the probability of transitioning from state i to state j given the training data.
[0254] - Update the value of the initial state probability vector π: π(i) = γ(1, i), that is, the probability of being in state i at the initial time given the training data.
[0255] Repeat the E-step and M-step until the model parameters converge or reach the preset number of iterations.
[0256] Decoding and Recognition
[0257] Extract the MFCC feature vectors from the speech to be recognized and convert them into a discrete sequence of codebook indices. Use the Viterbi algorithm to find the most likely hidden state sequence according to the trained HMM model and the observation sequence, that is, perform speech recognition.
[0258] 1) State transition probability matrix A:
[0259] A(i, j) = P(q_t = j | q_{t - 1} = i), representing the probability of transitioning from state i to state j.
[0260] 2) Observation probability matrix B:
[0261] B(j, k) = P(o_t = k | q_t = j), representing the probability of observing the observation value o_t = k in state j.
[0262] 3) Initial state probability vector π:
[0263] π(i) = P(q_1 = i), representing the probability of the state being i at the initial time.
[0264] Where q_t represents the hidden state at the t-th time, and o_t represents the observation value at the t-th time.
[0265] In the E-step, use the forward-backward algorithm to calculate the forward probability α and the backward probability β:
[0266] - Forward probability α(t, j): Represents the probability of being in state j at time t and observing the observation value sequence o_{1:t}.
[0267] - Backward probability β(t, j): Represents the probability of being in state j at time t and under the condition of the subsequent observation value sequence o_{t + 1:T}.
[0268] In the M-step, update the model parameters A, B, and π according to the calculated forward probability α and backward probability β:
[0269] - Update the transition probability matrix A:
[0270] A(i, j) = sum(α(t, i) * A(i, j) * B(j, o_{t + 1}) * β(t + 1, j)) / sum(α(t, i))
[0271] - Update the observation probability matrix B:
[0272] B(j,k) = sum(γ(t,j) * δ(o_t,k)) / sum(γ(t,j))
[0273] - Update the initial state probability vector π:
[0274] π(i) = γ(1,i)
[0275] where γ(t,j) represents the posterior probability of being in state j at time t, and δ(o_t,k) represents the indicator function of observing the observation value o_t = k at time t.
[0276] By iteratively executing the E-step and M-step, the model parameters are continuously updated until the model converges or reaches the preset number of iterations.
[0277] Finally, in the decoding and recognition stage, the Viterbi algorithm is used to find the most likely hidden state sequence according to the trained HMM model and the observation sequence, and then speech recognition is performed.
[0278] Embodiment 2
[0279] The difference between Embodiment 2 and Embodiment 1 is as follows:
[0280] Step 4: Feature matching and recognition: For the speech signal to be recognized, the MFCC algorithm is also used for feature extraction; then, using the trained VQ-HMM model, the probability of the given observation sequence is calculated by the forward-backward algorithm, so as to determine which hidden state (i.e., word / phoneme) the input speech signal belongs to; finally, classification and recognition decisions are made according to the scores;
[0281] Suppose we have a VQ-HMM model that contains K hidden states (represented by the prototype vector C), and the observation sequence is O = {o1, o2,..., oT}.
[0282] 1) Forward probability calculation: Use the forward algorithm to calculate the forward probability α of the given observation sequence. The forward probability represents the probability of being in state j at time t and observing the observation value sequence o_{1:t}.
[0283] α(t,j) = P(o_1, o_2,..., o_t, s_t = j) = ∑[α(t - 1,i) · A(i,j) · B(j,o_t)], where i represents the hidden state at the previous time.
[0284] Initial condition: α(1,j) = π(j) · B(j,o_1), which represents the probability of being in state j at the initial time and observing the first observation value o_1.
[0285] Recursive calculation: αt(j) = Σ[αt-1(i) * aij * b(ot|cj)], where aij is the transition probability from hidden state i to hidden state j, and b(ot|cj) is the probability that the observed value is ot when in hidden state j.
[0286] Termination: P(O) = ΣαT(j), where P(O) represents the probability of the given observation sequence O.
[0287] 2) Backward probability calculation: Use the backward algorithm to calculate the backward probability β of the given observation sequence. The backward probability represents the probability of being in state j at time t and given the subsequent observation sequence ot+1:T.
[0288] β(t,j) = P(ot+1, ot+2,..., oT|st = j) = ∑[A(i,j)·B(j,ot+1)·β(t+1,i)], where i represents the hidden state at the next time step.
[0289] Initial condition: β(T,j) = 1, indicating that the state probability at the last time step is 1.
[0290] Recursive calculation: βt(i) = Σ[aij * b(ot+1|cj) * βt+1(j)], where aij is the transition probability from hidden state i to hidden state j, and b(ot+1|cj) is the probability that the observed value is ot+1 when in hidden state j.
[0291] 3) Decision rule: Calculate the posterior probability γt(j) of each hidden state j given the observation sequence O: γt(j) = (αt(j) * βt(j)) / P(O), where αt(j) is the forward probability, βt(j) is the backward probability, and P(O) is the probability of the observation sequence.
[0292] By comparing the posterior probabilities γt(j) of all hidden states, find the hidden state with the maximum posterior probability as the recognition result. That is: j* = argmax(γt(j))
[0293] 4) Probability calculation: Calculate the overall probability P(O) of the given observation sequence.
[0294] P(O) = ∑[α(T,i)], where i represents the hidden state at the last time step.
[0295] 5) Score calculation: Based on the forward probability α and the backward probability β, the score of each hidden state can be calculated. A common method is to multiply or take the logarithm of the forward probability and the backward probability.
[0296] Score(j) = α(T,j)·β(T,j) or Score(j) = log(α(T,j)·β(T,j))
[0297] Classification and recognition decision: By comparing the scores of each hidden state, the input speech signal is classified into the hidden state with the highest score, i.e., the word / phoneme. According to a predefined threshold or by using other decision rules, the final recognition result can be determined.
[0298] Embodiment 3
[0299] The difference between Embodiment 3 and Embodiment 2 is as follows:
[0300] Step Five: Decoding and recognition: For the recognition result, some post-processing operations can be performed to improve accuracy and robustness; for example, a language model can be applied for statistical language modeling to enhance the coherence and semantic accuracy of the recognition result.
[0301] In the above specific embodiments, the technical problems solved, technical solutions, and beneficial effects of the present invention are further described in detail. It should be understood that the above are only specific embodiments of the present invention and are not used to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A speech recognition and analysis method based on the MFCC algorithm and the VQ-HMM algorithm, characterized in that, it includes the following steps: Step 1: Audio preprocessing: First, preprocess the input speech signal; this includes operations such as removing noise, reducing background noise, and adjusting the gain of the speech signal to improve the quality of subsequent feature extraction; Step 2: Feature extraction: Use the MFCC algorithm to extract features from the preprocessed speech signal; the MFCC algorithm frames the speech signal, filters each frame using a Mel filter bank, then converts the filtered result to the Mel frequency scale, and finally extracts cepstral coefficients through discrete cosine transform (DCT); these cepstral coefficients represent the spectral characteristics of the speech signal and are used for subsequent classification and recognition; Step 3: Training the model: It is divided into vector quantization, model establishment, model training, decoding and recognition, and use the VQ-HMM algorithm to train the speech recognition model; the VQ-HMM algorithm vector quantizes the MFCC feature vectors, maps the continuous feature vector sequence to a discrete symbol sequence, and then uses a hidden Markov model to model these symbol sequences; Step 4: Feature matching and recognition: For the speech signal to be recognized, also use the MFCC algorithm to extract features; then, use the trained VQ-HMM model to calculate the probability of the given observation sequence through the forward-backward algorithm, so as to judge which hidden state (i.e., word / phoneme) the input speech signal belongs to; finally, make a classification and recognition decision according to the score.
2. The speech recognition and analysis method based on the MFCC algorithm and the VQ-HMM algorithm according to claim 1, characterized in that, it includes the following steps: Step 1: Audio preprocessing: First, preprocess the input speech signal; this includes operations such as removing noise, reducing background noise, and adjusting the gain of the speech signal to improve the quality of subsequent feature extraction; Step 2: Feature extraction: Use the MFCC algorithm to extract features from the preprocessed speech signal; the MFCC algorithm frames the speech signal, filters each frame using a Mel filter bank, then converts the filtered result to the Mel frequency scale, and finally extracts cepstral coefficients through discrete cosine transform (DCT); these cepstral coefficients represent the spectral characteristics of the speech signal and are used for subsequent classification and recognition; Step 3: Training the model: It is divided into vector quantization, model establishment, model training, decoding and recognition, and use the VQ-HMM algorithm to train the speech recognition model; the VQ-HMM algorithm vector quantizes the MFCC feature vectors, maps the continuous feature vector sequence to a discrete symbol sequence, and then uses a hidden Markov model to model these symbol sequences; Step 4: Feature matching and recognition: For the speech signal to be recognized, also use the MFCC algorithm to extract features; then, use the trained VQ-HMM model to calculate the probability of the given observation sequence through the forward-backward algorithm, so as to judge which hidden state (i.e., word / phoneme) the input speech signal belongs to; finally, make a classification and recognition decision according to the score; Step Five: Decoding and Recognition: For the recognition results, some post-processing operations can be performed to improve accuracy and robustness; for example, a language model can be applied for statistical language modeling to enhance the coherence and semantic accuracy of the recognition results.
3. A speech recognition and analysis method based on the MFCC algorithm and the VQ-HMM algorithm according to claim 1, characterized in that, Step One includes: Pre-emphasis: Pre-emphasize the original speech signal to enhance the high-frequency part; y[n] = x[n] - a * x[n - 1]; where x[n] is the input speech signal, y[n] is the pre-emphasized signal, and a is the pre-emphasis coefficient (usually taken as 0.95 or 0.97).
4. A speech recognition and analysis method based on the MFCC algorithm and the VQ-HMM algorithm according to claim 1, characterized in that, Step Two includes: 1) Framing: Divide the pre-emphasized signal into short-time frames, usually with a duration of 20 - 40 milliseconds per frame; The framing formula is: x(n,m) = y(n * R + m), where x(n,m) is the nth sampling point of the mth frame, and R is the frame shift (usually half of the frame length); 2) Windowing: Apply a window function to each frame of the speech signal; The window function usually uses the Hamming Window, and the specific formula is: w[n] = 0.54 - 0.46 * cos(2 * π * n / (N - 1)); where w[n] is the window function, N is the window length, and n is the sample index within the window; 3) Fourier Transform: Perform a discrete Fourier transform (DFT) on each windowed frame of the speech signal; The specific formula is: X(k) = ∑[n = 0 to N - 1](x[n] * e^(-j * 2 * π * k * n / N)); where X(k) is the spectrum, x[n] is the windowed frame signal, N is the window length, and k is the frequency index; the length of the input sequence x[n] should be N, otherwise zero-padding or truncation is required; 4) Mel Filter Bank: Divide the spectrum into a series of Mel filter banks; The output of the Mel filter bank can be calculated by the following formula: H_m(k) = ∑[i = 0 to N - 1](X(i) * W_m(i,k)); where H_m(k) is the output of the mth filter, X(i) is the ith element of the spectrum, and W_m(i,k) is the response of the mth filter at frequency k; 5) Logarithm: Take the logarithm of each filter output to obtain the Mel spectrum; S_m = log(H_m); where S_m is the output of the mth filter, that is, the Mel spectrum; 6) Cepstral Transform: Perform a cepstral transform on the Mel spectrum to obtain cepstral coefficients; C_n = ∑[m = 0 to M - 1](S_m * cos((n * π * (m + 0.5)) / M)); where C_n is the nth cepstral coefficient, S_m is the Mel spectrum, and M is the number of cepstral coefficients.
5. A speech recognition and analysis method based on the MFCC algorithm and the VQ - HMM algorithm according to claim 1, characterized in that the vector quantization in step three is specifically as follows: Suppose we have a set of MFCC feature vectors X = {x1, x2,..., xn} containing N training samples, and each feature vector xi belongs to a d - dimensional feature space. Vector Quantization: Map each extracted MFCC feature vector to the nearest neighbor vector in a discrete codebook to achieve vector compression and representation. The specific vector quantization formula is: vq(x) = argmin||x - c_j||. Where vq(x) is the nearest neighbor vector of the feature vector x in the codebook, c_j is the jth vector in the codebook, and ||.|| represents the distance metric. The goal of vector quantization is to divide the d - dimensional feature space into K regions and define a representative prototype vector for each region, denoted as C = {c1, c2,..., cK}.
6. A speech recognition and analysis method based on the MFCC algorithm and the VQ - HMM algorithm according to claim 1, characterized in that the model establishment in step three is specifically as follows: Establish an HMM model and use the sequence of vector - quantized MFCC feature vectors for speech modeling and recognition 1) Prepare training data Collect training data containing a large number of different speech samples, and extract MFCC feature vectors for each speech sample. Vector - quantize these feature vectors to map the continuous MFCC feature vectors to discrete codebook indices. 2) Initialize the HMM model parameters Randomly initialize the transition probability matrix A, the observation probability matrix B, and the initial state probability vector π of the HMM model. There are N states and M observation values, and the model parameters are Λ = (A, B, π). A is the state transition matrix, representing the probability of transitioning from one state to another. The probability of transitioning from state i to state j can be represented by A(i, j). B is the observation probability matrix, representing the probability distribution of generating different observation values in each state. The probability of observing the observation value k in state j can be represented by B(j, k). π is the initial state probability vector, representing the probability of being in each state initially. The probability of being in state i initially can be represented by π(i).
7. A speech recognition and analysis method based on the MFCC algorithm and the VQ - HMM algorithm according to claim 1, characterized in that the model training in step three is specifically as follows: Train the model (parameter estimation) Use the Baum - Welch algorithm or other statistical learning algorithms to estimate the parameters of the HMM model. E step: - According to the current model parameters and training data, use the forward - backward algorithm to calculate the probability of being in each hidden state at each time given the observation sequence. - Calculate the updated value of the observation probability matrix B: B(j, k) = sum(γ(t, j) * δ(o_t = k)) / sum(γ(t, j)), where γ(t, j) represents the posterior probability of being in state j at time t, and δ(o_t = k) represents the indicator function of observing the observation value o_t = k at time t. M step: - Update the value of the transition probability matrix A: A(i, j) = sum(a(i, j)) / sum(γ(t, i)), where a(i, j) represents the probability of transitioning from state i to state j given the training data. - Update the value of the initial state probability vector π: π(i) = γ(1, i), that is, the probability of being in state i at the initial time given the training data. Repeat the E step and the M step until the model parameters converge or reach the preset number of iterations.
8. A speech recognition and analysis method based on the MFCC algorithm and the VQ - HMM algorithm according to claim 1, characterized in that the decoding and recognition in step three are specifically as follows: Decoding and recognition Extract the MFCC feature vectors of the speech to be recognized and convert them into a discrete codebook index sequence. Use the Viterbi algorithm to find the most likely hidden state sequence according to the trained HMM model and the observation sequence, that is, perform speech recognition. 1) State transition probability matrix A: A(i, j) = P(q_t = j|q_{t - 1} = i), representing the probability of transitioning from state i to state j. 2) Observation probability matrix B: B(j, k) = P(o_t = k|q_t = j), representing the probability of observing the observation value o_t = k in state j. 3) Initial state probability vector π: π(i) = P(q_1 = i), representing the probability of the state being i at the initial time. Where, q_t represents the hidden state at the t - th time, and o_t represents the observation value at the t - th time. In the E step, use the forward - backward algorithm to calculate the forward probability α and the backward probability β: - Forward probability α(t, j): Represents the probability of being in state j at time t and observing the observation value sequence o_{1:t}. - Backward probability β(t, j): Represents the probability of being in state j at time t and under the condition of the subsequent observation value sequence o_{t + 1:T}. In the M step, according to the calculated forward probability α and backward probability β, update the model parameters A, B, and π: - Update the transition probability matrix A: A(i, j) = sum(α(t, i) * A(i, j) * B(j, o_{t + 1}) * β(t + 1, j)) / sum(α(t, i)) - Update the observation probability matrix B: B(j, k) = sum(γ(t, j) * δ(o_t, k)) / sum(γ(t, j)) - Update the initial state probability vector π: π(i) = γ(1, i) Where, γ(t, j) represents the posterior probability of being in state j at time t, and δ(o_t, k) represents the indicator function of observing the observation value o_t = k at time t. By iteratively executing the E step and the M step, continuously update the model parameters until the model converges or reaches the preset number of iterations. Finally, in the decoding and recognition stage, the Viterbi algorithm is used to find the most likely hidden state sequence based on the trained HMM model and the observation sequence, and then speech recognition is performed.
9. A speech recognition and analysis method based on the MFCC algorithm and the VQ-HMM algorithm according to claim 1, characterized in that the calculation method in step four is specifically as follows: Suppose we have a VQ-HMM model, which contains K hidden states (represented by the prototype vector C), and the observation sequence is O = {o1, o2,..., oT}. 1) Forward probability calculation: Use the forward algorithm to calculate the forward probability α of the given observation sequence. The forward probability represents the probability of being in state j at time t and observing the observation value sequence o_{1:t}. α(t,j) = P(o_1, o_2,..., o_t, s_t = j) = ∑[α(t - 1,i)·A(i,j)·B(j,o_t)], where i represents the hidden state at the previous moment. Initial condition: α(1,j) = π(j)·B(j,o_1), which represents the probability of being in state j at the initial moment and observing the first observation value o_1. Recursive calculation: αt(j) = Σ[αt - 1(i)*aij*b(ot|cj)], where aij is the transition probability from hidden state i to hidden state j, and b(ot|cj) is the probability that the observation value is ot when in hidden state j. Termination: P(O) = ΣαT(j), where P(O) represents the probability of the given observation sequence O. 2) Backward probability calculation: Use the backward algorithm to calculate the backward probability β of the given observation sequence. The backward probability represents the probability of being in state j at time t and under the condition of the subsequent observation value sequence o_{t + 1:T}. β(t,j) = P(o_{t + 1}, o_{t + 2},..., o_T|s_t = j) = ∑[A(i,j)·B(j,o_{t + 1})·β(t + 1,i)], where i represents the hidden state at the next moment. Initial condition: β(T,j) = 1, which represents that the state probability at the last moment is 1. Recursive calculation: βt(i) = Σ[aij*b(ot + 1|cj)*βt + 1(j)], where aij is the transition probability from hidden state i to hidden state j, and b(ot + 1|cj) is the probability that the observation value is ot + 1 when in hidden state j. 3) Decision rule: Calculate the posterior probability γt(j) of each hidden state j under the given observation sequence O: γt(j) = (αt(j)*βt(j)) / P(O), where αt(j) is the forward probability, βt(j) is the backward probability, and P(O) is the probability of the observation sequence. By comparing the posterior probabilities γt(j) of all hidden states, find the hidden state with the maximum posterior probability as the recognition result. That is: j* = argmax(γt(j)). 4) Probability calculation: Calculate the overall probability P(O) of the given observation sequence. P(O) = ∑[α(T,i)], where i represents the hidden state at the last moment. 5) Score calculation: Based on the forward probability α and the backward probability β, the score of each hidden state can be calculated. A common method is to multiply or take the logarithm of the forward probability and the backward probability. Score(j) = α(T, j) · β(T, j) or Score(j) = log(α(T, j) · β(T, j)).
10. A speech recognition and analysis method based on the MFCC algorithm and the VQ-HMM algorithm according to claim 1, characterized in that the classification and recognition decision in step four is specifically: Classification and recognition decision: By comparing the scores of each hidden state, the input speech signal is classified into the hidden state with the highest score, i.e., the word / phoneme. According to a predefined threshold or other decision rules, the final recognition result can be determined.
Citation Information
Cited By
Loss and fatigue monitoring method for water gate opening and closing equipment
CN120761021A