A speech recognition method, device, medium and computing device

By introducing an auxiliary task layer and a feature fusion layer into the speech recognition model, integrating acoustic information and text sequence context information, and using the loss function of the auxiliary task layer in training, the problems of low speech recognition accuracy and vanishing gradients are solved, significantly. Improved model performance.

CN115064153BActive Publication Date: 2024-09-06HANGZHOU NETEASE ZHIQI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210615439.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-31
Publication Date
2024-09-06
Estimated Expiration
2042-05-31

AI Technical Summary

Technical Problem

Existing speech recognition technology has limited accuracy when processing complex human speech, and is prone to vanishing gradient problems, resulting in limited improvement in model performance.

Method used

Using a combination of auxiliary task layer and feature fusion layer, by classifying the output vector of the auxiliary task layer, and inputting it and the classification results to the feature fusion layer for feature fusion, the fusion of acoustic information and text sequence context information is achieved, and at the same time, The loss function of the auxiliary task layer is introduced in model training to alleviate the vanishing gradient problem.

Benefits of technology

It improves the accuracy of speech recognition, enhances the learning ability of the model, alleviates the vanishing gradient problem, and improves speech recognition performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115064153B
    Figure CN115064153B
Patent Text Reader

Abstract

The embodiment of the present disclosure provides a speech recognition method, including: inputting the speech features corresponding to the speech to be recognized into a pre-trained speech recognition model, and encoding the features by an encoder; in response to the current coding layer being an auxiliary task layer, a first classifier classifies the output vector of the current auxiliary task layer to determine a first classification result; the first classification result and the output vector of the current auxiliary task layer are input into the feature fusion layer to obtain fused features, and the fused features are input into the next coding layer; in response to the encoding of the encoder being completed, a second classifier classifies the output vector of the encoder to determine a second classification result, and by decoding the second classification result, a text sequence corresponding to the speech to be recognized is determined. In the above process, the fusion of the context information of the acoustic information and the text sequence can be achieved, thereby improving the accuracy of speech recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the field of speech recognition technology, and more specifically, the embodiments of the present disclosure relate to a speech recognition method, apparatus, medium and computing device. Background Art

[0002] This section is intended to provide a background or context to the embodiments of the disclosure that are recited in the claims. No description herein is admitted to be prior art by inclusion in this section.

[0003] Automatic Speech Recognition (ASR) technology refers to converting the vocabulary content in human speech into computer-readable input, such as keystrokes, binary codes or character sequences. With the development of artificial intelligence technology, speech recognition has been widely used in daily life, such as voice assistants in smartphones, speech-to-text functions in chat software, and voice control of smart speakers.

[0004] However, human speech is very complex. For example, there are many languages ​​in the world, each language has different dialects, and different people have different speaking habits, all of which may lead to speech recognition failure. Therefore, how to improve the accuracy of speech recognition and make speech recognition technology better serve humans is still one of the important research directions in the current field. Summary of the invention

[0005] In this context, embodiments of the present disclosure are intended to provide a speech recognition method and apparatus.

[0006] In a first aspect of the embodiments of the present disclosure, a speech recognition method is provided, comprising:

[0007] Input the speech features corresponding to the speech to be recognized into a pre-trained speech recognition model, and perform feature encoding by an encoder; wherein the speech recognition model includes the encoder, a first classifier and a second classifier; the encoder includes a plurality of encoding layers, and the output vector of each encoding layer is used as the input vector of the next encoding layer connected to the encoding layer; the encoding layer includes at least an auxiliary task layer and a feature fusion layer; the speech recognition model is trained based on the first loss function of the auxiliary task layer and the second loss function of the encoder;

[0008] In response to the current coding layer being an auxiliary task layer, the first classifier classifies the output vector of the current auxiliary task layer to determine a first classification result corresponding to the speech to be recognized;

[0009] Inputting the first classification result and the output vector of the current auxiliary task layer to the feature fusion layer, performing feature fusion on the speech features represented by the feature fusion layer based on the context features and the output vector of the current auxiliary task layer to obtain fused features, and inputting the fused features to the next encoding layer; wherein the context features are obtained based on the first classification result;

[0010] In response to the encoder completing encoding, the second classifier classifies the output vector of the encoder to determine a second classification result corresponding to the speech to be recognized, and determines a text sequence corresponding to the speech to be recognized by decoding the second classification result.

[0011] In a second aspect of the embodiments of the present disclosure, there is provided a speech recognition device, comprising:

[0012] An input module inputs speech features corresponding to the speech to be recognized into a pre-trained speech recognition model, and an encoder performs feature encoding; wherein the speech recognition model includes the encoder, a first classifier and a second classifier; the encoder includes a plurality of encoding layers, and the output vector of each encoding layer is used as the input vector of the next encoding layer connected to the encoding layer; the encoding layer includes at least an auxiliary task layer and a feature fusion layer; the speech recognition model is trained based on a first loss function of the auxiliary task layer and a second loss function of the encoder;

[0013] A first classification module, in response to the current coding layer being an auxiliary task layer, classifying the output vector of the current auxiliary task layer by the first classifier to determine a first classification result corresponding to the speech to be recognized;

[0014] A feature fusion module, inputting the first classification result and the output vector of the current auxiliary task layer to the feature fusion layer, performing feature fusion on the speech features represented by the feature fusion layer based on the context features and the output vector of the current auxiliary task layer to obtain fused features, and inputting the fused features to the next encoding layer; wherein the context features are obtained based on the first classification result;

[0015] A second classification module, in response to the encoder completing encoding, the second classifier classifies the output vector of the encoder to determine a second classification result corresponding to the speech to be recognized;

[0016] A decoding module is used to determine a text sequence corresponding to the speech to be recognized by decoding the second classification result.

[0017] In a third aspect of the embodiments of the present disclosure, a storage medium is provided, on which computer instructions are stored, and when the instructions are executed by a processor, any of the above-mentioned speech recognition methods is implemented.

[0018] In a fourth aspect of the embodiments of the present disclosure, there is provided a computing device, comprising:

[0019] A processor; and a memory for storing instructions executable by the processor;

[0020] The processor implements any of the speech recognition methods by running the executable instructions.

[0021] The above embodiments of the present disclosure have at least the following beneficial effects:

[0022] Through the above technical scheme, in the process of feature encoding of speech features based on the encoder, the output vector of the auxiliary task layer is classified, and the classification result and the output vector are input into the feature fusion layer for feature fusion, so as to realize the fusion of acoustic information and context information of the text sequence, so that the model can learn a variety of information and improve the accuracy of speech recognition; and when training the speech recognition model, the parameters of the model not only depend on the loss function of the encoder, but also depend on the loss function of the auxiliary task layer, so as to alleviate the problem of gradient disappearance.

[0023] In the above process, on the one hand, classification is performed based on the output vector of the auxiliary task layer, and the contextual information of the text sequence is introduced into the model based on the classification result, so that the auxiliary task layer is used to assist the model in learning a variety of information; on the other hand, feature fusion is performed by inputting the output vector of the auxiliary task layer and the classification result into the feature fusion layer to achieve the fusion of acoustic information and contextual information of the text sequence, thereby improving the accuracy of speech recognition. In addition, by assisting the training of the model with the loss function based on the auxiliary task layer, the problem of gradient disappearance when only the loss function of the encoder is used for training can be alleviated. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which:

[0025] Figure 1 A schematic diagram of the structure of a speech recognition model involved in a related technology is shown schematically;

[0026] Figure 2 A flowchart of a speech recognition method according to an embodiment of the present disclosure is schematically shown;

[0027] Figure 3 A schematic diagram schematically shows the structure of an encoder according to an embodiment of the present disclosure;

[0028] Figure 4 A schematic diagram of feature fusion according to an embodiment of the present disclosure is schematically shown;

[0029] Figure 5 A schematic diagram schematically shows another feature fusion according to an embodiment of the present disclosure;

[0030] Figure 6 A schematic diagram schematically shows another speech recognition method according to an embodiment of the present disclosure;

