Model training device, command word recognition device and method of command word recognition model
By acquiring a set of labeled voice command words, training the model using the voice frames with the highest target probability, and optimizing the model using the cross-entropy loss function, the problem of inaccurate recognition of the end position of voice frames was solved, thus improving the recognition accuracy of voice command words.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING ESWIN COMPUTING TECH CO LTD
- Filing Date
- 2023-03-01
- Publication Date
- 2026-07-03
Smart Images

Figure CN116229950B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of speech recognition technology, and in particular to a model training device, a command word recognition device and method for a command word recognition model. Background Technology
[0002] Voice command word recognition technology is an important technology for realizing human-computer voice interaction. It has been widely used in various smart devices, such as smart speakers, robot vacuum cleaners, voice assistants, and smart voice-controlled switches.
[0003] Currently, voice command word recognition technology mainly includes: inputting a voice sequence into a command word recognition model, extracting voice features from a voice frame of the voice sequence; predicting the category of the voice features (i.e., classifying the voice frame); and detecting whether a voice command word appears in the voice sequence based on the predicted voice frame category.
[0004] During the training of the command word recognition model, inaccurate identification of the end position of the voice command word will cause inaccurate category labeling of the voice frame. Inaccurate voice frame category labeling will reduce the accuracy of the voice frame classification model, thereby reducing the accuracy of voice command word recognition. Summary of the Invention
[0005] This application provides a model training device, a command word recognition device, and a method for a command word recognition model. These methods address the shortcomings of existing technologies where inaccurate identification of the end position of a voice command word during training leads to inaccurate category labeling of voice frames. Inaccurate voice frame category labeling reduces the accuracy of the voice frame classification model, thereby lowering the accuracy of voice command word recognition. The aim is to improve the accuracy of the command word recognition model and thus enhance the recognition accuracy of voice command words.
[0006] In a first aspect, this application provides a model training apparatus for a command word recognition model, comprising:
[0007] The sample acquisition module is used to acquire a set of labeled voice command words, which includes first voice sample data, and the first voice sample data includes positive sample voice frames and negative sample voice frames.
[0008] The model training module is used to train the initial training model based on the labeled voice command word sample set to obtain a command word recognition model. During the training process, loss is calculated based on all negative sample voice frames and one target positive sample voice frame in the first voice sample data. The target positive sample voice frame is the positive sample voice frame with the target probability among all positive sample voice frames in the first voice sample data. The target probability is the maximum probability among the probabilities of all positive sample voice frames in the first voice sample data belonging to multiple different voice command words.
[0009] According to the command word recognition model training device provided in this application, the model training module is specifically used for:
[0010] Calculate the cross-entropy loss for all negative sample speech frames in the first speech sample data;
[0011] Calculate the cross-entropy loss of one frame of the target positive sample speech in the first speech sample data;
[0012] The loss of the first speech sample data is calculated based on the cross-entropy loss of all the negative sample speech frames in the first speech sample data and the cross-entropy loss of one target positive sample speech frame.
[0013] According to the model training device for a command word recognition model provided in this application, the voice command word sample set further includes second voice sample data, and the second voice sample data includes negative sample voice frames;
[0014] The model training module is also used to: calculate the loss based on all the negative sample speech frames in the second speech sample data during the training process.
[0015] According to the command word recognition model training device provided in this application, the model training module is specifically used for:
[0016] Calculate the cross-entropy loss for all negative sample speech frames in the second speech sample data;
[0017] The loss of the second speech sample data is calculated based on the cross-entropy loss of all the negative sample speech frames in the second speech sample data.
[0018] According to the model training apparatus for a command word recognition model provided in this application, the sample acquisition module includes:
[0019] A partitioning unit is used to divide each speech sample data in the unlabeled speech command word sample set into a first number of speech frames;
[0020] The determining unit is configured to determine the activation interval corresponding to the end position of the estimated voice command word in the voice sample data when the voice sample data includes the voice command word;
[0021] A labeling unit is configured to, when the speech sample data includes the speech command word, label the speech frames in the speech sample data that are in the active region as positive sample speech frames, and label the speech frames in the speech sample data that are in the inactive region as negative sample speech frames, to obtain the first speech sample data; and when the speech sample data does not include the speech command word, label each speech frame in the speech sample data as a negative sample speech frame, to obtain the second speech sample data.
[0022] The generation unit is used to generate the tagged voice command word sample set based on the first voice sample data and the second voice sample data.
[0023] According to the model training apparatus for a command word recognition model provided in this application, the determining unit is specifically used for:
[0024] When the speech sample data includes the speech command word, the interval containing the target speech frame corresponding to the end position of the estimated speech command word, the second number of speech frames before the target speech frame, and the third number of speech frames after the target speech frame in the speech sample data is determined as the activation interval.
[0025] According to the model training apparatus for a command word recognition model provided in this application, the determining unit is specifically used for:
[0026] When the speech sample data includes the speech command word, the interval containing the target speech frame corresponding to the end position of the estimated speech command word in the speech sample data and the fourth number of speech frames after the target speech frame is determined as the activation interval.
[0027] According to the model training apparatus for a command word recognition model provided in this application, the sample acquisition module further includes:
[0028] The processing unit is used to perform zero-padding or pruning on the original speech sample data in the unlabeled speech command word sample set to obtain speech sample data of a preset length.
[0029] Secondly, this application also provides a command word recognition device, comprising:
[0030] The acquisition module is used to acquire the speech data to be recognized;
[0031] A recognition module. This module is used to input the speech data into the command word recognition model obtained by the model training device of any of the command word recognition models described in the first aspect, and to obtain the command word recognition result of the speech data.
[0032] Thirdly, this application also provides a model training method for a command word recognition model, including:
[0033] Obtain a tagged voice command word sample set, the voice command word sample set including first voice sample data, the first voice sample data including positive sample voice frames and negative sample voice frames;
[0034] The initial training model is trained based on the labeled voice command word sample set to obtain a command word recognition model. During the training process, loss is calculated based on all negative sample voice frames and one target positive sample voice frame in the first voice sample data. The target positive sample voice frame is the positive sample voice frame with the target probability among all positive sample voice frames in the first voice sample data. The target probability is the maximum probability among the probabilities of all positive sample voice frames in the first voice sample data belonging to multiple different voice command words.
[0035] Fourthly, this application also provides a command word recognition method, including:
[0036] Acquire the speech data to be recognized;
[0037] The voice data is input into the command word recognition model obtained by the model training device of any of the command word recognition models in the first aspect, and the command word recognition result of the voice data is obtained.
[0038] Fifthly, this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps of the model training method for the command word recognition model as described in the third aspect above, or the steps of the command word recognition method as described in the fourth aspect above.
[0039] Sixthly, this application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the model training method for the command word recognition model as described in the third aspect above, or implements the steps of the command word recognition method as described in the fourth aspect above.
[0040] The command word recognition model training device, command word recognition device, and method provided in this application first acquire a labeled voice command word sample set, which includes first voice sample data, including positive sample voice frames and negative sample voice frames. Then, the initial training model is trained based on the labeled voice command word sample set to obtain a command word recognition model. During the training process, loss is calculated based on all negative sample voice frames and one target positive sample voice frame in the first voice sample data. That is, the command word recognition model does not use the loss of all positive sample voice frames in each first voice sample data during training, but uses the loss of the target positive sample voice frame. Since the target positive sample voice frame is the positive sample voice frame corresponding to the target probability among all positive sample voice frames in the first voice sample data, and the target probability is the highest probability among the probabilities of all positive sample voice frames in the first voice sample data belonging to multiple different voice command words, the target positive sample voice frame is considered to be the voice frame at the end of the voice command word. This reduces the dependence on voice frame category labeling, improves the accuracy of the command word recognition model, and thus improves the recognition accuracy of voice command words. Attached Figure Description
[0041] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0042] Figure 1 This is a schematic diagram of the structure of the model training device for the command word recognition model provided in at least one embodiment of this application;
[0043] Figure 2 This is a schematic diagram of voice command word sample markings provided in at least one embodiment of this application;
[0044] Figure 3 This is a schematic diagram of the structure of a command word recognition device provided in at least one embodiment of this application;
[0045] Figure 4 This is a schematic flowchart of the model training method for the command word recognition model provided in at least one embodiment of this application;
[0046] Figure 5 This is a flowchart illustrating a command word recognition method provided in at least one embodiment of this application;
[0047] Figure 6 This is a schematic diagram of the structure of an electronic device provided in at least one embodiment of this application. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0049] The following is combined with Figure 1 and Figure 2 This application describes the model training apparatus for the command word recognition model.
[0050] Please refer to Figure 1 , Figure 1 This is a schematic diagram of the structure of a model training device for a command word recognition model provided in at least one embodiment of this application. For example... Figure 1 As shown, the model training device for the command word recognition model includes: a sample acquisition module 10 and a model training module 20, wherein:
[0051] The sample acquisition module 10 is used to acquire a set of labeled voice command word samples, which includes first voice sample data, and the first voice sample data includes positive sample voice frames and negative sample voice frames.
[0052] Specifically, the labeled voice command word sample set may include multiple first voice sample data. For example, the labeled voice command word sample set may include first voice sample data of N Chinese command words; wherein each Chinese command word includes approximately 500 first voice sample data, and the length of multiple first voice sample data is uniformly L1.
[0053] Furthermore, each first speech sample data includes positive sample speech frames and negative sample speech frames. Positive sample speech frames refer to speech frames labeled as positive sample categories, and negative sample speech frames refer to speech frames labeled as negative sample categories.
[0054] The model training module 20 is used to train the initial training model based on the labeled voice command word sample set to obtain the command word recognition model. During the training process, the loss is calculated based on all negative sample voice frames and one target positive sample voice frame in the first voice sample data. The target positive sample voice frame is the positive sample voice frame with the target probability among all positive sample voice frames in the first voice sample data. The target probability is the maximum probability among the probabilities of all positive sample voice frames in the first voice sample data belonging to multiple different voice command words.
[0055] Specifically, the initial training model can be a small network such as WaveNet, Recurrent Neural Network (RNN), or Long Short-Term Memory (LSTM), or a large network such as Transformer, to achieve better results. In this embodiment, WaveNet is chosen as the initial training model because its network structure is small and performs well, making it easy to run on resource-constrained devices.
[0056] The training process of the model may include: inputting a set of labeled voice command words into the initial training model; for each first voice sample data, selecting all negative sample voice frames and one target positive sample voice frame from the first voice sample data; extracting features from each selected voice frame to obtain voice features; predicting the category of the voice features; calculating the loss generated by the first voice sample data based on the actual category and the predicted category of each selected voice frame; calculating the gradient based on the loss of the first voice sample data; and then backpropagating to adjust the model parameters of the initial training model until the model converges, thereby obtaining the command word recognition model.
[0057] The selection of target positive sample speech frames involves first calculating the probability that each positive sample speech frame in the first speech sample data belongs to one of several different speech command words, for example, the probabilities of the first N rows of the probability matrix shown in Table 1. Then, the highest probability, i.e., the target probability, is determined. Finally, the positive sample speech frame corresponding to the target probability is identified as the target positive sample speech frame. The target positive sample speech frame is most likely the speech frame at the end of the speech command word, and the accuracy of obtaining the end position of the speech command word is higher than that of the predicted end position.
[0058] For example, the matrix elements in the probability matrix are shown in Table 1:
[0059] Table 1. Matrix elements in the probability matrix
[0060]
[0061]
[0062] Among them, P i 0Let represent the probability that the i-th frame belongs to the voice command word 1, where i represents the frame index. The N voice command words are represented sequentially from 0 to N-1, for example: 0 represents the first voice command word, 1 represents the second voice command word, ..., N-1 represents the Nth voice command word; non-voice command words are represented by N. Each voice sample data including voice command words consists of L2 frames, where 2*L3 frames are marked as positive sample voice frames, and the other L2-2*L3 frames are marked as negative sample voice frames.
[0063] Regarding the calculation of loss, optionally, the model training module 20 is specifically used to: calculate the cross-entropy loss of all negative sample speech frames in the first speech sample data; calculate the cross-entropy loss of one target positive sample speech frame in the first speech sample data; and calculate the loss of the first speech sample data based on the cross-entropy loss of all negative sample speech frames and the cross-entropy loss of one target positive sample speech frame in the first speech sample data.
[0064] It should be noted that the use of cross-entropy loss is only for teaching those skilled in the art how to implement this embodiment. This embodiment is not limited to this; mean squared error loss, mean absolute error loss, quantile loss, hinge loss, etc., can also be used.
[0065] In this embodiment, the command word recognition model does not use the loss of all positive sample speech frames in each first speech sample data during training. Instead, it uses the loss of the target positive sample speech frame. Since the target positive sample speech frame is the positive sample speech frame corresponding to the target probability among all positive sample speech frames in the first speech sample data, and the target probability is the highest probability among the probabilities of all positive sample speech frames in the first speech sample data belonging to multiple different speech command words, it is considered that the target positive sample speech frame is most likely the speech frame at the end of the speech command word. This can reduce the dependence on speech frame category labeling, improve the accuracy of the command word recognition model, and thus improve the recognition accuracy of speech command words.
[0066] In one embodiment, the voice command word sample set further includes second voice sample data, which includes negative sample voice frames; the model training module 20 is also used to: calculate the loss based on all negative sample voice frames in the second voice sample data during the training process.
[0067] Specifically, the labeled voice command word sample set may also include multiple second voice sample data. For example, the labeled voice command word sample set may also include a second voice sample data of another category; wherein, the second voice sample data of another category mainly includes various kinds of human voices, such as news voices, interview voices, and movie voices, etc., and such data should be sufficient to avoid misidentification. Furthermore, the length of both the multiple first voice sample data and the multiple second voice sample data is a uniform length L1.
[0068] Since the second speech sample data does not include speech command words, each speech frame in each second speech sample data is a negative sample speech frame, which refers to a speech frame labeled as a negative sample category.
[0069] Specifically, the training process of the model may also include: for each second speech sample data, extracting features from each negative sample speech frame in the second speech sample data to obtain speech features; performing category prediction on the speech features, and calculating the loss generated by the second speech sample data based on the actual category and predicted category of each negative sample speech frame in the second speech sample data.
[0070] Regarding the calculation of loss, optionally, the model training module 20 is specifically used to: calculate the cross-entropy loss of all negative sample speech frames in the second speech sample data respectively; and calculate the loss of the second speech sample data based on the cross-entropy loss of all negative sample speech frames in the second speech sample data.
[0071] It should be noted that the use of cross-entropy loss is only for teaching those skilled in the art how to implement this embodiment. This embodiment is not limited to this; mean squared error loss, mean absolute error loss, quantile loss, hinge loss, etc., can also be used.
[0072] In this embodiment, since the second speech sample data does not include speech command words, each speech frame in each second speech sample data is a negative sample speech frame. By adding enough second speech sample data during model training, the problem of misrecognition in the trained command word recognition model can be avoided.
[0073] In one embodiment, the sample acquisition module 10 includes: a partitioning unit, a determination unit, a labeling unit, and a generation unit, wherein:
[0074] A partitioning unit is used to divide each speech sample data in the unlabeled speech command word sample set into a first number of speech frames.
[0075] Specifically, the unlabeled speech command word sample set can include multiple speech sample data. For example, the unlabeled speech command word sample set includes: N Chinese command words and one other type of speech sample data; each Chinese command word includes 2-8 Chinese characters, and each Chinese command word includes approximately 500 speech sample data. The duration of the speech sample data with 2-8 Chinese characters does not exceed 3 seconds, and the length of different speech sample data varies. The other type of speech sample data mainly includes various human voices, such as news audio, interview audio, and movie audio, etc. This type of data should be sufficient to avoid misidentification. Before model training, the multiple speech sample data need to be processed into a uniform length L1.
[0076] For example, each speech sample data of duration L1 in the unlabeled speech command word sample set is divided into speech frames of duration L2.
[0077] The determining unit is used to determine the activation interval corresponding to the estimated end position of the voice command word in the voice sample data, when the voice sample data includes voice command words.
[0078] Specifically, the estimated position of the end of a voice command word can be identified by a voice activity detection (VAD) tool. The accuracy of the estimated position of the end of a voice command word depends on the accuracy of the VAD, so there may be inaccuracies in the estimated position of the end of a voice command word.
[0079] For speech sample data that includes speech command words, the estimated end position of the speech command word may be inaccurate. The accurate end position of the speech command word is generally near the estimated end position, and usually within the activation interval corresponding to the estimated end position.
[0080] The labeling unit is used to, when the speech sample data includes speech command words, label the speech frames in the active region of the speech sample data as positive sample speech frames and label the speech frames in the inactive region of the speech sample data as negative sample speech frames to obtain the first speech sample data; when the speech sample data does not include speech command words, label each speech frame in the speech sample data as a negative sample speech frame to obtain the second speech sample data.
[0081] For example, the unlabeled voice command word sample set includes: N Chinese command words and voice sample data of another class, for a total of N+1 classes; wherein, the N classes of Chinese command words are labeled with [0, N-1], and the other classes are labeled with N. If the voice sample data includes the i-th class of voice command words, the voice frames in the active region of the voice sample data are labeled as positive sample voice frames, which can be labeled as i; the voice frames in the inactive region of the voice sample data are labeled as negative sample voice frames, which can be labeled as N, thus obtaining the first voice sample data. If the voice sample data does not include voice command words, that is, all voice frames in the voice sample data are negative sample voice frames, all voice frames are labeled as N, thus obtaining the second voice sample data.
[0082] The generation unit is used to generate a set of labeled voice command words based on the first voice sample data and the second voice sample data.
[0083] In this embodiment, the activation space can be determined based on the estimated end position of the voice command word. If the voice sample data includes the voice command word, each voice frame in the activation interval is marked as a positive sample voice frame; otherwise, it is marked as a negative sample voice frame. If the voice sample data does not include the voice command word, all voice frames in the voice sample data are marked as negative sample voice frames, which can improve the efficiency of voice frame marking.
[0084] In one embodiment, the determining unit is specifically used for:
[0085] When the speech sample data includes speech command words, the interval containing the target speech frame corresponding to the end position of the predicted speech command word, the second number of speech frames before the target speech frame, and the third number of speech frames after the target speech frame in the speech sample data is determined as the activation interval.
[0086] For example, such as Figure 2 As shown, for speech sample data of length L1 including the i-th type of speech command words, the speech frames are divided into L2 frames. The interval containing the target speech frame corresponding to the end position of the predicted speech command word, the speech frames of (L3-1) frames before the target speech frame, and the speech frames of L3 frames after the target speech frame are determined as the activation interval, for a total of 2*L3 frames.
[0087] In the above embodiments, the interval containing the target speech frame corresponding to the estimated end position of the speech command word, the second number of speech frames before the target speech frame, and the third number of speech frames after the target speech frame in the speech sample data can be determined as the activation interval to ensure that the speech frame corresponding to the accurate end position of the speech command word can fall into the activation interval.
[0088] In another embodiment, the determining unit is specifically used for:
[0089] When the speech sample data includes speech command words, the interval containing the target speech frame corresponding to the estimated end position of the speech command word and the fourth number of speech frames after the target speech frame is determined as the activation interval.
[0090] For example, for speech sample data of length L1 including the i-th type of speech command words, the speech frames are divided into L2 frames. The interval where the target speech frame corresponding to the end position of the predicted speech command word and the speech frame of L4 after the target speech frame are located is determined as the activation interval, for a total of (1+L4) frames.
[0091] In the above implementation, the range of the target speech frame corresponding to the estimated end position of the speech command word in the speech sample data and the fourth number of speech frames after the target speech frame are determined as the activation range, which can narrow the range of the activation range and further approximate the accurate end position of the speech command word.
[0092] Optionally, the sample acquisition module 10 further includes:
[0093] The processing unit is used to perform zero-padding or pruning on the original speech sample data in the unlabeled speech command word sample set to obtain speech sample data of a preset length.
[0094] To facilitate model training, the original speech sample data including voice command words is padded with zeros to obtain speech sample data of length L1. The original speech sample data excluding voice command words (i.e., speech sample data of other classes) is pruned to obtain speech sample data of length L1.
[0095] In the above embodiments, the original speech sample data in the unlabeled speech command word sample set is padded with zeros or pruned into speech sample data of a preset length, which facilitates model training.
[0096] Please refer to Figure 3 , Figure 3 This is a schematic diagram of the structure of a command word recognition device provided in at least one embodiment of this application. For example... Figure 3 As shown, the command word recognition device may include:
[0097] Acquisition module 30 is used to acquire the speech data to be recognized;
[0098] Recognition module 40. Used to input the speech data into the command word recognition model obtained by the model training device of any of the above-mentioned command word recognition models, and obtain the command word recognition result of the speech data.
[0099] In this embodiment, the accuracy of the command word recognition model used has been improved, thereby improving the recognition accuracy of voice command words.
[0100] The following describes the model training method and command word recognition method of the command word recognition model provided in this application. The model training method and command word recognition method of the command word recognition model described below can be referred to in correspondence with the model training device and command word recognition device of the command word recognition model described above.
[0101] Please refer to Figure 4 , Figure 4 This is a schematic flowchart illustrating the model training method of the command word recognition model provided in at least one embodiment of this application. For example... Figure 4 As shown, the model training method for the command word recognition model may include the following steps:
[0102] Step 401: Obtain a tagged voice command word sample set, the voice command word sample set including first voice sample data, the first voice sample data including positive sample voice frames and negative sample voice frames;
[0103] Step 402: Train the initial training model based on the labeled voice command word sample set to obtain a command word recognition model; wherein, during the training process, loss is calculated based on all the negative sample voice frames and one target positive sample voice frame in the first voice sample data; the target positive sample voice frame is the positive sample voice frame corresponding to the target probability among all the positive sample voice frames in the first voice sample data; the target probability is the maximum probability among the probabilities of all the positive sample voice frames in the first voice sample data belonging to multiple different voice command words.
[0104] Optionally, step 402 includes:
[0105] Calculate the cross-entropy loss for all negative sample speech frames in the first speech sample data;
[0106] Calculate the cross-entropy loss of one frame of the target positive sample speech in the first speech sample data;
[0107] The loss of the first speech sample data is calculated based on the cross-entropy loss of all the negative sample speech frames in the first speech sample data and the cross-entropy loss of one target positive sample speech frame.
[0108] Optionally, the voice command word sample set further includes second voice sample data, which includes negative sample voice frames;
[0109] Step 402 may further include: during the training process, calculating the loss based on all the negative sample speech frames in the second speech sample data.
[0110] Optionally, step 402 includes:
[0111] Calculate the cross-entropy loss for all negative sample speech frames in the second speech sample data;
[0112] The loss of the second speech sample data is calculated based on the cross-entropy loss of all the negative sample speech frames in the second speech sample data.
[0113] Optionally, step 401 includes:
[0114] Step 4011: Divide each speech sample data in the unlabeled speech command word sample set into a first number of speech frames;
[0115] Step 4012: If the speech sample data includes the speech command word, determine the activation interval corresponding to the end position of the estimated speech command word in the speech sample data;
[0116] Step 4013: If the speech sample data includes the speech command word, mark the speech frames in the active region of the speech sample data as positive sample speech frames, and mark the speech frames in the inactive region of the speech sample data as negative sample speech frames to obtain the first speech sample data; if the speech sample data does not include the speech command word, mark each speech frame in the speech sample data as a negative sample speech frame to obtain the second speech sample data.
[0117] Step 4014: Generate the tagged voice command word sample set based on the first voice sample data and the second voice sample data.
[0118] Optionally, step 4012 includes:
[0119] When the speech sample data includes the speech command word, the interval containing the target speech frame corresponding to the end position of the estimated speech command word, the second number of speech frames before the target speech frame, and the third number of speech frames after the target speech frame in the speech sample data is determined as the activation interval.
[0120] Optionally, step 4012 includes:
[0121] When the speech sample data includes the speech command word, the interval containing the target speech frame corresponding to the end position of the estimated speech command word in the speech sample data and the fourth number of speech frames after the target speech frame is determined as the activation interval.
[0122] Optionally, step 401 further includes:
[0123] Step 4010: Pad the original speech sample data in the unlabeled speech command word sample set with zeros or prune it to obtain the speech sample data of a preset length.
[0124] The specific implementation process and technical effects of the model training method for the command word recognition model in this embodiment are similar to those in the embodiment of the model training device for the command word recognition model. For details, please refer to the detailed description in the embodiment of the model training device for the command word recognition model, which will not be repeated here.
[0125] Please refer to Figure 5 , Figure 5 This is a flowchart illustrating a command word recognition method provided in at least one embodiment of this application. For example... Figure 5 As shown, the command word recognition method may include the following steps:
[0126] Step 501: Obtain the speech data to be recognized;
[0127] Step 502: Input the speech data into the command word recognition model obtained by the model training device of any of the above command word recognition models to obtain the command word recognition result of the speech data.
[0128] The specific implementation process and technical effects of the command word recognition method in this embodiment are similar to those in the embodiment of the command word recognition device. For details, please refer to the detailed description in the embodiment of the command word recognition device, which will not be repeated here.
[0129] Figure 6 This is a schematic diagram of the structure of an electronic device provided in at least one embodiment of this application, such as... Figure 6 As shown, the electronic device may include a processor 810, a communications interface 820, a memory 830, and a communication bus 840. The processor 810, communications interface 820, and memory 830 communicate with each other via the communication bus 840. The processor 810 can call logical instructions in the memory 830 to execute the steps of any of the above method embodiments and achieve the same technical effect. To avoid repetition, further details are omitted here.
[0130] Furthermore, the logical instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0131] On the other hand, this application also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer can perform the steps of any of the above method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0132] In another aspect, this application also provides a non-transitory computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it is implemented to perform the steps of any of the above method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0133] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0134] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0135] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A model training device for a command word recognition model, characterized in that, include: The sample acquisition module is used to acquire a set of labeled voice command words, the set of voice command words including first voice sample data, the first voice sample data including positive sample voice frames and negative sample voice frames; The model training module is used to train the initial training model based on the labeled voice command word sample set to obtain a command word recognition model. During the training process, loss is calculated based on all negative sample voice frames and one target positive sample voice frame in the first voice sample data. The target positive sample voice frame is the positive sample voice frame with the target probability among all positive sample voice frames in the first voice sample data. The target probability is the maximum probability among the probabilities of all positive sample voice frames in the first voice sample data belonging to multiple different voice command words. The sample acquisition module includes: A partitioning unit is used to divide each speech sample data in the unlabeled speech command word sample set into a first number of speech frames; The determining unit is configured to determine the activation interval corresponding to the estimated end position of the voice command word in the voice sample data when the voice sample data includes the voice command word; A labeling unit is configured to, when the speech sample data includes the speech command words, label the speech frames in the active region of the speech sample data as positive sample speech frames, and label the speech frames in the inactive region of the speech sample data as negative sample speech frames, thereby obtaining the first speech sample data.
2. The model training device for the command word recognition model according to claim 1, characterized in that, The model training module is specifically used for: Calculate the cross-entropy loss for all negative sample speech frames in the first speech sample data; Calculate the cross-entropy loss of one frame of the target positive sample speech in the first speech sample data; The loss of the first speech sample data is calculated based on the cross-entropy loss of all the negative sample speech frames in the first speech sample data and the cross-entropy loss of one target positive sample speech frame.
3. The model training device for the command word recognition model according to claim 1 or 2, characterized in that, The voice command word sample set also includes second voice sample data, which includes negative sample voice frames. The model training module is also used to: calculate the loss based on all the negative sample speech frames in the second speech sample data during the training process.
4. The model training device for the command word recognition model according to claim 3, characterized in that, The model training module is specifically used for: Calculate the cross-entropy loss for all negative sample speech frames in the second speech sample data; The loss of the second speech sample data is calculated based on the cross-entropy loss of all the negative sample speech frames in the second speech sample data.
5. The model training device for the command word recognition model according to claim 3, characterized in that, The marking unit is further configured to mark each of the speech frames in the speech sample data as the negative sample speech frames when the speech sample data does not include the speech command words, thereby obtaining the second speech sample data; The sample acquisition module further includes a generation unit, which is used to generate the tagged voice command word sample set based on the first voice sample data and the second voice sample data.
6. The model training apparatus for the command word recognition model according to claim 5, characterized in that, The determining unit is specifically used for: When the speech sample data includes the speech command word, the interval containing the target speech frame corresponding to the end position of the estimated speech command word, the second number of speech frames before the target speech frame, and the third number of speech frames after the target speech frame in the speech sample data is determined as the activation interval.
7. The model training apparatus for the command word recognition model according to claim 5, characterized in that, The determining unit is specifically used for: When the speech sample data includes the speech command word, the interval containing the target speech frame corresponding to the end position of the estimated speech command word in the speech sample data and the fourth number of speech frames after the target speech frame is determined as the activation interval.
8. The model training apparatus for the command word recognition model according to claim 5, characterized in that, The sample acquisition module further includes: The processing unit is used to perform zero-padding or pruning on the original speech sample data in the unlabeled speech command word sample set to obtain speech sample data of a preset length.
9. A command word recognition device, characterized in that, include: The acquisition module is used to acquire the speech data to be recognized; The recognition module is used to input the voice data into the command word recognition model obtained by any one of claims 1 to 8 to obtain the command word recognition result of the voice data.
10. A method for training a command word recognition model, characterized in that, include: Obtain a tagged voice command word sample set, the voice command word sample set including first voice sample data, the first voice sample data including positive sample voice frames and negative sample voice frames; The initial training model is trained based on the labeled voice command word sample set to obtain a command word recognition model. During the training process, a loss is calculated based on all negative sample voice frames and one target positive sample voice frame from the first voice sample data. The target positive sample voice frame is the positive sample voice frame with the target probability among all positive sample voice frames in the first voice sample data. The target probability is the maximum probability among the probabilities of all positive sample voice frames in the first voice sample data belonging to multiple different voice command words. The method for determining the first speech sample data includes: dividing each speech sample data in the unlabeled speech command word sample set into a first number of speech frames; when the speech sample data includes the speech command word, determining the activation interval corresponding to the estimated end position of the speech command word in the speech sample data; when the speech sample data includes the speech command word, marking the speech frames in the speech sample data that are in the activation interval as the positive sample speech frames, and marking the speech frames in the speech sample data that are in the non-activation interval as the negative sample speech frames, thereby obtaining the first speech sample data.
11. A command word recognition method, characterized in that, include: Acquire the speech data to be recognized; The voice data is input into the command word recognition model obtained by any one of claims 1-8 to obtain the command word recognition result of the voice data.
12. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the model training method for the command word recognition model as described in claim 10, or the steps of the command word recognition method as described in claim 11.
13. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the model training method of the command word recognition model as described in claim 10, or the steps of the command word recognition method as described in claim 11.
Citation Information
Patent Citations
CN111653276A
CN111933114A