Vehicle-mounted speech recognition method and device
By combining the depth-separable convolution and self-attention mechanism with the expanded scaling unit of hierarchical grouping linear transformation, the Transformer model is improved, solving the problem of low recognition efficiency in vehicle speech recognition, achieving efficient and accurate speech recognition, and adapting to new energy sources. Real-time response of cars and limited computing resources.
Patent Information
- Application Number
- CN202410925821.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2044-07-11
AI Technical Summary
Existing vehicle speech recognition methods are difficult to ensure recognition accuracy while meeting real-time and computing resource constraints, resulting in low recognition efficiency.
The encoder is built using depth-separable convolution and self-attention mechanism, combined with the expansion scaling unit of hierarchical grouped linear transformation, to improve the Transformer model, reduce the amount of model parameters and computational complexity, and improve adaptability through data preprocessing and noise removal. .
It achieves efficient speech recognition under real-time response and limited computing resources of new energy vehicles, improves recognition accuracy and efficiency, and adapts to noisy in-vehicle environments.
Smart Images

Figure CN118471203B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of speech recognition technology, and more specifically, to a vehicle-mounted speech recognition method and device. Background Art
[0002] At present, with the rapid development of intelligent driving technology, in-vehicle voice recognition systems have attracted much attention as an important way of human-computer interaction. Existing in-vehicle voice recognition methods usually use a voice processor to amplify, filter, denoise, and convert the collected voice information to obtain a voice digital signal, which is then input into the voice recognition processor, which then recognizes the voice digital signal to obtain a voice command. However, in practice, it is found that existing methods are difficult to ensure recognition accuracy while meeting the real-time nature of the in-vehicle environment, and are constrained by computing resources and low in accuracy, thereby reducing recognition efficiency. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a method and device for in-vehicle speech recognition, which can significantly reduce the number of parameters and computational complexity of in-vehicle speech recognition, can adapt to the computing power limitations of the in-vehicle environment, improve the ability to understand and model speech, and thus improve the accuracy and efficiency of in-vehicle speech recognition.
[0004] The first aspect of the present application provides a vehicle-mounted speech recognition method, comprising:
[0005] Collecting original voice data;
[0006] Performing data preprocessing on the original speech data to obtain feature data;
[0007] Performing labeling processing on the feature data to obtain labeled feature data;
[0008] The original encoder is constructed based on depthwise separable convolution and self-attention mechanism, and the original decoder is constructed based on dilated scaling units with layered grouped linear transformations.
[0009] The original encoder and the original decoder are trained by using the annotated feature data to obtain a vehicle-mounted speech recognition model;
[0010] Deploying the vehicle-mounted speech recognition model onto the vehicle-mounted hardware platform of the target vehicle;
[0011] Collecting user voice commands in real time through the microphone of the target vehicle;
[0012] Performing speech recognition processing through the vehicle-mounted speech recognition model and the user voice command to obtain a speech recognition result;
[0013] The semantic tags in the speech recognition result are identified to obtain the user's instruction intention.
[0014] In the above implementation process, this method can reduce the number of model parameters and computational complexity by improving the encoder and decoder structure of the Transformer model, while maintaining sufficient recognition accuracy, so that it can meet the requirements of real-time response and limited computing resources of new energy vehicles.
[0015] Furthermore, the data preprocessing of the original speech data to obtain feature data includes:
[0016] Using a pre-configured noise reduction unit to perform noise removal processing on the original speech data to obtain first processed data;
[0017] Performing data cleaning processing on the first processed data to obtain second processed data;
[0018] performing data segmentation processing on the second processed data to obtain preprocessed data;
[0019] Feature extraction is performed on the preprocessed data to obtain feature data.
[0020] Further, the extracting features from the preprocessed data to obtain feature data includes:
[0021] Performing pre-emphasis processing on the pre-processed data to obtain pre-emphasized audio data;
[0022] Dividing the pre-emphasized audio data to obtain multiple frames of audio data;
[0023] Applying a window function to each frame of the audio data to obtain a window weighted sequence of the audio data of each frame;
[0024] Performing fast Fourier transform on the window weighted sequence to obtain frequency domain data;
[0025] Mapping the frequency domain data to Mel frequencies to obtain Mel frequency triangular filter bank coefficients;
[0026] Performing logarithmic calculation on the Mel-frequency triangular filter bank coefficients to obtain logarithmic Mel-frequency spectrum coefficients;
[0027] Performing discrete cosine transform on the logarithmic Mel spectrum coefficients to obtain MFCC coefficients;
[0028] The MFCC coefficients are determined as feature data.
[0029] Furthermore, the labeling process of the feature data to obtain the labeled feature data includes:
[0030] Performing transcription processing on the feature data to obtain text data corresponding to each feature data;
[0031] Identify the text data to obtain a semantic label corresponding to each text data;
[0032] Each of the feature data is annotated according to the semantic label to obtain annotated feature data.
[0033] Furthermore, the original encoder includes an input representation layer, a plurality of encoder blocks, and a residual connection and normalization layer; wherein the input representation layer is used to convert the input data into a continuous representation space of the encoder model dimension through a linear projection algorithm; the encoder block includes a depth-separable convolutional coding layer and a multi-head self-attention layer;
[0034] The original decoder includes an expansion and scaling unit based on a hierarchical grouped linear transformation; wherein the parameters of the expansion and scaling unit include the number of layers, input dimension, output dimension and the maximum number of groups of the hierarchical grouped linear transformation.
[0035] Furthermore, the original encoder and the original decoder are trained by the annotated feature data to obtain a vehicle-mounted speech recognition model, including:
[0036] Integrating the original encoder and the original decoder to obtain an original recognition model;
[0037] Performing data enhancement processing on the labeled feature data to obtain a training data set;
[0038] Determine model training parameters; wherein the model training parameters include loss function, model optimization algorithm, gradient update algorithm, layer-by-layer adaptive learning rate, and training termination condition;
[0039] The original recognition model is trained according to the model training parameters and the training data set to obtain a vehicle-mounted speech model.
[0040] Furthermore, after identifying the semantic tags in the speech recognition result to obtain the user's instruction intention, the method further includes:
[0041] The target vehicle is controlled to perform corresponding operations according to the instruction intention.
[0042] A second aspect of the present application provides a vehicle-mounted speech recognition device, the vehicle-mounted speech recognition device comprising:
[0043] A first collection unit, used for collecting original voice data;
[0044] A preprocessing unit, used for performing data preprocessing on the original speech data to obtain feature data;
[0045] A labeling unit, used for labeling the feature data to obtain labeled feature data;
[0046] Building blocks for building primitive encoders based on depthwise separable convolutions and self-attention, and primitive decoders based on dilated scaling blocks with layered grouped linear transformations;
[0047] A training unit, used for training the original encoder and the original decoder by using the annotated feature data to obtain an in-vehicle speech recognition model;
[0048] A deployment unit, used to deploy the vehicle-mounted speech recognition model onto a vehicle-mounted hardware platform of a target vehicle;
[0049] A second collection unit, used to collect user voice commands in real time through a microphone of the target vehicle;
[0050] A first recognition unit, configured to perform speech recognition processing using the vehicle-mounted speech recognition model and the user voice command to obtain a speech recognition result;
[0051] The second recognition unit is used to recognize the semantic tags in the speech recognition result to obtain the user's instruction intention.
[0052] Furthermore, the preprocessing unit comprises:
[0053] A noise removal subunit, configured to perform noise removal processing on the original speech data using a pre-configured noise reduction unit to obtain first processed data;
[0054] a data cleaning subunit, configured to perform data cleaning on the first processed data to obtain second processed data;
[0055] A data segmentation subunit, used for performing data segmentation processing on the second processed data to obtain pre-processed data;
[0056] The feature extraction subunit is used to extract features from the preprocessed data to obtain feature data.
[0057] Furthermore, the feature extraction subunit includes:
[0058] A pre-emphasis module, used for performing pre-emphasis processing on the pre-processed data to obtain pre-emphasized audio data;
[0059] A division module, used for dividing the pre-emphasized audio data to obtain multiple frames of audio data;
[0060] An applying module, used for applying a window function to each frame of the audio data to obtain a window weighted sequence of the audio data of each frame;
[0061] A transformation module, used for performing a fast Fourier transform on the window weighted sequence to obtain frequency domain data;
[0062] A mapping module, used for mapping the frequency domain data to Mel frequency to obtain Mel frequency triangular filter bank coefficients;
[0063] A calculation module, used for performing logarithmic calculation on the Mel-frequency triangular filter bank coefficients to obtain logarithmic Mel-frequency spectrum coefficients;
[0064] The transformation module is further used to perform discrete cosine transformation on the logarithmic Mel spectrum coefficients to obtain MFCC coefficients;
[0065] A determination module is used to determine the MFCC coefficients as feature data.
[0066] Furthermore, the labeling unit includes:
[0067] A transcription subunit, used for performing transcription processing on the feature data to obtain text data corresponding to each feature data;
[0068] An identification subunit, used to identify the text data and obtain a semantic label corresponding to each of the text data;
[0069] The labeling subunit is used to label each feature data according to the semantic label to obtain labeled feature data.
[0070] Furthermore, the original encoder includes an input representation layer, a plurality of encoder blocks, and a residual connection and normalization layer; wherein the input representation layer is used to convert the input data into a continuous representation space of the encoder model dimension through a linear projection algorithm; the encoder block includes a depth-separable convolutional coding layer and a multi-head self-attention layer;
[0071] The original decoder includes an expansion and scaling unit based on a hierarchical grouped linear transformation; wherein the parameters of the expansion and scaling unit include the number of layers, input dimension, output dimension and the maximum number of groups of the hierarchical grouped linear transformation.
[0072] Furthermore, the training unit comprises:
[0073] An integration subunit, used for integrating the original encoder and the original decoder to obtain an original recognition model;
[0074] A data enhancement subunit, used to perform data enhancement processing on the labeled feature data to obtain a training data set;
[0075] A determination subunit is used to determine model training parameters; wherein the model training parameters include a loss function, a model optimization algorithm, a gradient update algorithm, a layer-by-layer adaptive learning rate, and a training termination condition;
[0076] The training subunit is used to train the original recognition model according to the model training parameters and the training data set to obtain a vehicle-mounted speech model.
[0077] Furthermore, the vehicle-mounted speech recognition device further includes:
[0078] The control unit is used to identify the semantic tags in the speech recognition result in the second recognition unit, obtain the user's instruction intention, and then control the target vehicle to perform corresponding operations according to the instruction intention.
[0079] A third aspect of the present application provides an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to perform the in-vehicle speech recognition method described in any one of the first aspects of the present application.
[0080] A fourth aspect of the present application provides a computer-readable storage medium storing computer program instructions. When the computer program instructions are read and executed by a processor, the vehicle-mounted speech recognition method described in any one of the first aspects of the present application is executed.
[0081] The beneficial effects of this application are:
[0082] (1) By improving the structure of the encoder and decoder of the Transformer model, a lightweight and efficient model suitable for in-vehicle speech recognition scenarios can be obtained, reducing the number of model parameters and computational complexity. While maintaining sufficient recognition accuracy, it can also meet the requirements of real-time response and limited computing resources of new energy vehicles.
[0083] (2) The model can improve its adaptability to low signal-to-noise ratio environments through methods such as data enhancement and noise removal, enabling it to maintain a high recognition accuracy in noisy in-vehicle environments;
[0084] (3) The model combines deep separable convolution and self-attention mechanism as encoders, which can significantly reduce the number of parameters and computational complexity, and adapt to the computing power constraints of the vehicle environment. At the same time, it innovatively uses the dilation and scaling unit of layered grouped linear transformation as the decoder, which further reduces the parameter scale while retaining the expressive power.
[0085] (4) By adopting an autoregressive end-to-end training method, the model can not only consider the current input when generating the output of each time step, but also refer to the output of the previous time step. It can be seen that this method helps the model better capture the temporal correlation and sequence information in the speech data, improves the ability to understand and model speech, and thus improves the accuracy of recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0086] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0087] Figure 1 A flowchart of a vehicle-mounted speech recognition method provided in an embodiment of the present application;
[0088] Figure 2 An example block diagram of a vehicle-mounted speech recognition method provided in an embodiment of the present application;
[0089] Figure 3 A flowchart of another in-vehicle speech recognition method provided in an embodiment of the present application;
[0090] Figure 4 An overall block diagram of a vehicle-mounted speech recognition method provided in an embodiment of the present application;
[0091] Figure 5 A schematic diagram of the structure of a vehicle-mounted speech recognition device provided in an embodiment of the present application;
[0092] Figure 6 A schematic diagram of the structure of another vehicle-mounted speech recognition device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0093] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0094] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0095] Example 1
[0096] Please see Figure 1 , Figure 1A flow chart of a vehicle-mounted speech recognition method provided in this embodiment. The vehicle-mounted speech recognition method includes:
[0097] S101, collecting original voice data.
[0098] S102: Preprocess the original speech data to obtain feature data.
[0099] S103: labeling the feature data to obtain labeled feature data.
[0100] S104. Construct an original encoder based on deep separable convolution and self-attention mechanism, and construct an original decoder based on dilation and scaling unit of layered grouped linear transformation.
[0101] S105. Train the original encoder and the original decoder by annotating feature data to obtain an in-vehicle speech recognition model.
[0102] S106: deploying the in-vehicle speech recognition model onto the in-vehicle hardware platform of the target vehicle.
[0103] S107. Collect user voice commands in real time through the microphone of the target vehicle.
[0104] S108: Perform speech recognition processing using the vehicle-mounted speech recognition model and the user's speech command to obtain a speech recognition result.
[0105] S109: Identify semantic tags in the speech recognition result to obtain the user's instruction intention.
[0106] Please see Figure 2 , Figure 2 An example block diagram of a vehicle-mounted speech recognition method is shown. Figure 2 The five most important steps of this application are shown:
[0107] S1, data collection and labeling;
[0108] S2, encoder design based on the combination of deep separable convolution and self-attention mechanism;
[0109] S3, decoder design based on hierarchical grouping linear transformation;
[0110] S4, In-vehicle speech recognition model training based on improved Transformer;
[0111] S5. Perform in-vehicle language recognition based on the trained in-vehicle speech recognition model to complete corresponding operations.
[0112] It can be seen that the content disclosed in this application is based on the refinement of the above five steps, and the above five steps are the instantiation framework of this application.
[0113] In this embodiment, the execution subject of the method may be a computing device such as a computer or a server, and no limitation is made in this embodiment.
[0114] In this embodiment, the execution subject of the method may also be a smart device such as a smart phone, a tablet computer, etc., which is not limited in this embodiment.
[0115] It can be seen that implementing the in-vehicle speech recognition method described in this embodiment can greatly reduce the number of parameters and computational complexity of in-vehicle speech recognition, can adapt to the computing power limitations of the in-vehicle environment, and improve the ability to understand and model speech, thereby improving the accuracy and efficiency of in-vehicle speech recognition.
[0116] Example 2
[0117] Please see Figure 3 , Figure 3 A flow chart of a vehicle-mounted speech recognition method provided in this embodiment. The vehicle-mounted speech recognition method includes:
[0118] S201, collecting original voice data.
[0119] In this embodiment, the original speech data collection of the vehicle-mounted speech recognition involves the use of hardware devices such as microphone array, trigger and memory, etc. Among them, the microphone array is composed of four MEMS (micro-electromechanical system) microphones with a sampling rate of 16bit / 44.1Khz.
[0120] For example, the data collector can drive the vehicle for a period of time (such as 1 minute, 2 minutes, 5 minutes, 10 minutes, 12 minutes, 15 minutes, etc.) according to his driving habits. During the driving process, the data collector can press the set trigger to start recording, and the recording ends when the trigger is released. When the recording ends, the generated audio file is transferred to the storage device via USB. Repeat the above data collection process to obtain the original voice data data.
[0121] S202: Use a pre-configured noise reduction unit to perform noise reduction processing on original speech data to obtain first processed data.
[0122] In this embodiment, this step can use the ADSP-21584 noise reduction unit of Analog Devices Inc to remove noise from the original voice data data, thereby reducing the interference of noise from the external environment (such as open windows, traffic, weather, etc.) on the voice signal.
[0123] S203: Perform data cleaning on the first processed data to obtain second processed data.
[0124] In this embodiment, this step can delete audio files with too much noise, files with too small audio volume, and audio files with damaged formats.
[0125] S204: Perform data segmentation processing on the second processed data to obtain pre-processed data.
[0126] In this embodiment, this step can divide the continuous audio stream into independent audio files according to the trigger operation, and mark the start and end of each audio file.
[0127] S205 , performing pre-emphasis processing on the pre-processed data to obtain pre-emphasized audio data.
[0128] In this embodiment, this step can perform pre-emphasis on the pre-processed data after noise removal, data cleaning and data segmentation. Pre-emphasis is a high-pass filter technology used to enhance high-frequency components and reduce energy attenuation of low-frequency components in speech signals.
[0129] S206: Divide the pre-emphasized audio data to obtain multiple frames of audio data.
[0130] In this embodiment, this step can divide the pre-emphasized audio data into adjacent short-time frames, wherein the frame shift is 10 ms and the frame length is 25 ms.
[0131] S207 . Apply a window function to each frame of audio data to obtain a window weighted sequence of each frame of audio data.
[0132] S208, performing fast Fourier transform on the window weighted sequence to obtain frequency domain data.
[0133] In this embodiment, this step may perform a fast Fourier transform (FFT) on the window weighted sequence of each frame to obtain frequency domain data.
[0134] S209, mapping the frequency domain data to Mel frequency to obtain Mel frequency triangular filter bank coefficients.
[0135] S210 , performing logarithm calculation on the Mel-frequency triangular filter bank coefficients to obtain logarithmic Mel-frequency spectrum coefficients.
[0136] In this embodiment, this step may take the logarithm of the Mel-frequency triangular filter bank coefficients to obtain the logarithmic Mel-frequency spectrum coefficients.
[0137] S211. Perform discrete cosine transform on the logarithmic Mel spectrum coefficients to obtain MFCC coefficients.
[0138] In this embodiment, the method may use Mel Frequency Cepstral Coefficients (MFCC) to extract features and obtain an input sequence.
[0139] In this embodiment, the method can perform discrete cosine transform (DCT) on the logarithmic Mel spectrum coefficients to obtain MFCC coefficients, which is the input sequence ,in is the MFCC feature vector at the tth time step, d feat is the dimension of MFCC features.
[0140] S212: Determine the MFCC coefficients as feature data.
[0141] S213: transcribe the feature data to obtain text data corresponding to each feature data.
[0142] In this embodiment, the method can automatically transcribe the feature data and transcribe the speech into text. The automatic transcription process can be converted into manual transcription when manual intervention is required.
[0143] S214: Identify the text data to obtain a semantic label corresponding to each text data.
[0144] S215: label each feature data according to the semantic label to obtain labeled feature data.
[0145] In this embodiment, the method can annotate the semantic label of each voice command based on the text transcription, including: "open the car window", "play music", "turn on the air conditioner" and "switch the driving mode", etc.
[0146] In this embodiment, the annotation feature data can be expressed as:
[0147] Input sequence: MFCC feature sequence X;
[0148] Output label features: semantic label label.
[0149] S216. Construct an original encoder based on deep separable convolution and self-attention mechanism, and construct an original decoder based on dilated scaling unit of layered grouped linear transformation.
[0150] In this embodiment, the original encoder includes an input representation layer, a plurality of encoder blocks, and a residual connection and a normalization layer; wherein the input representation layer is used to convert the input data into a continuous representation space of the encoder model dimension through a linear projection algorithm; the encoder block includes a depth-separable convolutional coding layer and a multi-head self-attention layer;
[0151] The original decoder includes an expansion and scaling unit based on a hierarchical grouped linear transformation; wherein the parameters of the expansion and scaling unit include the number of layers, input dimension, output dimension and the maximum number of groups of the hierarchical grouped linear transformation.
[0152] In this embodiment, the method is based on the self-attention mechanism of Transformer, combines the ideas of convolutional neural network (CNN) and deep separable convolution, and proposes a lightweight encoder structure.
[0153] Assuming that the input data is the MFCC feature sequence X (i.e. the above-mentioned labeled feature data), first, the method can give the MFCC feature sequence , maps the feature sequence X to the encoder model dimension d through linear projection model The continuous representation space of :
[0154] ;
[0155] in, is the word embedding, is the weight matrix of the word embedding matrix, is the bias matrix of word embedding.
[0156] At this time, in order to capture the position information of the sequence, absolute position encoding is used. positions, whose position encoding vector for:
[0157]
[0158] in , which aims to distinguish between odd and even positions. This encoding method makes the position encoding vectors corresponding to different position indexes have a certain periodicity. Due to the periodic decreasing characteristics of trigonometric functions, the position encoding vectors corresponding to distant position indexes are quite different, which helps the model better capture the relationship between positions.
[0159] Encode the position With word embedding Add together to get the input sequence containing position information :
[0160] .
[0161] In this embodiment, regarding the depthwise separable convolutional coding layer:
[0162] The traditional Transformer uses a fully connected feedforward neural network, which has a high computational complexity. In order to reduce the amount of computation, a depthwise separable convolution is used instead of a feedforward network, that is, a depthwise convolution is performed first, followed by a pointwise convolution operation. Specifically, for the input sequence , in the first layer, a one-dimensional depth convolution kernel is first used for convolution operation:
[0163] ;
[0164] in, is the depth convolution kernel weight of the i-th row, and k is the size of the convolution kernel;
[0165] The role of tk / 2+i is to start from the current time step t, move k / 2 positions forward and backward, and perform convolution operations within this range. Through this "alignment" method, the convolution kernel can be guaranteed to always align with the center of the sequence, thereby effectively capturing local features.
[0166] Output of depthwise convolution Perform point convolution operation:
[0167] ;
[0168] in, is the weight parameter of the point convolution, is the adjusted number of channels.
[0169] right Normalization and nonlinear activation are performed to obtain the output of the first layer :
[0170] ;
[0171] in, is the GELU activation function, is the cumulative distribution function of the standard normal distribution.
[0172] In this embodiment, the multi-head self-attention layer adopts the multi-head self-attention mechanism in Transformer. Linearly projecting onto query Q, key K, and value V, we get:
[0173] , , ;
[0174] in, , , is the weight matrix of the linear projection, and are the dimensions of the query / key and value of each attention head respectively.
[0175] Compute scaled dot product attention:
[0176] ;
[0177] For multi-head attention, Q, K, and V are calculated h times separately, and finally the attention outputs of all heads are concatenated to obtain the first-layer attention representation A1:
[0178] ;
[0179] ;
[0180] in, is a linear transformation used to project the output of the multi-head attention back to the model dimension .
[0181] In this embodiment, regarding residual connection and layer normalization:
[0182] In order to improve the expressiveness and gradient propagation of the model, a residual connection is made between the self-attention output A1 and the input H1 in the first layer, and layer normalization (LayerNorm) is performed to obtain the output O1 of the first layer:
[0183] .
[0184] In this embodiment, regarding the encoder stack:
[0185] The above depth-wise separable convolutional coding layer and multi-head self-attention layer are stacked alternately N times, that is, N such encoder blocks are constructed. Finally, the output of the last encoder block is As the output feature representation of the entire encoder, it is sent to the decoder for sequence generation.
[0186] In this embodiment, the decoder design based on hierarchical grouped linear transformation: based on the output feature representation of the encoder ,To generate the final speech recognition sequence, a lightweight decoder is designed.,The decoder adopts a dilation and scaling unit based on hierarchical,grouped linear transformation to reduce the computational complexity while maintaining sufficient,expression ability.
[0187] In this embodiment, regarding the hierarchical grouping linear transformation:
[0188] Traditional fully connected layers will lead to excessive parameters, so we introduce hierarchical grouping linear transformation. Different from fully connected, it allows neurons to be grouped, and each group is only connected to some neurons in the previous layer, thus greatly reducing the number of parameters. For an N-layer fully connected network, n l With k l are the input and output of the lth layer, g l is the number of groups of neurons in layer l. For a normal fully connected network, the parameter is , if the hierarchical grouping linear transformation is adopted, its parameter quantity is It can be seen that when the number of network layers and the number of neurons in each layer are the same, the number of parameters of the layered group linear transformation is the same as that of the fully connected network. .
[0189] In this embodiment, regarding the expansion and scaling unit:
[0190] Based on the hierarchical grouped linear transformation, a dilation and scaling unit is designed for the decoder. The unit first expands the input to a higher dimension to give it stronger expressive power, and then shrinks it back to the output dimension layer by layer to control the number of parameters. The dilation and scaling unit is controlled by four parameters: (1) the number of layers D; (2) the input dimension d i ; (3) Output dimension d o ; (4) Maximum number of groups g for hierarchical grouping linear transformation max .
[0191] In the expansion phase, the dimension is d i The input vector will be mapped layer by layer to a dimension of d in the first [D / 2] layers. max =m w d i In the contraction phase, the remaining [D / 2] layers are used to shrink the highest dimension d max Transform to output dimension d o . Hierarchical Grouped Linear Transformation The input is the output feature representation of the encoder O N Or the output of the middle layer , is the segmentation mixing function, the output of the first layer is Y l The calculation process is shown as follows:
[0192] ;
[0193] ;
[0194] in, is the hierarchical grouped linear transformation, , is the weight matrix and bias vector of the current layer.
[0195] For the obtained layer l output , add a softmax layer to output the final one-hot prediction output of the decoder:
[0196] ;
[0197] in, and are the weight matrix and bias vector of the softmax layer respectively.
[0198] The final output probability distribution P is the predicted distribution probability of the decoder for each target word.
[0199] In this embodiment, the decoder uses an expansion and scaling unit based on hierarchical grouped linear transformation, breaking through the bottleneck of large number of parameters and complex calculation of traditional fully connected decoders. The decoder can effectively reduce the number of parameters and the amount of calculation while retaining sufficient expression ability, providing a good solution for real-time processing and resource constraints of in-vehicle speech recognition tasks.
[0200] By implementing this implementation, the encoder can extract local features using deep convolution (deep convolution only operates on the channel dimension, while point-by-point convolution only operates on the spatial dimension) to achieve the effect of sparse interaction. This sparse interaction can reduce the number of parameters of the model and reduce the complexity of the model. Among them, the self-attention mechanism captures long-range dependencies, and the encoder structure is lightweight and efficient, which meets the high-precision requirements of new energy vehicles.
[0201] On the other hand, the dilated scaling decoder unit based on layered grouped linear transformation can divide the l-layer neurons into g l The group is transformed by layered grouping linearly, and its parameter amount is 1 / g of the corresponding fully connected network l At the same time, the method of first expanding and then contracting is used to retain sufficient expressive power, which solves the problem of high computational overhead of traditional decoders and improves the generalization ability of the model in actual vehicle environments.
[0202] S217, integrating the original encoder and the original decoder to obtain an original recognition model.
[0203] In this embodiment, the method can form an improved Transformer vehicle-mounted speech recognition model based on the integration of the encoder and the decoder.
[0204] S218: Perform data enhancement processing on the labeled feature data to obtain a training data set.
[0205] In this embodiment, the method can import the labeled feature data in batches, and perform data enhancement on the input MFCC feature sequence X of each batch, such as adding Gaussian noise, time distortion, etc., to improve the generalization ability of the model.
[0206] S219, determining model training parameters; wherein the model training parameters include a loss function, a model optimization algorithm, a gradient update algorithm, a layer-by-layer adaptive learning rate, and a training termination condition.
[0207] In this embodiment, given the input MFCC sequence X and the label sequence label, the training model is forced to output the correct label at each time step, using the cross entropy loss function (i.e., the above loss function):
[0208] ;
[0209] in, is the label one-hot vector, is the probability that the model outputs Y given X.
[0210] In this example, regarding loss calculation and gradient update:
[0211] The Adam optimization algorithm is used to perform gradient updates on the encoder / decoder parameters according to the loss function L:
[0212] ;
[0213] in, represents the parameters to be updated, which can be the weight matrix and bias vector in the encoder and decoder;
[0214] is the learning rate, which controls the step size of each parameter update;
[0215] Represents the loss function Parameters The gradient of , which represents the rate of change of the loss function with respect to the parameters.
[0216] It can be seen that by multiplying the learning rate , the parameters can be updated according to the direction and magnitude of the gradient , so that the loss function gradually decreases and the model can better adapt to the training data. The updated parameters It will be used in the next iteration of training process.
[0217] In this embodiment, regarding the layer-by-layer adaptive learning rate: different learning rates are assigned to different layers, and the learning rate of the lower layer is smaller than that of the higher layer, so that the basic features obtained by the lower layer can be protected from being destroyed.
[0218] In this embodiment, regarding the training termination condition: according to the loss function value of the validation set, when the loss cannot be reduced for N consecutive epochs, the training process is terminated.
[0219] S220: Train the original recognition model according to the model training parameters and the training data set to obtain a vehicle-mounted speech model.
[0220] In this embodiment, the method uses an autoregressive approach to perform end-to-end training on the model.
[0221] In this embodiment, model saving: the final model parameters are saved at the end of training as a deployment model for in-vehicle speech recognition.
[0222] By implementing this implementation, the model can autonomously learn the ability of speech recognition from the training data through the above end-to-end training process. In practical applications, the trained model can also be compressed (such as quantized or pruned) to meet the computing resource constraints of the vehicle environment.
[0223] This implementation enables end-to-end training using autoregressive methods, so that the model considers the output of previous time steps when generating output, rather than just the input of the current time step. It can be seen that this method enables the model to better capture the temporal correlation and sequence information in the speech data, thereby improving recognition accuracy. Introducing the cross entropy loss function: Introducing the cross entropy loss function to measure the model output With label By minimizing the cross entropy loss, the model is forced to produce the correct output at each time step, which promotes the model to learn more accurate speech recognition features. Adopt layer-by-layer adaptive learning rate: The learning rates of different layers are set to different values to protect the basic features obtained at the bottom layer from being affected by the update of high-level parameters. Therefore, such a design helps ensure that the model better learns features at different levels of abstraction during training.
[0224] S221. Deploy the vehicle-mounted speech recognition model onto the vehicle-mounted hardware platform of the target vehicle.
[0225] S222. Collect user voice commands in real time through the microphone of the target vehicle.
[0226] S223: Perform voice recognition processing using the vehicle-mounted voice recognition model and the user's voice command to obtain a voice recognition result.
[0227] S224: Identify semantic tags in the speech recognition result to obtain the user's instruction intention.
[0228] For example, deploy the trained in-vehicle speech recognition model to the in-vehicle hardware platform. When the user's voice command is collected through the microphone, the following steps are performed:
[0229] (1) Speech pre-processing: noise reduction, data cleaning and other pre-processing of the collected raw speech data;
[0230] (2) Speech feature extraction: Extract the MFCC features of speech as input to the recognition model;
[0231] (3) Speech recognition: MFCC is input into the recognition model, and the model outputs the recognition result and its corresponding semantic label;
[0232] (4) Semantic understanding: parsing semantic tags and identifying the user’s instruction intent;
[0233] (5) Task execution: Based on the recognition results, perform corresponding in-vehicle operations, such as opening windows, playing music, etc.
[0234] By implementing this embodiment, the vehicle-mounted voice recognition system can capture and understand the user's voice commands in real time and automatically execute corresponding vehicle-mounted tasks, bringing the user a more natural and convenient human-computer interaction experience.
[0235] S225. Control the target vehicle to perform corresponding operations according to the instruction intention.
[0236] Please see Figure 4 , Figure 4 An overall block diagram of an in-vehicle speech recognition method is shown.
[0237] In this embodiment, the execution subject of the method may be a computing device such as a computer or a server, and no limitation is made in this embodiment.
[0238] In this embodiment, the execution subject of the method may also be a smart device such as a smart phone, a tablet computer, etc., which is not limited in this embodiment.
[0239] It can be seen that implementing the in-vehicle speech recognition method described in this embodiment can greatly reduce the number of parameters and computational complexity of in-vehicle speech recognition, can adapt to the computing power limitations of the in-vehicle environment, and improve the ability to understand and model speech, thereby improving the accuracy and efficiency of in-vehicle speech recognition.
[0240] Example 3
[0241] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of a vehicle-mounted speech recognition device provided in this embodiment. Figure 5 As shown, the vehicle-mounted speech recognition device includes:
[0242] The first collection unit 310 is used to collect original voice data;
[0243] The preprocessing unit 320 is used to perform data preprocessing on the original speech data to obtain feature data;
[0244] The labeling unit 330 is used to label the feature data to obtain labeled feature data;
[0245] A construction unit 340, configured to construct an original encoder based on a depthwise separable convolution and a self-attention mechanism, and an original decoder based on a dilation and scaling unit of a hierarchical grouped linear transformation;
[0246] A training unit 350, used to train the original encoder and the original decoder by annotating feature data to obtain a vehicle-mounted speech recognition model;
[0247] A deployment unit 360, used to deploy the vehicle-mounted speech recognition model onto a vehicle-mounted hardware platform of a target vehicle;
[0248] The second collection unit 370 is used to collect user voice commands in real time through the microphone of the target vehicle;
[0249] The first recognition unit 380 is used to perform speech recognition processing through the vehicle-mounted speech recognition model and the user's voice command to obtain a speech recognition result;
[0250] The second recognition unit 390 is used to recognize semantic tags in the speech recognition result to obtain the user's instruction intention.
[0251] In this embodiment, the explanation of the vehicle-mounted voice recognition device can refer to the description in Embodiment 1 or Embodiment 2, and will not be further elaborated in this embodiment.
[0252] It can be seen that the implementation of the in-vehicle speech recognition device described in this embodiment can greatly reduce the number of parameters and computational complexity of in-vehicle speech recognition, can adapt to the computing power limitations of the in-vehicle environment, improve the ability to understand and model speech, and thus improve the accuracy and efficiency of in-vehicle speech recognition.
[0253] Example 4
[0254] Please see Figure 6 , Figure 6 This is a schematic diagram of the structure of a vehicle-mounted speech recognition device provided in this embodiment. Figure 6 As shown, the vehicle-mounted speech recognition device includes:
[0255] The first collection unit 310 is used to collect original voice data;
[0256] The preprocessing unit 320 is used to perform data preprocessing on the original speech data to obtain feature data;
[0257] The labeling unit 330 is used to label the feature data to obtain labeled feature data;
[0258] A construction unit 340, configured to construct an original encoder based on a depthwise separable convolution and a self-attention mechanism, and an original decoder based on a dilation and scaling unit of a hierarchical grouped linear transformation;
[0259] A training unit 350, used to train the original encoder and the original decoder by annotating feature data to obtain a vehicle-mounted speech recognition model;
[0260] A deployment unit 360, used to deploy the vehicle-mounted speech recognition model onto a vehicle-mounted hardware platform of a target vehicle;
[0261] The second collection unit 370 is used to collect user voice commands in real time through the microphone of the target vehicle;
[0262] The first recognition unit 380 is used to perform speech recognition processing through the vehicle-mounted speech recognition model and the user's voice command to obtain a speech recognition result;
[0263] The second recognition unit 390 is used to recognize semantic tags in the speech recognition result to obtain the user's instruction intention.
[0264] As an optional implementation, the preprocessing unit 320 includes:
[0265] The noise removal subunit 321 is used to perform noise removal processing on the original speech data using a pre-configured noise reduction unit to obtain first processed data;
[0266] The data cleaning subunit 322 is used to perform data cleaning processing on the first processed data to obtain second processed data;
[0267] The data segmentation subunit 323 is used to perform data segmentation processing on the second processed data to obtain pre-processed data;
[0268] The feature extraction subunit 324 is used to extract features from the preprocessed data to obtain feature data.
[0269] As an optional implementation, the feature extraction subunit 324 includes:
[0270] A pre-emphasis module, used for performing pre-emphasis processing on the pre-processed data to obtain pre-emphasized audio data;
[0271] A division module, used for dividing the pre-emphasized audio data to obtain multiple frames of audio data;
[0272] An applying module, used for applying a window function to each frame of audio data to obtain a window weighted sequence of each frame of audio data;
[0273] A transform module, used for performing fast Fourier transform on the window weighted sequence to obtain frequency domain data;
[0274] A mapping module, used for mapping frequency domain data to Mel frequency to obtain Mel frequency triangular filter bank coefficients;
[0275] A calculation module, used for performing logarithmic calculation on the Mel frequency triangular filter bank coefficients to obtain logarithmic Mel frequency spectrum coefficients;
[0276] The transformation module is also used to perform discrete cosine transformation on the logarithmic Mel spectrum coefficients to obtain MFCC coefficients;
[0277] The determination module is used to determine the MFCC coefficients as feature data.
[0278] As an optional implementation, the labeling unit 330 includes:
[0279] The transcription subunit 331 is used to transcribe the feature data to obtain text data corresponding to each feature data;
[0280] The recognition subunit 332 is used to recognize the text data and obtain the semantic label corresponding to each text data;
[0281] The labeling subunit 333 is used to label each feature data according to the semantic label to obtain labeled feature data.
[0282] In this embodiment, the original encoder includes an input representation layer, a plurality of encoder blocks, and a residual connection and a normalization layer; wherein the input representation layer is used to convert the input data into a continuous representation space of the encoder model dimension through a linear projection algorithm; the encoder block includes a depth-separable convolutional coding layer and a multi-head self-attention layer;
[0283] The original decoder includes an expansion and scaling unit based on a hierarchical grouped linear transformation; wherein the parameters of the expansion and scaling unit include the number of layers, input dimension, output dimension and the maximum number of groups of the hierarchical grouped linear transformation.
[0284] As an optional implementation, the training unit 350 includes:
[0285] An integration subunit 351 is used to integrate the original encoder and the original decoder to obtain an original recognition model;
[0286] The data enhancement subunit 352 is used to perform data enhancement processing on the labeled feature data to obtain a training data set;
[0287] A determination subunit 353 is used to determine model training parameters; wherein the model training parameters include a loss function, a model optimization algorithm, a gradient update algorithm, a layer-by-layer adaptive learning rate, and a training termination condition;
[0288] The training subunit 354 is used to train the original recognition model according to the model training parameters and the training data set to obtain the vehicle-mounted speech model.
[0289] As an optional implementation, the vehicle-mounted speech recognition device further includes:
[0290] The control unit 400 is used to identify the semantic tags in the speech recognition result in the second recognition unit, obtain the user's instruction intention, and then control the target vehicle to perform corresponding operations according to the instruction intention.
[0291] In this embodiment, the explanation of the vehicle-mounted voice recognition device can refer to the description in Embodiment 1 or Embodiment 2, and will not be further elaborated in this embodiment.
[0292] It can be seen that the implementation of the in-vehicle speech recognition device described in this embodiment can greatly reduce the number of parameters and computational complexity of in-vehicle speech recognition, can adapt to the computing power limitations of the in-vehicle environment, improve the ability to understand and model speech, and thus improve the accuracy and efficiency of in-vehicle speech recognition.
[0293] An embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the in-vehicle speech recognition method in embodiment 1 or embodiment 2 of the present application.
[0294] An embodiment of the present application provides a computer-readable storage medium storing computer program instructions. When the computer program instructions are read and executed by a processor, the vehicle-mounted speech recognition method in Embodiment 1 or Embodiment 2 of the present application is executed.
[0295] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0296] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0297] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
[0298] The above description is only an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0299] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0300] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
Claims
1. A vehicle-mounted speech recognition method, characterized in that: include: Collecting original voice data; Performing data preprocessing on the original speech data to obtain feature data; Performing labeling processing on the feature data to obtain labeled feature data; The original encoder is constructed based on depthwise separable convolution and self-attention mechanism, and the original decoder is constructed based on dilated scaling units with layered grouped linear transformations. The original encoder and the original decoder are trained by using the annotated feature data to obtain a vehicle-mounted speech recognition model; Deploying the vehicle-mounted speech recognition model onto the vehicle-mounted hardware platform of the target vehicle; Collecting user voice commands in real time through the microphone of the target vehicle; Performing speech recognition processing through the vehicle-mounted speech recognition model and the user voice command to obtain a speech recognition result; Identify the semantic tags in the speech recognition result to obtain the user's instruction intention; The original encoder includes an input representation layer, a plurality of encoder blocks, and a residual connection and a normalization layer; wherein the input representation layer is used to convert input data into a continuous representation space of the encoder model dimension through a linear projection algorithm; the encoder block includes a depth-separable convolutional coding layer and a multi-head self-attention layer; The original decoder includes an expansion and scaling unit based on a hierarchical grouped linear transformation; wherein the parameters of the expansion and scaling unit include the number of layers, input dimension, output dimension and the maximum number of groups of the hierarchical grouped linear transformation.
2. The vehicle-mounted speech recognition method according to claim 1, characterized in that: The step of performing data preprocessing on the original speech data to obtain feature data includes: Using a pre-configured noise reduction unit to perform noise removal processing on the original speech data to obtain first processed data; Performing data cleaning processing on the first processed data to obtain second processed data; performing data segmentation processing on the second processed data to obtain preprocessed data; Feature extraction is performed on the preprocessed data to obtain feature data.
3. The vehicle-mounted speech recognition method according to claim 2, characterized in that: The step of extracting features from the preprocessed data to obtain feature data includes: Performing pre-emphasis processing on the pre-processed data to obtain pre-emphasized audio data; Dividing the pre-emphasized audio data to obtain multiple frames of audio data; Applying a window function to each frame of the audio data to obtain a window weighted sequence of the audio data of each frame; Performing fast Fourier transform on the window weighted sequence to obtain frequency domain data; Mapping the frequency domain data to Mel frequencies to obtain Mel frequency triangular filter bank coefficients; Performing logarithmic calculation on the Mel-frequency triangular filter bank coefficients to obtain logarithmic Mel-frequency spectrum coefficients; Performing discrete cosine transform on the logarithmic Mel spectrum coefficients to obtain MFCC coefficients; The MFCC coefficients are determined as feature data.
4. The vehicle-mounted speech recognition method according to claim 1, characterized in that: The labeling process of the feature data to obtain the labeled feature data includes: Performing transcription processing on the feature data to obtain text data corresponding to each feature data; Identify the text data to obtain a semantic label corresponding to each text data; Each of the feature data is annotated according to the semantic label to obtain annotated feature data.
5. The vehicle-mounted speech recognition method according to claim 1, characterized in that: The training of the original encoder and the original decoder by using the annotated feature data to obtain a vehicle-mounted speech recognition model includes: Integrating the original encoder and the original decoder to obtain an original recognition model; Performing data enhancement processing on the labeled feature data to obtain a training data set; Determine model training parameters; wherein the model training parameters include loss function, model optimization algorithm, gradient update algorithm, layer-by-layer adaptive learning rate, and training termination condition; The original recognition model is trained according to the model training parameters and the training data set to obtain a vehicle-mounted speech model.
6. The vehicle-mounted speech recognition method according to claim 1, characterized in that: After identifying the semantic tags in the speech recognition result and obtaining the user's instruction intention, the method further includes: The target vehicle is controlled to perform corresponding operations according to the instruction intention.
7. A vehicle-mounted speech recognition device, characterized in that: The vehicle-mounted speech recognition device comprises: A first collection unit, used for collecting original voice data; A preprocessing unit, used for performing data preprocessing on the original speech data to obtain feature data; A labeling unit, used for labeling the feature data to obtain labeled feature data; Building blocks for building primitive encoders based on depthwise separable convolutions and self-attention, and primitive decoders based on dilated scaling blocks with layered grouped linear transformations; A training unit, used for training the original encoder and the original decoder by using the annotated feature data to obtain an in-vehicle speech recognition model; A deployment unit, used to deploy the vehicle-mounted speech recognition model onto a vehicle-mounted hardware platform of a target vehicle; A second collection unit, used to collect user voice commands in real time through a microphone of the target vehicle; A first recognition unit, configured to perform speech recognition processing using the vehicle-mounted speech recognition model and the user voice command to obtain a speech recognition result; A second recognition unit is used to recognize semantic tags in the speech recognition result to obtain the user's instruction intention; The original encoder includes an input representation layer, a plurality of encoder blocks, and a residual connection and a normalization layer; wherein the input representation layer is used to convert input data into a continuous representation space of the encoder model dimension through a linear projection algorithm; the encoder block includes a depth-separable convolutional coding layer and a multi-head self-attention layer; The original decoder includes an expansion and scaling unit based on a hierarchical grouped linear transformation; wherein the parameters of the expansion and scaling unit include the number of layers, input dimension, output dimension and the maximum number of groups of the hierarchical grouped linear transformation.
8. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to perform the in-vehicle speech recognition method according to any one of claims 1 to 6.
9. A readable storage medium, characterized in that: The readable storage medium stores computer program instructions, and when the computer program instructions are read and executed by a processor, the vehicle-mounted speech recognition method according to any one of claims 1 to 6 is executed.
