A method and related device for speech recognition
By extracting the speech features of the speech to be recognized and the historical speech, using the semantic extraction model to obtain the context embedded feature representation, and combining the encoding features for speech recognition, the problem of reduced accuracy caused by relying on historical text recognition results in the existing technology is solved, and a better Efficient speech recognition effect.
Patent Information
- Application Number
- CN202210482513.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-05
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2042-05-05
AI Technical Summary
Existing speech recognition technology relies on historical text recognition results, resulting in reduced accuracy of current speech recognition results, especially when there are errors in the text recognition results of historical speech.
By obtaining the speech features of the speech to be recognized and historical speech, the semantic extraction model is used to extract the context embedded feature representation, and the encoding features are input into the speech recognition model to avoid dependence on the current speech recognition results and improve the recognition accuracy.
It effectively improves the accuracy of speech recognition, avoids deviations in recognition results caused by historical speech text recognition errors, and improves the efficiency of human-computer interaction.
Smart Images

Figure CN115101075B
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of artificial intelligence technology, and specifically to a method for speech recognition and related devices. Background Art
[0002] Human-computer interaction technology based on automatic speech recognition (ASR) is a very important technology in the field of artificial intelligence (AI). It is widely used in various speech recognition devices, such as mobile phones and tablets, to improve the efficiency of human-computer interaction between the target object and the speech recognition device. The current mainstream end-to-end speech recognition is based on the Conformer architecture of convolutional neural network (CNN) and self-attention mechanism. The Conformer architecture can model both local and global information of speech, and has good recognition ability for end-to-end speech recognition.
[0003] However, in the current mainstream speech recognition method, the text recognition results of historical speech are usually used as the input of the speech recognition model to obtain the text recognition results of the current speech. In other words, in the relevant scheme, the speech recognition of the current speech will depend on the text recognition results of the historical speech. If the text recognition results of the historical speech are wrong, the text recognition results of the speech recognition of the current speech will also deviate greatly from the actual results, thereby reducing the accuracy of the recognition results of the current speech. Summary of the invention
[0004] The embodiments of the present application provide a method and related devices for speech recognition, which comprehensively consider the speech features of the current speech to be recognized and the corresponding context embedded feature representation, rather than relying solely on the text recognition results of historical speech, thereby avoiding errors in the recognition results obtained by speech recognition of the current speech to be recognized and improving the accuracy of speech recognition.
[0005] In the first aspect, the embodiment of the present application provides a method for speech recognition. The method may include: obtaining speech features of a speech to be recognized and speech features of a historical speech, wherein the historical speech is at least one speech sentence arranged before the speech to be recognized; using the speech features of the speech to be recognized and the speech features of the historical speech as inputs of a semantic extraction model to obtain a contextual embedded feature representation of the speech to be recognized; encoding the speech features of the speech to be recognized to obtain the encoded features of the speech to be recognized; based on the speech recognition model, performing recognition processing on the encoded features of the speech to be recognized and the contextual embedded feature representation of the speech to be recognized to obtain a recognition result of the speech to be recognized, and the recognition result is used to indicate the matching text corresponding to the speech to be recognized. It should be noted that the semantic extraction model in the embodiment of the present application is a machine learning model obtained by training with the extraction of the contextual embedded feature representation of the current speech sample as the training target, the speech features of the current speech sample, the text features corresponding to the current speech sample, the speech features of the historical speech sample, and the text features corresponding to the historical speech sample as the training data. In addition, the speech recognition model is a machine learning model obtained by training with the recognition of the text recognition result of the speech to be recognized as the training target, and the speech features of the current speech sample and the text features corresponding to the current speech sample as the training data.
[0006] In a second aspect, an embodiment of the present application provides a speech recognition device. The speech recognition device includes but is not limited to a terminal device, a server, etc. The speech recognition device includes an acquisition unit and a processing unit. The acquisition unit is used to acquire the speech features of the speech to be recognized and the speech features of the historical speech, wherein the historical speech is at least one speech sentence arranged before the speech to be recognized. The processing unit is used to use the speech features of the speech to be recognized and the speech features of the historical speech as inputs to a semantic extraction model to obtain a context embedded feature representation of the speech to be recognized. The processing unit is used to encode the speech features of the speech to be recognized to obtain the encoded features of the speech to be recognized. The processing unit is used to perform recognition processing on the encoded features of the speech to be recognized and the context embedded feature representation of the speech to be recognized based on the speech recognition model to obtain a recognition result of the speech to be recognized, and the recognition result is used to indicate the matching text corresponding to the speech to be recognized.
[0007] In some optional examples, the processing unit is used to: use the speech features of the speech to be recognized as the input of the semantic extraction model to obtain the semantic feature representation of the speech to be recognized; use the speech features of the historical speech as the input of the semantic extraction model to obtain the semantic feature representation of the historical speech; fuse the semantic feature representation of the speech to be recognized and the semantic feature representation of the historical speech to obtain the context embedded feature representation of the speech to be recognized.
[0008] In other optional examples, the processing unit is used to: input the encoded features of the speech to be recognized and the context embedded feature representation of the speech to be recognized into the speech recognition model to obtain the predicted classification probability of each word in the speech to be recognized; and determine the recognition result of the speech to be recognized based on the predicted classification probability of each word.
[0009] In other optional examples, the processing unit is used to: concatenate the speech features of the speech to be recognized and an all-zero feature vector of a preset length to obtain a concatenated first speech feature; input the concatenated first speech feature into a semantic extraction model to obtain a semantic feature representation of the speech to be recognized.
[0010] In other optional examples, the processing unit is used to: concatenate the speech features of the historical speech and an all-zero feature vector of a preset length to obtain a concatenated second speech feature; input the concatenated second speech feature into a semantic extraction model to obtain a semantic feature representation of the historical speech.
[0011] In some other optional examples, the acquisition unit is used to acquire the speech to be recognized. The processing unit is used to input the speech to be recognized into a speech feature extraction model to obtain speech features of the speech to be recognized, wherein the speech feature extraction model is a machine learning model obtained by training and processing speech samples as training data.
[0012] In some other optional examples, the acquisition unit is also used to acquire the speech features of the current speech sample and the text features corresponding to the current speech sample. The processing unit is also used to perform feature deletion and / or feature masking on the speech features of the current speech sample to obtain the first speech sample features, and perform feature deletion and / or feature masking on the text features corresponding to the current speech sample to obtain the first text features. The acquisition unit is also used to acquire the speech features of the historical speech sample and the historical text features corresponding to the historical speech sample. The processing unit is also used to perform feature deletion and / or feature masking on the speech features of the historical speech sample to obtain the first historical speech sample features, and perform feature deletion and / or feature masking on the historical text features corresponding to the historical speech sample to obtain the first historical text features. The processing unit is also used to iteratively train the semantic extraction model based on the first speech sample features, the first text features, the first historical speech sample features, and the first historical text features.
[0013] In other optional examples, the processing unit is also used to: input the first speech sample feature and the first text feature into the semantic extraction model to obtain a first semantic feature representation; obtain a reconstruction loss value based on the difference between the first semantic feature representation and the semantic feature representation of the current speech sample, wherein the semantic feature representation of the current speech sample is a semantic feature vector obtained after inputting the speech features of the current speech sample and the text features corresponding to the current speech sample into the semantic extraction model; and update the model parameters of the semantic extraction model based on the reconstruction loss value to obtain a semantic extraction model.
[0014] In other optional examples, the processing unit is also used to: input the speech features of the current speech sample and the first speech sample features into the semantic extraction model respectively to obtain the semantic representation corresponding to the current speech sample and the semantic representation corresponding to the first speech sample features; obtain the speech loss value based on the difference between the semantic representation corresponding to the current speech sample and the semantic representation corresponding to the first speech sample features; update the model parameters of the semantic extraction model based on the speech loss value to obtain the semantic extraction model.
[0015] In other optional examples, the processing unit is used to: calculate a first feature similarity between a semantic representation corresponding to a current speech sample and a semantic representation corresponding to a first speech sample feature, and a second feature similarity between the semantic representation corresponding to the current speech sample and a preset speech feature vector, wherein the preset speech feature vector is a feature vector independent of the current speech sample; and determine a speech loss value based on the first feature similarity and the second feature similarity.
[0016] In other optional examples, the processing unit is also used to: input the text features corresponding to the current voice sample and the first text features into the semantic extraction model respectively to obtain the semantic representation of the text features corresponding to the current voice sample and the semantic representation of the first text features; obtain the text loss value based on the difference between the semantic representation of the text features corresponding to the current voice sample and the semantic representation of the first text features; update the model parameters of the semantic extraction model based on the text loss value to obtain the semantic extraction model.
[0017] In other optional examples, the processing unit is used to: determine a second text feature from the text features corresponding to the current speech sample, wherein the second text feature is a feature of the text features corresponding to the current speech other than the first text feature; input the second text feature into a semantic extraction model to obtain a semantic representation of the second text feature; calculate the distance between the semantic representation of the second text feature and the semantic representation of the first text feature to obtain a text loss value.
[0018] The third aspect of the embodiment of the present application provides a speech recognition device, including: a memory, an input / output (I / O) interface and a memory. The memory is used to store program instructions. The processor is used to execute the program instructions in the memory to perform the speech recognition method corresponding to the implementation method of the first aspect above.
[0019] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer is enabled to execute a method corresponding to the implementation method of the first aspect described above.
[0020] The fifth aspect of the embodiments of the present application provides a computer program product containing instructions, which, when executed on a computer or a processor, enables the computer or the processor to execute the method corresponding to the implementation method of the first aspect.
[0021] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0022] In the embodiment of the present application, after obtaining the speech features of the speech to be recognized and the speech features of the historical speech, the speech features of the speech to be recognized and the speech features of the historical speech can be input into the semantic extraction model to obtain the corresponding context embedded feature representation of the speech to be recognized. In this way, after encoding the speech features of the speech to be recognized to obtain the encoded features of the speech to be recognized, the encoded features of the speech to be recognized and the context embedded feature representation of the speech to be recognized are used together as the input of the speech recognition model, and then the recognition result of the speech to be recognized is obtained, and the matching text corresponding to the speech to be recognized can be indicated by the recognition result. In other words, for the speech recognition of the current speech to be recognized in the embodiment of the present application, it is necessary to extract context information from the audio corresponding to the speech to be recognized, that is, it is necessary to take into account the speech features of the current speech to be recognized and the corresponding context embedded feature representation, rather than relying solely on the text recognition results of the historical speech, thereby avoiding errors in the recognition results obtained by speech recognition of the current speech to be recognized and improving the accuracy of speech recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0024] Figure 1 A schematic diagram showing an application scenario of the method for speech recognition provided by an embodiment of the present application is shown;
[0025] Figure 2 A schematic diagram of a recognition process framework of speech recognition provided by an embodiment of the present application is shown;
[0026] Figure 3A A flow chart of a method for speech recognition provided by an embodiment of the present application is shown;
[0027] Figure 3B Another flow chart of the method for speech recognition provided by an embodiment of the present application is shown;
[0028] Figure 4 A training diagram of a semantic extraction model provided in an embodiment of the present application is shown;
[0029] Figure 5 A schematic diagram of an embodiment of a speech recognition device provided in an embodiment of the present application is shown;
[0030] Figure 6 A schematic diagram of another embodiment of the speech recognition device provided in the embodiments of the present application is shown. DETAILED DESCRIPTION
[0031] The embodiments of the present application provide a method and related devices for speech recognition, which comprehensively consider the speech features of the current speech to be recognized and the corresponding context embedded feature representation, rather than relying solely on the text recognition results of historical speech, thereby avoiding errors in the recognition results obtained by speech recognition of the current speech to be recognized and improving the accuracy of speech recognition.
[0032] It is understandable that in the specific implementation of this application, related data such as user information is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0033] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0034] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the implementation of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0035] With the research and progress of artificial intelligence (AI) technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, unmanned driving, automatic driving, drones, robots, smart medical care, smart customer service, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0036] Human-computer interaction technology based on speech recognition is a very important technology in the field of artificial intelligence. It is widely used in various speech recognition devices and can improve the efficiency of human-computer interaction between the target object and the speech recognition device. End-to-end speech recognition is based on the Conformer architecture of CNN and self-attention mechanism in machine learning (ML) in the field of artificial intelligence. It has good recognition ability for end-to-end speech recognition and is currently a popular and important application scenario.
[0037] The embodiment of the present application provides a method for speech recognition. The method for speech recognition provided in the embodiment of the present application is implemented based on artificial intelligence. Artificial intelligence is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that the machines have the functions of perception, reasoning and decision-making.
[0038] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech technology, natural language processing technology, and machine learning / deep learning.
[0039] In the embodiments of the present application, the artificial intelligence technologies mainly involved include the above-mentioned speech technology, machine learning and other directions. For example, it may involve speech recognition in speech technology (speech technology); it may also involve deep learning (deep learning) in machine learning (machine learning, ML), including automatic encoders, embedding, etc. Among them, the key technologies of speech technology include automatic speech recognition technology, speech synthesis technology (text to speech, TTS) and voiceprint recognition technology, which enable computers to listen, see, speak and feel, and are the direction of future human-computer interaction, among which speech has become one of the most promising human-computer interaction methods in the future.
[0040] The speech recognition method provided in this application can be applied to speech recognition devices with data processing capabilities, such as terminal devices, servers, question-and-answer robots, etc. Among them, terminal devices may include but are not limited to smart phones, desktop computers, laptops, tablet computers, smart speakers, vehicle-mounted devices, smart watches, wearable smart devices, intelligent voice interaction devices, smart home appliances, aircraft, etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services, etc., which is not specifically limited in this application. In addition, the terminal devices and servers mentioned can be directly or indirectly connected by wired communication or wireless communication, etc., which is not specifically limited in this application.
[0041] The above-mentioned speech recognition device may have the ability to implement the above-mentioned automatic speech recognition technology. The automatic speech recognition technology mentioned may also be called speech recognition, computer speech recognition (computer speech recognition, CSR) or speech to text recognition (speech to text, STT), which can use a computer to automatically convert human speech content into corresponding text information. In an embodiment of the present application, the speech recognition device can perform speech recognition processing on the speech to be recognized and the context information of the speech to be recognized through the automatic speech recognition technology, and then obtain the text recognition result corresponding to the speech to be recognized.
[0042] In addition, the speech recognition device can also have machine learning capabilities. Machine learning is a multi-disciplinary subject that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include technologies such as neural networks.
[0043] The artificial intelligence model used in the speech recognition method provided in the embodiment of the present application mainly involves the application of a neural network, which is used to realize recognition processing of the text recognition result corresponding to the speech to be recognized.
[0044] In order to facilitate understanding of the technical solution of the present application, the method of speech recognition provided in the embodiment of the present application is introduced below in combination with actual application scenarios. Figure 1 A schematic diagram of an application scenario of the speech recognition method provided in an embodiment of the present application is shown.
[0045] As in Figure 1 The application scenario shown includes a terminal device and a server corresponding to the target object. Among them, the server stores various models, such as but not limited to a speech feature extraction model, a semantic extraction model, a speech recognition model, and the like. In order to achieve target object adaptation of speech recognition and subsequent cross-modal speech recognition, when the terminal device detects the speech to be recognized spoken by the target object, the speech to be recognized can be sent to the server. The server obtains the speech features of the speech to be recognized based on the corresponding speech feature extraction model, and obtains the speech features of the historical speech. Then, the server can also process the speech features of the speech to be recognized and the speech features of the historical speech based on the semantic extraction model, and can obtain the context embedded feature representation of the speech to be recognized, and then understand the context information of the speech to be recognized. In this way, after the server encodes based on the speech features of the speech to be recognized, it can input the encoded features and the context embedded feature representation into the speech recognition model for recognition processing, thereby obtaining the recognition result of the speech to be recognized, that is, indicating the matching text corresponding to the speech to be recognized through the recognition result.
[0046] It should be noted that the semantic extraction model mentioned is a machine learning model obtained by training with the contextual embedding feature representation of the current speech sample as the training target, and the speech features of the current speech sample, the text features corresponding to the current speech sample, the speech features of the historical speech sample, and the text features corresponding to the historical speech samples as the training data. For details, please refer to Figure 4The training process of the semantic extraction model described in the previous section is needed to understand it, so it will not be described here.
[0047] It is understandable that the above-mentioned speech feature extraction model, semantic extraction model, speech recognition model, etc. can also be deployed in the terminal device, and this application does not limit the specific description. In addition, the server can be an independent physical server, or a server cluster composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud storage, and CDN. The terminal device can also be understood with reference to the above content, which will not be repeated here.
[0048] Figure 2 A schematic diagram of a recognition process framework of speech recognition provided in an embodiment of the present application is shown.
[0049] like Figure 2 As shown, after obtaining the speech to be recognized and the historical speech, you can Figure 1 After the speech feature extraction model described in the above extracts speech features of the speech to be recognized and the historical speech respectively, the speech features of the speech to be recognized and the speech features of the historical speech can be obtained. Then, the speech features of the speech to be recognized and the speech features of the historical speech are input into Figure 1 In the semantic extraction model described in the above, the context embedding feature representation of the speech to be recognized is obtained. In addition, the speech recognition model can also include an encoding model and a decoding model, and the speech features of the speech to be recognized can be encoded by the encoding model in the speech recognition model, etc., to extract the corresponding encoding features. In this way, the context embedding feature representation and the encoding feature are input into the above Figure 1 The decoding model in the described speech recognition model can obtain the final recognition result of the speech to be recognized.
[0050] It should be understood that in practical applications, the above Figure 1 and Figure 2 The speech feature extraction model described in may include but is not limited to the Wav2vec2.0 model. Figure 2 The encoding model in the speech recognition model may also include but not limited to Conformer Encoder, etc., and the decoding model in the speech recognition model may also include but not limited to Contextual Decoder, etc., which are not specifically limited in this application. In addition, the encoding model is mainly used to encode the speech features of the speech to be recognized to obtain the encoding features representing the meaning. The decoding model is mainly used to decode the encoding features and the context embedded feature representation, so as to obtain the recognition results reflecting the context information, thereby improving the accuracy of the speech recognition network model.
[0051] A method for speech recognition provided in an embodiment of the present application is introduced below with reference to the accompanying drawings. Figure 3A A flow chart of the method for speech recognition provided by an embodiment of the present application is shown. Figure 3A As shown, the speech recognition method may include the following steps:
[0052] 301. Acquire speech features of the speech to be recognized and speech features of historical speech.
[0053] In this example, the speech to be recognized can be understood as the speech data of the corresponding text that needs to be recognized, or it can also be understood as the speech sentence of the corresponding text that needs to be recognized in a section of audio. The historical speech described can be understood as at least one speech sentence arranged in chronological order before the speech to be recognized in the same section of audio. Exemplarily, after the target object records the current speech to be recognized through a terminal device, etc., it can obtain the historical speech of the speech to be recognized in the same section of audio based on the query of time information.
[0054] In some optional examples, the speech features of the speech to be recognized can be obtained in the following manner, namely: obtaining the speech to be recognized; inputting the speech to be recognized into a speech feature extraction model to obtain the speech features of the speech to be recognized, wherein the speech feature extraction model is a machine learning model obtained after training processing using speech samples as training data.
[0055] In this example, since it may be applied to different intelligent speech recognition task processing scenarios, the speech to be recognized can be the same or different. For example, if the speech features are extracted in scenarios such as identity recognition of the target object, the speech to be recognized at this time can be a complete speech uploaded to the terminal device in advance. If the corresponding speech features need to be extracted in scenarios such as voice control, the speech to be recognized at this time can obtain the speech emitted by the target object through the built-in microphone, sound card and other devices of the terminal device. The method of obtaining the speech to be recognized here is only an example. In actual applications, there may be other acquisition methods, which are not specifically limited in this application.
[0056] In addition, since the speech feature extraction model is a pre-trained feature extraction model, and the speech feature extraction model is a machine learning model obtained by training with speech samples as training data and extracting speech features as the training target, after obtaining the speech to be recognized, the speech to be recognized can be processed by the speech feature extraction model to obtain the corresponding speech features of the speech to be recognized.
[0057] Similarly, after obtaining the speech to be recognized, the historical speech of the speech to be recognized can also be obtained based on time information, etc. In this way, after obtaining the historical speech, the historical speech can also be input into the speech feature extraction model to extract the speech features of the corresponding historical speech.
[0058] The speech features of the speech to be recognized described may include, but are not limited to, melfrequency cepstrum coefficient (MFCC) features, Fbank features, wave features, gamma features, prosody features, etc., which are not specifically limited in this application. Similarly, the speech features of historical speech may include, but are not limited to, MFCC features, Fbank features, wave features, gamma features, prosody features, etc., which are not specifically limited in this application.
[0059] 302. Using the speech features of the speech to be recognized and the speech features of the historical speech as inputs to a semantic extraction model to obtain a contextual embedded feature representation of the speech to be recognized.
[0060] In this example, the semantic extraction model described is a machine learning model obtained by training with the contextual embedding feature representation of the current speech sample as the training target, and with the speech features of the current speech sample, the text features corresponding to the current speech sample, the speech features of the historical speech sample, and the historical text features corresponding to the historical speech sample as the training data. Figure 3A The method of obtaining the speech features of the speech to be recognized in step 301 of FIG. 3 is understood, and will not be described in detail here. Similarly, the process of obtaining the speech features of the historical speech samples can also be specifically referred to in the aforementioned Figure 3A The method of obtaining the speech features of the historical speech in step 301 can be understood, and will not be repeated here.
[0061] For the text features corresponding to the current voice sample, the corresponding text can be determined after the current voice sample is obtained. Then, the text of the current voice sample is feature extracted based on the pre-trained text feature extraction model to obtain the corresponding text features corresponding to the current voice sample. Similarly, for the historical text features corresponding to the historical voice samples, the specific process of obtaining the text features corresponding to the current voice sample can also be understood by referring to the process of obtaining the text features corresponding to the current voice sample, which will not be described in detail here.
[0062] In this way, after obtaining the speech features of the current speech sample, the text features corresponding to the current speech sample, the speech features of the historical speech samples, and the historical text features corresponding to the historical speech samples, the context embedding features of the current speech sample can be used as the training target, and the speech features of the current speech, the text features corresponding to the current speech sample, the speech features of the historical speech samples, and the historical text features corresponding to the historical speech samples can be trained through machine learning, so that the trained semantic extraction model can have the ability to extract context-related information of the current speech from a piece of audio.
[0063] Schematically, before applying the semantic extraction model to extract the context embedding feature representation, the semantic extraction model can also be constructed and trained first. For example, Figure 4 A training diagram of the semantic extraction model provided in an embodiment of the present application is shown.
[0064] like Figure 4 As shown, in the model training process of the semantic extraction model, the acquired speech features of the current speech sample can be subjected to one or more operations of feature deletion and feature masking to obtain the first speech sample features. For example, if the speech features of the current speech sample are a1, a2, a3, a4 and a5. At this time, some of the speech features (such as a2) can be deleted and / or masked, and the first speech sample features obtained are: a1, a3, a4 and a5. It should be noted that the described speech features a1, a2, a3, a4 and a5 are only a schematic description, and in actual applications, they can also be other speech features, which are not specifically limited in the embodiments of the present application.
[0065] Similarly, the text features corresponding to the current voice sample are also subjected to one or more operations of feature deletion and feature masking to obtain the first text features. For example, if the voice features of the current voice sample are t1, t2, t3, t4 and t5. At this time, some of the text features (such as t2) can be deleted and / or masked, and the first text features obtained are: t1, t3, t4 and t5. It should be noted that the described text features t1, t2, t3, t4 and t5 are merely a schematic description, and in actual applications, they can also be other voice features, which are not specifically limited in the embodiments of the present application.
[0066] Similarly, it is also necessary to perform one or more operations including feature deletion and feature masking on the speech features of the historical speech samples and the historical text features corresponding to the historical speech samples to obtain the corresponding first historical speech sample features and first historical text features. The specific understanding can be referred to the aforementioned process of performing feature deletion and / or feature masking on the speech features of the current speech sample and the text features corresponding to the current speech sample, which will not be elaborated here.
[0067] In this way, after obtaining the first speech sample feature, the first text feature, the first historical speech sample feature and the first historical text feature, the first speech sample feature, the first text feature, the first historical speech sample feature and the first historical text feature can be used as training data to iteratively train the semantic extraction model, thereby achieving the training goal of extracting the context embedded feature representation of the current speech sample.
[0068] In some examples, because we want the output of the deep neural network to be as close as possible to the value we really want to predict, we can compare the predicted value of the current network with the target value we really want, and then update the weight vector of each layer of the neural network according to the difference between the two (of course, there is usually an initialization process before the first update, that is, pre-configuring parameters for each layer in the deep neural network). For example, if the network's predicted value is high, adjust the weight vector to make it predict lower, and keep adjusting until the neural network can predict the target value we really want. Therefore, it is necessary to pre-define "how to compare the difference between the predicted value and the target value", which is the loss function or objective function, which are important equations used to measure the difference between the predicted value and the target value. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, so the training of the deep neural network becomes a process of minimizing this loss as much as possible.
[0069] Therefore, in the specific training process, a loss function can be added synchronously to improve the learning ability of the semantic extraction model. The loss function described may include but is not limited to a reconstruction loss function, a speech loss function, a text loss function, etc., and this application does not make specific limitations. It should be understood that the embodiments of this application will subsequently use the three loss functions of reconstruction loss function, speech loss function, and text loss function as examples to illustrate how to train the semantic extraction model.
[0070] (1) Use the reconstruction loss function to train the semantic extraction model
[0071] Exemplarily, the speech recognition method may also include: inputting a first speech sample feature and a first text feature into a semantic extraction model to obtain a first semantic feature representation; obtaining a reconstruction loss value based on the difference between the first semantic feature representation and the semantic feature representation of the current speech sample, wherein the semantic feature representation of the current speech sample is a semantic feature vector obtained after inputting the speech features of the current speech sample and the text features corresponding to the current speech sample into the semantic extraction model; updating the model parameters of the semantic extraction model based on the reconstruction loss value to obtain a semantic extraction model.
[0072] For example, to obtain the output value of the reconstruction loss function, the first speech sample feature and the first text feature can be input into the semantic extraction model to obtain the first semantic feature representation. The first semantic feature representation described can be understood as the corresponding text representation after deleting and / or covering some speech sample features and text features.
[0073] Then, the reconstruction loss value is obtained by calculating the difference between the first semantic feature representation and the semantic feature representation of the current speech sample. In this way, the model parameters of the semantic extraction model can be continuously updated based on the reconstruction loss value, and the semantic extraction model can be trained.
[0074] It should be noted that the semantic feature representation of the current speech sample is a semantic feature vector obtained after the speech features of the current speech sample and the text features corresponding to the current speech sample are input into the semantic extraction model. In other words, the semantic feature representation of the current speech sample is the corresponding text representation before the speech sample features and text features are not deleted and / or covered.
[0075] (2) Using speech loss function to train semantic extraction model
[0076] In some optional examples, when the speech loss function is taken into account, the model parameters of the semantic extraction model can also be updated based on the output value of the speech loss function, that is, the speech loss value, to obtain the semantic extraction model. Specifically, the method also includes: inputting the speech features of the current speech sample and the first speech sample features into the semantic extraction model respectively to obtain the semantic representation corresponding to the current speech sample and the semantic representation corresponding to the first speech sample features; based on the difference between the semantic representation corresponding to the current speech sample and the semantic representation corresponding to the first speech sample features, obtaining the speech loss value; based on the speech loss value, updating the model parameters of the semantic extraction model to obtain the semantic extraction model.
[0077] In this example, the semantic representation corresponding to the current speech sample described can be understood as the semantic representation corresponding to all speech features of the current speech sample before they are deleted and / or covered. The semantic representation corresponding to the first speech sample feature can be understood as the semantic representation corresponding to some speech features of the current speech sample after they have been deleted and / or covered. The specific understanding can also refer to the content of the semantic representation corresponding to the first speech sample feature in the reconstruction loss function in (1) above, which will not be elaborated here.
[0078] In this way, by calculating the difference between the semantic representation corresponding to the first speech sample feature and the semantic representation of the current speech sample, the speech loss value is obtained. In this way, the model parameters of the semantic extraction model can be continuously updated based on the speech loss value, and the semantic extraction model can be trained.
[0079] Exemplarily, the speech loss value can also be calculated in the following manner, that is, based on the difference between the semantic representation corresponding to the current speech sample and the semantic representation corresponding to the first speech sample feature, the speech loss value is obtained, including: calculating the first feature similarity between the semantic representation corresponding to the current speech sample and the semantic representation corresponding to the first speech sample feature, and the second feature similarity between the semantic representation corresponding to the current speech sample and a preset speech feature vector, wherein the preset speech feature vector is a feature vector independent of the current speech sample; based on the first feature similarity and the second feature similarity, the speech loss value is determined.
[0080] In this example, the first feature similarity between the semantic representation corresponding to the current voice sample and the semantic representation corresponding to the first voice sample feature can be calculated using a preset similarity algorithm, such as: sim(H,H remain ), where H is the semantic representation corresponding to the current speech sample, H remain It is represented as the semantic representation corresponding to the first speech sample feature.
[0081] Then, the second feature similarity between the semantic representation corresponding to the current speech sample and the preset speech feature vector is calculated based on the preset similarity algorithm, that is, sim(H,H other ), where H other Represented as a feature vector that is independent of the current speech sample.
[0082] In this way, the speech loss value is determined based on the first feature similarity and the second feature similarity. For example, the first feature similarity sim(H,H remain ) and the second feature similarity sim(H,H other ) is input into the preset speech loss function to obtain the speech loss value. The preset speech loss function described can be understood as:
[0083]
[0084] It should be noted that the H other It is represented as a feature vector that is independent of the current speech sample, L MAN (θ) is represented as the speech loss value.
[0085] (3) Use text loss function to train semantic extraction model
[0086] In some optional examples, when the text loss function is taken into account, the model parameters of the semantic extraction model can also be updated based on the output value of the text loss function, that is, the text loss value, to obtain the semantic extraction model. Specifically, the method also includes: inputting the text features and the first text features corresponding to the current voice sample into the semantic extraction model respectively to obtain the semantic representation of the text features corresponding to the current voice sample and the semantic representation of the first text features; obtaining the text loss value based on the difference between the semantic representation of the text features corresponding to the current voice sample and the semantic representation of the first text features; updating the model parameters of the semantic extraction model based on the text loss value to obtain the semantic extraction model.
[0087] In this example, the semantic representation of the text features corresponding to the current voice sample can be understood as the semantic representation before all the text features corresponding to the current voice sample are deleted and / or covered. The semantic representation corresponding to the first text feature can be understood as the semantic representation after some of the text features corresponding to the current voice sample have been deleted and / or covered. The specific content can also be understood by referring to the semantic representation corresponding to the first text feature in the reconstruction loss function in (1) above, which will not be elaborated here.
[0088] In this way, by calculating the difference between the semantic representation of the text feature corresponding to the current speech sample and the semantic representation corresponding to the first text feature, the text loss value is obtained. In this way, the model parameters of the semantic extraction model can be continuously updated based on the text loss value, and the semantic extraction model can be trained.
[0089] Exemplarily, the text loss value can also be calculated in the following manner, that is, based on the difference between the semantic representation of the text feature corresponding to the current voice sample and the semantic representation of the first text feature, the text loss value is obtained, including: determining a second text feature from the text feature corresponding to the current voice sample, wherein the second text feature is a feature in the text feature corresponding to the current voice except the first text feature; inputting the second text feature into a semantic extraction model to obtain the semantic representation of the second text feature; calculating the distance between the semantic representation of the second text feature and the semantic representation of the first text feature to obtain the text loss value.
[0090] In this example, since the first text feature is the remaining text feature after the text feature corresponding to the current voice sample is deleted and / or covered, the second text feature can be determined from the text feature corresponding to the current voice sample, that is, the second text feature is the feature of the text feature corresponding to the current voice except the first text feature. In other words, the second text feature is the part of the text feature that is deleted and / or covered in the text feature corresponding to the current voice sample.
[0091] Then, the first text feature is input into the semantic extraction model to obtain the corresponding semantic representation of the first text feature. Similarly, the second text feature is input into the semantic extraction model to obtain the corresponding semantic representation of the second text feature. In this way, by presetting the text loss function and calculating the distance between the semantic representation of the second text feature and the semantic representation of the first text feature, the corresponding text loss value can be obtained.
[0092] It should be noted that the preset text loss function described can be understood by referring to the following formula, namely:
[0093] L MLM (θ)=-E (A,T) logP θ (T masked |A,T remain )
[0094] Among them, T masked |A represents the semantic representation of the second text feature, T remain It is represented as the semantic representation of the first text feature, L MLM (θ) is represented as the distance between the semantic representation of the second text feature and the semantic representation of the first text feature, that is, the text loss value.
[0095] It should be noted that, in practical applications, for the speech features of the historical speech samples and the historical text features corresponding to the historical speech samples, the corresponding loss values can also be calculated by referring to the contents in (1) to (3) above, and the semantic extraction model can be trained. In addition, in the embodiment of the present application, the reconstruction loss value, text loss value and speech loss value calculated separately above can also be used together to iteratively update the model parameters of the semantic extraction model, so as to train a semantic extraction model with better learning performance.
[0096] In passing Figure 4 After the semantic extraction model of the embodiment of the present application is obtained by training in the described manner, the context embedding feature representation of the speech to be recognized can be extracted based on the semantic extraction model. Specifically, Figure 3B Another flow chart of the method for speech recognition provided by the embodiment of the present application is shown. Figure 3A For details, please refer to step 302 in Figure 3B The contents of steps S3021 to S3023 shown in the figure are understood as follows:
[0097] S3021. Using the speech features of the speech to be recognized as input to a semantic extraction model to obtain a semantic feature representation of the speech to be recognized.
[0098] In this example, the semantic extraction model described can be understood by referring to the content of the semantic extraction model in the above step 302, which will not be described here. After obtaining the speech features of the speech to be recognized, the speech features of the speech to be recognized can be directly used as the input of the semantic extraction model to obtain the semantic feature representation of the speech to be recognized. The semantic feature representation of the speech to be recognized described can also be understood as the text representation of the current speech to be recognized.
[0099] Exemplarily, the speech features of the speech to be recognized are used as the input of the semantic extraction model to obtain the semantic feature representation of the speech to be recognized. This can be specifically achieved in the following way, namely: concatenating the speech features of the speech to be recognized and an all-zero feature vector of a preset length to obtain a concatenated first speech feature; inputting the concatenated first speech feature into the semantic extraction model to obtain the semantic feature representation of the speech to be recognized.
[0100] In this example, since in the training process of the semantic extraction model, the semantic extraction model uses sample pairs consisting of speech features and text features as training samples, and when using the semantic extraction model, since only the speech features of the speech to be recognized are input, an all-zero feature vector can be used to fill the length corresponding to the original text features in the training process. Specifically, the speech features of the speech to be recognized and the all-zero feature vector of a preset length can be concatenated to obtain the concatenated first speech features, and the concatenated first speech features are input into the semantic extraction model to obtain the semantic feature representation of the speech to be recognized, that is, Q i =CME(A i ,P). Among them, Q i represents the semantic feature representation of the speech to be recognized, CME represents the semantic extraction model provided by this application, and A i represents the speech features of the speech to be recognized, and P is an all-zero feature vector.
[0101] It should be noted that the semantic feature representation of the speech to be recognized can reflect the text representation learned from the speech to be recognized alone. The length of the all-zero feature vector described is not specifically limited in this application.
[0102] S3022. Use the speech features of the historical speech as input to a semantic extraction model to obtain a semantic feature representation of the historical speech.
[0103] In this example, the semantic extraction model described can be understood by referring to the content of the semantic extraction model in the above step 302, which will not be described here. After obtaining the speech features of the historical speech, the speech features of the historical speech can be directly used as the input of the semantic extraction model to obtain the semantic feature representation of the historical speech.
[0104] Exemplarily, the speech features of historical speech are used as the input of a semantic extraction model to obtain a semantic feature representation of the historical speech. This can be specifically achieved in the following way: concatenating the speech features of the historical speech and an all-zero feature vector of a preset length to obtain a concatenated second speech feature; and inputting the concatenated second speech feature into the semantic extraction model to obtain the semantic feature representation of the historical speech.
[0105] In this example, since in the training process of the semantic extraction model, the semantic extraction model uses sample pairs consisting of speech features and text features as training samples, and when using the semantic extraction model, since only the speech features of the historical speech are input, the full-zero feature vector can be used to fill the length corresponding to the original text features in the training process. Specifically, the speech features of the historical speech and the full-zero feature vector of a preset length can be concatenated to obtain the concatenated second speech features, and the concatenated second speech features are input into the semantic extraction model to obtain the semantic feature representation of the historical speech, that is, Q i-1 =CME(A i-1 ,P), where Q i-1 represents the semantic feature representation of historical speech, CME represents the semantic extraction model provided by this application, and A i-1 represents the speech features of historical speech, and P is an all-zero feature vector.
[0106] It should be noted that the semantic feature representation of the historical speech can reflect the text representation learned from the historical speech alone. The length of the all-zero feature vector described is not specifically limited in this application.
[0107] S3023: Fusing the semantic feature representation of the speech to be recognized with the semantic feature representation of the historical speech to obtain a context embedded feature representation of the speech to be recognized.
[0108] In this example, after obtaining the semantic feature representation of the speech to be recognized and the semantic feature representation of the historical speech, the semantic feature representation of the speech to be recognized and the semantic feature representation of the historical speech can be fused. In this way, the semantic feature representation obtained after the fusion process is used as the context embedded feature representation of the speech to be recognized. For example, the semantic feature representation of the speech to be recognized is directly spliced after the semantic feature representation of the historical speech in chronological order, and the context embedded feature representation of the speech to be recognized can be obtained, that is, Q context =(Q i-1 ,Q i ). Among them, Q context Represents the contextual embedding feature representation of the speech to be recognized, Q i-1 Represents the semantic feature representation of historical speech, Q iRepresents the semantic features of the speech to be recognized.
[0109] In this way, through the above steps S3021 to S3023, the context embedded feature representation of the speech to be recognized can be obtained.
[0110] 303. Encode the speech features of the speech to be recognized to obtain the encoded features of the speech to be recognized.
[0111] In this example, after the speech features of the speech to be recognized are obtained, the speech features of the speech to be recognized may also be encoded. Exemplarily, the speech features of the speech to be recognized may be encoded by the encoding model in the speech recognition model to extract the encoding features of the speech to be recognized. The encoding features of the speech to be recognized described may sometimes also be referred to as high-dimensional features, which are not specifically limited.
[0112] The encoding model described can be composed of a convolutional (CONV) module, a multi-head self attention (MHSA) module, and a feedforward neural network (FFN) module. Specifically, after obtaining the speech features of the speech to be recognized, the speech features of the speech to be recognized can be input into the MHSA module, and the feature S can be output. i , that is, S i =MHSA(A i )+A i , where A i is the speech feature of the speech to be recognized. Then, the feature S i As the input of the CONV module, the output is feature C i , that is, C i =CONV(S i ). Finally, feature C i As the input of the FFN module, the coding feature Z of the speech to be recognized is obtained. i , that is, Z i =FFN(C i )+C i .
[0113] It should be noted that in actual applications, step 303 may be performed first, and then step 302. Alternatively, step 302 may be performed first, and then step 303. Alternatively, step 302 and step 303 may be performed simultaneously. This application does not specifically limit the order in which the above steps 302 and 303 are performed.
[0114] 304. Based on the speech recognition model, recognition processing is performed on the coded features of the speech to be recognized and the context embedded feature representation of the speech to be recognized to obtain a recognition result of the speech to be recognized, and the recognition result is used to indicate a matching text corresponding to the speech to be recognized.
[0115] In this example, the speech recognition model described is a machine learning model obtained after training with the text recognition result of the speech to be recognized as the training target, and the speech features of the current speech sample and the text features corresponding to the current speech sample as the training data. In other words, the training data of the speech recognition model provided in the embodiment of the present application need to focus on the speech features of the current speech sample and the text features of the text corresponding to the current speech sample. In this way, with the text recognition result of the current speech sample as the training target, the speech features of the current speech sample, and the text features corresponding to the current speech sample as training data, the training data is trained through machine learning, so as to construct and train the speech recognition model. It should be noted that the speech features of the current speech sample and the text features corresponding to the current speech sample described here can be specifically understood with reference to the content in the aforementioned step 302, and will not be repeated here.
[0116] In this way, after obtaining the coding features and context embedded feature representation of the speech to be recognized, the coding features and context embedded feature representation of the speech to be recognized can be used as the input of the speech recognition model, and then decoded by the decoding model in the speech recognition model to obtain the recognition result of the speech to be recognized.
[0117] The speech recognition model described above can refer to the aforementioned Figure 2 The decoding model may include an MHSA module and a multi-head attention (MHA) module. For example, after obtaining the speech A to be recognized m After that, the speech A to be recognized can be m As the input of the MHSA module, to obtain the feature O m , that is: m =MHSA(A m )+A m Then, the feature O m and the encoding feature Z of the speech to be recognized i As the input of the MHA module, we can obtain the feature R m , that is, R m =MHA(O m ,Z i )+O m Finally, the feature R m and contextual embedding feature representation Q contextAs the input of the next layer MHA module, to obtain the recognition result of the speech to be recognized, that is, T = MHA (R m , Q context )+R m .
[0118] It should be noted that the contextual embedding feature described here represents Q context , encoding feature Z i , the voice features of the voice to be recognized, etc., can be understood by referring to the contents of the aforementioned steps 301 to 303, and will not be repeated here.
[0119] Exemplarily, in some optional examples, the encoding features of the speech to be recognized and the context embedded feature representation of the speech to be recognized are recognized based on the speech recognition model to obtain the recognition result of the speech to be recognized. This can be achieved in the following way, namely: the encoding features of the speech to be recognized and the context embedded feature representation of the speech to be recognized are input into the speech recognition model to obtain the predicted classification probability of each word in the speech to be recognized; and the recognition result of the speech to be recognized is determined based on the predicted classification probability of each word.
[0120] In this example, since the speech to be recognized is a speech sentence in an audio segment, the predicted classification probability of each word in the speech to be recognized can be obtained by inputting the encoding features of the speech to be recognized and the context embedding features of the speech to be recognized into the speech recognition model. Then, the recognition result of the speech to be recognized is determined from the predicted classification probabilities of all the words. For example, the maximum predicted classification probability can be determined from the predicted classification probabilities of all the words, and then the word corresponding to the maximum predicted classification probability is used as the recognition result.
[0121] In an embodiment of the present application, after obtaining the speech features of the speech to be recognized and the speech features of the historical speech, the speech features of the speech to be recognized and the speech features of the historical speech can be input into the semantic extraction model to obtain the corresponding context-embedded feature representation of the speech to be recognized. In this way, the speech features of the speech to be recognized and the context-embedded feature representation of the speech to be recognized are used together as the input of the speech recognition model, and then the recognition result of the speech to be recognized is obtained, and the matching text corresponding to the speech to be recognized can be indicated by the recognition result. In other words, in an embodiment of the present application, for the speech recognition of the current speech to be recognized, it is necessary to extract context information from the audio corresponding to the speech to be recognized, that is, it is necessary to take into account the speech features of the current speech to be recognized and the corresponding context-embedded feature representation, rather than relying solely on the text recognition results of the historical speech, thereby avoiding errors in the recognition results obtained by the speech recognition of the current speech to be recognized and improving the accuracy of speech recognition.
[0122] The above mainly introduces the scheme provided by the embodiment of the present application from the perspective of the method. It can be understood that in order to realize the above functions, the hardware structure and / or software module corresponding to the execution of each function are included. Those skilled in the art should easily realize that, in combination with the modules and algorithm steps of each example described in the embodiment disclosed in this application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0123] The embodiment of the present application can divide the functional modules of the device according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0124] The following is a detailed description of the speech recognition device in the embodiment of the present application. Figure 5 FIG. 1 is a schematic diagram of an embodiment of a speech recognition device provided in an embodiment of the present application. Figure 5 As shown, the speech recognition device may include an acquisition unit 501 and a processing unit 502 .
[0125] The acquisition unit 501 is used to acquire the speech features of the speech to be recognized and the speech features of the historical speech, wherein the historical speech is at least one speech sentence arranged before the speech to be recognized.
[0126] Processing unit 502 is used to use the speech features of the speech to be recognized and the speech features of the historical speech as inputs of the semantic extraction model to obtain the context embedded feature representation of the speech to be recognized. Figure 3A The contents described in step 302 can be understood for reference only and will not be elaborated here.
[0127] The processing unit 502 is used to encode the speech features of the speech to be recognized, obtain the encoded features of the speech to be recognized, and perform recognition processing on the encoded features of the speech to be recognized and the context embedded feature representation of the speech to be recognized based on the speech recognition model to obtain the recognition result of the speech to be recognized, and the recognition result is used to indicate the matching text corresponding to the speech to be recognized. For details, please refer to the aforementioned Figure 3A The contents described in step 303 to step 304 can be understood for reference only and will not be described in detail here.
[0128] In some optional examples, the processing unit 502 is used to: use the speech features of the speech to be recognized as the input of the semantic extraction model to obtain the semantic feature representation of the speech to be recognized; use the speech features of the historical speech as the input of the semantic extraction model to obtain the semantic feature representation of the historical speech; fuse the semantic feature representation of the speech to be recognized and the semantic feature representation of the historical speech to obtain the context-embedded feature representation of the speech to be recognized.
[0129] In other optional examples, the processing unit 502 is used to: input the encoded features of the speech to be recognized and the context embedded feature representation of the speech to be recognized into the speech recognition model to obtain the predicted classification probability of each word in the speech to be recognized; and determine the recognition result of the speech to be recognized based on the predicted classification probability of each word.
[0130] In other optional examples, the processing unit 502 is used to: concatenate the speech features of the speech to be recognized and an all-zero feature vector of a preset length to obtain a concatenated first speech feature; input the concatenated first speech feature into a semantic extraction model to obtain a semantic feature representation of the speech to be recognized.
[0131] In other optional examples, the processing unit 502 is used to: concatenate the speech features of the historical speech and an all-zero feature vector of a preset length to obtain a concatenated second speech feature; input the concatenated second speech feature into a semantic extraction model to obtain a semantic feature representation of the historical speech.
[0132] In some other optional examples, the acquisition unit 501 is used to acquire the speech to be recognized. The processing unit 502 is used to input the speech to be recognized into a speech feature extraction model to obtain the speech features of the speech to be recognized, wherein the speech feature extraction model is a machine learning model obtained by training with speech samples as training data.
[0133] In some other optional examples, the acquisition unit 501 is also used to acquire the speech features of the current speech sample and the text features corresponding to the current speech sample. The processing unit 502 is also used to perform feature deletion and / or feature masking on the speech features of the current speech sample to obtain the first speech sample features, and perform feature deletion and / or feature masking on the text features corresponding to the current speech sample to obtain the first text features. The acquisition unit 501 is also used to acquire the speech features of the historical speech sample and the historical text features corresponding to the historical speech sample. The processing unit 502 is also used to perform feature deletion and / or feature masking on the speech features of the historical speech sample to obtain the first historical speech sample features, and perform feature deletion and / or feature masking on the historical text features corresponding to the historical speech sample to obtain the first historical text features. The processing unit 502 is also used to iteratively train the semantic extraction model based on the first speech sample features, the first text features, the first historical speech sample features, and the first historical text features.
[0134] In other optional examples, the processing unit 502 is also used to: input the first speech sample feature and the first text feature into the semantic extraction model to obtain a first semantic feature representation; obtain a reconstruction loss value based on the difference between the first semantic feature representation and the semantic feature representation of the current speech sample, wherein the semantic feature representation of the current speech sample is a semantic feature vector obtained after inputting the speech features of the current speech sample and the text features corresponding to the current speech sample into the semantic extraction model; and update the model parameters of the semantic extraction model based on the reconstruction loss value to obtain a semantic extraction model.
[0135] In other optional examples, the processing unit 502 is also used to: input the speech features of the current speech sample and the first speech sample features into the semantic extraction model respectively to obtain the semantic representation corresponding to the current speech sample and the semantic representation corresponding to the first speech sample features; obtain the speech loss value based on the difference between the semantic representation corresponding to the current speech sample and the semantic representation corresponding to the first speech sample features; update the model parameters of the semantic extraction model based on the speech loss value to obtain the semantic extraction model.
[0136] In other optional examples, the processing unit 502 is used to: calculate a first feature similarity between the semantic representation corresponding to the current speech sample and the semantic representation corresponding to the first speech sample feature, and a second feature similarity between the semantic representation corresponding to the current speech sample and a preset speech feature vector, wherein the preset speech feature vector is a feature vector independent of the current speech sample; and determine a speech loss value based on the first feature similarity and the second feature similarity.
[0137] In other optional examples, the processing unit 502 is also used to: input the text features corresponding to the current voice sample and the first text features into the semantic extraction model respectively to obtain the semantic representation of the text features corresponding to the current voice sample and the semantic representation of the first text features; obtain a text loss value based on the difference between the semantic representation of the text features corresponding to the current voice sample and the semantic representation of the first text features; update the model parameters of the semantic extraction model based on the text loss value to obtain the semantic extraction model.
[0138] In other optional examples, the processing unit 502 is used to: determine a second text feature from the text features corresponding to the current speech sample, wherein the second text feature is a feature of the text features corresponding to the current speech other than the first text feature; input the second text feature into a semantic extraction model to obtain a semantic representation of the second text feature; calculate the distance between the semantic representation of the second text feature and the semantic representation of the first text feature to obtain a text loss value.
[0139] The above describes the speech recognition device in the embodiment of the present application from the perspective of modular functional entities, and the following describes the speech recognition device in the embodiment of the present application from the perspective of hardware processing. Figure 6 60 is a schematic diagram of the structure of a speech recognition device provided in an embodiment of the present application. The speech recognition device may have relatively large differences due to different configurations or performances. The speech recognition device may include at least one processor 601, a communication line 607, a memory 603 and at least one communication interface 604.
[0140] The processor 601 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (server IC), or one or more integrated circuits for controlling the execution of the program of the present application.
[0141] The communication link 607 may include a pathway to transmit information between the above-mentioned components.
[0142] The communication interface 604 uses any transceiver-like device for communicating with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area networks (WLAN), etc.
[0143] The memory 603 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, and the memory may exist independently and be connected to the processor via a communication line 607. The memory may also be integrated with the processor.
[0144] The memory 603 is used to store computer-executable instructions for executing the solution of the present application, and the execution is controlled by the processor 601. The processor 601 is used to execute the computer-executable instructions stored in the memory 603, thereby realizing the method of speech recognition provided in the above embodiment of the present application.
[0145] Optionally, the computer-executable instructions in the embodiments of the present application may also be referred to as application code, which is not specifically limited in the embodiments of the present application.
[0146] In a specific implementation, as an embodiment, the speech recognition device may include multiple processors, such as Figure 6 601 and processor 602 in FIG. Each of these processors may be a single-CPU processor or a multi-CPU processor. A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0147] In a specific implementation, as an embodiment, the speech recognition device may further include an output device 605 and an input device 606. The output device 605 communicates with the processor 601 and may display information in a variety of ways. The input device 606 communicates with the processor 601 and may receive input of a target object in a variety of ways. For example, the input device 606 may be a mouse, a touch screen device, or a sensor device.
[0148] The above-mentioned speech recognition device can be a general device or a special device. In a specific implementation, the speech recognition device can be a server, a terminal, etc. or a Figure 6 The embodiment of the present application does not limit the type of the speech recognition device.
[0149] Need to explain, Figure 6 The processor 601 in the embodiment can call the computer execution instruction stored in the memory 603 to make the speech recognition device execute the following FIG. 3A to FIG. 4 The method in the corresponding method embodiment.
[0150] Specifically, Figure 5The function / implementation process of the processing unit 502 in Figure 6 The processor 601 in the embodiment calls the computer execution instructions stored in the memory 603 to implement. Figure 5 The function / implementation process of the acquisition unit 501 in can be Figure 6 It is implemented by the communication interface 604 in.
[0151] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0152] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0153] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of 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 an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0154] 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.
[0155] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0156] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, 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 various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., and other media that can store program codes.
[0157] The above embodiments may be implemented in whole or in part through software, hardware, firmware or any combination thereof. When implemented by software, they may be implemented in whole or in part in the form of a computer program product.
[0158] The computer program product includes one or more computer instructions. When loading and executing the computer execution instruction on the computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable devices. The computer instruction can be stored in a computer-readable storage medium, or transmitted from a computer-readable storage medium to another computer-readable storage medium. For example, the computer instruction can be transmitted from a website site, a computer, a server or a data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server, a data center, etc. that includes one or more available media integration. Available media can be magnetic media, (for example, floppy disk, hard disk, tape), optical media (for example, DVD), or semiconductor media (such as SSD)) and the like.
[0159] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for speech recognition, characterized in that: include: Acquire speech features of the speech to be recognized and speech features of historical speech, wherein the historical speech is at least one speech sentence arranged before the speech to be recognized; Using the speech features of the speech to be recognized as input of a semantic extraction model to obtain a semantic feature representation of the speech to be recognized; Using the speech features of the historical speech as input of the semantic extraction model to obtain a semantic feature representation of the historical speech; Fusing the semantic feature representation of the speech to be recognized with the semantic feature representation of the historical speech to obtain a context embedded feature representation of the speech to be recognized; Encoding the speech features of the speech to be recognized to obtain the coded features of the speech to be recognized; Based on the speech recognition model, the encoding features of the speech to be recognized and the context embedded feature representation of the speech to be recognized are recognized and processed to obtain a recognition result of the speech to be recognized, and the recognition result is used to indicate the matching text corresponding to the speech to be recognized.
2. The method according to claim 1, characterized in that The step of performing recognition processing on the coding features of the speech to be recognized and the context embedded feature representation of the speech to be recognized based on the speech recognition model to obtain the recognition result of the speech to be recognized includes: Inputting the encoding features of the speech to be recognized and the context embedding feature representation of the speech to be recognized into the speech recognition model to obtain the predicted classification probability of each word in the speech to be recognized; The recognition result of the speech to be recognized is determined based on the predicted classification probability of each word.
3. The method according to claim 1, characterized in that: The step of using the speech features of the speech to be recognized as input of a semantic extraction model to obtain a semantic feature representation of the speech to be recognized includes: Concatenate the speech feature of the speech to be recognized and the all-zero feature vector of a preset length to obtain a concatenated first speech feature; The concatenated first speech features are input into the semantic extraction model to obtain the semantic feature representation of the speech to be recognized.
4. The method according to claim 1, characterized in that The step of using the speech features of the historical speech as input of the semantic extraction model to obtain the semantic feature representation of the historical speech includes: Concatenating the speech feature of the historical speech and the all-zero feature vector of a preset length to obtain a concatenated second speech feature; The concatenated second speech features are input into the semantic extraction model to obtain the semantic feature representation of the historical speech.
5. The method according to claim 1, characterized in that: The step of obtaining the speech features of the speech to be recognized includes: Acquire the speech to be recognized; The speech to be recognized is input into a speech feature extraction model to obtain speech features of the speech to be recognized, wherein the speech feature extraction model is a machine learning model obtained by training with speech samples as training data.
6. The method according to claim 1, characterized in that The method further comprises: Acquire speech features of a current speech sample and text features corresponding to the current speech sample; Performing feature deletion and / or feature masking processing on the speech feature of the current speech sample to obtain a first speech sample feature, and performing feature deletion and / or feature masking processing on the text feature corresponding to the current speech sample to obtain a first text feature; Acquire speech features of historical speech samples and historical text features corresponding to the historical speech samples; Performing feature deletion and / or feature masking processing on the speech feature of the historical speech sample to obtain a first historical speech sample feature, and performing feature deletion and / or feature masking processing on the historical text feature corresponding to the historical speech sample to obtain a first historical text feature; The semantic extraction model is iteratively trained based on the first speech sample feature, the first text feature, the first historical speech sample feature, and the first historical text feature.
7. The method according to claim 6, characterized in that The method further comprises: Inputting the first speech sample feature and the first text feature into the semantic extraction model to obtain a first semantic feature representation; Obtaining a reconstruction loss value based on a difference between the first semantic feature representation and the semantic feature representation of the current speech sample, wherein the semantic feature representation of the current speech sample is a semantic feature vector obtained after inputting speech features of the current speech sample and text features corresponding to the current speech sample into the semantic extraction model; The model parameters of the semantic extraction model are updated based on the reconstruction loss value to obtain the semantic extraction model.
8. The method according to claim 6, characterized in that The method further comprises: Inputting the speech features of the current speech sample and the first speech sample features into the semantic extraction model respectively to obtain the semantic representation corresponding to the current speech sample and the semantic representation corresponding to the first speech sample features; Acquire a speech loss value based on a difference between a semantic representation corresponding to the current speech sample and a semantic representation corresponding to the first speech sample feature; The model parameters of the semantic extraction model are updated based on the speech loss value to obtain the semantic extraction model.
9. The method according to claim 8, characterized in that The acquiring the speech loss value based on the difference between the semantic representation corresponding to the current speech sample and the semantic representation corresponding to the first speech sample feature includes: Calculating a first feature similarity between the semantic representation corresponding to the current voice sample and the semantic representation corresponding to the first voice sample feature, and a second feature similarity between the semantic representation corresponding to the current voice sample and a preset voice feature vector, wherein the preset voice feature vector is a feature vector unrelated to the current voice sample; A speech loss value is determined based on the first feature similarity and the second feature similarity.
10. The method according to claim 6, characterized in that The method further comprises: Inputting the text feature corresponding to the current voice sample and the first text feature into the semantic extraction model respectively to obtain the semantic representation of the text feature corresponding to the current voice sample and the semantic representation of the first text feature; Acquire a text loss value based on a difference between a semantic representation of a text feature corresponding to the current speech sample and a semantic representation of the first text feature; The model parameters of the semantic extraction model are updated based on the text loss value to obtain the semantic extraction model.
11. The method according to claim 10, characterized in that The obtaining of the text loss value based on the difference between the semantic representation of the text feature corresponding to the current speech sample and the semantic representation of the first text feature includes: Determining a second text feature from the text features corresponding to the current voice sample, wherein the second text feature is a feature of the text features corresponding to the current voice except the first text feature; Inputting the second text feature into the semantic extraction model to obtain a semantic representation of the second text feature; The distance between the semantic representation of the second text feature and the semantic representation of the first text feature is calculated to obtain the text loss value.
12. A speech recognition device, characterized in that: include: An acquisition unit, configured to acquire speech features of a speech to be recognized and speech features of historical speech, wherein the historical speech is at least one speech sentence arranged before the speech to be recognized; A processing unit, configured to use the speech features of the speech to be recognized as input to a semantic extraction model to obtain a semantic feature representation of the speech to be recognized; use the speech features of the historical speech as input to the semantic extraction model to obtain a semantic feature representation of the historical speech; fuse the semantic feature representation of the speech to be recognized with the semantic feature representation of the historical speech to obtain a context embedded feature representation of the speech to be recognized; The processing unit is used to encode the speech features of the speech to be recognized to obtain the coded features of the speech to be recognized; The processing unit is used to perform recognition processing on the encoded features of the speech to be recognized and the context embedded feature representation of the speech to be recognized based on the speech recognition model to obtain the recognition result of the speech to be recognized, and the recognition result is used to indicate the matching text corresponding to the speech to be recognized.
13. The device according to claim 12, characterized in that The processing unit is used to input the encoding features of the speech to be recognized and the context embedded feature representation of the speech to be recognized into the speech recognition model to obtain the predicted classification probability of each word in the speech to be recognized; and determine the recognition result of the speech to be recognized based on the predicted classification probability of each word.
14. The device according to claim 12, characterized in that The processing unit is used to concatenate the speech feature of the speech to be recognized and the all-zero feature vector of a preset length to obtain a concatenated first speech feature; The concatenated first speech features are input into the semantic extraction model to obtain the semantic feature representation of the speech to be recognized.
15. The device according to claim 12, characterized in that The processing unit is used to perform concatenation processing on the speech feature of the historical speech and the all-zero feature vector of a preset length to obtain a concatenated second speech feature; The concatenated second speech features are input into the semantic extraction model to obtain the semantic feature representation of the historical speech.
16. The device according to claim 12, characterized in that The acquisition unit is used to acquire the speech to be recognized; The processing unit is used to input the speech to be recognized into a speech feature extraction model to obtain the speech features of the speech to be recognized, wherein the speech feature extraction model is a machine learning model obtained after training processing using speech samples as training data.
17. The device according to claim 12, characterized in that The acquisition unit is also used to acquire the voice features of the current voice sample and the text features corresponding to the current voice sample; The processing unit is further used to perform feature deletion and / or feature masking processing on the speech feature of the current speech sample to obtain a first speech sample feature, and perform feature deletion and / or feature masking processing on the text feature corresponding to the current speech sample to obtain a first text feature; The acquisition unit is also used to acquire the speech features of the historical speech samples and the historical text features corresponding to the historical speech samples; The processing unit is further used to perform feature deletion and / or feature masking processing on the speech feature of the historical speech sample to obtain a first historical speech sample feature, and perform feature deletion and / or feature masking processing on the historical text feature corresponding to the historical speech sample to obtain a first historical text feature; The processing unit is further used to iteratively train the semantic extraction model based on the first speech sample feature, the first text feature, the first historical speech sample feature, and the first historical text feature.
18. The device according to claim 17, characterized in that The processing unit is also used to input the first speech sample feature and the first text feature into the semantic extraction model to obtain a first semantic feature representation; obtain a reconstruction loss value based on the difference between the first semantic feature representation and the semantic feature representation of the current speech sample, wherein the semantic feature representation of the current speech sample is a semantic feature vector obtained after inputting the speech features of the current speech sample and the text features corresponding to the current speech sample into the semantic extraction model; and update the model parameters of the semantic extraction model based on the reconstruction loss value to obtain the semantic extraction model.
19. The device according to claim 17, characterized in that The processing unit is further used to input the speech features of the current speech sample and the first speech sample features into the semantic extraction model respectively to obtain the semantic representation corresponding to the current speech sample and the semantic representation corresponding to the first speech sample features; based on the difference between the semantic representation corresponding to the current speech sample and the semantic representation corresponding to the first speech sample features, obtain the speech loss value; The model parameters of the semantic extraction model are updated based on the speech loss value to obtain the semantic extraction model.
20. The device according to claim 19, characterized in that The processing unit is used to calculate a first feature similarity between the semantic representation corresponding to the current speech sample and the semantic representation corresponding to the first speech sample feature, and a second feature similarity between the semantic representation corresponding to the current speech sample and a preset speech feature vector, wherein the preset speech feature vector is a feature vector independent of the current speech sample; and determine a speech loss value based on the first feature similarity and the second feature similarity.
21. The device according to claim 17, characterized in that The processing unit is also used to input the text features corresponding to the current voice sample and the first text features into the semantic extraction model respectively to obtain the semantic representation of the text features corresponding to the current voice sample and the semantic representation of the first text features; obtain a text loss value based on the difference between the semantic representation of the text features corresponding to the current voice sample and the semantic representation of the first text features; and update the model parameters of the semantic extraction model based on the text loss value to obtain the semantic extraction model.
22. The device according to claim 21, characterized in that The processing unit is used to determine a second text feature from the text features corresponding to the current voice sample, wherein the second text feature is a feature of the text features corresponding to the current voice other than the first text feature; input the second text feature into the semantic extraction model to obtain a semantic representation of the second text feature; calculate the distance between the semantic representation of the second text feature and the semantic representation of the first text feature to obtain the text loss value.
23. A speech recognition device, characterized in that: include: An input / output (I / O) interface, a processor, and a memory, wherein program instructions are stored in the memory; The processor is used to execute program instructions stored in the memory to perform the method according to any one of claims 1 to 11.
24. A computer-readable storage medium, characterized in that: The computer-readable storage medium comprises instructions, which, when executed on a computer device, cause the computer device to perform the method according to any one of claims 1 to 11.
25. A computer program product, characterized in that The computer program product comprises instructions, which, when executed on a computer device, cause the computer device to perform the method according to any one of claims 1 to 11.