[0031] Figure 7 A schematic diagram schematically shows the structure of a speech recognition model according to an embodiment of the present disclosure;

[0032] Figure 8 A schematic diagram schematically shows a training process of a speech recognition model according to an embodiment of the present disclosure;

[0033] Fig. 9 A block diagram of a speech recognition device according to an embodiment of the present disclosure is schematically shown;

[0034] Fig.10 A schematic diagram schematically shows a speech recognition medium according to an embodiment of the present disclosure;

[0035] Fig.11 A schematic diagram of an electronic device capable of implementing the above method according to an embodiment of the present disclosure is schematically shown.

[0036] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts. DETAILED DESCRIPTION

[0037] The principles and spirit of the present disclosure will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present disclosure, and are not intended to limit the scope of the present disclosure in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.

[0038] Those skilled in the art know that the embodiments of the present disclosure can be implemented as a system, device, equipment, method or computer-readable storage medium. Therefore, the present disclosure can be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.

[0039] According to an embodiment of the present disclosure, a speech recognition method, apparatus, medium and computing device are proposed.

[0040] In this document, it should be understood that any number of elements in the drawings is for illustration and not limitation, and any naming is only for distinction and does not have any limiting meaning. In addition, the data involved in this disclosure may be data authorized by the user or fully authorized by all parties.

[0041] The principle and spirit of the present disclosure are explained in detail below with reference to several representative embodiments of the present disclosure.

[0042] Application Scenario Overview

[0043] Speech recognition technology can be divided into four steps: input, encoding, decoding, and output. For example, the speech to be recognized can be input into the speech recognition model, the encoder converts the input audio into a feature vector, and then the feature vector is input into the decoder, which outputs text.

[0044] In the speech recognition model training process in the related art, the speech audio needs to be divided into multiple audio frames, and for each audio frame, its corresponding label needs to be determined in order to perform effective training. Therefore, before training the model, data alignment preprocessing is required.

[0045] For example, assuming that the semantic content corresponding to the audio is "good", and this audio is divided into 10 audio frames, then the phonemes corresponding to each audio frame need to be annotated (for ease of understanding, letters are used as phonemes to illustrate), and the annotation results can be shown in the following Table 1:

[0046] Table 1

[0047] Audio Frame 1 2 3 4 5 6 7 8 9 10 phoneme h h h a a o d d d e

[0048] It can be seen that a lot of time is needed for labeling during preprocessing, and once the audio frame labeling is missing, it will affect the accuracy of the model prediction.

[0049] In speech recognition technology, since the input audio is a sequence and the output result is also a sequence, an end-to-end speech recognition model can be used. During the training process, the end-to-end speech recognition model only needs one input sequence and one output sequence for training, without the need for pre-alignment of data or labeling of each audio frame.

[0050] For example, when constructing training samples, each sample pair may include speech and text corresponding to the speech, such as audio as the input sequence, and the text "good" corresponding to the audio as the true sequence, and the audio and text "good" constitute a sample pair for training.

[0051] It is worth mentioning that the CTC (Connectionist Temporal classification) algorithm can be used to solve the classification problem of time series data. The CTC algorithm only cares whether the predicted output sequence is close to or the same as the actual sequence, but does not care whether each result in the predicted output sequence is aligned with the input sequence at a time point.

[0052] In the related technology, the speech recognition model based on the CTC algorithm has been widely used because it can solve the problem of input and output alignment.

[0053] See also Figure 1 , Figure 1 FIG. 1 is a schematic diagram of a structure of a speech recognition model involved in a related technology provided as an example. Figure 1 As shown, the speech recognition model in the related art includes an encoder and a classifier. The encoder includes multiple feature extraction layers with the same structure, and the output vector of each feature extraction layer serves as the input vector of the next feature extraction layer connected to the feature extraction layer.

[0054] Each feature extraction layer usually includes a self-attention layer, which uses the self-attention mechanism to achieve attention based on the input itself to extract acoustic features. The acoustic features finally extracted by the classifier encoder are used for classification prediction.

[0055] In addition, the above-mentioned traditional speech recognition model needs to be trained based on the loss function corresponding to the encoder during model training.

[0056] It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principle of the present disclosure, and the embodiments of the present disclosure are not limited in this respect. On the contrary, the embodiments of the present disclosure can be applied to any applicable scenario. SUMMARY OF THE INVENTION

[0058] The inventors have discovered that in a speech recognition model based on the CTC algorithm, in the process of completing the end-to-end recognition from a speech sequence to a text sequence, the model usually only utilizes the acoustic information of the speech, resulting in limited accuracy in speech recognition. In addition, a speech recognition model based on the CTC algorithm usually also has a vanishing gradient problem, that is, as the number of layers of the model increases, the prediction accuracy decreases, resulting in the inability to improve speech recognition performance.

[0059] In view of this, the present specification provides a technical solution for determining the classification result through the output vector of the auxiliary task layer, and fusing the acoustic information corresponding to the output vector and the context information corresponding to the classification result through a feature fusion layer, thereby improving the accuracy of speech recognition and alleviating the gradient vanishing problem.

[0060] The core technical concept of this manual is:

[0061] In the process of encoding speech features based on the encoder, the output vector of the auxiliary task layer is classified, and the classification result and the output vector are input into the feature fusion layer for feature fusion, so as to realize the fusion of acoustic information and context information of text sequence, so that the model can learn a variety of information and improve the accuracy of speech recognition; and when training the speech recognition model, the parameters of the model depend not only on the loss function of the encoder, but also on the loss function of the auxiliary task layer, so as to alleviate the problem of gradient disappearance.

[0062] In the above process, on the one hand, classification is performed based on the output vector of the auxiliary task layer, and the contextual information of the text sequence is introduced into the model based on the classification result, so that the auxiliary task layer is used to assist the model in learning a variety of information; on the other hand, feature fusion is performed by inputting the output vector of the auxiliary task layer and the classification result into the feature fusion layer to achieve the fusion of acoustic information and contextual information of the text sequence, thereby improving the accuracy of speech recognition. In addition, by assisting the training of the model with the loss function based on the auxiliary task layer, the problem of gradient disappearance when only the loss function of the encoder is used for training can be alleviated.

[0063] After introducing the basic principles of the present disclosure, various non-limiting embodiments of the present disclosure are described in detail below.

[0064] Exemplary Methods

[0065] The technical concept of this specification will be described in detail below through specific embodiments.

[0066] The present disclosure aims to provide a technical solution for determining a classification result through an output vector of an auxiliary task layer, and fusing the acoustic information corresponding to the output vector and the context information corresponding to the classification result through a feature fusion layer, thereby improving the accuracy of speech recognition and alleviating the gradient vanishing problem.

[0067] During implementation, the speech features corresponding to the speech to be recognized can be input into a pre-trained speech recognition model, and the encoder can perform feature encoding;

[0068] The speech recognition model includes the encoder, the first classifier and the second classifier; the encoder may include multiple encoding layers, and the output vector of each encoding layer can be used as the input vector of the next encoding layer connected to the encoding layer; the encoding layer includes at least an auxiliary task layer and a feature fusion layer.

[0069] Then, in response to the current coding layer being an auxiliary task layer, the first classifier may classify the output vector of the current auxiliary task layer to determine a first classification result corresponding to the speech to be recognized;

[0070] For example, a certain position in multiple coding layers of the encoder can be set as an auxiliary task layer. When the encoder performs encoding layer by layer, if the current coding layer is the auxiliary task layer, the output vector of the auxiliary task layer is input into the first classifier for classification to determine the first classification result corresponding to the speech to be recognized.

[0071] Next, the first classification result and the output vector of the current auxiliary task layer can be input into the feature fusion layer, so as to perform feature fusion based on the context feature and the speech feature represented by the output vector of the current auxiliary task layer by the feature fusion layer to obtain a fused feature, and the fused feature is input into the next encoding layer;

[0072] Wherein, the context feature is obtained based on the first classification result;

