Neural network training method, speech recognition method, device, equipment and medium

By introducing historical and future audio frames into streaming speech recognition, the robustness of the speech recognition model is enhanced, the problems of slow recognition speed and low accuracy in streaming speech recognition are solved, and fast and accurate speech recognition is achieved.

CN115331660BActive Publication Date: 2024-10-29BEIJING JUEYING INTELLIGENT TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210952689.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-09
Publication Date
2024-10-29
Estimated Expiration
2042-08-09

AI Technical Summary

Technical Problem

Existing speech recognition technology suffers from slow recognition speed and low accuracy in streaming environments, especially when real-time recognition is required.

Method used

By introducing historical audio frames and future audio frames on the basis of the current audio frame, the richness of sample audio clips is increased, the quality of training data for streaming speech recognition neural networks is improved, and the robustness of the model is enhanced, thereby improving the accuracy of speech recognition. degree and speed.

Benefits of technology

It achieves fast and accurate speech recognition results in streaming speech recognition, improves recognition speed and accuracy, and is suitable for real-time speech recognition scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115331660B_ABST
    Figure CN115331660B_ABST
Patent Text Reader

Abstract

The present disclosure provides a neural network training method, a speech recognition method, an apparatus, a device and a medium. By introducing historical audio frames and future audio frames on the basis of current audio frames, the number of audio frames contained in a sample audio segment is increased, the richness of the sample audio segment is increased, the sample feature vectors contained in the training data are increased, the receptive field of the streaming speech recognition neural network for each sample audio segment is increased, the recognition effect for the context is enhanced, the robustness of the streaming speech recognition model obtained through training is greatly increased, the speech recognition accuracy and speed of the streaming speech recognition model are effectively improved, and then the trained streaming speech recognition model can be used to perform speech recognition on the current speech segment output in real time, with high recognition accuracy, fast recognition speed and good recognition effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computers, and in particular to a neural network training method, a speech recognition method, a device, a equipment and a medium. Background Art

[0002] Automatic Speech Recognition (ASR) is a technology that converts human speech into text and is widely used in various scenarios such as voice interaction and human-computer interaction.

[0003] The common method of speech recognition is to identify the information contained in the audio data after receiving a paragraph of speech from the speaker. However, this method requires a large amount of calculation and has a slow speech recognition speed. With the development and progress of society, more and more scenarios require the use of streaming ASR. At this time, if the method of receiving a paragraph of speech from the speaker and then performing recognition is still used, a long time delay will be generated. Streaming ASR needs to recognize the corresponding text information as soon as possible after receiving a word spoken by the speaker. However, in this case, the audio data available for analysis is limited, resulting in low accuracy of the recognition results. Summary of the invention

[0004] The embodiments of the present disclosure at least provide a neural network training method, a speech recognition method, an apparatus, a device and a medium.

[0005] The present disclosure provides a neural network training method, the method comprising:

[0006] Acquire sample audio data and actual audio recognition results of the sample audio data;

[0007] Determine a plurality of sample audio segments from the sample audio data, and determine an actual segment recognition result of each sample audio segment from the actual audio recognition result, wherein the sample audio segment includes a plurality of current audio frames, at least one historical audio frame before the plurality of current audio frames, and at least one future audio frame after the plurality of current audio frames;

[0008] Inputting the plurality of sample audio segments into a pre-built streaming speech recognition neural network to obtain a predicted segment recognition result for each of the sample audio segments;

[0009] Based on the obtained multiple predicted segment recognition results and the actual segment recognition results corresponding to each predicted segment recognition result, the network parameters of the streaming speech recognition neural network are adjusted until the streaming speech recognition neural network meets the training cutoff conditions, thereby obtaining a streaming speech recognition model for real-time speech recognition.

[0010] In this way, by introducing historical audio frames and future audio frames on the basis of the current audio frames, the number of audio frames contained in the sample audio clip is increased, the richness of the sample audio clip can be increased, the sample feature vectors contained in the training data can be increased, the receptive field of the streaming speech recognition neural network for each sample audio clip can be increased, the recognition effect of the context can be enhanced, the robustness of the streaming speech recognition model obtained through training can be greatly increased, and the speech recognition accuracy and speed of the streaming speech recognition model can be effectively improved.

[0011] In an optional implementation manner, determining a plurality of sample audio segments from the sample audio data includes:

[0012] Using a preset sampling time window and a preset sampling displacement, the sample audio data is sampled to obtain a plurality of sampled audio frames, wherein a time span corresponding to the preset sampling time window is greater than a time span corresponding to the preset sampling displacement;

[0013] The multiple sampled audio frames are segmented to obtain multiple sample audio segments.

[0014] In this way, the sample audio data can be converted into multiple sample audio segments, and the sample audio segments can be used to simulate the speech segments received during actual speech recognition, thereby improving the training effect of the subsequent streaming speech recognition neural network.

[0015] In an optional implementation manner, the segmenting of the multiple sampled audio frames to obtain multiple sample audio segments includes:

[0016] Taking a set of audio frames obtained by continuously sampling a preset number of times through the preset sampling time window as a candidate audio segment, obtaining multiple candidate audio segments, wherein the continuous multiple-frame sampled audio frames in the candidate audio segments are taken as corresponding multiple-frame current audio frames;

[0017] For each candidate audio segment, determine, from the multiple sampled audio frames, at least one continuous historical audio frame before the candidate audio segment, and, according to the dynamic delay time generated for this round of training, determine at least one continuous future audio frame after the candidate audio segment and matching the dynamic delay time, wherein the at least one continuous historical audio frame and the at least one future audio frame are respectively adjacent to the candidate audio segment;

[0018] The at least one historical audio frame, the multiple current audio frames of the candidate audio segment, and the at least one future audio frame are spliced ​​to obtain a corresponding sample audio segment.

[0019] In this way, by determining the historical audio frames and future audio frames corresponding to each candidate audio clip, sample audio clips are spliced ​​together to increase the richness of the sample audio clips, increase the sample feature vectors contained in the training data, and improve the receptive field of the streaming speech recognition neural network for each sample audio clip, thereby effectively enhancing the recognition effect of the context.

[0020] In an optional implementation manner, determining at least one continuous historical audio frame before the candidate audio segment from the multiple sampled audio frames, and determining at least one continuous future audio frame after the candidate audio segment and matching the dynamic delay time according to the dynamic delay time generated for this round of training, comprises:

[0021] In the process of determining the at least one historical audio frame and the at least one future audio frame of the candidate audio segment, if the candidate audio segment is the first audio segment among the multiple candidate audio segments, determining at least one first blank audio frame, and using the at least one first blank audio frame as the at least one historical audio frame of the candidate audio segment;

[0022] If the candidate audio segment is the last audio segment among the multiple candidate audio segments, at least one second blank audio frame is determined, and the at least one second blank audio frame is used as at least one future audio frame of the candidate audio segment.

[0023] In this way, in the process of determining at least one historical audio frame and at least one future audio frame of the candidate audio segment, a blank audio frame is introduced for the first audio segment and the last audio segment among multiple candidate audio segments, which are divided into at least one historical audio frame as the first audio segment and at least one future audio frame as the last audio segment, so that the data in the training process of the streaming speech recognition neural network is consistent with the actual speech output data, thereby ensuring the accuracy and effectiveness of the streaming speech recognition neural network training process.

[0024] In an optional implementation, the step of inputting the plurality of sample audio segments into a pre-built streaming speech recognition neural network to obtain a predicted segment recognition result for each of the sample audio segments includes:

[0025] For each of the sample audio segments, input the sample audio segment into a feature convolution layer in a streaming speech recognition neural network to obtain a first sample feature sequence of the sample audio segment output by the feature convolution layer;

[0026] Inputting the first sample feature sequence into a feature encoding layer in the streaming speech recognition neural network to obtain an encoded second sample feature sequence;

[0027] The second sample feature sequence is input into the feature decoding layer of the streaming speech recognition neural network to obtain a predicted segment recognition result of the sample audio segment.

[0028] In this way, through the processing of each layer in the streaming speech recognition neural network, the predicted segment recognition result of the sample audio segment can be obtained, so as to subsequently adjust the network parameters of the streaming speech recognition neural network based on the predicted segment recognition result.

[0029] In an optional implementation, the step of inputting the sample audio segment into a feature convolution layer in a streaming speech recognition neural network to obtain a first sample feature sequence of the sample audio segment output by the feature convolution layer includes:

[0030] Inputting the sample audio segment into a feature convolution layer in a streaming speech recognition neural network, respectively extracting a historical sample feature vector of the at least one historical audio frame, a current sample feature sequence of the multiple current audio frames, and a future sample feature sequence of the at least one future audio frame;

