Speech recognition method, network model, device and storage medium
By introducing an efficient attention mechanism and Transformer framework into the UNet network, the long-range context interaction ability for time series data is enhanced, solving the problem of UNet network's insufficient ability to capture the context of time series data, and improving the accuracy and system efficiency of speech recognition. .
Patent Information
- Application Number
- CN202411015280.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-10-11
AI Technical Summary
The UNet network has weak ability to interact with long-range context of time series data and cannot fully capture long-range contextual relationships, which affects the speech recognition effect.
Combining UNet and the efficient attention mechanism, by designing the end-to-end encoder and decoder structures under the Transformer framework, using efficient attention modules and cross-attention modules to perform feature compression and up and down sampling, and enhance the network's capture of multi-scale information. and utilization.
It improves the accuracy of speech recognition and context understanding, reduces the amount of network parameters and training time, and improves system efficiency and practicality.
Smart Images

Figure CN118762691A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of speech recognition technology, and in particular to a speech recognition method, network model, device and storage medium. Background Art
[0002] UNet is a deep learning network structure for image segmentation. Its core idea is to achieve accurate pixel-level prediction by learning the skip connection between the encoder and decoder.
[0003] The overall structure of UNet is U-shaped, so it is called UNet. It consists of an encoder and a decoder. The encoder is used to extract image features, while the decoder passes the feature map back to the original resolution through jump connections and produces pixel-level prediction results. The encoder part generally uses a convolutional neural network, which gradually reduces the spatial dimension of the features through a series of convolution and pooling operations and increases the number of feature channels. This helps to extract high-level semantic features of the image. The decoder part gradually restores the spatial dimension of the features through upsampling and jump connections. The upsampling operation usually uses deconvolution or upsampling operations to restore the feature map to the same size as the input image. The jump connection connects the feature map in the encoder with the corresponding feature map in the decoder to help transfer low-level and high-level feature information. The jump connection of UNet helps to retain multi-scale detail information and can solve the problem of blurred object boundaries in segmentation tasks.
[0004] However, UNet has weak long-range contextual interaction capabilities for time series data (such as speech, audio, etc.). This is due to the structural characteristics of the UNet network and the local receptive field of the convolution and upsampling operations it uses. For tasks with time series data, such as speech recognition, some key information may span a long time range and need to capture long-range contextual information. In this case, the local receptive field of UNet may not be able to fully capture these long-range contextual relationships, thus affecting its effect when applied to time series features. Summary of the invention
[0005] The present application provides a speech recognition method, network model, device and storage medium, which solves the technical problem that the structural characteristics of the UNet network lead to weak long-range context interaction capabilities for time series data, and cannot fully capture these long-range contextual relationships, thereby affecting the effect of applying to time series features.
[0006] In view of this, the first aspect of the present application provides a speech recognition method, the method comprising:
[0007] Step S1, obtaining input audio;
[0008] Step S2: input the input audio into a speech recognition network model based on UNet and efficient attention, and obtain a speech recognition result output by the speech recognition network model, wherein:
[0009] The speech recognition network model based on UNet and efficient attention is an end-to-end encoder and decoder UNet structure, and the UNet structure is applied in the transformer framework;
[0010] The plurality of encoder layers included in the encoder and the plurality of decoder layers included in the decoder are symmetrical;
[0011] Each encoder layer consists of an efficient attention module and a feed-forward network, downsampling is performed in each encoder layer, and the output of each encoder layer is jump-connected to the symmetrical decoder layer;
[0012] Each of the decoder layers includes a criss-cross attention module and upsampling is performed in each of the decoder layers.
[0013] Optionally, the efficient attention module is used to perform feature compression processing.
[0014] Optionally, the output X of the efficient attention module is specifically:
[0015] X = QS;
[0016]
[0017] Q=qW Q1 ,K=kW K1 ,V=vW V1 ;
[0018] in, `
[0019] d = (d*(ni)) / n, n represents the number of encoder layers, i represents the i-th encoder layer, S represents the attention score, is the scaling factor.
[0020] Optionally, the jump connection of the output of each encoder layer to the symmetrical decoder layer is specifically:
[0021] The encoder corresponds to the output X of the i-th encoder layer i and the input Y of the ni-th decoder layer in the decoder n-i Skip connections.
[0022] The second aspect of the present application provides a speech recognition network model, specifically:
[0023] The speech recognition network model is a UNet structure of an end-to-end encoder and decoder, and the UNet structure is applied under the transformer framework;
[0024] The plurality of encoder layers included in the encoder and the plurality of decoder layers included in the decoder are symmetrical;
[0025] Each encoder layer consists of an efficient attention module and a feed-forward network, downsampling is performed in each encoder layer, and the output of each encoder layer is jump-connected to the symmetrical decoder layer;
[0026] Each of the decoder layers includes a criss-cross attention module and upsampling is performed in each of the decoder layers.
[0027] Optionally, the efficient attention module is used to perform feature compression processing.
[0028] Optionally, the output X of the efficient attention module is specifically:
[0029] X = QS;
[0030]
[0031] Q=qW Q1 ,K=kW K1 ,V=vW V1 ;
[0032] in, `
[0033] d = (d*(ni)) / n, n represents the number of encoder layers, i represents the i-th encoder layer, S represents the attention score, is the scaling factor.
[0034] Optionally, the jump connection of the output of each encoder layer to the symmetrical decoder layer is specifically:
[0035] The encoder corresponds to the output X of the i-th encoder layer i and the input Y of the ni-th decoder layer in the decoder n-i Skip connections.
[0036] A third aspect of the present application provides a speech recognition device, the device comprising a processor and a memory:
[0037] The memory is used to store program code and transmit the program code to the processor;
[0038] The processor is used to execute the steps of the method for speech recognition based on UNet and efficient attention as described in the first aspect above according to the instructions in the program code.
[0039] A fourth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store program code, and the program code is used to execute the method described in the first aspect above.
[0040] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0041] In the present application, a speech recognition method, network model, device and storage medium are provided. By combining UNet and efficient attention mechanism, multi-scale detail information can be better captured and utilized, thereby improving the accuracy of speech recognition, wherein the jump connection of UNet helps to retain key time-frequency features and pass them to the decoding stage, making the recognition result more accurate; the efficient attention mechanism enables the network to better model the dependencies of long-range contexts, capture the global information in the speech signal, and improve the understanding and modeling capabilities of the context. Embedding the U-shaped structure of UNet into the Transformer framework can fully utilize the advantages of jump connections and feature reuse, reduce the number of network parameters, and accelerate the training process of the network, improve the efficiency and practicality of the system, and solve the technical problem that the structural characteristics of the UNet network lead to weak long-range context interaction capabilities for time series data, and cannot fully capture these long-range contextual relationships, thereby affecting the effect of applying to time series features. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A method flow chart of the speech recognition method in an embodiment of the present application;
[0043] Figure 2 This is a structural diagram of the speech recognition network model in the embodiment of the present application;
[0044] Figure 3 This is a structural diagram of a speech recognition device in an embodiment of the present application;
[0045] Figure 4 This is the network structure diagram of the traditional self-attention mechanism;
[0046] Figure 5 A network structure diagram of an efficient attention module provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0048] This application designs a speech recognition method, network model, device and storage medium to solve the technical problem that the structural characteristics of the UNet network lead to weak long-range context interaction capabilities for time series data, and are unable to fully capture these long-range contextual relationships, thus affecting the effect of applying to time series features.
[0049] For easier understanding, see Figure 1 , Figure 1 is a method flow chart of the speech recognition method in the embodiment of the present application, such as Figure 1 As shown, specifically:
[0050] Step S1, obtaining input audio;
[0051] Step S2: input the input audio into the speech recognition network model based on UNet and efficient attention, and obtain the speech recognition result output by the speech recognition network model, wherein:
[0052] The speech recognition network model based on UNet and efficient attention is an end-to-end encoder and decoder UNet structure, and the UNet structure is applied in the transformer framework;
[0053] The encoder includes a plurality of encoder layers and the decoder includes a plurality of decoder layers that are symmetrical;
[0054] Each encoder layer consists of an efficient attention module and a feed-forward network, downsampling is performed in each encoder layer, and the output of each encoder layer is skip-connected to the symmetrical decoder layer;
[0055] Each decoder layer includes a criss-cross attention module and upsampling is performed in each decoder layer.
[0056] It should be noted that when taking audio signals as input, preprocessing is usually required, such as framing, windowing, Fourier transform, etc.
[0057] The audio signal passes through the encoder layers, each layer extracts features and downsamples them, while passing the features to the decoder through skip connections.
[0058] The decoder layer uses a criss-cross attention module to combine the global information of the encoder and the local information of the decoder to gradually generate prediction results.
[0059] The decoder layer gradually restores the spatial resolution of the prediction results through upsampling and refines the output of speech recognition.
[0060] The model finally outputs a text sequence, which represents the recognition result of the input audio.
[0061] During the training process, a loss function (such as cross entropy loss) is used to measure the difference between the predicted text and the true text and optimize the model parameters.
[0062] The symmetric encoder-decoder structure of UNet is adopted, in which the encoder gradually extracts features and reduces the dimension, and the decoder gradually restores the features and generates output. In the encoder, each layer performs a downsampling operation to reduce the spatial dimension of the features while increasing the abstraction level of the features. In the decoder, each layer performs an upsampling operation to gradually restore the spatial dimension of the features while refining the prediction results.
[0063] By introducing the jump connection of UNet, this method can retain multi-scale detail information. This is very important for tasks such as speech recognition, because speech signals contain rich spectral and time domain features, which may exist at different scales.
[0064] The jump connections of UNet can help the network effectively capture and utilize this multi-scale information, thereby improving the performance of speech recognition.
[0065] In addition, applying the UNet network to the Transformer framework can also bring other benefits. Transformer is a network architecture based on the self-attention mechanism, which has strong modeling capabilities and the advantages of parallel computing. The U-shaped structure of UNet can further accelerate network training and reduce the number of network parameters. This is because the skip connections and feature reuse in the UNet network can reduce information loss during training and improve the expressiveness of features without increasing the number of network layers.
[0066] like Figure 2 As shown, Figure 2 This is a structural diagram of the speech recognition network model in the embodiment of the present application, which adopts an end-to-end encoder-decoder structure, and the encoder and decoder are symmetrical.
[0067] Each encoder layer consists of an efficient attention module and a feed-forward network, and the decoder also includes a criss-cross attention module.
[0068] Different from the traditional transformer model, this network uses the UNet principle to downsample each sub-layer in the encoder, upsample in each decoder, and jump-connect the output of each layer of the encoder to the decoder.
[0069] Skip connections connect features in the encoder with corresponding features in the decoder to help transfer low-level and high-level feature information.
[0070] Furthermore, an efficient attention module is used to perform feature compression processing.
[0071] It should be noted that an efficient attention method is used to compress features for each encoder. On the one hand, this can solve the problem of the computational complexity and time complexity of the self-attention mechanism being squared with the output length. On the other hand, it can reduce the number of parameters and calculations in the subsequent feedforward network, greatly improving the model inference speed.
[0072] Furthermore, the output X of the efficient attention module is specifically:
[0073] X = QS;
[0074]
[0075] Q=qW Q1 ,K=kW K1 ,V=vW V1 ;
[0076] in, `
[0077] d = (d*(ni)) / n, n represents the number of encoder layers, i represents the i-th encoder layer, S represents the attention score, is the scaling factor.
[0078] It should be noted that if Figure 4 and Figure 5 As shown, Figure 4 This is the network structure diagram of the traditional self-attention mechanism. Figure 5 A network structure diagram of an efficient attention module provided in an embodiment of the present application.
[0079] For traditional self-attention, the feature output X can be expressed as:
[0080] X=SV
[0081]
[0082] Q=qW Q ,K=kW K ,V=vW V
[0083] Here, and h represents the attention space of h heads, which is convenient for capturing the attention features of different spaces; S represents the attention score, the scaling factor It is used to reduce the T The impact of dot product calculation on the Softmax(·) function.
[0084] It is worth noting that S∈R T×T (T represents the length of the input sequence), so the computational complexity of obtaining S is T 2 , which is difficult to handle long sequence problems.
[0085] The efficient attention method provided in the embodiment of the present application has a feature output X calculation process as follows:
[0086] X=QS
[0087]
[0088] Q=qW Q1 ,K=kW K1 ,V=vW V1
[0089] Here, where d ` =(d*(ni)) / n, n represents the number of encoder layers, i represents the i-th sublayer. Here The size of is not determined by the input length, but by the size of the feature dimension of each layer. At the same time, in the sub-layers behind the encoder or the sub-layers before the decoder, d ` will be smaller, which helps speed up the model.
[0090] Furthermore, the output of each encoder layer is jump-connected to the symmetric decoder layer as follows:
[0091] The encoder corresponds to the output X of the i-th encoder layer i and the input Y of the ni-th decoder layer in the decoder n-i Skip connections.
[0092] It should be noted that for the skip connection of the network, since the network follows the UNet structure, the encoder and decoder are symmetrical. Therefore, the encoder corresponds to the output X of the i-th layer i It can be combined with the input Y of the ni-th sub-layer in the decoder n-i Skip connections. Skip connections connect features in the encoder with corresponding features in the decoder to help transfer low-level and high-level feature information.
[0093] See also Figure 2 , Figure 2 Schematic diagram of the structure of the speech recognition network model in the embodiment of the present application. Figure 2 As shown, specifically:
[0094] The speech recognition network model is an end-to-end encoder and decoder UNet structure, and the UNet structure is applied under the transformer framework;
[0095] The encoder includes a plurality of encoder layers and the decoder includes a plurality of decoder layers that are symmetrical;
[0096] Each encoder layer consists of an efficient attention module and a feed-forward network, downsampling is performed in each encoder layer, and the output of each encoder layer is skip-connected to the symmetrical decoder layer;
[0097] Each decoder layer includes a criss-cross attention module and upsampling is performed in each decoder layer.
[0098] It should be noted that when taking audio signals as input, preprocessing is usually required, such as framing, windowing, Fourier transform, etc.
[0099] The audio signal passes through the encoder layers, each layer extracts features and downsamples them, while passing the features to the decoder through skip connections.
[0100] The decoder layer uses a criss-cross attention module to combine the global information of the encoder and the local information of the decoder to gradually generate prediction results.
[0101] The decoder layer gradually restores the spatial resolution of the prediction results through upsampling and refines the output of speech recognition.
[0102] The model finally outputs a text sequence, which represents the recognition result of the input audio.
[0103] During the training process, a loss function (such as cross entropy loss) is used to measure the difference between the predicted text and the true text and optimize the model parameters.
[0104] The symmetric encoder-decoder structure of UNet is adopted, in which the encoder gradually extracts features and reduces the dimension, and the decoder gradually restores the features and generates output. In the encoder, each layer performs a downsampling operation to reduce the spatial dimension of the features while increasing the abstraction level of the features. In the decoder, each layer performs an upsampling operation to gradually restore the spatial dimension of the features while refining the prediction results.
[0105] By introducing the jump connection of UNet, this method can retain multi-scale detail information. This is very important for tasks such as speech recognition, because speech signals contain rich spectral and time domain features, which may exist at different scales.
[0106] The jump connections of UNet can help the network effectively capture and utilize this multi-scale information, thereby improving the performance of speech recognition.
[0107] In addition, applying the UNet network to the Transformer framework can also bring other benefits. Transformer is a network architecture based on the self-attention mechanism, which has strong modeling capabilities and the advantages of parallel computing. The U-shaped structure of UNet can further accelerate network training and reduce the number of network parameters. This is because the skip connections and feature reuse in the UNet network can reduce information loss during training and improve the expressiveness of features without increasing the number of network layers.
[0108] like Figure 2 As shown, Figure 2 This is a structural diagram of the speech recognition network model in the embodiment of the present application, which adopts an end-to-end encoder-decoder structure, and the encoder and decoder are symmetrical.
[0109] Each encoder layer consists of an efficient attention module and a feed-forward network, and the decoder also includes a criss-cross attention module.
[0110] Different from the traditional transformer model, this network uses the UNet principle to downsample each sub-layer in the encoder, upsample in each decoder, and jump-connect the output of each layer of the encoder to the decoder.
[0111] Skip connections connect features in the encoder with corresponding features in the decoder to help transfer low-level and high-level feature information.
[0112] Furthermore, an efficient attention module is used to perform feature compression processing.
[0113] It should be noted that an efficient attention method is used to compress features for each encoder. On the one hand, this can solve the problem of the computational complexity and time complexity of the self-attention mechanism being squared with the output length. On the other hand, it can reduce the number of parameters and calculations in the subsequent feedforward network, greatly improving the model inference speed.
[0114] Furthermore, the output X of the efficient attention module is specifically:
[0115] X = QS;
[0116]
[0117] Q=qW Q1 ,K=kW K1 ,V=vW V1 ;
[0118] in, `
[0119] d = (d*(ni)) / n, n represents the number of encoder layers, i represents the i-th encoder layer, S represents the attention score, is the scaling factor.
[0120] It should be noted that if Figure 4 and Figure 5 As shown, Figure 4 This is the network structure diagram of the traditional self-attention mechanism. Figure 5 A network structure diagram of an efficient attention module provided in an embodiment of the present application.
[0121] For traditional self-attention, the feature output X can be expressed as:
[0122] X=SV
[0123]
[0124] Q=qW Q ,K=kW K ,V=vW V
[0125] Here, and h represents the attention space of h heads, which is convenient for capturing the attention features of different spaces; S represents the attention score, the scaling factor It is used to reduce the T The impact of dot product calculation on the Softmax(·) function.
[0126] It is worth noting that (T represents the length of the input sequence), so the computational complexity of obtaining S is T 2 , which is difficult to handle long sequence problems.
[0127] The efficient attention method provided in the embodiment of the present application has a feature output X calculation process as follows:
[0128] X=QS
[0129]
[0130] Q=qW Q1,K=kW K1 ,V=vW V1
[0131] Here, where d ` =(d*(ni)) / n, n represents the number of encoder layers, i represents the i-th sublayer. Here The size of is not determined by the input length, but by the size of the feature dimension of each layer. At the same time, in the sub-layers behind the encoder or the sub-layers before the decoder, d ` will be smaller, which helps speed up the model.
[0132] Furthermore, the output of each encoder layer is jump-connected to the symmetric decoder layer as follows:
[0133] The encoder corresponds to the output X of the i-th encoder layer i and the input Y of the ni-th decoder layer in the decoder n-i Skip connections.
[0134] It should be noted that for the skip connection of the network, since the network follows the UNet structure, the encoder and decoder are symmetrical. Therefore, the encoder corresponds to the output X of the i-th layer i It can be combined with the input Y of the ni-th sub-layer in the decoder n-i Skip connections. Skip connections connect features in the encoder with corresponding features in the decoder to help transfer low-level and high-level feature information.
[0135] The present application embodiment also provides another speech recognition device based on UNet and efficient attention, such as Figure 3 For the sake of convenience, only the parts related to the embodiments of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiments of the present application. The terminal can be any terminal device including a mobile phone, a tablet computer, a personal digital assistant (English full name: Personal Digital Assistant, English abbreviation: PDA), a sales terminal (English full name: Point of Sales, English abbreviation: POS), a car computer, etc., taking the terminal as a mobile phone as an example:
[0136] Figure 3 FIG. 1 is a block diagram showing a partial structure of a mobile phone related to a terminal provided in an embodiment of the present application. Figure 3The mobile phone includes: a radio frequency (RF) circuit 1010, a memory 1020, an input unit 1030, a display unit 1040, a sensor 1050, an audio circuit 1060, a wireless fidelity (WiFi) module 1070, a processor 1080, and a power supply 1090. Those skilled in the art can understand that Figure 3 The mobile phone structure shown in the figure does not constitute a limitation on the mobile phone, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0137] Combine the following Figure 3 A detailed introduction to the various components of the mobile phone:
[0138] The RF circuit 1010 can be used for receiving and sending signals during information transmission or calls. In particular, after receiving the downlink information of the base station, it is sent to the processor 1080 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit 1010 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (full name: Low Noise Amplifier, English abbreviation: LNA), a duplexer, etc. In addition, the RF circuit 1010 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communications can use any communication standard or protocol, including but not limited to Global System of Mobile communications (Global System of Mobile communication, English abbreviation: GSM), General Packet Radio Service (General Packet Radio Service, GPRS), Code Division Multiple Access (Code Division Multiple Access, English abbreviation: CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (Long Term Evolution, English abbreviation: LTE), e-mail, Short Messaging Service (SMS), etc.
[0139] The memory 1020 can be used to store software programs and modules. The processor 1080 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 1020. The memory 1020 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 1020 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0140] The input unit 1030 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the mobile phone. Specifically, the input unit 1030 may include a touch panel 1031 and other input devices 1032. The touch panel 1031, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 1031 or near the touch panel 1031 using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel 1031 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 1080, and can receive and execute commands sent by the processor 1080. In addition, the touch panel 1031 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 1031, the input unit 1030 may further include other input devices 1032. Specifically, the other input devices 1032 may include but are not limited to one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
[0141] The display unit 1040 can be used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 1040 may include a display panel 1041. Optionally, the display panel 1041 may be configured in the form of a liquid crystal display (full name in English: Liquid Crystal Display, English abbreviation: LCD), an organic light-emitting diode (full name in English: Organic Light-Emitting Diode, English abbreviation: OLED), etc. Further, the touch panel 1031 may cover the display panel 1041. When the touch panel 1031 detects a touch operation on or near it, it is transmitted to the processor 1080 to determine the type of touch event. Subsequently, the processor 1080 provides a corresponding visual output on the display panel 1041 according to the type of touch event. Although in Figure 3 In the embodiment, the touch panel 1031 and the display panel 1041 are used as two independent components to realize the input and output functions of the mobile phone, but in some embodiments, the touch panel 1031 and the display panel 1041 can be integrated to realize the input and output functions of the mobile phone.
[0142] The mobile phone may also include at least one sensor 1050, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 1041 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 1041 and / or the backlight when the mobile phone is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can be configured in the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be repeated here.
[0143] The audio circuit 1060, the speaker 1061, and the microphone 1062 can provide an audio interface between the user and the mobile phone. The audio circuit 1060 can transmit the received audio data to the speaker 1061 after converting the received audio data into an electrical signal, which is converted into a sound signal for output; on the other hand, the microphone 1062 converts the collected sound signal into an electrical signal, which is received by the audio circuit 1060 and converted into audio data, and then the audio data is output to the processor 1080 for processing, and then sent to another mobile phone through the RF circuit 1010, or the audio data is output to the memory 1020 for further processing.
[0144] WiFi is a short-range wireless transmission technology. The mobile phone can help users send and receive emails, browse web pages and access streaming media through the WiFi module 1070. It provides users with wireless broadband Internet access. Figure 3 A WiFi module 1070 is shown, but it is understandable that it is not an essential component of the mobile phone and can be omitted as needed without changing the essence of the invention.
[0145] The processor 1080 is the control center of the mobile phone. It uses various interfaces and lines to connect various parts of the entire mobile phone. By running or executing software programs and / or modules stored in the memory 1020 and calling data stored in the memory 1020, it executes various functions of the mobile phone and processes data, thereby monitoring the mobile phone as a whole. Optionally, the processor 1080 may include one or more processing units; preferably, the processor 1080 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 1080.
[0146] The mobile phone also includes a power supply 1090 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 1080 through a power management system, so that the power management system can manage functions such as charging, discharging, and power consumption.
[0147] Although not shown, the mobile phone may also include a camera, a Bluetooth module, etc., which will not be described in detail here.
[0148] In the embodiment of the present application, the processor 1080 included in the terminal also has the following functions:
[0149] Step S1, obtaining input audio;
[0150] Step S2: input the input audio into the speech recognition network model based on UNet and efficient attention, and obtain the speech recognition result output by the speech recognition network model, wherein:
[0151] The speech recognition network model based on UNet and efficient attention is an end-to-end encoder and decoder UNet structure, and the UNet structure is applied in the transformer framework;
[0152] The encoder includes a plurality of encoder layers and the decoder includes a plurality of decoder layers that are symmetrical;
[0153] Each encoder layer consists of an efficient attention module and a feed-forward network, downsampling is performed in each encoder layer, and the output of each encoder layer is skip-connected to the symmetrical decoder layer;
[0154] Each decoder layer includes a criss-cross attention module and upsampling is performed in each decoder layer.
[0155] It should be noted that when taking audio signals as input, preprocessing is usually required, such as framing, windowing, Fourier transform, etc.
[0156] The audio signal passes through the encoder layers, each layer extracts features and downsamples them, while passing the features to the decoder through skip connections.
[0157] The decoder layer uses a criss-cross attention module to combine the global information of the encoder and the local information of the decoder to gradually generate prediction results.
[0158] The decoder layer gradually restores the spatial resolution of the prediction results through upsampling and refines the output of speech recognition.
[0159] The model finally outputs a text sequence, which represents the recognition result of the input audio.
[0160] During the training process, a loss function (such as cross entropy loss) is used to measure the difference between the predicted text and the true text and optimize the model parameters.
[0161] The symmetric encoder-decoder structure of UNet is adopted, in which the encoder gradually extracts features and reduces the dimension, and the decoder gradually restores the features and generates output. In the encoder, each layer performs a downsampling operation to reduce the spatial dimension of the features while increasing the abstraction level of the features. In the decoder, each layer performs an upsampling operation to gradually restore the spatial dimension of the features while refining the prediction results.
[0162] By introducing the jump connection of UNet, this method can retain multi-scale detail information. This is very important for tasks such as speech recognition, because speech signals contain rich spectral and time domain features, which may exist at different scales.
[0163] The jump connections of UNet can help the network effectively capture and utilize this multi-scale information, thereby improving the performance of speech recognition.
[0164] In addition, applying the UNet network to the Transformer framework can also bring other benefits. Transformer is a network architecture based on the self-attention mechanism, which has strong modeling capabilities and the advantages of parallel computing. The U-shaped structure of UNet can further accelerate network training and reduce the number of network parameters. This is because the skip connections and feature reuse in the UNet network can reduce information loss during training and improve the expressiveness of features without increasing the number of network layers.
[0165] like Figure 2 As shown, Figure 2 This is a structural diagram of the speech recognition network model in the embodiment of the present application, which adopts an end-to-end encoder-decoder structure, and the encoder and decoder are symmetrical.
[0166] Each encoder layer consists of an efficient attention module and a feed-forward network, and the decoder also includes a criss-cross attention module.
[0167] Different from the traditional transformer model, this network uses the UNet principle to downsample each sub-layer in the encoder, upsample in each decoder, and jump-connect the output of each layer of the encoder to the decoder.
[0168] Skip connections connect features in the encoder with corresponding features in the decoder to help transfer low-level and high-level feature information.
[0169] Furthermore, an efficient attention module is used to perform feature compression processing.
[0170] It should be noted that an efficient attention method is used to compress features for each encoder. On the one hand, this can solve the problem of the computational complexity and time complexity of the self-attention mechanism being squared with the output length. On the other hand, it can reduce the number of parameters and calculations in the subsequent feedforward network, greatly improving the model inference speed.
[0171] Furthermore, the output X of the efficient attention module is specifically:
[0172] X = QS;
[0173]
[0174] Q=qW Q1 ,K=kW K1 ,V=vW V1 ;
[0175] in, `
[0176] d = (d*(ni)) / n, n represents the number of encoder layers, i represents the i-th encoder layer, S represents the attention score, is the scaling factor.
[0177] It should be noted that if Figure 4 and Figure 5 As shown, Figure 4 This is the network structure diagram of the traditional self-attention mechanism. Figure 5 A network structure diagram of an efficient attention module provided in an embodiment of the present application.
[0178] For traditional self-attention, the feature output X can be expressed as:
[0179] X=SV
[0180]
[0181] Q=qW Q ,K=kW K ,V=vW V
[0182] Here, and h represents the attention space of h heads, which is convenient for capturing the attention features of different spaces; S represents the attention score, the scaling factor It is used to reduce the T The impact of dot product calculation on the Softmax(·) function.
[0183] It is worth noting that (T represents the length of the input sequence), so the computational complexity of obtaining S is T 2 , which is difficult to handle long sequence problems.
[0184] The efficient attention method provided in the embodiment of the present application has a feature output X calculation process as follows:
[0185] X=QS
[0186]
[0187] Q=qW Q1 ,K=kW K1 ,V=vW V1
[0188] Here, where d ` =(d*(ni)) / n, n represents the number of encoder layers, i represents the i-th sublayer. Here The size of is not determined by the input length, but by the size of the feature dimension of each layer. At the same time, in the sub-layers behind the encoder or the sub-layers before the decoder, d ` will be smaller, which helps speed up the model.
[0189] Furthermore, the output of each encoder layer is jump-connected to the symmetric decoder layer as follows:
[0190] The encoder corresponds to the output X of the i-th encoder layer i and the input Y of the ni-th decoder layer in the decoder n-i Skip connections.
[0191] It should be noted that for the skip connection of the network, since the network follows the UNet structure, the encoder and decoder are symmetrical. Therefore, the encoder corresponds to the output X of the i-th layer i It can be combined with the input Y of the ni-th sub-layer in the decoder n-i Skip connections. Skip connections connect features in the encoder with corresponding features in the decoder to help transfer low-level and high-level feature information.
[0192] An embodiment of the present application also provides a computer-readable storage medium for storing program code, wherein the program code is used to execute any one of the implementation methods of a speech recognition method described in the aforementioned embodiments.
[0193] In the embodiment of the present application, a speech recognition method, network model, device and storage medium are provided. By combining UNet and efficient attention mechanism, multi-scale detail information is better captured and utilized, thereby improving the accuracy of speech recognition, wherein the jump connection of UNet helps to retain key time-frequency features and pass them to the decoding stage, making the recognition result more accurate; the efficient attention mechanism enables the network to better model the dependencies of long-range contexts, capture the global information in the speech signal, and improve the understanding and modeling capabilities of the context. Embedding the U-shaped structure of UNet into the Transformer framework can fully utilize the advantages of jump connections and feature reuse, reduce the number of network parameters, and accelerate the training process of the network, improve the efficiency and practicality of the system, and solve the technical problem that the structural characteristics of the UNet network lead to weak long-range context interaction capabilities for time series data, and cannot fully capture these long-range contextual relationships, thereby affecting the effect of applying to time series features.
[0194] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0195] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0196] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0197] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0198] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0199] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0200] If the integrated unit is implemented in the form of a software functional unit 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 is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a 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 (full name in English: Read-Only Memory, English abbreviation: ROM), random access memory (full name in English: Random Access Memory, English abbreviation: RAM), disk or optical disk and other media that can store program codes.
[0201] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A speech recognition method, characterized in that: include: Step S1, obtaining input audio; Step S2: input the input audio into a speech recognition network model based on UNet and efficient attention, and obtain a speech recognition result output by the speech recognition network model, wherein: The speech recognition network model based on UNet and efficient attention is an end-to-end encoder and decoder UNet structure, and the UNet structure is applied in the transformer framework; The plurality of encoder layers included in the encoder and the plurality of decoder layers included in the decoder are symmetrical; Each encoder layer consists of an efficient attention module and a feed-forward network, downsampling is performed in each encoder layer, and the output of each encoder layer is jump-connected to the symmetrical decoder layer; Each of the decoder layers includes a criss-cross attention module and upsampling is performed in each of the decoder layers.
2. The speech recognition method based on UNet and efficient attention according to claim 1, characterized in that: The efficient attention module is used to perform feature compression processing.
3. The speech recognition method based on UNet and efficient attention according to claim 2, characterized in that: The output X of the efficient attention module is specifically: X = QS; Q=qW Q1 ,K=kW K1 ,V=vW V1 ; in, ` d = (d*(ni)) / n, n represents the number of encoder layers, i represents the i-th encoder layer, S represents the attention score, is the scaling factor.
4. The speech recognition method based on UNet and efficient attention according to claim 1, characterized in that: The jump connection of the output of each encoder layer to the symmetrical decoder layer is specifically: The encoder corresponds to the output X of the i-th encoder layer i and the input Y of the ni-th decoder layer in the decoder n-i Skip connections.
5. A speech recognition network model, characterized in that: The speech recognition network model is a UNet structure of an end-to-end encoder and decoder, and the UNet structure is applied under the transformer framework; The plurality of encoder layers included in the encoder and the plurality of decoder layers included in the decoder are symmetrical; Each encoder layer consists of an efficient attention module and a feed-forward network, downsampling is performed in each encoder layer, and the output of each encoder layer is jump-connected to the symmetrical decoder layer; Each of the decoder layers includes a criss-cross attention module and upsampling is performed in each of the decoder layers.
6. The speech recognition network model according to claim 5, characterized in that: The efficient attention module is used to perform feature compression processing.
7. The speech recognition network model according to claim 6, characterized in that: The output X of the efficient attention module is specifically: X = QS; Q=qW Q1 ,K=kW K1 ,V=vW V1 ; in, ` d = (d*(ni)) / n, n represents the number of encoder layers, i represents the i-th encoder layer, S represents the attention score, is the scaling factor.
8. The speech recognition network model according to claim 5, characterized in that: The jump connection of the output of each encoder layer to the symmetrical decoder layer is specifically: The encoder corresponds to the output X of the i-th encoder layer i and the input Y of the ni-th decoder layer in the decoder n-i Skip connections.
9. A speech recognition device based on UNet and efficient attention, characterized in that: The device comprises a processor and a memory: The memory is used to store program codes and transmit the program codes to the processor; The processor is used to execute the speech recognition method according to any one of claims 1 to 4 according to the instructions in the program code.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store program codes, and the program codes are used to execute the speech recognition method according to any one of claims 1 to 4.