[0073] For example, a feature fusion layer is also set in the multiple coding layers of the encoder. After determining the first classification result, the first classification result and the output vector of the current auxiliary task layer can be input into the feature fusion layer; the feature fusion layer then performs feature fusion based on the contextual features obtained based on the first classification result and the speech features represented by the output vector of the current auxiliary task layer to obtain fused features, and input the fused features into the next coding layer.

[0074] Finally, in response to the encoder completing encoding, the second classifier may classify the output vector of the encoder to determine a second classification result corresponding to the speech to be recognized, and determine a text sequence corresponding to the speech to be recognized by decoding the second classification result;

[0075] For example, when the final output vector of the encoder is determined, the second classifier can perform classification prediction to determine the second classification result corresponding to the speech to be recognized, and determine the text sequence corresponding to the speech to be recognized by decoding the second classification result.

[0076] Through the above technical scheme, in the process of feature encoding of speech features based on the encoder, the output vector of the auxiliary task layer is classified, and the classification result and the output vector are input into the feature fusion layer for feature fusion, so as to realize the fusion of acoustic information and context information of the text sequence, so that the model can learn a variety of information and improve the accuracy of speech recognition; and when training the speech recognition model, the parameters of the model not only depend on the loss function of the encoder, but also depend on the loss function of the auxiliary task layer, so as to alleviate the problem of gradient disappearance.

[0077] In the above process, on the one hand, classification is performed based on the output vector of the auxiliary task layer, and the contextual information of the text sequence is introduced into the model based on the classification result, so that the auxiliary task layer is used to assist the model in learning a variety of information; on the other hand, feature fusion is performed by inputting the output vector of the auxiliary task layer and the classification result into the feature fusion layer to achieve the fusion of acoustic information and contextual information of the text sequence, thereby improving the accuracy of speech recognition. In addition, by assisting the training of the model with the loss function based on the auxiliary task layer, the problem of gradient disappearance when only the loss function of the encoder is used for training can be alleviated.

[0078] See also Figure 2 , Figure 2 1 is a flow chart of a speech recognition method provided by an exemplary embodiment, comprising the following steps:

[0079] Step 201, input the speech features corresponding to the speech to be recognized into a pre-trained speech recognition model, and perform feature encoding by an encoder.

[0080] In this embodiment, the speech features corresponding to the speech to be recognized can be input into a pre-trained speech recognition model, and the encoder can perform feature encoding;

[0081] The speech recognition model includes the encoder, a first classifier and a second classifier; the encoder includes multiple encoding layers, and the output vector of each encoding layer serves as the input vector of the next encoding layer connected to the encoding layer; the encoding layer includes at least an auxiliary task layer and a feature fusion layer; the speech recognition model is trained based on the first loss function of the auxiliary task layer and the second loss function of the encoder.

[0082] For example, based on a preset algorithm, the speech features corresponding to the speech to be recognized can be determined, and then the speech features can be input into a pre-trained speech recognition model, and further encoded by an encoder.

[0083] Continuing with the example, suppose the encoder contains 5 coding layers. When the encoder performs feature encoding, it needs to encode layer by layer according to the order of the 5 coding layers. For example, the output vector of the first coding layer needs to be input to the second coding layer, and then the output vector of the second coding layer needs to be input to the third coding layer, and so on.

[0084] It should be noted that the positions of the auxiliary task layer and the feature fusion layer in the multiple coding layers can be customized by the user as needed.

[0085] In one embodiment shown, the coding layer includes a head coding layer and a tail coding layer, and multiple auxiliary task layers and multiple feature fusion layers located therebetween; wherein the upper coding layer adjacent to the feature fusion layer is the upper auxiliary task layer, and the lower coding layer adjacent to the feature fusion layer is the lower auxiliary task layer; the output of the upper auxiliary task layer serves as the input of the feature fusion layer, and the output of the feature fusion layer serves as the input of the lower auxiliary task layer;

[0086] Further, the fused features may be input into the next auxiliary task layer adjacent to the feature fusion layer.

[0087] by Figure 3 For example, see Figure 3 , Figure 3 FIG. 1 is a schematic diagram of the structure of an encoder provided by an exemplary embodiment. Figure 3 As shown, the encoder includes multiple encoding layers, the head-end encoding layer is used to input the speech features corresponding to the original speech to be recognized, the end encoding layer is used to output the final encoding result, and the auxiliary task layer and the feature fusion layer are located between the head-end encoding layer and the end encoding layer.

[0088] exist Figure 3 In the figure, the auxiliary task layer A, the feature fusion layer B and the auxiliary task layer C are adjacent to each other in sequence. As mentioned above, the encoder needs to perform feature encoding layer by layer according to the sequence of multiple encoding layers, that is, the output of the auxiliary task layer A is used as the input of the feature fusion layer B, and the output of the feature fusion layer B is used as the input of the auxiliary task layer C.

[0089] in addition, Figure 3 The multiple auxiliary task layers set in the embodiment may also be adjacent to each other. For example, the output of auxiliary task layer A is used as the input of auxiliary task layer C. The auxiliary task layers are not limited to this in the present disclosure.

[0090] It should be noted that the terminal coding layer may be a feature fusion layer, in which case the fusion features of the last feature fusion layer may be used as the final coding result of the coding layer.

[0091] In one embodiment shown, the speech to be recognized can be obtained and divided into T audio frames; feature extraction is performed on each audio frame respectively to determine the feature vector corresponding to each audio frame; the dimension of the feature vector is N; and a T*N feature matrix composed of the feature vectors corresponding to each audio frame is used as the speech feature corresponding to the speech to be recognized.

[0092] For example, the audio of the speech to be recognized can be divided into T audio frames, and the speech signal can be converted into T N-dimensional vectors through feature extraction, which can be used as the speech features corresponding to the speech to be recognized, which can be recorded as X = {x1, x2, ..., x T}, X is the characteristic matrix of T*N.

[0093] Step 202, in response to the current coding layer being an auxiliary task layer, the first classifier classifies the output vector of the current auxiliary task layer to determine a first classification result corresponding to the speech to be recognized.

[0094] In this embodiment, in response to the current coding layer being an auxiliary task layer, the first classifier of the speech recognition model can perform classification prediction on the output vector of the current auxiliary task layer to determine the first classification result corresponding to the predicted speech to be recognized.

[0095] For example, in Figure 3 When the encoder shown performs layer-by-layer encoding, in response to the current encoding layer being the auxiliary task layer A, the first classifier of the speech recognition model performs classification prediction on the output vector Ca of the auxiliary task layer A to obtain the first classification result Pa corresponding to the predicted speech to be recognized.

[0096] It is worth noting that different auxiliary task layers can be set with different parameters, so that different auxiliary task layers can obtain different acoustic information of the input speech features. Moreover, by adding auxiliary task layers, in the above speech recognition model, the gradient comes not only from the final layer, but also from the intermediate auxiliary task layer, thereby shortening the distance between different network layers in the speech recognition model when transferring gradients from back to front, and alleviating the problem of gradient disappearance.

[0097] Step 203, inputting the first classification result and the output vector of the current auxiliary task layer to the feature fusion layer, performing feature fusion on the speech features represented by the feature fusion layer based on the context features and the output vector of the current auxiliary task layer, obtaining fused features, and inputting the fused features to the next encoding layer;

[0098] The context feature is obtained based on the first classification result.

[0099] In this embodiment, the first classification result and the output vector of the current auxiliary task layer can be input into the feature fusion layer to perform feature fusion on the contextual features obtained by the feature fusion layer based on the first classification result and the speech features represented by the output vector of the current auxiliary task layer to obtain fused features, and the fused features are input into the next encoding layer.

[0100] exist Figure 3 Based on Figure 4 For example, see Figure 4 , Figure 4 FIG. 1 is a schematic diagram of a feature fusion provided by an exemplary embodiment. Figure 4 As shown, the auxiliary task layer A and the feature fusion layer B are adjacent to each other. The output vector Ca of the auxiliary task layer A can be classified and predicted by the first classifier to obtain the first classification result Pa corresponding to the predicted speech to be recognized.