[0031] Based on the historical sample feature vector, the current sample feature sequence and the future sample feature sequence, an initial sample feature sequence of the sample audio segment is obtained;

[0032] The initial sample feature sequence is subjected to convolution processing to obtain a first sample feature sequence output by the feature convolution layer.

[0033] In this way, through the processing of the convolutional feature layer, the sample audio segment is converted into a first sample feature sequence, so that the first sample feature sequence contains information of historical audio frames, current audio frames and future audio frames, effectively improving the receptive field of the streaming speech recognition neural network during the training process.

[0034] In an optional implementation, the step of inputting the first sample feature sequence into a feature encoding layer in the neural network to obtain an encoded second sample feature sequence includes:

[0035] Taking the sample audio segment as the current audio segment, obtaining a previous feature vector of at least one previous audio segment before the current audio segment;

[0036] Based on the first sample feature sequence, determining a first key feature sequence, a first value feature sequence, and a first query feature sequence for the current audio segment, wherein the first key feature sequence includes a first historical key feature, a current key feature, and a future key feature, the first value feature sequence includes a first historical value feature, a current value feature, and a future value feature, and the first query feature sequence includes a current query feature vector and a future query feature vector;

[0037] Determining a second history key feature and a second history value feature for the current audio segment based on the previous feature vector;

[0038] Based on the second historical key feature and the second historical value feature, as well as the first historical key feature, the current key feature, the future key feature, the first historical value feature, the current value feature, the future value feature, the current query feature vector and the future query feature vector, determine a second sample feature sequence obtained by encoding the first sample feature sequence.

[0039] In this way, through the processing of the feature coding layer, the first key feature sequence, the first value feature sequence and the first query feature sequence of the current audio clip are obtained, and then combined with the second historical key feature and the second historical value feature, the second sample feature sequence is obtained after encoding the first sample feature sequence, thereby effectively increasing the richness of the second sample feature sequence.

[0040] In an optional implementation manner, the method further includes:

[0041] During the process of encoding the first sample feature sequence, the current feature sequence of the current audio segment is output so that during the encoding process of the subsequent audio segment after the current audio segment, a previous feature vector of at least one previous audio segment before the subsequent audio segment can be determined based on the obtained current feature sequence.

[0042] In this way, the current feature sequence of the current audio segment can be stored so that the subsequent audio segment after the current audio segment can obtain the previous feature vector of at least one previous audio segment before the subsequent audio segment during the encoding process.

[0043] In an optional implementation manner, the method further includes:

[0044] In a case where the current audio segment is the first audio segment among the multiple sample audio segments, determining, based on a current feature sequence of the current audio segment, a current feature vector corresponding to the current feature sequence;

[0045] The current feature vector is used as a previous feature vector of at least one previous audio segment before the current audio segment.

[0046] In this way, when the current audio segment is the first audio segment among multiple sample audio segments, the current feature vector corresponding to the current feature sequence is used as the previous feature vector, thereby improving the flexibility and accuracy of the streaming speech recognition neural network training process.

[0047] In an optional implementation manner, inputting the second sample feature sequence into the feature decoding layer of the neural network to obtain a predicted segment recognition result of the sample audio segment includes:

[0048] The feature decoding layer of the neural network decodes the second sample feature sequence to obtain a plurality of candidate recognition results of the sample audio segment, wherein the candidate recognition results include blank labels and text labels;

[0049] Deleting blank labels from the plurality of candidate recognition results to obtain a plurality of candidate recognition results after deletion;

[0050] For the multiple candidate recognition results after the deletion processing, based on the text content of each text label, the multiple candidate recognition results after the deletion processing are deduplicated to obtain multiple candidate recognition results after the deduplication processing;

[0051] The multiple candidate recognition results after deduplication processing are combined and arranged to obtain a predicted segment recognition result of the sample audio segment.

[0052] In this way, multiple candidate recognition results are deleted and deduplicated, and then combined and arranged to ensure the effectiveness and accuracy of the predicted segment recognition results.

[0053] The present disclosure provides a speech recognition method, the method comprising:

[0054] Receive a current voice segment output in real time, wherein the current voice segment includes a plurality of current real-time audio frames and at least one historical real-time audio frame before the plurality of current real-time audio frames;

[0055] The current speech segment is input into a streaming speech recognition model trained according to the above-mentioned neural network training method and used for real-time speech recognition to obtain a speech recognition result of the current speech segment.

[0056] In this way, the trained streaming speech recognition model can be used to perform speech recognition on the current speech segment output in real time, thereby obtaining the speech recognition result of the current speech segment, which helps to quickly obtain the speech recognition result with high recognition accuracy, fast recognition speed and good recognition effect.

[0057] The present disclosure also provides a neural network training device, the device comprising:

[0058] A sample acquisition module, used to acquire sample audio data and actual audio recognition results of the sample audio data;

[0059] a segment determination module, configured to determine a plurality of sample audio segments from the sample audio data, and to determine an actual segment recognition result of each sample audio segment from the actual audio recognition result, wherein the sample audio segment includes a plurality of current audio frames, at least one historical audio frame before the plurality of current audio frames, and at least one future audio frame after the plurality of current audio frames;

[0060] A prediction result determination module, used for inputting the plurality of sample audio segments into a pre-built streaming speech recognition neural network to obtain a prediction segment recognition result of each of the sample audio segments;

[0061] A model determination module is used to adjust the network parameters of the streaming speech recognition neural network based on the obtained multiple predicted segment recognition results and the actual segment recognition results corresponding to each predicted segment recognition result, until the streaming speech recognition neural network meets the training cutoff condition, thereby obtaining a streaming speech recognition model for real-time speech recognition.

[0062] In an optional implementation manner, when the segment determination module is used to determine a plurality of sample audio segments from the sample audio data, it is specifically used to:

[0063] Using a preset sampling time window and a preset sampling displacement, the sample audio data is sampled to obtain a plurality of sampled audio frames, wherein a time span corresponding to the preset sampling time window is greater than a time span corresponding to the preset sampling displacement;

[0064] The multiple sampled audio frames are segmented to obtain multiple sample audio segments.

[0065] In an optional implementation manner, when the segment determination module is used to segment the multiple sampled audio frames to obtain multiple sample audio segments, it is specifically used to:

[0066] Taking a set of audio frames obtained by continuously sampling a preset number of times through the preset sampling time window as a candidate audio segment, obtaining multiple candidate audio segments, wherein the continuous multiple-frame sampled audio frames in the candidate audio segments are taken as corresponding multiple-frame current audio frames;

[0067] For each candidate audio segment, determine, from the multiple sampled audio frames, at least one continuous historical audio frame before the candidate audio segment, and, according to the dynamic delay time generated for this round of training, determine at least one continuous future audio frame after the candidate audio segment and matching the dynamic delay time, wherein the at least one continuous historical audio frame and the at least one future audio frame are respectively adjacent to the candidate audio segment;

[0068] The at least one historical audio frame, the multiple current audio frames of the candidate audio segment, and the at least one future audio frame are spliced ​​to obtain a corresponding sample audio segment.

[0069] In an optional implementation manner, the segment determination module is used to determine at least one historical audio frame that is continuous before the candidate audio segment from the multiple sampled audio frames, and to determine at least one future audio frame that is continuous after the candidate audio segment and matches the dynamic delay time according to the dynamic delay time generated for this round of training, specifically for:

[0070] In the process of determining the at least one historical audio frame and the at least one future audio frame of the candidate audio segment, if the candidate audio segment is the first audio segment among the multiple candidate audio segments, determining at least one first blank audio frame, and using the at least one first blank audio frame as the at least one historical audio frame of the candidate audio segment;

[0071] If the candidate audio segment is the last audio segment among the multiple candidate audio segments, at least one second blank audio frame is determined, and the at least one second blank audio frame is used as at least one future audio frame of the candidate audio segment.

[0072] In an optional implementation manner, the prediction result determination module is specifically used to:

[0073] For each of the sample audio segments, input the sample audio segment into a feature convolution layer in a streaming speech recognition neural network to obtain a first sample feature sequence of the sample audio segment output by the feature convolution layer;

[0074] Inputting the first sample feature sequence into a feature encoding layer in the streaming speech recognition neural network to obtain an encoded second sample feature sequence;

[0075] The second sample feature sequence is input into the feature decoding layer of the streaming speech recognition neural network to obtain a predicted segment recognition result of the sample audio segment.

[0076] In an optional implementation manner, the prediction result determination module, when used to input the sample audio segment into a feature convolution layer in a streaming speech recognition neural network to obtain a first sample feature sequence of the sample audio segment output by the feature convolution layer, is specifically used to:

[0077] Inputting the sample audio segment into a feature convolution layer in a streaming speech recognition neural network, respectively extracting a historical sample feature vector of the at least one historical audio frame, a current sample feature sequence of the multiple current audio frames, and a future sample feature sequence of the at least one future audio frame;

[0078] Based on the historical sample feature vector, the current sample feature sequence and the future sample feature sequence, an initial sample feature sequence of the sample audio segment is obtained;

[0079] The initial sample feature sequence is subjected to convolution processing to obtain a first sample feature sequence output by the feature convolution layer.

[0080] In an optional implementation manner, when the prediction result determination module is used to input the first sample feature sequence into the feature encoding layer in the neural network to obtain the encoded second sample feature sequence, it is specifically used to:

[0081] Taking the sample audio segment as the current audio segment, obtaining a previous feature vector of at least one previous audio segment before the current audio segment;

[0082] Based on the first sample feature sequence, determining a first key feature sequence, a first value feature sequence, and a first query feature sequence for the current audio segment, wherein the first key feature sequence includes a first historical key feature, a current key feature, and a future key feature, the first value feature sequence includes a first historical value feature, a current value feature, and a future value feature, and the first query feature sequence includes a current query feature vector and a future query feature vector;

[0083] Determining a second history key feature and a second history value feature for the current audio segment based on the previous feature vector;

[0084] Based on the second historical key feature and the second historical value feature, as well as the first historical key feature, the current key feature, the future key feature, the first historical value feature, the current value feature, the future value feature, the current query feature vector and the future query feature vector, determine a second sample feature sequence obtained by encoding the first sample feature sequence.

[0085] In an optional implementation manner, the prediction result determination module is further used to:

[0086] During the process of encoding the first sample feature sequence, the current feature sequence of the current audio segment is output so that during the encoding process of the subsequent audio segment after the current audio segment, a previous feature vector of at least one previous audio segment before the subsequent audio segment can be determined based on the obtained current feature sequence.

[0087] In an optional implementation manner, the prediction result determination module is further used to:

[0088] In a case where the current audio segment is the first audio segment among the multiple sample audio segments, determining, based on a current feature sequence of the current audio segment, a current feature vector corresponding to the current feature sequence;

[0089] The current feature vector is used as a previous feature vector of at least one previous audio segment before the current audio segment.

[0090] In an optional implementation manner, when the prediction result determination module is used to input the second sample feature sequence into the feature decoding layer of the neural network to obtain the predicted segment recognition result of the sample audio segment, it is specifically used to:

[0091] The feature decoding layer of the neural network decodes the second sample feature sequence to obtain a plurality of candidate recognition results of the sample audio segment, wherein the candidate recognition results include blank labels and text labels;

[0092] Deleting blank labels from the plurality of candidate recognition results to obtain a plurality of candidate recognition results after deletion;

[0093] For the multiple candidate recognition results after the deletion processing, based on the text content of each text label, the multiple candidate recognition results after the deletion processing are deduplicated to obtain multiple candidate recognition results after the deduplication processing;

[0094] The multiple candidate recognition results after deduplication processing are combined and arranged to obtain a predicted segment recognition result of the sample audio segment.

[0095] The present disclosure also provides a speech recognition device, the device comprising:

[0096] A data acquisition module, configured to receive a current voice segment output in real time, wherein the current voice segment includes a plurality of current real-time audio frames and at least one historical real-time audio frame before the plurality of current real-time audio frames;

[0097] The speech recognition module is used to input the current speech segment into a streaming speech recognition model trained by the above-mentioned neural network training device for real-time speech recognition to obtain a speech recognition result of the current speech segment.

[0098] An embodiment of the present disclosure also provides an electronic device, including: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the above-mentioned neural network training method or speech recognition method are performed.

[0099] The embodiments of the present disclosure also provide a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the above-mentioned neural network training method or speech recognition method are executed.

[0100] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings.

[0101] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and are not intended to limit the technical solutions of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0102] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following briefly introduces the drawings required for use in the embodiments, which are incorporated into the specification and constitute a part of the specification, and these drawings illustrate embodiments consistent with the present disclosure, and together with the specification, are used to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure, and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.

[0103] Figure 1 A flowchart of a neural network training method provided by an embodiment of the present disclosure is shown;

[0104] Figure 2 A schematic diagram of determining a sampled audio frame provided by an embodiment of the present disclosure is shown;

[0105] Figure 3 A schematic diagram of the structure of a streaming speech recognition neural network provided by an embodiment of the present disclosure is shown;

[0106] Figure 4 A schematic diagram of determining a first sample feature sequence provided by an embodiment of the present disclosure is shown;

[0107] Figure 5 A schematic diagram of determining a second sample feature sequence provided by an embodiment of the present disclosure is shown;

[0108] Figure 6A flow chart of a speech recognition method provided by an embodiment of the present disclosure is shown;

[0109] Figure 7 A schematic diagram of a neural network training device provided by an embodiment of the present disclosure is shown;

[0110] Figure 8 A schematic diagram of a speech recognition device provided by an embodiment of the present disclosure is shown;

[0111] Fig. 9 A schematic diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0112] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.

[0113] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0114] The term "and / or" herein only describes an association relationship, indicating that three relationships may exist. For example, A and / or B may represent the following three situations: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C may represent including any one or more elements selected from the set consisting of A, B, and C.

[0115] Research has found that in scenarios where speech recognition is needed, people mostly want to wait as long as possible for the recognition results. Since the length of audio data is related to the recognition time, long audio data will lead to large computational complexity, slow recognition speed, and time delay, which requires a lot of time to wait for the recognition results. Therefore, streaming ASR is widely used in a large number of scenarios, which requires recognizing the speech content as soon as possible after receiving a word spoken by the speaker, but at this time there is little information available for recognition, and the speech recognition effect is not good.

[0116] Based on the above research, the present disclosure provides a neural network training method and a speech recognition method. By introducing historical audio frames and future audio frames on the basis of the current audio frames, the number of audio frames contained in the sample audio segment is increased, the sample feature vectors contained in the training data can be improved, and the robustness of the streaming speech recognition model obtained through training can be greatly increased. Then, the trained streaming speech recognition model can be used to perform speech recognition on the current speech segment output in real time, with high recognition accuracy, fast recognition speed and good recognition effect.

[0117] The defects existing in the above solutions are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the present disclosure for the above problems below should be the contributions made by the inventor to the present disclosure during the disclosure process.

[0118] To facilitate understanding of this embodiment, a neural network training method disclosed in an embodiment of the present disclosure is first introduced in detail. The execution subject of the neural network training method provided in the embodiment of the present disclosure may be a neural network training device. For example, the neural network training method may be executed by a terminal device or a server or other processing device. In some possible implementations, the neural network training method may be implemented by a processor calling a computer-readable instruction stored in a memory.

[0119] A neural network training method provided by an embodiment of the present disclosure is described below.

[0120] See also Figure 1 , Figure 1 A flowchart of a neural network training method provided by an embodiment of the present disclosure. Figure 1 As shown in , the neural network training method provided by the embodiment of the present disclosure includes:

[0121] S101: Acquire sample audio data and actual audio recognition results of the sample audio data.

[0122] When neural network training is required, firstly, sample audio data for training needs to be prepared, and the actual audio recognition result corresponding to the sample audio data needs to be determined;

[0123] Here, the actual audio recognition result includes text information obtained by recognizing the sample audio data, and the text information includes the words recorded in the sample audio data.

[0124] Optionally, according to training requirements, recording devices such as recorders and microphones can be set up in real scenarios to collect sample audio data through the recording devices. Alternatively, shooting devices such as video recorders can be set up to capture a video including the speaking process, and then the audio signal can be extracted from the video as sample audio data. Alternatively, sample audio data can be obtained from an audio database on the Internet. No limitation is made here.

[0125] S102: Determine multiple sample audio segments from the sample audio data, and determine an actual segment recognition result of each sample audio segment from the actual audio recognition result, the sample audio segment including multiple frames of current audio frames, at least one frame of historical audio frames before the multiple frames of current audio frames, and at least one frame of future audio frames after the multiple frames of current audio frames.

[0126] When actually performing speech recognition, most of the scenarios are streaming speech recognition. In order to be able to train to meet the training requirements of streaming speech recognition scenarios, multiple sample audio segments can be determined from the sample audio data. Correspondingly, the actual segment recognition result of each sample audio segment needs to be determined from the actual audio recognition result.

[0127] Here, the sample audio segment includes multiple frames of current audio frames, at least one frame of historical audio frames before the multiple frames of current audio frames, and at least one frame of future audio frames after the multiple frames of current audio frames. This can simulate the effect of streaming recognition during actual speech recognition. In this way, by adding historical information and future information, the sample data volume and richness of each sample audio segment are increased, which helps to improve the accuracy of speech recognition.