[0101] exist Figure 4 In the process, the first classification result Pa and the output vector Ca can be input into the feature fusion layer B, so that the feature fusion layer B can obtain the context feature based on the first classification result Pa and obtain the speech feature based on the output vector Ca. The context feature and the speech feature are fused by the feature fusion layer B to obtain the fused feature, which combines the acoustic information obtained on the basis of the output vector Ca of the auxiliary task layer A and the context information of the text sequence, and then the fused feature can be input into the next encoding layer.

[0102] In one embodiment shown, the feature fusion layer includes a word embedding layer, a self-attention layer, and a multi-head attention layer;

[0103] Furthermore, feature extraction can be performed on the output vector of the current auxiliary task layer based on the self-attention layer to obtain an extracted first feature, where the first feature represents the speech feature;

[0104] Inputting the first classification result into the word embedding layer for processing to obtain a processed second feature;

[0105] Based on the multi-head attention layer, jointly extract features of the second feature and the output vector of the current auxiliary task layer to obtain an extracted third feature;

[0106] The first feature and the third feature are fused to obtain the fused feature.

[0107] In another embodiment shown, a first weight corresponding to the first feature and a second weight corresponding to the third feature may be calculated based on a sigmoid function; wherein the sum of the first weight and the second weight is 1;

[0108] A first product of the first weight and the first feature is calculated, and a second product of the second weight and the third feature is calculated, and the first product and the second product are added to obtain the fusion feature.

[0109] exist Figure 4 Based on Figure 4 For example, see Figure 4 , Figure 4 FIG. 1 is a schematic diagram of another feature fusion provided by an exemplary embodiment. Figure 4 As shown, the feature fusion layer B may include a word embedding layer, a self-attention layer, and a multi-head attention layer.

[0110] exist Figure 4 In order to obtain the fusion features, the following steps can be performed:

[0111] S501, based on the self-attention layer, feature extraction is performed on the output vector Ca of the auxiliary task layer A to obtain an extracted first feature, where the first feature represents the speech feature.

[0112] The attention mechanism is similar to the selective visual attention mechanism of humans. Its core goal is to select the more critical information for the current task goal from a large amount of information. For example, the self-attention mechanism can determine the connection between any two words in a sentence. Therefore, when the distance between two interdependent features is too far, the self-attention mechanism can shorten this distance and effectively utilize these features.

[0113] In the above speech recognition process, the output vector Ca itself can be subjected to feature extraction through the self-attention mechanism to determine the first feature representing the speech feature.

[0114] It is worth noting that in Figure 4 In the above figure, the query, key, and value of the self-attention layer all come from the same input, namely the output vector Ca.

[0115] S502, input the first classification result Pa into the word embedding layer for processing, and obtain the processed second feature.

[0116] The second feature of the first classification result Pa can be obtained through word embedding, and the second feature is a vector representation of the text sequence corresponding to the first classification result.

[0117] S503, based on the multi-head attention layer, perform joint feature extraction on the second feature and the output vector Ca of the auxiliary task layer A to obtain the extracted third feature.

[0118] In the above process, different knowledge can be learned based on the second feature and the output vector Ca through the multi-head attention mechanism, and then the different knowledge can be combined to obtain the third feature.

[0119] It is worth noting that in Figure 4 In , the query of the self-attention layer comes from the output vector Ca of the input, while the key and value come from the second feature of the input.

[0120] S504: Fusing the first feature and the third feature to obtain a fused feature.

[0121] Since the first feature represents the acoustic information and the third feature represents the contextual information of the text sequence, multiple information can be fused through feature fusion, and the obtained fused feature has a stronger representation ability.

[0122] When S504 is executed for fusion, it can be performed based on a threshold control (Gate) mechanism, including the following process:

[0123] S5041, calculating a first weight corresponding to the first feature and a second weight corresponding to the third feature based on a sigmoid activation function; wherein the sum of the first weight and the second weight is 1;

[0124] S5042, calculate a first product of the first weight and the first feature, calculate a second product of the second weight and the third feature, add the first product and the second product, and obtain a fusion feature.

[0125] For example, assuming that the first feature is X1 and the third feature is X2, the first weight g1 and the second weight g2 can be calculated according to the following formula:

[0126] g1=sigmod(W1*X1+W2*X2+a), g2=1-g1;

[0127] Among them, W1, W2, and a are preset parameters;

[0128] Furthermore, the fusion feature X3 can be calculated by the following formula:

[0129] X3=g1*X1+g2*X2.

[0130] It is worth noting that the above-mentioned threshold control mechanism refers to controlling the degree of information inflow or outflow through adjustment. In the above process, for different feature fusion layers, different threshold control parameters, namely the above-mentioned first weight and second weight, can be set by means of the threshold control mechanism, so that different feature fusion layers pay different attention to the acoustic information and the contextual information of the text sequence. For example, a higher first weight can be set in the feature fusion layer A to strengthen the role of acoustic information, and a higher second weight can be set in the feature fusion layer B to strengthen the role of the contextual information of the text sequence, so that the model can more intelligently realize the cross-fusion between different features, thereby improving the efficiency of model fusion and the effect of the model.

[0131] Step 204, in response to the encoder completing encoding, the second classifier classifies the output vector of the encoder to determine a second classification result corresponding to the speech to be recognized, and determines a text sequence corresponding to the speech to be recognized by decoding the second classification result.

[0132] In this embodiment, in response to the encoder completing encoding, a second classifier may classify the encoder's output vector to determine a second classification result corresponding to the speech to be recognized, and decode the second classification result to determine a text sequence corresponding to the speech to be recognized.

[0133] For example, in Figure 3 In the embodiment, when the terminal coding layer in the encoder completes the encoding and determines the output vector, the second classifier can perform classification prediction to determine the second classification result corresponding to the speech to be recognized, and determine the text sequence corresponding to the speech to be recognized by decoding the second classification result.

[0134] It is worth noting that, although the first classifier and the second classifier mentioned above play different roles, the parameters of the first classifier and the second classifier may be the same or different, and those skilled in the art may make their own choices according to their needs.

[0135] In an illustrated implementation manner, the second classification result may be decoded by a path search algorithm to determine all possible path information, and an optimal solution may be searched out as an optimal path, and a decoding result may be determined according to the optimal path.

[0136] The above-mentioned path search algorithm may be a greedy search algorithm or a beam search algorithm, which is not limited in this specification.

[0137] For example, taking the beam search algorithm as an example, by setting the hyperparameter k, also called the beam width, when decoding the classification results through the beam search algorithm, the k words with the largest current conditional probability in the first time step can be selected as the first word of the candidate output sequence; in each subsequent time step, based on the output sequence of the previous time step, the k words with the largest conditional probability among all combinations are selected as the candidate output sequence under the time step. K candidates are always maintained until the search is completed, and then the optimal solution is selected from the k candidates as the optimal path, and the decoding result is determined according to the optimal path.

[0138] The above encoder contains multiple encoding layers. The more encoding layers there are, the more network parameters are introduced, and the higher the accuracy of the model. However, if all the speech to be recognized is encoded layer by layer in the encoder until it is output after the terminal encoding layer, it is not flexible enough and cannot be adjusted according to the difficulty of speech recognition. On the other hand, it will affect the speed of speech recognition.

[0139] In one embodiment shown, when executing the above step 204, it is possible to:

[0140] In response to the current auxiliary task layer encoding being completed, the first classification result may be decoded by a path search algorithm to determine a decoding result;

[0141] In response to the path confidence corresponding to the decoding result not reaching a threshold preset for the current auxiliary task layer, continue to determine an output vector of a subsequent coding layer;

[0142] In response to the path confidence corresponding to the decoding result reaching a threshold preset for the current auxiliary task layer, the decoding result is determined as a text sequence corresponding to the speech to be recognized.

[0143] See also Figure 6 , Figure 6 FIG. 1 is a schematic diagram of another speech recognition method provided by an exemplary embodiment. Figure 6 As shown, for the multiple auxiliary task layers of the encoder, confidence levels can be set for different auxiliary task layers to achieve dynamic network reasoning, so that the model can adaptively match different network layers for output for input speech features with different complexities, thereby improving the speed of speech recognition.

[0144] It is worth noting that the above confidence levels can be set manually by the user, and the confidence levels of different auxiliary task layers can be different. In order to improve the accuracy of recognition, the confidence level thresholds corresponding to the front auxiliary task layers can be set larger.

[0145] exist Figure 6 In the example of auxiliary task layer A, the following steps can be performed:

[0146] S601, in response to the completion of encoding of the auxiliary task layer A, the first classifier performs classification prediction on the output vector Ca of the auxiliary task layer A to determine a first classification result Pa corresponding to the speech to be recognized.

[0147] In one embodiment shown, the first classifier can classify the output vector of the current auxiliary task layer, and determine the classification probability of each audio frame based on the feature vectors in the output vector corresponding to each audio frame in the speech to be recognized.

[0148] For example, the first classifier may perform classification prediction on the output vector Ca of the auxiliary task layer A, and determine the classification probability of each audio frame according to the feature vectors in the output vector Ca corresponding to each audio frame in the speech to be recognized.

[0149] Continuing with the example, assuming that the semantic content of the speech to be recognized is "cat", and the speech to be recognized is divided into 6 audio frames, the first classification result, that is, the classification probability of each audio frame can be shown in the following Table 2:

[0150] Audio frame 1 Audio frame 2 Audio frame 3 Audio frame 4 Audio frame 5 Audio frame 6 blank 0.2 0.1 0.8 0.04 0.8 0.1 c 0.7 0.8 0.1 0.01 0.07 0.05 a 0.07 0.07 0.07 0.9 0.1 0.05 t 0.03 0.03 0.03 0.05 0.03 0.8

[0151] Among them, blank is an empty element introduced in the CTC algorithm. It is a blank symbol used to represent no semantic content, denoted as “-”, and can be used to indicate a pause in speech.

[0152] S602: Decode the first classification result Pa by using a path search algorithm to determine a decoding result Ta.

[0153] In one embodiment shown, the classification probability of each audio frame in the speech to be recognized can be decoded through a path search algorithm to obtain a path search result, and duplicate items and blank symbols representing semanticless content in the search results are eliminated to determine the decoding result.

[0154] For example, the first classification result in Table 2 is decoded by the path search algorithm. According to the classification probability of each audio frame in Table 2, the path search result can be obtained as "cc-at". Furthermore, by eliminating duplicate items and blank symbols representing semanticless content, the decoding result can be obtained as "cat".

[0155] When decoding based on the path search algorithm, there are multiple path search methods, such as greedy search, beam search, etc. Those skilled in the art can choose according to their needs, and this is not limited in the present disclosure.

[0156] S603: In response to the path confidence Sa corresponding to the decoding result Ta not reaching the threshold S1 preset for the auxiliary task layer A, continue to determine the output vector of the subsequent coding layer.

[0157] For example, when calculating the confidence Sa, the classification probability of each audio frame can be logarithmically operated, and the maximum value in the logarithmic operation result can be taken as the confidence Sa. Then, it is determined whether the path confidence Sa reaches the preset threshold S1; if not, the output vector of the current auxiliary task layer is input into the next coding layer, and the output vector of the subsequent coding layer is further determined.

[0158] S604, in response to the path confidence Sa corresponding to the decoding result Ta reaching the threshold S1 preset for the auxiliary task layer A, the decoding result Ta is determined as the semantic content corresponding to the speech to be recognized.

[0159] For example, if the path confidence Sa reaches the threshold S1 preset for the auxiliary task layer A, the encoder is considered to have completed encoding, and no subsequent encoding layer is required to perform feature encoding. The output vector of the current auxiliary task layer is directly determined as the output vector of the encoder, so the decoding result of the current auxiliary task layer can be determined as the text sequence corresponding to the speech to be recognized.

[0160] In one embodiment shown, the speech recognition model further includes a convolutional layer;

[0161] Furthermore, the convolutional layer may downsample the speech features corresponding to the speech to be recognized.

[0162] For example, by setting the downsampling multiple d, the input T*N audio feature matrix can be changed from T to T / d in the time dimension, thereby achieving the effect of removing redundancy.

[0163] In one embodiment shown, the speech recognition model further includes a linear layer;

[0164] Furthermore, the linear layer may map the output vector of the current auxiliary task layer to a specified dimension; and the linear layer may map the output vector of the encoder to a specified dimension.

[0165] For example, the dimension specified above may be the size of a preset dictionary, that is, the number of words contained in the dictionary. By mapping the output vector to the size of the dictionary, the classification probability of the speech corresponding to each word in the dictionary may be determined.

[0166] In one embodiment shown, the training process of the speech recognition model includes:

[0167] Inputting a training sample set into a speech recognition model to be trained; the training sample includes a speech sequence corresponding to the speech sample and a text sequence corresponding to the speech sample;

[0168] The encoder performs feature encoding on the speech features corresponding to the speech sample;

[0169] Calculating the first loss function according to the first classification result and the text sequence;

[0170] Calculating the second loss function according to the second classification result and the text sequence;

[0171] For the first loss function and the second loss function, calculating a third loss function according to preset weights;

[0172] The speech recognition model is iteratively trained until the third loss function converges to obtain a trained speech recognition model.

[0173] In order to enable those skilled in the art to better understand the embodiments of the present disclosure, the structure of the speech recognition model and the training process of the speech recognition model are respectively illustrated below.

[0174] See also Figure 7 , Figure 7 FIG. 1 is a schematic diagram of the structure of a speech recognition model provided by an exemplary embodiment. Figure 7 As shown, the speech recognition model includes a convolutional layer, an encoder, a first classifier, a second classifier, and a linear layer.

[0175] For a detailed description of the encoder structure and the encoding process, please refer to the above Figure 3-Figure 6 The description will not be repeated here.

[0176] It is understood that through the above description, those skilled in the art can know the structure of the speech recognition model in this specification and the feature extraction process, which is similar to the above description. Figure 1 The difference between traditional speech recognition models.

[0177] Based on Figure 7 When performing speech recognition using the pre-trained speech recognition model shown, the following steps may be included:

[0178] S701, inputting the speech feature X into the convolution layer, and the convolution layer downsamples the speech feature to obtain an output vector h0 of the convolution layer; wherein the speech feature X may be a feature matrix of T*N;

[0179] S702, input h0 to the encoder, and the encoder determines the output vector h L; where L represents the number of encoding layers in the encoder;

[0180] S703, input the output vector h L into the linear layer, and the linear layer maps the output vector h L to a specified dimension;

[0181] S704, calculate the classification probability of each audio frame by the second classifier to determine the second classification result;

[0182] S705, determine the decoding result by decoding the second classification result; where the decoding result is the text sequence corresponding to the speech to be recognized.

[0183] Regarding the implementation processes of the above S701 - S705, corresponding to the implementation processes in the foregoing embodiments, details are not described herein. Those skilled in the art can refer to the descriptions in the foregoing embodiments.

[0184] Based on Figure 7 , please refer to Figure 8 , Figure 8 which is a schematic diagram of the training process of a speech recognition model provided by an exemplary embodiment. As Figure 8 shown, the training process of the speech recognition model may include the following steps:

[0185] Step 801, input the training sample set into the speech recognition model to be trained;

[0186] where the training samples include the speech sequence corresponding to the speech sample and the text sequence corresponding to the speech sample.

[0187] Taking Chinese as an example, a dictionary can be obtained by sequentially numbering each character in the Chinese character set. The size of the dictionary is equal to the number of Chinese characters appearing in the dictionary. For example, the numbers corresponding to the set {"one", "ding", "up", "down",...} in the dictionary can be {1, 2, 3, 4,...}.

[0188] Continuing with the example, when creating training samples, the speech samples can be annotated. For example, if the semantic content corresponding to a certain speech is "The weather is nice today", then this speech can be annotated with the text information "The weather is nice today"; further, based on the annotated text information, a preset dictionary can be searched to determine the number corresponding to each character in the dictionary, thereby determining the text sequence corresponding to the speech, and obtaining the text sequence Y=(102, 815, 815, 1980, 10, 3891).