[0128] In order to determine the sample audio segment, in some possible implementation modes, determining a plurality of sample audio segments from the sample audio data includes:

[0129] Using a preset sampling time window and a preset sampling displacement, the sample audio data is sampled to obtain a plurality of sampled audio frames, wherein a time span corresponding to the preset sampling time window is greater than a time span corresponding to the preset sampling displacement;

[0130] The multiple sampled audio frames are segmented to obtain multiple sample audio segments.

[0131] In this step, a preset sampling time window and a preset sampling shift for this round of training may be obtained according to training requirements, so as to perform data sampling on the sample audio data to obtain a plurality of sampled audio frames.

[0132] Here, the time span corresponding to the preset sampling time window is greater than the time span corresponding to the preset sampling shift.

[0133] It can be understood that because the time span corresponding to the preset sampling time window is greater than the time span corresponding to the preset sampling shift, the same unit audio frame must exist in two consecutive sampled audio frames, which helps to ensure the information integrity of the sampled audio frames.

[0134] Then, the multiple sampled audio frames may be segmented, and historical audio frames and future audio frames may be added to obtain multiple sample audio segments.

[0135] For example, please see also Figure 2 If the time span corresponding to the sampling time window is 25ms, and the time span corresponding to the preset sampling shift is 10ms, then for the sample audio data, a 25ms sampled audio frame is collected each time, and collection is performed every 10ms. In this way, 0-25ms is the first sampled audio frame collected, 10-35ms is the second sampled audio frame collected, 20-45ms is the third sampled audio frame collected, 30-55ms is the fourth sampled audio frame collected, and so on, thereby achieving sampling of multiple sampled audio frames from the sample audio data.

[0136] In this way, the sample audio data can be converted into multiple sample audio segments, and the sample audio segments can be used to simulate the speech segments received during actual speech recognition, thereby improving the training effect of the subsequent streaming speech recognition neural network.

[0137] Accordingly, in some possible implementations, the segmenting of the multiple sampled audio frames to obtain multiple sample audio segments includes:

[0138] Taking a set of audio frames obtained by continuously sampling a preset number of times through the preset sampling time window as a candidate audio segment, obtaining multiple candidate audio segments, wherein the continuous multiple-frame sampled audio frames in the candidate audio segments are taken as corresponding multiple-frame current audio frames;

[0139] For each candidate audio segment, determine, from the multiple sampled audio frames, at least one continuous historical audio frame before the candidate audio segment, and, according to the dynamic delay time generated for this round of training, determine at least one continuous future audio frame after the candidate audio segment and matching the dynamic delay time, wherein the at least one continuous historical audio frame and the at least one future audio frame are respectively adjacent to the candidate audio segment;

[0140] The at least one historical audio frame, the multiple current audio frames of the candidate audio segment, and the at least one future audio frame are spliced ​​to obtain a corresponding sample audio segment.

[0141] In this step, when multiple sampled audio frames are obtained, a set of audio frames obtained by continuously sampling the preset number of times through the preset sampling time window is determined according to the preset number of times, and the audio frame set is used as a candidate audio segment, thereby obtaining multiple candidate audio segments.

[0142] Exemplarily, following the above example, if the preset number of times is 4, the first to fourth sampled audio frames are subjected to frame stacking processing to obtain the first audio frame set, the second to fifth sampled audio frames are subjected to frame stacking processing to obtain the second audio frame set, and so on, and each obtained audio frame set is used as a candidate audio segment, thereby obtaining multiple candidate audio segments.

[0143] In this way, by determining the historical audio frames and future audio frames corresponding to each candidate audio clip, sample audio clips are spliced ​​together to increase the richness of the sample audio clips, increase the sample feature vectors contained in the training data, and improve the receptive field of the streaming speech recognition neural network for each sample audio clip, thereby effectively enhancing the recognition effect of the context.

[0144] Then, for each candidate audio segment, from the multiple frames of sampled audio frames, at least one continuous frame of historical audio frames before the candidate audio segment can be determined according to a preset number of historical audio frames. At the same time, based on the dynamic delay time generated for this round of training, at least one continuous frame of future audio frame after the candidate audio segment and matching the dynamic delay time can be determined.

[0145] Here, the at least one historical audio frame and the at least one future audio frame are respectively adjacent to the candidate audio segment, effectively ensuring the relevance of the at least one historical audio frame and the at least one future audio frame to the candidate audio segment, thereby enhancing the recognition effect of the context.

[0146] Among them, according to the training requirements of each round of training, a dynamic delay time matching this round of training can be generated.

[0147] Preferably, the dynamic delay time corresponding to each round of training can be different, which helps to improve the robustness of the trained streaming speech recognition model.

[0148] Exemplarily, the dynamic delay time corresponding to the first round of training is 320 ms, and the dynamic delay time corresponding to the second round of training is 640 ms.

[0149] Among them, in the process of determining at least one historical audio frame and the at least one future audio frame of the candidate audio segment, for the first audio segment among multiple candidate audio segments, there is no historical audio frame before it, and for the last audio segment among multiple candidate audio segments, there is no future audio frame after it. Therefore, certain settings are required for the first audio segment and the last audio segment among the multiple candidate audio segments.

[0150] Therefore, in some possible implementations, in the process of determining at least one historical audio frame and at least one future audio frame of the candidate audio segment, if the candidate audio segment is the first audio segment among the multiple candidate audio segments, at least one first blank audio frame is determined, and the at least one first blank audio frame is used as the at least one historical audio frame of the candidate audio segment; if the candidate audio segment is the last audio segment among the multiple candidate audio segments, at least one second blank audio frame is determined, and the at least one second blank audio frame is used as the at least one future audio frame of the candidate audio segment.

[0151] In this way, in the process of determining at least one historical audio frame and at least one future audio frame of the candidate audio segment, a blank audio frame is introduced for the first audio segment and the last audio segment among multiple candidate audio segments, which are divided into at least one historical audio frame as the first audio segment and at least one future audio frame as the last audio segment, so that the data in the training process of the streaming speech recognition neural network is consistent with the actual speech output data, thereby ensuring the accuracy and effectiveness of the streaming speech recognition neural network training process.

[0152] Next, the at least one historical audio frame, the multiple current audio frames of the candidate audio segment, and the at least one future audio frame are spliced ​​to obtain a corresponding sample audio segment.

[0153] S103: Input the plurality of sample audio segments into a pre-built streaming speech recognition neural network to obtain a predicted segment recognition result for each of the sample audio segments.

[0154] In this step, after obtaining multiple sample audio segments, the multiple sample audio segments can be input into a pre-built streaming speech recognition neural network. Through the processing of the streaming speech recognition neural network, a predicted segment recognition result of each sample audio segment can be obtained.

[0155] Specifically, in some possible implementations, the step of inputting the plurality of sample audio segments into a pre-built streaming speech recognition neural network to obtain a predicted segment recognition result for each of the sample audio segments includes:

[0156] For each of the sample audio segments, input the sample audio segment into a feature convolution layer in a streaming speech recognition neural network to obtain a first sample feature sequence of the sample audio segment output by the feature convolution layer;

[0157] Inputting the first sample feature sequence into a feature encoding layer in the streaming speech recognition neural network to obtain an encoded second sample feature sequence;

[0158] The second sample feature sequence is input into the feature decoding layer of the streaming speech recognition neural network to obtain a predicted segment recognition result of the sample audio segment.

[0159] Here, you can also refer to Figure 3 , Figure 3 A schematic diagram of the structure of a streaming speech recognition neural network provided in an embodiment of the present disclosure, such as Figure 3 As shown in, the streaming speech recognition network may include a feature convolution layer, a feature encoding layer and then a feature decoding layer, the feature convolution layer is used to convolve each of the sample audio segments to obtain a first sample feature sequence of the sample audio segment, the feature encoding layer is used to encode the first sample feature sequence to obtain a second sample feature sequence, and the feature decoding layer is used to decode the second sample feature sequence to obtain a predicted segment recognition result of the sample audio segment.

[0160] In this way, through the processing of each layer in the streaming speech recognition neural network, the predicted segment recognition result of the sample audio segment can be obtained, so as to subsequently adjust the network parameters of the streaming speech recognition neural network based on the predicted segment recognition result.

[0161] Specifically, when the sample audio segment needs to be processed, in some possible implementations, inputting the sample audio segment into a feature convolution layer in a streaming speech recognition neural network to obtain a first sample feature sequence of the sample audio segment output by the feature convolution layer includes:

[0162] Inputting the sample audio segment into a feature convolution layer in a streaming speech recognition neural network, respectively extracting a historical sample feature vector of the at least one historical audio frame, a current sample feature sequence of the multiple current audio frames, and a future sample feature sequence of the at least one future audio frame;

[0163] Based on the historical sample feature vector, the current sample feature sequence and the future sample feature sequence, an initial sample feature sequence of the sample audio segment is obtained;

[0164] The initial sample feature sequence is subjected to convolution processing to obtain a first sample feature sequence output by the feature convolution layer.

[0165] Here, in order to reduce the amount of calculation and improve the training speed, the at least one historical audio frame can be compressed to obtain a compressed historical sample feature vector.

[0166] For example, please see also Figure 4 , Figure 4 A schematic diagram for determining a first sample feature sequence provided for an embodiment of the present disclosure, wherein the feature convolution layer includes two VGG layers, the two VGG layers are arranged in series, each VGG layer is composed of two 3×3 convolution layers, an activation function layer and a pooling layer, the first VGG layer has 32 channels, and the second VGG layer has 64 channels. Each VGG layer uses a 2×2 maximum pool with a step size of 2, which can extract a feature vector from a sample audio clip, and then map the feature vector from a low dimension to a high dimension to obtain a first sample feature sequence.

[0167] In this way, through the processing of the convolutional feature layer, the sample audio segment is converted into a first sample feature sequence, so that the first sample feature sequence contains information of historical audio frames, current audio frames and future audio frames, effectively improving the receptive field of the streaming speech recognition neural network during the training process.

[0168] In some possible implementations, inputting the first sample feature sequence into a feature encoding layer in the neural network to obtain an encoded second sample feature sequence includes:

[0169] Taking the sample audio segment as the current audio segment, obtaining a previous feature vector of at least one previous audio segment before the current audio segment;

[0170] Based on the first sample feature sequence, determining a first key feature sequence, a first value feature sequence, and a first query feature sequence for the current audio segment, wherein the first key feature sequence includes a first historical key feature, a current key feature, and a future key feature, the first value feature sequence includes a first historical value feature, a current value feature, and a future value feature, and the first query feature sequence includes a current query feature vector and a future query feature vector;

[0171] Determining a second history key feature and a second history value feature for the current audio segment based on the previous feature vector;

[0172] Based on the second historical key feature and the second historical value feature, as well as the first historical key feature, the current key feature, the future key feature, the first historical value feature, the current value feature, the future value feature, the current query feature vector and the future query feature vector, determine a second sample feature sequence obtained by encoding the first sample feature sequence.

[0173] The preceding audio segment of the current audio segment is an audio segment before the current audio segment and not adjacent to the current audio segment.

[0174] Exemplarily, the current audio segment is 10s-12s, and the previous audio segment is 0-2s.

[0175] Optionally, the feature encoding layer can be composed of 12 transformer layers, each transformer layer has 8 multi-head SANs, the transformer layer dimension is 768, and the FFN dimension is 2048.

[0176] Here, please also refer to Figure 5 , Figure 5 A schematic diagram of determining a second sample feature sequence provided in an embodiment of the present disclosure is provided. Here, a processing process of a transformer layer is used as an example for explanation. The processing processes of each transformer layer are the same. Figure 5As shown in , it can be determined that the first sample feature sequence includes a feature vector M indicating at least one future audio frame, a feature vector C indicating the current audio frame, and a feature vector R indicating at least one future audio frame. At the same time, the first sample feature sequence can be average-pooled to obtain a current feature sequence S of the current audio segment. In addition, a previous feature vector L (not shown) corresponding to the current audio segment can also be determined, and then based on the first sample feature sequence, a first key feature sequence K, a first value feature sequence V and a first query feature sequence Q for the current audio segment are determined. The first key feature sequence K includes a first historical key feature KM, a current key feature KC and a future key feature KR. The first value feature sequence V includes a first historical value feature VM, a current value feature VC and a future value feature VR. The first query feature sequence Q includes a current query feature vector QC and a future query feature vector QR. Based on the previous feature vector L, the second historical key feature KL and the second historical value feature VL for the current audio segment are determined. Based on the second historical key feature KL and the second historical value feature VL, the first historical key feature KM, the current key feature KC, the future key feature KR, the first historical value feature VM, the current value feature VC, the future value feature VR, the current query feature vector QC and the future query feature vector QR, the second sample feature sequence obtained after encoding the first sample feature sequence is determined.

[0177] The calculation formula of the first key feature sequence is shown in the following formula (1):

[0178]

[0179] in, is the first key feature sequence, is a feature vector indicating at least one future audio frame, is the second history key feature, is the feature vector indicating the current audio frame, is a feature vector indicating at least one future audio frame, W k is a learnable matrix.

[0180] The calculation formula of the first value feature sequence is shown in the following formula (2):

[0181]

[0182] in, is the first value characteristic sequence, is a feature vector indicating at least one future audio frame, is the second historical value feature, is the feature vector indicating the current audio frame, is a feature vector indicating at least one future audio frame, W v is a learnable matrix.

[0183] The calculation formula of the FFN is shown in the following formula (3):

[0184]

[0185] in, is the processed feature vector indicating the current audio frame, is a processed feature vector indicating at least one future audio frame, is the feature vector indicating the current audio frame, is a feature vector indicating at least one future audio frame.

[0186] The calculation formula of the attention is shown in the following formulas (4), (5), and (6):

[0187]

[0188] in, is the feature vector indicating the current audio frame applied to the remaining transformer layers and FFN, W q is the learnable matrix, is the processed feature vector indicating the current audio frame, is the first key feature sequence, is the first value characteristic sequence, is a feature vector indicating the current audio frame.

[0189]

[0190] in, is the feature vector indicating at least one future audio frame applied to the remaining transformer layers and FFN, W q is the learnable matrix, is a processed feature vector indicating at least one future audio frame, is the first key feature sequence, is the first value characteristic sequence, is a feature vector indicating at least one future audio frame.

[0191]

[0192] in, is the current eigenvector, W q is the learnable matrix, is the current feature sequence, is the first key feature sequence, is the first value feature sequence.

[0193] The calculation formula of the output sequence of the transformer layer is shown in the following formulas (7), (8) and (9):

[0194]

[0195] in, is the current feature vector set, is the current feature vector.

[0196]

[0197] in, is the candidate feature sequence to be transmitted to the next transformer layer, is the feature vector indicating the current audio frame applied to the remaining transformer layers and FFN, is a feature vector indicating at least one future audio frame that is applied to the remaining transformer layers and FFN.

[0198]

[0199] in, is the feature sequence transmitted to the next transformer layer, is the candidate feature sequence to be transmitted to the next transformer layer, is the feature vector indicating the current audio frame applied to the remaining transformer layers and FFN, is a feature vector indicating at least one future audio frame that is applied to the remaining transformer layers and FFN.

[0200] In this way, through the processing of the feature coding layer, the first key feature sequence, the first value feature sequence and the first query feature sequence of the current audio clip are obtained, and then combined with the second historical key feature and the second historical value feature, the second sample feature sequence is obtained after encoding the first sample feature sequence, thereby effectively increasing the richness of the second sample feature sequence.

[0201] In some possible implementations, the method further includes:

[0202] During the process of encoding the first sample feature sequence, the current feature sequence of the current audio segment is output so that during the encoding process of the subsequent audio segment after the current audio segment, a previous feature vector of at least one previous audio segment before the subsequent audio segment can be determined based on the obtained current feature sequence.

[0203] Here, you can also refer to Figure 5 , Figure 5 The S in it is the current feature sequence of the current audio segment, and the QS obtained based on S can be output and stored to determine the previous feature vector of at least one previous audio segment before the subsequent audio segment as the current feature sequence.

[0204] In this way, the current feature sequence of the current audio segment can be stored so that the subsequent audio segment after the current audio segment can obtain the previous feature vector of at least one previous audio segment before the subsequent audio segment during the encoding process.

[0205] Wherein, for the first audio segment among the plurality of sample audio segments, there is no previous audio segment, so the online feature vector corresponding to the first audio segment may be set in a certain manner.

[0206] Accordingly, in some possible implementations, the method further includes:

[0207] In a case where the current audio segment is the first audio segment among the multiple sample audio segments, determining, based on a current feature sequence of the current audio segment, a current feature vector corresponding to the current feature sequence;

[0208] The current feature vector is used as a previous feature vector of at least one previous audio segment before the current audio segment.

[0209] In this way, when the current audio segment is the first audio segment among multiple sample audio segments, the current feature vector corresponding to the current feature sequence is used as the previous feature vector, thereby improving the flexibility and accuracy of the streaming speech recognition neural network training process.

[0210] In some possible implementations, inputting the second sample feature sequence into the feature decoding layer of the neural network to obtain a predicted segment recognition result of the sample audio segment includes:

[0211] The feature decoding layer of the neural network decodes the second sample feature sequence to obtain a plurality of candidate recognition results of the sample audio segment, wherein the candidate recognition results include blank labels and text labels;

[0212] Deleting blank labels from the plurality of candidate recognition results to obtain a plurality of candidate recognition results after deletion;

[0213] For the multiple candidate recognition results after the deletion processing, based on the text content of each text label, the multiple candidate recognition results after the deletion processing are deduplicated to obtain multiple candidate recognition results after the deduplication processing;

[0214] The multiple candidate recognition results after deduplication processing are combined and arranged to obtain a predicted segment recognition result of the sample audio segment.

[0215] Optionally, when multiple candidate recognition results after deduplication are combined and arranged, multiple sequences corresponding to multiple feasible arrangement methods can be obtained. In order to improve the accuracy of the predicted fragment recognition results, the multiple sequences can be probability optimized to maximize the probability of the correct sequence.

[0216] Here, if multiple sequences are obtained, the probability optimization can be performed on each sequence separately, or multiple sequences can be combined into a comprehensive sequence and then the probability optimization can be performed on the comprehensive sequence. No limitation is made here.

[0217] Optionally, probability optimization can be performed by back propagation. For example, if the sequence probability is 0.1 and the optimization probability target is 1, there is a 0.9 difference between the sequence probability and the optimization probability target, which means that the loss is relatively large at this time. Therefore, the sequence probability needs to be optimized in the direction of reducing the loss. After the loss is reduced, the correct sequence can be screened out with a higher probability.

[0218] Among them, the sequence can be optimized by CYC loss. For example, there are multiple candidate recognition results L. The candidate recognition results in CTC can be expressed as L'=L∪{blank}. Let π be a feasible solution sequence, is the output probability of unit k at time t, then the calculation formula of the sequence probability is shown in the following formula (10):

[0219]

[0220] Among them, p(π|X) is the probability of each sequence, and T is the length of the second sample feature sequence.

[0221] The CTC criterion defines B(Y) to map the second sample feature sequence of length T to the correct sequence Y of length U. CTC calculates the probability of the correct sequence as shown in the following formula (11):

[0222]

[0223] Among them, p(Y|X) is the probability of the correct sequence, and p(π|X) is the probability of each sequence.

[0224] In this way, multiple candidate recognition results are deleted and deduplicated, and then combined and arranged to ensure the effectiveness and accuracy of the predicted segment recognition results.

[0225] S104: Based on the obtained multiple predicted segment recognition results and the actual segment recognition results corresponding to each predicted segment recognition result, the network parameters of the streaming speech recognition neural network are adjusted until the streaming speech recognition neural network meets the training cutoff condition, thereby obtaining a streaming speech recognition model for real-time speech recognition.

[0226] Optionally, based on a preset loss function, a loss value between multiple predicted segment recognition results and the actual segment recognition result corresponding to each predicted segment recognition result can be obtained. Combined with the loss value, when the loss value is less than a preset loss value, it is determined that the streaming speech recognition neural network meets the training cutoff condition, thereby obtaining a streaming speech recognition model for real-time speech recognition.

[0227] Optionally, when the number of training times of the streaming speech recognition neural network is greater than or equal to a preset number of training times, it is determined that the streaming speech recognition neural network meets the training cutoff condition, thereby obtaining a streaming speech recognition model for real-time speech recognition.

[0228] The neural network training method provided by the embodiment of the present disclosure increases the number of audio frames included in the sample audio segment by introducing historical audio frames and future audio frames on the basis of the current audio frame, thereby increasing the richness of the sample audio segment, improving the sample feature vectors included in the training data, improving the receptive field of the streaming speech recognition neural network for each sample audio segment, enhancing the recognition effect for the context, greatly increasing the robustness of the streaming speech recognition model obtained through training, and effectively improving the speech recognition accuracy and speed of the streaming speech recognition model.

[0229] Further, after the streaming speech recognition model is trained, the streaming speech recognition model can be used for speech recognition. Accordingly, the embodiment of the present disclosure also provides a speech recognition method. The execution subject of the speech recognition method provided by the embodiment of the present disclosure can be a neural network training device. For example, the speech recognition method can be executed by a terminal device or a server or other processing device. In some possible implementations, the speech recognition method can be implemented by a processor calling a computer-readable instruction stored in a memory.

[0230] A speech recognition method provided by an embodiment of the present disclosure is described below.

[0231] See also Figure 6 , Figure 6 Flow chart of a speech recognition method provided by an embodiment of the present disclosure. Figure 6 As shown in , the speech recognition method provided by the embodiment of the present disclosure includes:

[0232] S601: Receive a current voice segment output in real time, where the current voice segment includes a plurality of current real-time audio frames and at least one historical real-time audio frame before the plurality of current real-time audio frames.

[0233] In this step, when speech recognition is required, the current speech segment output in real time can be received.

[0234] The current voice segment may be a voice output of a speaker received in real time in a real scene.

[0235] Here, the current voice segment includes multiple frames of current real-time audio frames and at least one frame of historical real-time audio frames before the multiple frames of current real-time audio frames.

[0236] S602: Input the current voice segment into a streaming voice recognition model trained according to the above-mentioned neural network training method and used for real-time voice recognition to obtain a voice recognition result of the current voice segment.

[0237] In this step, after the current voice segment is input into the streaming voice recognition model, a voice recognition result for the current voice segment can be obtained.

[0238] Here, the recognition process for the current voice segment is similar to the above training process, which will not be described in detail here.

[0239] It should be noted that, different from the training process, since the current voice segment includes multiple frames of current real-time audio frames and at least one frame of historical real-time audio frames before the multiple frames of current real-time audio frames, and does not include future real-time audio frames, the feature convolution layer in the streaming speech recognition model does not need to extract the future sample feature sequence when processing the current voice segment, and does not need to determine the future key feature, the future value feature and the future query feature vector when the feature coding layer processes the first sample feature sequence.

[0240] The speech recognition method provided by the embodiment of the present disclosure can use the trained streaming speech recognition model to perform speech recognition on the current speech segment output in real time, so as to obtain the speech recognition result of the current speech segment, which helps to quickly obtain the speech recognition result with high recognition accuracy, fast recognition speed and good recognition effect.

[0241] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.

[0242] Based on the same inventive concept, a neural network training device corresponding to the neural network training method is also provided in the embodiments of the present disclosure. Since the principle of solving the problem by the device in the embodiments of the present disclosure is similar to the above-mentioned neural network training method in the embodiments of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0243] See also Figure 7 , Figure 7 Schematic diagram of a neural network training device provided by an embodiment of the present disclosure. Figure 7 As shown in , the neural network training device 700 provided in the embodiment of the present disclosure includes:

[0244] A sample acquisition module 710 is used to acquire sample audio data and actual audio recognition results of the sample audio data;

[0245] a segment determination module 720, configured to determine a plurality of sample audio segments from the sample audio data, and to determine an actual segment recognition result of each sample audio segment from the actual audio recognition result, wherein the sample audio segment includes a plurality of current audio frames, at least one historical audio frame before the plurality of current audio frames, and at least one future audio frame after the plurality of current audio frames;

[0246] A prediction result determination module 730 is used to input the plurality of sample audio segments into a pre-built streaming speech recognition neural network to obtain a prediction segment recognition result for each of the sample audio segments;

[0247] The model determination module 740 is used to adjust the network parameters of the streaming speech recognition neural network based on the obtained multiple predicted segment recognition results and the actual segment recognition results corresponding to each predicted segment recognition result, until the streaming speech recognition neural network meets the training cutoff condition, thereby obtaining a streaming speech recognition model for real-time speech recognition.

[0248] In an optional implementation manner, when the segment determination module 720 is used to determine a plurality of sample audio segments from the sample audio data, it is specifically used to:

[0249] Using a preset sampling time window and a preset sampling displacement, the sample audio data is sampled to obtain a plurality of sampled audio frames, wherein a time span corresponding to the preset sampling time window is greater than a time span corresponding to the preset sampling displacement;

[0250] The multiple sampled audio frames are segmented to obtain multiple sample audio segments.

[0251] In an optional implementation manner, when the segment determination module 720 is used to segment the multiple sampled audio frames to obtain multiple sample audio segments, it is specifically used to:

[0252] Taking a set of audio frames obtained by continuously sampling a preset number of times through the preset sampling time window as a candidate audio segment, obtaining multiple candidate audio segments, wherein the continuous multiple-frame sampled audio frames in the candidate audio segments are taken as corresponding multiple-frame current audio frames;