[0189] Step 802, perform feature encoding on the speech features corresponding to the speech samples by the encoder;

[0190] As can be seen from the foregoing, the speech feature X corresponding to the speech sample can be determined first, and then the speech feature X is input into the speech recognition model, and the encoder performs feature encoding on the speech feature X.

[0191] Step 803, calculating a first loss function of the auxiliary task layer according to the first classification result and the text sequence;

[0192] In the process of the encoder performing layer-by-layer feature encoding, if the current encoding layer is an auxiliary task layer, the first classifier can classify the output vector of the current auxiliary task layer to determine the first classification result corresponding to the speech to be recognized; further, the first loss function of the auxiliary task layer can be calculated according to the first classification result and the text sequence, and the calculation formula is as follows:

[0193] Loss 辅助任务层 =ctc_loss(P 辅助任务层 , Y);

[0194] Among them, ctc_loss represents the loss function calculation based on the CTC algorithm, P 辅助任务层 represents the prediction result of the current auxiliary task layer, and Y represents the text sequence, that is, the true value.

[0195] Step 804, calculating a second loss function of the encoder according to the second classification result and the text sequence;

[0196] In response to the completion of the encoding by the encoder, the second classifier classifies the output vector of the encoder to determine the second classification result corresponding to the speech to be recognized; further, the second loss function of the encoder can be calculated according to the second classification result and the text sequence, and the calculation formula is as follows:

[0197] Loss ctc =ctc_loss(P L , Y);

[0198] Among them, ctc_loss represents the loss function calculation based on the CTC algorithm, P L represents the prediction result of the Lth encoding layer, and Y represents the text sequence, that is, the true value.

[0199] Step 805: Calculate a third loss function according to preset weights for the first loss function and the second loss function;

[0200] The calculation formula of the final third loss function of the model is as follows:

[0201] Loss 总 =α*Loss ctc +(1-α) / k*∑Loss 辅助任务层 ;

[0202] Among them, α is a manually set parameter, and k represents the number of auxiliary task layers in the encoder.

[0203] Step 806, iteratively train the speech recognition model until the third loss function converges to obtain a trained speech recognition model.

[0204] Through the above technical scheme, in the process of feature encoding of speech features based on the encoder, the output vector of the auxiliary task layer is classified, and the classification result and the output vector are input into the feature fusion layer for feature fusion, so as to realize the fusion of acoustic information and context information of the text sequence, so that the model can learn a variety of information and improve the accuracy of speech recognition; and when training the speech recognition model, the parameters of the model not only depend on the loss function of the encoder, but also depend on the loss function of the auxiliary task layer, so as to alleviate the problem of gradient disappearance.

[0205] In the above process, on the one hand, classification is performed based on the output vector of the auxiliary task layer, and the contextual information of the text sequence is introduced into the model based on the classification result, so that the auxiliary task layer is used to assist the model in learning a variety of information; on the other hand, feature fusion is performed by inputting the output vector of the auxiliary task layer and the classification result into the feature fusion layer to achieve the fusion of acoustic information and contextual information of the text sequence, thereby improving the accuracy of speech recognition. In addition, by assisting the training of the model with the loss function based on the auxiliary task layer, the problem of gradient disappearance when only the loss function of the encoder is used for training can be alleviated.

[0206] Exemplary Devices

[0207] After introducing the method of the exemplary embodiment of the present disclosure, next, see Fig. 9 , Fig. 9 It is a block diagram of a speech recognition device provided by an exemplary embodiment.

[0208] The implementation process of the functions and effects of each module in the following device is specifically described in the implementation process of the corresponding steps in the above method, which will not be repeated here. For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can be referred to the partial description of the method embodiment.

[0209] like Fig. 9 As shown, the speech recognition device 900 may include: an input module 901, a first classification module 902, a feature fusion module 903, a second classification module 904 and a decoding module 905. Among them:

[0210] The input module 901 is configured to input the speech features corresponding to the speech to be recognized into a pre-trained speech recognition model, and the encoder performs feature encoding; wherein the speech recognition model includes the encoder, a first classifier and a second classifier; the encoder includes a plurality of encoding layers, and the output vector of each encoding layer is used as the input vector of the next encoding layer connected to the encoding layer; the encoding layer includes at least an auxiliary task layer and a feature fusion layer; the speech recognition model is trained based on the first loss function of the auxiliary task layer and the second loss function of the encoder;

[0211] The first classification module 902 is configured to, in response to the current coding layer being an auxiliary task layer, classify the output vector of the current auxiliary task layer by the first classifier to determine a first classification result corresponding to the speech to be recognized;

[0212] The feature fusion module 903 is configured to input the first classification result and the output vector of the current auxiliary task layer to the feature fusion layer, perform feature fusion on the speech features represented by the feature fusion layer based on the context features and the output vector of the current auxiliary task layer, obtain fused features, and input the fused features to the next encoding layer; wherein the context features are obtained based on the first classification result;

[0213] The second classification module 904 is configured to, in response to the encoder completing encoding, classify the output vector of the encoder by the second classifier to determine a second classification result corresponding to the speech to be recognized;

[0214] The decoding module 905 is configured to determine a text sequence corresponding to the speech to be recognized by decoding the second classification result.

[0215] In one embodiment, the coding layer includes a head coding layer and a tail coding layer, and a plurality of auxiliary task layers and a plurality of feature fusion layers located therebetween; wherein the upper coding layer adjacent to the feature fusion layer is the upper auxiliary task layer, and the lower coding layer adjacent to the feature fusion layer is the lower auxiliary task layer; the output of the upper auxiliary task layer serves as the input of the feature fusion layer, and the output of the feature fusion layer serves as the input of the lower auxiliary task layer;

[0216] The feature fusion module 903 further:

[0217] The fused features are input to the next auxiliary task layer adjacent to the feature fusion layer.

[0218] In one embodiment, the decoding module 905 further:

[0219] In response to the current auxiliary task layer encoding being completed, decoding the first classification result by a path search algorithm to determine a decoding result;

[0220] In response to the path confidence corresponding to the decoding result not reaching a threshold preset for the current auxiliary task layer, continue to determine an output vector of a subsequent coding layer;

[0221] In response to the path confidence corresponding to the decoding result reaching a threshold preset for the current auxiliary task layer, the decoding result is determined as a text sequence corresponding to the speech to be recognized.

[0222] In one embodiment, the decoding module 905 further:

[0223] The second classification result is decoded by a path search algorithm to determine all possible path information, and an optimal solution is searched out as an optimal path, and a decoding result is determined according to the optimal path.

[0224] In one embodiment, the training process of the speech recognition model includes:

[0225] Inputting a training sample set into a speech recognition model to be trained; the training sample includes a speech sequence corresponding to the speech sample and a text sequence corresponding to the speech sample;

[0226] The encoder performs feature encoding on the speech features corresponding to the speech sample;

[0227] Calculating the first loss function according to the first classification result and the text sequence;

[0228] Calculating the second loss function according to the second classification result and the text sequence;

[0229] For the first loss function and the second loss function, calculating a third loss function according to preset weights;

[0230] The speech recognition model is iteratively trained until the third loss function converges to obtain a trained speech recognition model.

[0231] In one embodiment, the speech recognition model further includes a convolutional layer;

[0232] The device 900 further includes:

[0233] The convolution module 906 is configured to downsample the speech features corresponding to the speech to be recognized by the convolution layer.

[0234] In one embodiment, the speech recognition model further comprises a linear layer;

[0235] The device 900 further includes:

[0236] The linear module 907 is configured to map the output vector of the current auxiliary task layer to a specified dimension by the linear layer; and map the output vector of the encoder to a specified dimension by the linear layer.

[0237] In one embodiment, the apparatus 900 further includes:

[0238] The division module 908 is configured to obtain the speech to be recognized and divide the speech to be recognized into T audio frames;

[0239] The audio frame feature extraction module 909 is configured to perform feature extraction on each audio frame respectively, and determine a feature vector corresponding to each audio frame; the dimension of the feature vector is N;