[0253] For each candidate audio segment, determine, from the multiple sampled audio frames, at least one continuous historical audio frame before the candidate audio segment, and, according to the dynamic delay time generated for this round of training, determine at least one continuous future audio frame after the candidate audio segment and matching the dynamic delay time, wherein the at least one continuous historical audio frame and the at least one future audio frame are respectively adjacent to the candidate audio segment;

[0254] The at least one historical audio frame, the multiple current audio frames of the candidate audio segment, and the at least one future audio frame are spliced ​​to obtain a corresponding sample audio segment.

[0255] In an optional implementation manner, the segment determination module 720 is used to determine, from the multiple sampled audio frames, at least one historical audio frame that is continuous before the candidate audio segment, and to determine, according to the dynamic delay time generated for this round of training, at least one future audio frame that is continuous after the candidate audio segment and matches the dynamic delay time, specifically for:

[0256] In the process of determining the at least one historical audio frame and the at least one future audio frame of the candidate audio segment, if the candidate audio segment is the first audio segment among the multiple candidate audio segments, determining at least one first blank audio frame, and using the at least one first blank audio frame as the at least one historical audio frame of the candidate audio segment;

[0257] If the candidate audio segment is the last audio segment among the multiple candidate audio segments, at least one second blank audio frame is determined, and the at least one second blank audio frame is used as at least one future audio frame of the candidate audio segment.

[0258] In an optional implementation manner, the prediction result determination module 730 is specifically used to:

[0259] For each of the sample audio segments, input the sample audio segment into a feature convolution layer in a streaming speech recognition neural network to obtain a first sample feature sequence of the sample audio segment output by the feature convolution layer;

[0260] Inputting the first sample feature sequence into a feature encoding layer in the streaming speech recognition neural network to obtain an encoded second sample feature sequence;

[0261] The second sample feature sequence is input into the feature decoding layer of the streaming speech recognition neural network to obtain a predicted segment recognition result of the sample audio segment.

[0262] In an optional implementation manner, the prediction result determination module 730, when used to input the sample audio segment into a feature convolution layer in a streaming speech recognition neural network to obtain a first sample feature sequence of the sample audio segment output by the feature convolution layer, is specifically used to:

[0263] Inputting the sample audio segment into a feature convolution layer in a streaming speech recognition neural network, respectively extracting a historical sample feature vector of the at least one historical audio frame, a current sample feature sequence of the multiple current audio frames, and a future sample feature sequence of the at least one future audio frame;

[0264] Based on the historical sample feature vector, the current sample feature sequence and the future sample feature sequence, an initial sample feature sequence of the sample audio segment is obtained;

[0265] The initial sample feature sequence is subjected to convolution processing to obtain a first sample feature sequence output by the feature convolution layer.

[0266] In an optional implementation manner, the prediction result determination module 730, when used to input the first sample feature sequence into the feature encoding layer in the neural network to obtain the encoded second sample feature sequence, is specifically used to:

[0267] Taking the sample audio segment as the current audio segment, obtaining a previous feature vector of at least one previous audio segment before the current audio segment;

[0268] Based on the first sample feature sequence, determining a first key feature sequence, a first value feature sequence, and a first query feature sequence for the current audio segment, wherein the first key feature sequence includes a first historical key feature, a current key feature, and a future key feature, the first value feature sequence includes a first historical value feature, a current value feature, and a future value feature, and the first query feature sequence includes a current query feature vector and a future query feature vector;

[0269] Determining a second history key feature and a second history value feature for the current audio segment based on the previous feature vector;

[0270] Based on the second historical key feature and the second historical value feature, as well as the first historical key feature, the current key feature, the future key feature, the first historical value feature, the current value feature, the future value feature, the current query feature vector and the future query feature vector, determine a second sample feature sequence obtained by encoding the first sample feature sequence.

[0271] In an optional implementation manner, the prediction result determination module 730 is further configured to:

[0272] During the process of encoding the first sample feature sequence, the current feature sequence of the current audio segment is output so that during the encoding process of the subsequent audio segment after the current audio segment, a previous feature vector of at least one previous audio segment before the subsequent audio segment can be determined based on the obtained current feature sequence.

[0273] In an optional implementation manner, the prediction result determination module 730 is further configured to:

[0274] In a case where the current audio segment is the first audio segment among the multiple sample audio segments, determining, based on a current feature sequence of the current audio segment, a current feature vector corresponding to the current feature sequence;

[0275] The current feature vector is used as a previous feature vector of at least one previous audio segment before the current audio segment.

[0276] In an optional implementation manner, when the prediction result determination module 730 is used to input the second sample feature sequence into the feature decoding layer of the neural network to obtain the predicted segment recognition result of the sample audio segment, it is specifically used to:

[0277] The feature decoding layer of the neural network decodes the second sample feature sequence to obtain a plurality of candidate recognition results of the sample audio segment, wherein the candidate recognition results include blank labels and text labels;

[0278] Deleting blank labels from the plurality of candidate recognition results to obtain a plurality of candidate recognition results after deletion;

[0279] For the multiple candidate recognition results after the deletion processing, based on the text content of each text label, the multiple candidate recognition results after the deletion processing are deduplicated to obtain multiple candidate recognition results after the deduplication processing;

[0280] The multiple candidate recognition results after deduplication processing are combined and arranged to obtain a predicted segment recognition result of the sample audio segment.

[0281] The neural network training device provided by the embodiment of the present disclosure increases the number of audio frames included in the sample audio segment by introducing historical audio frames and future audio frames on the basis of the current audio frame, thereby increasing the richness of the sample audio segment, improving the sample feature vectors included in the training data, improving the receptive field of the streaming speech recognition neural network for each sample audio segment, enhancing the recognition effect for the context, greatly increasing the robustness of the streaming speech recognition model obtained through training, and effectively improving the speech recognition accuracy and speed of the streaming speech recognition model.

[0282] Based on the same inventive concept, a speech recognition device corresponding to the speech recognition method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned speech recognition method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0283] See also Figure 8 , Figure 8 Schematic diagram of a speech recognition device provided by an embodiment of the present disclosure. Figure 8 As shown in , the speech recognition device 800 provided in the embodiment of the present disclosure includes:

[0284] The data acquisition module 810 is used to receive a current voice segment output in real time, wherein the current voice segment includes a plurality of current real-time audio frames and at least one historical real-time audio frame before the plurality of current real-time audio frames;

[0285] The speech recognition module 820 is used to input the current speech segment into a streaming speech recognition model trained by the above-mentioned neural network training device for real-time speech recognition to obtain a speech recognition result of the current speech segment.

[0286] The speech recognition device provided by the embodiment of the present disclosure can use the trained streaming speech recognition model to perform speech recognition on the current speech segment output in real time, so as to obtain the speech recognition result of the current speech segment, which helps to quickly obtain the speech recognition result with high recognition accuracy, fast recognition speed and good recognition effect.

[0287] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.

[0288] Corresponding to the above-mentioned neural network training method or speech recognition method, the embodiment of the present disclosure further provides an electronic device 900, such as Fig. 9 FIG. 1 is a schematic diagram of the structure of an electronic device 900 provided in an embodiment of the present disclosure, including:

[0289] Processor 910, memory 920, and bus 930; memory 920 is used to store execution instructions, including internal memory 921 and external memory 922; the internal memory 921 here is also called internal memory, which is used to temporarily store the operation data in the processor 910, and the data exchanged with the external memory 922 such as a hard disk. The processor 910 exchanges data with the external memory 922 through the internal memory 921. When the electronic device 900 is running, the processor 910 communicates with the memory 920 through the bus 930, so that the processor 910 can execute the steps of the above-mentioned neural network training method or speech recognition method.

[0290] The present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the neural network training method or the speech recognition method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.

[0291] The embodiments of the present disclosure also provide a computer program product, which includes computer instructions. When the computer instructions are executed by a processor, the steps of the neural network training method or speech recognition method described in the above method embodiments can be executed. For details, please refer to the above method embodiments, which will not be repeated here.

[0292] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is implemented as a computer storage medium. In another optional embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).

[0293] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the above-described equipment and devices can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed equipment, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0294] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0295] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0296] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0297] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A neural network training method, characterized in that: The method comprises: Acquire sample audio data and actual audio recognition results of the sample audio data; Determine a plurality of sample audio segments from the sample audio data, and determine an actual segment recognition result of each sample audio segment from the actual audio recognition result, wherein the sample audio segment includes a plurality of current audio frames, at least one historical audio frame before the plurality of current audio frames, and at least one future audio frame after the plurality of current audio frames; For each of the sample audio segments, input the sample audio segment into a feature convolution layer in a streaming speech recognition neural network to obtain a first sample feature sequence of the sample audio segment output by the feature convolution layer; Inputting the first sample feature sequence into a feature encoding layer in the streaming speech recognition neural network to obtain an encoded second sample feature sequence; The second sample feature sequence is decoded by the feature decoding layer of the neural network to obtain multiple candidate recognition results of the sample audio segment, wherein the candidate recognition results include blank labels and text labels; the blank labels are deleted from the multiple candidate recognition results to obtain multiple candidate recognition results after deletion; for the multiple candidate recognition results after deletion, based on the text content of each text label, the multiple candidate recognition results after deletion are deduplicated to obtain multiple candidate recognition results after deduplication; the multiple candidate recognition results after deduplication are combined and arranged to obtain a predicted segment recognition result of the sample audio segment; Based on the obtained multiple predicted segment recognition results and the actual segment recognition results corresponding to each predicted segment recognition result, the network parameters of the streaming speech recognition neural network are adjusted until the streaming speech recognition neural network meets the training cutoff conditions, thereby obtaining a streaming speech recognition model for real-time speech recognition.

2. The method according to claim 1, characterized in that The determining a plurality of sample audio segments from the sample audio data comprises: Using a preset sampling time window, sampling the sample audio data according to a preset sampling displacement to obtain a plurality of sampled audio frames, wherein the time span corresponding to the preset sampling time window is greater than the time span corresponding to the preset sampling displacement; The multiple sampled audio frames are segmented to obtain multiple sample audio segments.

3. The method according to claim 2, characterized in that The segmenting process of the plurality of sampled audio frames to obtain a plurality of sample audio segments includes: Taking a set of audio frames obtained by continuously sampling a preset number of times through the preset sampling time window as a candidate audio segment, obtaining multiple candidate audio segments, wherein the continuous multiple sampled audio frames in the candidate audio segments are taken as corresponding multiple current audio frames; For each candidate audio segment, determine, from the multiple sampled audio frames, at least one continuous historical audio frame before the candidate audio segment, and, according to the dynamic delay time generated for this round of training, determine at least one continuous future audio frame after the candidate audio segment and matching the dynamic delay time, wherein the at least one continuous historical audio frame and the at least one future audio frame are respectively adjacent to the candidate audio segment; The at least one historical audio frame, the multiple current audio frames of the candidate audio segment, and the at least one future audio frame are spliced ​​to obtain a corresponding sample audio segment.

4. The method according to claim 3, characterized in that The step of determining, from the multiple sampled audio frames, at least one historical audio frame that is continuous before the candidate audio segment, and determining, according to the dynamic delay time generated for this round of training, at least one future audio frame that is continuous after the candidate audio segment and matches the dynamic delay time, comprises: In the process of determining the at least one historical audio frame and the at least one future audio frame of the candidate audio segment, if the candidate audio segment is the first audio segment among the multiple candidate audio segments, determining at least one first blank audio frame, and using the at least one first blank audio frame as the at least one historical audio frame of the candidate audio segment; If the candidate audio segment is the last audio segment among the multiple candidate audio segments, at least one second blank audio frame is determined, and the at least one second blank audio frame is used as at least one future audio frame of the candidate audio segment.

5. The method according to claim 1, characterized in that The step of inputting the sample audio segment into a feature convolution layer in a streaming speech recognition neural network to obtain a first sample feature sequence of the sample audio segment output by the feature convolution layer includes: Inputting the sample audio segment into a feature convolution layer in a streaming speech recognition neural network, respectively extracting a historical sample feature vector of the at least one historical audio frame, a current sample feature sequence of the multiple current audio frames, and a future sample feature sequence of the at least one future audio frame; Based on the historical sample feature vector, the current sample feature sequence and the future sample feature sequence, an initial sample feature sequence of the sample audio segment is obtained; The initial sample feature sequence is subjected to convolution processing to obtain a first sample feature sequence output by the feature convolution layer.

6. The method according to claim 1, characterized in that The step of inputting the first sample feature sequence into a feature encoding layer in the neural network to obtain an encoded second sample feature sequence comprises: Taking the sample audio segment as the current audio segment, obtaining a previous feature vector of at least one previous audio segment before the current audio segment; Based on the first sample feature sequence, determining a first key feature sequence, a first value feature sequence, and a first query feature sequence for the current audio segment, wherein the first key feature sequence includes a first historical key feature, a current key feature, and a future key feature, the first value feature sequence includes a first historical value feature, a current value feature, and a future value feature, and the first query feature sequence includes a current query feature vector and a future query feature vector; Determining a second history key feature and a second history value feature for the current audio segment based on the previous feature vector; Based on the second historical key feature and the second historical value feature, as well as the first historical key feature, the current key feature, the future key feature, the first historical value feature, the current value feature, the future value feature, the current query feature vector and the future query feature vector, determine a second sample feature sequence obtained by encoding the first sample feature sequence.

7. The method according to claim 6, characterized in that The method further comprises: During the process of encoding the first sample feature sequence, the current feature sequence of the current audio segment is output so that during the encoding process of the subsequent audio segment after the current audio segment, a previous feature vector of at least one previous audio segment before the subsequent audio segment can be determined based on the obtained current feature sequence.

8. The method according to claim 7, characterized in that The method further comprises: In a case where the current audio segment is the first audio segment among the multiple sample audio segments, determining, based on a current feature sequence of the current audio segment, a current feature vector corresponding to the current feature sequence; The current feature vector is used as a previous feature vector of at least one previous audio segment before the current audio segment.

9. A speech recognition method, characterized in that: The method comprises: Receive a current voice segment output in real time, wherein the current voice segment includes a plurality of current real-time audio frames and at least one historical real-time audio frame before the plurality of current real-time audio frames; The current speech segment is input into a streaming speech recognition model for real-time speech recognition obtained by training according to any one of the neural network training methods of claims 1-8 to obtain a speech recognition result of the current speech segment.

10. A neural network training device, characterized in that: The device comprises: A sample acquisition module, used to acquire sample audio data and actual audio recognition results of the sample audio data; a segment determination module, configured to determine a plurality of sample audio segments from the sample audio data, and to determine an actual segment recognition result of each sample audio segment from the actual audio recognition result, wherein the sample audio segment includes a plurality of current audio frames, at least one historical audio frame before the plurality of current audio frames, and at least one future audio frame after the plurality of current audio frames; A prediction result determination module is used to input each of the sample audio segments into a feature convolution layer in a streaming speech recognition neural network to obtain a first sample feature sequence of the sample audio segment output by the feature convolution layer; input the first sample feature sequence into a feature coding layer in the streaming speech recognition neural network to obtain an encoded second sample feature sequence; input the first sample feature sequence into a feature coding layer in the streaming speech recognition neural network to obtain an encoded second sample feature sequence; decode the second sample feature sequence through a feature decoding layer of the neural network to obtain a plurality of candidate recognition results of the sample audio segment, the candidate recognition results including blank labels and text labels; delete the blank labels from the plurality of candidate recognition results to obtain a plurality of candidate recognition results after deletion; perform deduplication processing on the plurality of candidate recognition results after deletion based on the text content of each text label to obtain a plurality of candidate recognition results after deduplication; perform combination and arrangement on the plurality of candidate recognition results after deduplication to obtain a predicted segment recognition result of the sample audio segment; A model determination module is used to adjust the network parameters of the streaming speech recognition neural network based on the obtained multiple predicted segment recognition results and the actual segment recognition results corresponding to each predicted segment recognition result, until the streaming speech recognition neural network meets the training cutoff condition, thereby obtaining a streaming speech recognition model for real-time speech recognition.

11. A speech recognition device, characterized in that: The device comprises: A data acquisition module, configured to receive a current voice segment output in real time, wherein the current voice segment includes a plurality of current real-time audio frames and at least one historical real-time audio frame before the plurality of current real-time audio frames; A speech recognition module is used to input the current speech segment into a streaming speech recognition model trained by the neural network training device according to claim 10 and used for real-time speech recognition to obtain a speech recognition result of the current speech segment.

12. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the neural network training method according to any one of claims 1 to 8 or the speech recognition method according to claim 9 are performed.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, executes the steps of the neural network training method according to any one of claims 1 to 8 or the speech recognition method according to claim 9.

Citation Information

Patent Citations

  • Speech recognition method and device based on deep learning, equipment and medium

    CN114155832A

  • Streaming coding and speech recognition method and device, electronic equipment and storage medium

    CN114530144A

  • Speech recognition method and system, electronic equipment and storage medium

    CN114743540A