[0240] The feature matrix determination module 910 is configured to use a T*N feature matrix formed by combining the feature vectors corresponding to each audio frame as the speech feature corresponding to the speech to be recognized.

[0241] In one embodiment, the first classification module 902 further:

[0242] The first classifier classifies the output vector of the current auxiliary task layer, and determines the classification probability of each audio frame according to the feature vectors in the output vector corresponding to each audio frame in the speech to be recognized.

[0243] In one embodiment, the decoding module 905 further:

[0244] The classification probability of each audio frame in the speech to be recognized is decoded through a path search algorithm to obtain a path search result, and duplicate items and blank symbols representing no semantic content in the search result are eliminated to determine the decoding result.

[0245] In one embodiment, the feature fusion layer includes a word embedding layer, a self-attention layer, and a multi-head attention layer;

[0246] The feature fusion module 903 further:

[0247] Performing feature extraction on the output vector of the current auxiliary task layer based on the self-attention layer to obtain an extracted first feature, wherein the first feature represents the speech feature;

[0248] Inputting the first classification result into the word embedding layer for processing to obtain a processed second feature;

[0249] Based on the multi-head attention layer, jointly extract features of the second feature and the output vector of the current auxiliary task layer to obtain an extracted third feature;

[0250] The first feature and the third feature are fused to obtain the fused feature.

[0251] In one embodiment, the feature fusion module 903 further:

[0252] Calculating a first weight corresponding to the first feature and a second weight corresponding to the third feature based on a sigmoid function; wherein the sum of the first weight and the second weight is 1;

[0253] A first product of the first weight and the first feature is calculated, and a second product of the second weight and the third feature is calculated, and the first product and the second product are added to obtain the fusion feature.

[0254] The specific details of each module of the above-mentioned speech recognition device 900 have been described in detail in the previous description of the speech recognition method process, so they will not be repeated here.

[0255] It should be noted that, although several modules or units of speech recognition device 900 are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.

[0256] Exemplary Media

[0257] After introducing the apparatus of the exemplary embodiment of the present disclosure, next, see Fig.10 , Fig.10 is a schematic diagram of a speech recognition medium provided by an exemplary embodiment.

[0258] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible embodiments, various aspects of the present disclosure may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to perform the steps according to various exemplary embodiments of the present disclosure described in the above "Exemplary Method" section of the present specification.

[0259] refer to Fig.10As shown, a readable storage medium 1000 for implementing the above method according to an embodiment of the present disclosure is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the readable storage medium of the present disclosure is not limited thereto. In this document, the readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0260] The readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0261] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0262] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0263] Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user computing device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0264] Exemplary Computing Devices

[0265] After introducing the method, medium and apparatus of the exemplary embodiments of the present disclosure, see Fig.11 , Fig.11 It is a schematic diagram of an electronic device capable of implementing the above method provided by an exemplary embodiment.

[0266] Refer to the following Fig.11 1100 according to this embodiment of the present disclosure is described. Fig.11 The electronic device 1100 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0267] like Fig.11 As shown, the electronic device 1100 is in the form of a general computing device. The components of the electronic device 1100 may include but are not limited to: at least one processing unit 1101, at least one storage unit 1102, and a bus 1103 connecting different system components (including the storage unit 1102 and the processing unit 1101).

[0268] The storage unit stores program codes, and the program codes can be executed by the processing unit 1101, so that the processing unit 1101 executes the steps of the above-mentioned various embodiments of this specification.

[0269] The storage unit 1102 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 11021 and / or a cache storage unit 11022 , and may further include a read-only storage unit (ROM) 11023 .

[0270] The storage unit 1102 may also include a program / utility 11024 having a set (at least one) of program modules 11025, such program modules 11025 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include the reality of a network environment.

[0271] The bus 1103 may include a control bus, an address bus, and a data bus.

[0272] The electronic device 1100 can also communicate with one or more external devices 1104 (e.g., keyboards, pointing devices, Bluetooth devices, etc.). Such communication can be performed through an input / output (I / O) interface 1105. In addition, the electronic device 1100 can also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs) and / or public networks, such as the Internet) through a network adapter 1106. As shown, the network adapter 1106 communicates with other modules of the electronic device 1100 through a bus 1103. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the electronic device 1100, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.

[0273] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiment of the present disclosure.

[0274] It should be noted that, although several units / modules or sub-units / sub-modules of the device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules to be embodied.

[0275] In addition, although the operations of the disclosed method are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.

[0276] Although the spirit and principle of the present disclosure have been described with reference to several specific embodiments, it should be understood that the present disclosure is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined to benefit, and such division is only for the convenience of expression. The present disclosure is intended to cover various modifications and equivalent arrangements included in the spirit and scope of the attached claims.

Claims

1. A speech recognition method, include: Input the speech features corresponding to the speech to be recognized into a pre-trained speech recognition model, and perform feature encoding by an encoder; wherein the speech recognition model includes the encoder, a first classifier and a second classifier; the encoder includes a plurality of encoding layers, and the output vector of each encoding layer is used as the input vector of the next encoding layer connected to the encoding layer; the encoding layer includes at least an auxiliary task layer and a feature fusion layer; the speech recognition model is trained based on the first loss function of the auxiliary task layer and the second loss function of the encoder; In response to the current coding layer being an auxiliary task layer, the first classifier classifies the output vector of the current auxiliary task layer to determine a first classification result corresponding to the speech to be recognized; Inputting the first classification result and the output vector of the current auxiliary task layer to the feature fusion layer, performing feature fusion on the speech features represented by the feature fusion layer based on the context features and the output vector of the current auxiliary task layer to obtain fused features, and inputting the fused features to the next encoding layer; wherein the context features are obtained based on the first classification result; In response to the encoder completing encoding, the second classifier classifies the output vector of the encoder to determine a second classification result corresponding to the speech to be recognized, and determines a text sequence corresponding to the speech to be recognized by decoding the second classification result.

2. According to the method of claim 1, the coding layer comprises a head-end coding layer and a tail-end coding layer, and a plurality of auxiliary task layers and a plurality of feature fusion layers located therebetween; in, The previous coding layer adjacent to the feature fusion layer is the previous auxiliary task layer, and the next coding layer adjacent to the feature fusion layer is the next auxiliary task layer; the output of the previous auxiliary task layer is used as the input of the feature fusion layer, and the output of the feature fusion layer is used as the input of the next auxiliary task layer; The step of inputting the fused features to the next encoding layer comprises: The fused features are input to the next auxiliary task layer adjacent to the feature fusion layer.

3. The method according to claim 2, wherein the text sequence corresponding to the speech to be recognized is determined by decoding the second classification result. include: In response to the current auxiliary task layer encoding being completed, decoding the first classification result by a path search algorithm to determine a decoding result; In response to the path confidence corresponding to the decoding result not reaching a threshold preset for the current auxiliary task layer, continue to determine an output vector of a subsequent coding layer; In response to the path confidence corresponding to the decoding result reaching a threshold preset for the current auxiliary task layer, the decoding result is determined as a text sequence corresponding to the speech to be recognized.

4. The method according to claim 1, wherein the second classification result is decoded. include: The second classification result is decoded by a path search algorithm to determine all possible path information, and an optimal solution is searched out as an optimal path, and a decoding result is determined according to the optimal path.

5. The method according to claim 1, wherein the training process of the speech recognition model include: Inputting the training sample set into the speech recognition model to be trained; The training sample includes a speech sequence corresponding to the speech sample and a text sequence corresponding to the speech sample; The encoder performs feature encoding on the speech features corresponding to the speech sample; Calculating the first loss function according to the first classification result and the text sequence; Calculating the second loss function according to the second classification result and the text sequence; For the first loss function and the second loss function, calculating a third loss function according to preset weights; The speech recognition model is iteratively trained until the third loss function converges to obtain a trained speech recognition model.

6. The method according to claim 1, wherein the speech recognition model further comprises a convolutional layer; Before the encoder performs feature encoding, the method further include: The convolutional layer downsamples the speech features corresponding to the speech to be recognized.

7. The method according to claim 1, wherein the speech recognition model further comprises a linear layer; Before the first classifier classifies the output vector of the current auxiliary task layer, the method further includes: The linear layer maps the output vector of the current auxiliary task layer to a specified dimension; Before classifying the output vector of the encoder by the second classifier, the method further comprises: The output vector of the encoder is mapped to a specified dimension by the linear layer.

8. The method according to claim 1, before inputting the speech features corresponding to the speech to be recognized into the pre-trained speech recognition model, the method further include: Acquire the speech to be recognized, and divide the speech to be recognized into T audio frames; Perform feature extraction on each audio frame respectively to determine a feature vector corresponding to each audio frame; the dimension of the feature vector is N; A T*N feature matrix formed by combining the feature vectors corresponding to each audio frame is used as the speech feature corresponding to the speech to be recognized.

9. The method according to claim 8, wherein the first classifier classifies the output vector of the current auxiliary task layer to determine a first classification result corresponding to the speech to be recognized, include: The first classifier classifies the output vector of the current auxiliary task layer, and determines the classification probability of each audio frame according to the feature vectors in the output vector corresponding to each audio frame in the speech to be recognized.

10. The method according to claim 9, wherein the first classification result is decoded by a path search algorithm to determine a decoding result, include: The classification probability of each audio frame in the speech to be recognized is decoded through a path search algorithm to obtain a path search result, and duplicate items and blank symbols representing no semantic content in the search result are eliminated to determine the decoding result.

11. The method according to claim 1, wherein the feature fusion layer comprises a word embedding layer, a self-attention layer, and a multi-head attention layer; The feature fusion layer performs feature fusion based on the context feature and the speech feature represented by the output vector of the current auxiliary task layer to obtain a fused feature, including: Performing feature extraction on the output vector of the current auxiliary task layer based on the self-attention layer to obtain an extracted first feature, wherein the first feature represents the speech feature; Inputting the first classification result into the word embedding layer for processing to obtain a processed second feature; Based on the multi-head attention layer, jointly extract features of the second feature and the output vector of the current auxiliary task layer to obtain an extracted third feature; The first feature and the third feature are fused to obtain the fused feature.

12. The method according to claim 11, wherein the first feature and the third feature are subjected to feature fusion to obtain the fused feature, include: Calculating a first weight corresponding to the first feature and a second weight corresponding to the third feature based on a sigmoid function; wherein the sum of the first weight and the second weight is 1; A first product of the first weight and the first feature is calculated, and a second product of the second weight and the third feature is calculated, and the first product and the second product are added to obtain the fusion feature.

13. A speech recognition device, include: An input module inputs speech features corresponding to the speech to be recognized into a pre-trained speech recognition model, and an encoder performs feature encoding; wherein the speech recognition model includes the encoder, a first classifier and a second classifier; the encoder includes a plurality of encoding layers, and the output vector of each encoding layer is used as the input vector of the next encoding layer connected to the encoding layer; the encoding layer includes at least an auxiliary task layer and a feature fusion layer; the speech recognition model is trained based on a first loss function of the auxiliary task layer and a second loss function of the encoder; A first classification module, in response to the current coding layer being an auxiliary task layer, classifying the output vector of the current auxiliary task layer by the first classifier to determine a first classification result corresponding to the speech to be recognized; A feature fusion module, inputting the first classification result and the output vector of the current auxiliary task layer to the feature fusion layer, performing feature fusion on the speech features represented by the feature fusion layer based on the context features and the output vector of the current auxiliary task layer to obtain fused features, and inputting the fused features to the next encoding layer; wherein the context features are obtained based on the first classification result; A second classification module, in response to the encoder completing encoding, the second classifier classifies the output vector of the encoder to determine a second classification result corresponding to the speech to be recognized; A decoding module is used to determine a text sequence corresponding to the speech to be recognized by decoding the second classification result.

14. The device according to claim 13, wherein the coding layer comprises a head-end coding layer and a tail-end coding layer, and a plurality of auxiliary task layers and a plurality of feature fusion layers located therebetween; in, The previous coding layer adjacent to the feature fusion layer is the previous auxiliary task layer, and the next coding layer adjacent to the feature fusion layer is the next auxiliary task layer; the output of the previous auxiliary task layer is used as the input of the feature fusion layer, and the output of the feature fusion layer is used as the input of the next auxiliary task layer; The feature fusion module further: The fused features are input to the next auxiliary task layer adjacent to the feature fusion layer.

15. The device according to claim 14, wherein the decoding module further comprises: In response to the current auxiliary task layer encoding being completed, decoding the first classification result by a path search algorithm to determine a decoding result; In response to the path confidence corresponding to the decoding result not reaching a threshold preset for the current auxiliary task layer, continue to determine an output vector of a subsequent coding layer; In response to the path confidence corresponding to the decoding result reaching a threshold preset for the current auxiliary task layer, the decoding result is determined as a text sequence corresponding to the speech to be recognized.

16. The device according to claim 13, wherein the decoding module further comprises: The second classification result is decoded by a path search algorithm to determine all possible path information, and an optimal solution is searched out as an optimal path, and a decoding result is determined according to the optimal path.

17. The apparatus according to claim 13, wherein the training process of the speech recognition model include: Inputting the training sample set into the speech recognition model to be trained; The training sample includes a speech sequence corresponding to the speech sample and a text sequence corresponding to the speech sample; The encoder performs feature encoding on the speech features corresponding to the speech sample; Calculating the first loss function according to the first classification result and the text sequence; Calculating the second loss function according to the second classification result and the text sequence; For the first loss function and the second loss function, calculating a third loss function according to preset weights; The speech recognition model is iteratively trained until the third loss function converges to obtain a trained speech recognition model.

18. The apparatus according to claim 13, wherein the speech recognition model further comprises a convolutional layer; The device also include: The convolution module downsamples the speech features corresponding to the speech to be recognized by the convolution layer.

19. The apparatus according to claim 13, wherein the speech recognition model further comprises a linear layer; The device also include: A linear module, wherein the linear layer maps the output vector of the current auxiliary task layer to a specified dimension; And, the output vector of the encoder is mapped to a specified dimension by the linear layer.

20. The device according to claim 13, further comprising: include: A division module, which obtains the speech to be recognized and divides the speech to be recognized into T audio frames; An audio frame feature extraction module performs feature extraction on each audio frame to determine a feature vector corresponding to each audio frame; the dimension of the feature vector is N; The feature matrix determination module uses a T*N feature matrix formed by combining the feature vectors corresponding to each audio frame as the speech feature corresponding to the speech to be recognized.

21. The apparatus according to claim 20, wherein the first classification module further comprises: The first classifier classifies the output vector of the current auxiliary task layer, and determines the classification probability of each audio frame according to the feature vectors in the output vector corresponding to each audio frame in the speech to be recognized.

22. The device according to claim 21, wherein the decoding module further comprises: The classification probability of each audio frame in the speech to be recognized is decoded through a path search algorithm to obtain a path search result, and duplicate items and blank symbols representing no semantic content in the search result are eliminated to determine the decoding result.

23. The apparatus according to claim 13, wherein the feature fusion layer comprises a word embedding layer, a self-attention layer, and a multi-head attention layer; The feature fusion module further: Performing feature extraction on the output vector of the current auxiliary task layer based on the self-attention layer to obtain an extracted first feature, wherein the first feature represents the speech feature; Inputting the first classification result into the word embedding layer for processing to obtain a processed second feature; Based on the multi-head attention layer, jointly extract features of the second feature and the output vector of the current auxiliary task layer to obtain an extracted third feature; The first feature and the third feature are fused to obtain the fused feature.

24. The device according to claim 23, wherein the feature fusion module further comprises: Calculate a first weight corresponding to the first feature and a second weight corresponding to the third feature based on a sigmoid function; in, The sum of the first weight and the second weight is 1; A first product of the first weight and the first feature is calculated, and a second product of the second weight and the third feature is calculated, and the first product and the second product are added to obtain the fusion feature.

25. A storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 12.

26. A computing device, include: processor; a memory for storing processor-executable instructions; The processor implements the method according to any one of claims 1 to 12 by running the executable instructions.