Voice control method and device based on command word recognition, equipment and storage medium
By using the center loss function and the focus loss function in the command word recognition model for training, the problem of misrecognition in complex speech scenarios is solved, and the model achieves efficient recognition and improved accuracy in complex speech scenarios.
Patent Information
- Application Number
- CN202210959603.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-10
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2042-08-10
AI Technical Summary
In existing technologies, command word recognition models suffer from severe misidentification in complex speech scenarios and have low training efficiency, making it difficult to effectively improve the recognition accuracy of models in complex speech scenarios.
The command word recognition model is jointly trained using the center loss function and the focus loss function. By reducing the intra-class distance of command words of the same type and increasing the inter-class distance of command words of different types, the model's discriminative ability is improved.
The model improves the accuracy of command word recognition in complex speech scenarios, while also increasing model training efficiency and reducing misrecognition.
Smart Images

Figure CN117636860B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of speech recognition technology, and in particular to a voice control method, apparatus, device and storage medium based on command word recognition. Background Technology
[0002] Command word recognition is an important area of speech recognition technology, typically used for controlling or waking up terminal devices. When the input speech is complex, command word recognition models may exhibit misidentification. Misidentification generally includes misidentifying non-command words as command words, misidentifying command words with different meanings, and misidentifying command words as non-command words.
[0003] To avoid misidentification in command word recognition models in existing technologies, the loss function during training can be set to minimize the distance between classes and maximize the distance between classes. This loss function, combined with carefully selected triples (positive samples far from ordinary samples and negative samples close to ordinary samples), can effectively improve the model's recognition accuracy in complex speech scenarios. However, the process of collecting these carefully selected triples is cumbersome and time-consuming, resulting in low training efficiency. Summary of the Invention
[0004] This application provides a voice control method, device, equipment, and storage medium based on command word recognition, which can achieve optimized model performance training by training the model with ordinary samples, ensuring the recognition accuracy of the model in complex speech scenarios while improving the model training efficiency, so as to solve the problem of low model training efficiency in the prior art.
[0005] In a first aspect, this application provides a voice control method based on command word recognition, comprising: Obtain the audio data to be recognized from the currently input voice information; The audio data to be recognized is input into a pre-trained command word recognition model to obtain the command word result output by the command word recognition model; the command word recognition model is trained based on the training sample set, and the center loss function and the focus loss function are used during the training process; Based on the command word result, determine the operation instruction triggered by the voice information.
[0006] Secondly, this application provides a voice control device based on command word recognition, comprising: The audio acquisition module is configured to acquire the audio data to be recognized from the currently input speech information; The command word recognition module is configured to input the audio data to be recognized into a pre-trained command word recognition model to obtain the command word result output by the command word recognition model; the command word recognition model is trained based on a training sample set, and a center loss function and a focus loss function are used during the training process; The operation triggering module is configured to determine the operation instruction triggered by the voice information based on the command word result.
[0007] Thirdly, this application provides a voice control device based on command word recognition, comprising: One or more processors; a storage device storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement the voice control method based on command word recognition as described in the first aspect.
[0008] Fourthly, this application provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the voice control method based on command word recognition as described in the first aspect.
[0009] This application employs a center loss function and a focus loss function during the training of a command word recognition model. The center loss function reduces the intra-class distance of similar command words in the feature space, thus indirectly increasing the inter-class distance of different command words, making the feature parameters of different command words more discriminative and improving the discriminative ability of the command word recognition model. For some difficult-to-train samples with low discriminativeness, the focus loss function assigns them a larger weight; for some easily trainable samples with high discriminativeness, the focus loss function assigns them a smaller weight, so that the model training can pay more attention to the feature parameters of difficult-to-train samples. The combined use of the focus loss function and the center loss function can reduce the intra-class distance of similar command words, including difficult-to-train samples, in the feature space, indirectly increasing the inter-class distance of different command words, including difficult-to-train samples, thereby increasing the discriminativeness of the features of difficult-to-train samples, improving the discriminative ability of the command word recognition model, improving the recognition accuracy of the command word recognition model, and avoiding misidentification. By employing the aforementioned techniques, the training effect of optimizing model performance can still be achieved using ordinary samples when training the command word recognition model. This ensures the model's recognition accuracy in complex speech scenarios while improving model training efficiency, thus solving the problem of low model training efficiency in existing technologies. Attached Figure Description
[0010] Figure 1 This is a flowchart of a voice control method based on command word recognition provided in an embodiment of this application; Figure 2 This is a schematic diagram of the structure of the command word recognition model provided in the embodiments of this application; Figure 3 This is a flowchart of command word recognition using a command word recognition model provided in an embodiment of this application; Figure 4 This is a flowchart illustrating the training process of the command word recognition model provided in this application embodiment; Figure 5 This is a flowchart illustrating the determination of the second loss value based on the focus center loss function provided in an embodiment of this application; Figure 6 This is a flowchart illustrating the determination of weight coefficients based on the focusing loss function provided in an embodiment of this application; Figure 7 This is a flowchart of training a first neural network model based on an orthogonalization loss function and a focus center loss function, provided in an embodiment of this application. Figure 8 This is a flowchart of determining the third loss value provided in an embodiment of this application; Figure 9 This is a flowchart of training a second neural network model based on the cross-entropy loss function, provided in an embodiment of this application. Figure 10 This is a flowchart illustrating the training of a third neural network model based on the cross-entropy loss function and the center loss function, as provided in an embodiment of this application. Figure 11 This is a schematic diagram of the structure of a voice control device based on command word recognition provided in an embodiment of this application; Figure 12 This is a schematic diagram of the structure of a voice control device based on command word recognition provided in an embodiment of this application. Detailed Implementation
[0011] To make the objectives, technical solutions, and advantages of this application clearer, specific embodiments of this application will be described in further detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely for explaining this application and not for limiting it. It should also be noted that, for ease of description, only the parts relevant to this application are shown in the drawings, not all of them. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe operations (or steps) as sequential processes, many of these operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. A process can be terminated when its operation is completed, but it may also have additional steps not included in the drawings. A process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0012] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0013] The voice control method based on command word recognition provided in this embodiment can be executed by a voice control device based on command word recognition. This voice control device can be implemented through software and / or hardware. It can consist of two or more physical entities, or it can consist of a single physical entity. For example, the voice control device based on command word recognition can be a smart device equipped with a voice acquisition device, such as a smart home device, or it can be the processor of a smart device.
[0014] The command-word recognition-based voice control device has at least one type of operating system installed, including but not limited to Android, Linux, and Windows. The command-word recognition-based voice control device can install at least one application on the operating system; this application can be a built-in application of the operating system or an application downloaded from a third-party device or server. In this embodiment, the command-word recognition-based voice control device has at least one application capable of executing the command-word recognition-based voice control method; therefore, the command-word recognition-based voice control device can also be the application itself.
[0015] For ease of understanding, this embodiment uses a smart home device as the subject executing the voice control method based on command word recognition as an example for description.
[0016] In one embodiment, the smart home device has a voice control function. It collects the user's current voice input through a voice acquisition device and identifies command words in the voice information based on a pre-trained command word recognition model. The smart home device then performs corresponding operations based on these command words. However, the command word recognition model may misidentify commands when the input voice is complex. For example, if a command word in the input voice sounds similar to a non-command word, the model may mistakenly identify the command word as a non-command word. To avoid misidentification, existing technologies specifically employ a loss function that minimizes the distance between classes and maximizes the distance between classes when training the command word recognition model. This loss function requires carefully selected triples consisting of positive samples far from ordinary samples and negative samples close to ordinary samples to improve the accuracy of the command word recognition model in complex voice scenarios. If this loss function is used in conjunction with ordinary samples for training, the model becomes unstable and converges slowly during training, making training difficult and unsuitable for complex voice scenarios. However, the process of collecting selected triples is quite complicated and takes a long time to collect sample data for training the model, resulting in low training efficiency.
[0017] To address the aforementioned issues, this embodiment provides a voice control method based on command word recognition, which can achieve optimized model performance even when training the model using ordinary samples.
[0018] Figure 1 A flowchart of a voice control method based on command word recognition provided in an embodiment of this application is given. (Reference) Figure 1 The voice control method based on command word recognition specifically includes: S110. Obtain the audio data to be recognized from the currently input voice information.
[0019] The voice information refers to the user's voice currently collected by the voice acquisition device installed in the smart home device. This voice information may contain command words input by the user to control the smart home device. Command word recognition can be performed on this voice information to determine the command words it contains, thereby determining the control operation currently input by the user. The audio data to be recognized is the voice used as input to the command word recognition model from the voice information. The command word recognition model identifies the command words in the audio data to be recognized, and these command words are used as the command words contained in the voice information.
[0020] Since the input audio data length of the command word recognition model is limited, if the length of the speech information is less than or equal to the maximum length of the input audio data, the speech information can be used as the audio data to be recognized and input into the command word recognition model. If the length of the speech information is greater than the maximum length of the input audio data, audio data of a preset window length is extracted from the speech information by sliding according to a preset window sliding step size. Each extracted audio data is used as an audio data to be recognized, and each audio data to be recognized is input into the command word recognition model sequentially.
[0021] S120. Input the audio data to be recognized into the pre-trained command word recognition model to obtain the command word result output by the command word recognition model; the command word recognition model is trained based on the training sample set, and the center loss function and the focus loss function are used in the training process.
[0022] The command word recognition model is a neural network model pre-trained using sample audio data from a training sample set. During the training process, the loss value of the sample audio data is jointly calculated based on the center loss function and the focus loss function, and the parameters of the neural network model are adjusted in reverse based on the loss value.
[0023] For example, the command word recognition model is an end-to-end neural network model. After inputting audio data into the command word recognition model, the command word results output by the command word recognition model can be obtained. Figure 2 This is a schematic diagram of the command word recognition model provided in an embodiment of this application. For example... Figure 2 As shown, the command word recognition model consists of a neural network, a pooling layer, and a linear transformation layer connected in series. In this embodiment, Figure 3 This is a flowchart illustrating command word recognition using a command word recognition model, as provided in an embodiment of this application. Figure 3 As shown, the steps for command word recognition using the command word recognition model specifically include S1201-S1203: S1201. Input the audio data to be recognized into the neural network to obtain the first feature parameter output by the neural network.
[0024] For example, speech features are extracted from the audio data to be recognized using a neural network to obtain a first feature parameter, which is a speech feature matrix composed of speech feature vectors from multiple frames. The neural network in this embodiment can be a CNN (Convolutional Neural Network), a DNN (Deep Neural Network), an RNN (Recurrent Neural Network), or a neural network based on an attention mechanism.
[0025] S1202. Input the first feature parameter into the pooling layer to obtain the second feature parameter output by the pooling layer.
[0026] For example, the input data of the linear transform layer is a column vector. Therefore, the pooling layer compresses the first feature parameter in matrix form into a second feature parameter in column vector form. In this embodiment, the pooling layer can be an average pooling layer to compress the speech feature matrix into a speech feature vector, or the speech feature vector of the last frame in the first feature parameter can be taken as the second feature parameter.
[0027] It should be noted that although pooling layers are also used in neural networks, they are used to prevent the dimensionality of the input data to each convolutional layer from increasing explosively, so as to appropriately reduce the computational cost of the convolutional layers.
[0028] S1203. Input the second feature parameter into the linear transformation layer to obtain the command word result output by the linear transformation layer.
[0029] For example, the linear transformation layer maps the high-dimensional second feature parameters to a low-dimensional output, resulting in a command word result in vector form. The dimension of the command word result is equal to the number of command word categories that the command word recognition model can distinguish, including categories of different command words and categories that do not contain command words. For example, if the number of different command word categories is N1, then the number of command word categories is N1+1, and the dimension of the command word result is N1+1. Each dimension in the command word result corresponds to one command word category, and each element of the dimension represents the probability that the command word recognition model predicts the presence of the corresponding command word in the audio data to be recognized. For example, the command word result is... In the command word result, the first dimension corresponds to the first command word, the second dimension to the second command word, the third dimension to the third command word, and the fourth dimension to the absence of a command word. Based on this command word result, the probability that the audio data to be identified contains the first command word is 0.01, the probability that it contains the second command word is 0.95, the probability that it contains the third command word is 0.02, and the probability that it does not contain a command word is 0.02. In this embodiment, the command word with the highest predicted probability can be determined as the command word contained in the audio data to be identified.
[0030] It should be noted that the sample audio data used in this embodiment is ordinary sample. In order to improve the model recognition accuracy and training efficiency, the center loss function and the focus loss function are combined with the sample audio data to train the command word recognition model.
[0031] For example, Figure 4 This is a flowchart illustrating the training process of the command word recognition model provided in this application embodiment. For example... Figure 4 As shown, the training steps of this command word recognition model specifically include S210-S250: S210. Input the sample audio data from the training sample set into the first neural network model to obtain the first result information output by the first neural network model.
[0032] In this embodiment, the first neural network model is the command word recognition model before it was trained based on the center loss function and the focus loss function.
[0033] For example, the sample audio data in the training sample set is divided into multiple batches to train the first neural network model in batches. The number of sample audio data in each batch is the same, and the number of sample audio data in a batch is generally set to 32, 64, and 128. All sample audio data in the current batch are sequentially input into the first neural network model, and the first result information corresponding to each sample audio data is obtained sequentially.
[0034] It should be noted that the structure of the first neural network model is the same as that of the command word recognition model. If the structure of the command word recognition model is as follows... Figure 2 As shown, the structure of the first neural network model is also as follows: Figure 2 The only difference is the model parameters of the two models. Accordingly, the neural network in the first neural network model can output the first feature parameters of the sample audio data, the pooling layer in the first neural network model can output the second feature parameters of the sample audio data, and the first result information output by the linear transformation layer in the first neural network model is the command word result in vector form.
[0035] S220. Based on the first cross-entropy loss function, determine the first loss value according to the first result information and label information of the sample audio data.
[0036] For example, the expression for the first cross-entropy loss function is as follows:
[0037] in, The first loss value, This is the second feature parameter of the sample audio data. For the command word categories of the sample audio data, The number of dimensions of the command result. For the command result, the first Each dimension corresponds to a category of command terms. For the command result, the first Each dimension corresponds to an element value. These are the element values corresponding to the dimension of the command word category in the sample audio data of the command word results. and These are the parameters of the linear transformation layer. Assume the first result information of the sample audio data is... The label information of the sample audio data is Then, the first loss value of the sample audio data can be determined to be -log0.95.
[0038] It should be noted that the center loss function and the focus loss function cannot be used alone. Therefore, they need to be used in conjunction with the cross-entropy loss function to improve the training effect compared to using the cross-entropy loss function alone.
[0039] S230. Based on the focus center loss function, determine the second loss value according to the second feature parameters of the sample audio data and the center feature parameters of each command word category; the focus center loss function consists of the first center loss function and the focus loss function.
[0040] In this embodiment, the center loss function in the center-focusing loss function is used to calculate the loss value of the sample, and the focusing loss function is used to calculate the weighting coefficient of the sample loss value. Figure 5 This is a flowchart illustrating the determination of the second loss value based on the focus center loss function provided in an embodiment of this application. For example... Figure 5 As shown, the determination of the second loss value based on the focus center loss function specifically includes S2301-S2303: S2301. Based on the first center loss function, determine the fourth loss value according to the second feature parameter of the sample audio data and the center feature parameter of the command word category of the sample audio data.
[0041] For example, the expression for the first center loss function is as follows:
[0042] in, This is the fourth loss value. The central feature parameters for the command word categories of the sample audio data. This represents the distance between the second feature parameter and the corresponding central feature parameter of the sample audio data. The central feature parameter is a column vector with the same dimension as the second feature parameter.
[0043] As can be seen from the expression of the first center loss function, the smaller the loss value calculated based on the center loss function, the closer the features of the sample audio data are to the central features of the corresponding command word category. Therefore, the center loss function can reduce the distance between the features of the sample audio data and the corresponding central features, thereby reducing the intra-class distance of command words of the same class in the feature space, which in turn increases the inter-class distance of command words of different classes in the feature space.
[0044] S2302. Based on the focus loss function, determine the weight coefficient of the fourth loss value according to the second feature parameter of the sample audio data and the central feature parameter of each command word category.
[0045] For example, the focus loss function is used to assign greater weights to difficult-to-train samples and less weights to easy-to-train samples, so that the model can pay more attention to the features of difficult-to-train samples during training. Figure 6This is a flowchart illustrating the determination of weight coefficients based on a focusing loss function, provided in an embodiment of this application. For example... Figure 6 As shown, the steps for determining the weight coefficients based on the focusing loss function specifically include S23021-S23024: S23021. Determine the distance between the sample audio data and the central feature parameters of each command word category based on the second feature parameter of the sample audio data.
[0046] For example, the expression for feature distance is as follows:
[0047] in, For the command result, the first The central feature parameters of the command word category corresponding to each dimension The second feature parameter and the third feature parameter of the sample audio data The distance between the central feature parameters of the command word categories corresponding to each dimension.
[0048] S23022. Determine whether the command word category corresponding to the minimum distance is the same as the command word category of the sample audio data.
[0049] For example, the smaller the distance between the features of the sample audio data and the central feature of a certain command word category, the higher the probability that the command word recognition model predicts the sample audio data to belong to that command word category. The distances between the central features of each command word category and the sample features are compared, and it is determined whether the command word category corresponding to the central feature closest to the sample features is the command word category of the sample audio data. If the command word category corresponding to the central feature closest to the sample features is the command word category of the sample audio data, it indicates that the features of the sample audio data are already distinguishable from the features of different command word categories, and therefore the sample audio data is considered an easily trainable sample. If the command word category corresponding to the central feature closest to the sample features is not the command word category of the sample audio data, it indicates that the features of the sample audio data are not yet distinguishable from the features of different command word categories, and therefore the sample audio data is considered a difficult-to-train sample.
[0050] It should be noted that the command word category of the sample audio data can be determined based on the label information of the sample audio data.
[0051] S23023. When the command word category corresponding to the minimum distance is the command word category of the sample audio data, the weight coefficient is determined to be the first preset value.
[0052] S23024. If the command word category corresponding to the minimum distance is not the command word category of the sample audio data, determine the weight coefficient as the second preset value, which is greater than the first preset value.
[0053] In this embodiment, the weighting coefficients include a first preset value and a second preset value, where the second preset value is greater than the first preset value. Generally, the second preset value is set to 1, and the first preset value is set to less than 1. For example, when the sample audio data is determined to be an easy-to-train sample, the first preset value can be used as the weighting coefficient for the fourth loss value of that sample audio data. When the sample audio data is determined to be a difficult-to-train sample, the second preset value can be used as the weighting coefficient for the fourth loss value of that sample audio data. The weighting coefficient for difficult-to-train samples is greater than that for easy-to-train samples, so that the model training can pay more attention to the features of difficult-to-train samples, increasing the correlation between the features of difficult-to-train samples and the central features of similar command words, thereby increasing the distinguishability between the features of difficult-to-train samples and the central features of similar command words.
[0054] S2303. Multiply the fourth loss value by the corresponding weight coefficient to obtain the second loss value.
[0055] In summary, the expression for the center-of-focus loss function is as follows:
[0056] in, This is the second loss value. The first preset value, This is the second preset value. The focus center loss function can reduce the intra-class distance of command words of the same class, including those that are difficult to train, in the feature space, and indirectly increase the inter-class distance of command words of different classes, including those that are difficult to train, in the feature space. This increases the distinguishability of the features of the difficult-to-train samples and the central features of command words of different classes, improves the distinguishability of the command word recognition model, improves the recognition accuracy of the command word recognition model, and avoids misrecognition.
[0057] S240. Adjust the central feature parameters and the model parameters of the first neural network model based on the first loss value and the second loss value.
[0058] For example, the first loss value of all sample audio data in the current batch is summed, and the second loss value of all sample audio data in the current batch is summed. The sum of the second loss values is multiplied by the parameters of the balancing center loss function and the cross-entropy loss function, and then added to the sum of the first loss values to obtain the first total loss value. The center feature parameters of each command word category and the model parameters of the first neural network model are adjusted inversely using the first total loss value.
[0059] In this embodiment, the expression for the first total loss value is as follows:
[0060] in, This is the first total loss value. To balance the parameters of the center loss function and the cross-entropy loss function, This represents the total number of sample audio data in the current batch. For the first in the current batch The second feature parameter of each sample audio data. For the first in the current batch Command word categories for each sample audio data.
[0061] It should be noted that the central feature parameters of each command word category are preset and optimized together during the training of the command word recognition model. In one embodiment, the W parameters of each layer of the linear transformation layer can also be used as the central feature parameters of the corresponding command word category. Adjusting the W parameters of the linear transformation layer is equivalent to adjusting the central feature parameters, thereby improving the model training efficiency.
[0062] It is understandable that the center-focusing loss function reduces the distance between sample features and the central features of similar command words, thereby reducing the intra-class distance of similar command words in the feature space, and indirectly increasing the inter-class distance of different command words in the feature space. In another embodiment, the orthogonalization loss function and the center-focusing loss function can be used to directly and indirectly increase the inter-class distance of different command words in the feature space. For example, Figure 7 This is a flowchart illustrating the training of a first neural network model based on an orthogonalization loss function and a focus center loss function, as provided in an embodiment of this application. Figure 7 As shown, the training of the first neural network model based on the orthogonalization loss function and the focus center loss function includes S2401-S2402: S2401. Based on the orthogonalization loss function, determine the third loss value according to the central feature parameters of each command word category.
[0063] For example, Figure 8 This is a flowchart for determining the third loss value provided in an embodiment of this application. For example... Figure 8 As shown, the step of determining the third loss value specifically includes S24011-S24013: S24011. Determine the product of the central feature parameter and the corresponding transpose parameter for each command word category.
[0064] For example, the central feature parameters of each command word category are column vectors, and the product of a column vector and its transpose is a k×k projection matrix P, where k is the dimension of the central feature parameter. The projection matrix P is the transformation matrix when other column vectors are projected onto the corresponding column vector space. For example, if the central feature parameter of the first command word is column vector a, the central feature parameter of the second command word is column vector b, and the matrix when column vector b is projected onto the space of column vector a is p, then p = Pb.
[0065] S24012. Determine the difference between the product and the identity matrix corresponding to each command word category.
[0066] S24013. Determine the third loss value based on the sum of all the differences.
[0067] For example, the projection matrix of the central feature parameters of each command word category is subtracted from the identity matrix, and the absolute value of the difference is taken. The sum of the absolute values of all differences is used as the third loss value. By minimizing the third loss value, the projection matrix of the central feature parameters of each command word category is made to approach the identity matrix. When the projection matrix is the identity matrix, it can be deduced that p=b, that is, when column vector b is projected onto the space of column vector a, column vector b is still itself and is not affected by the space of column vector a. At this time, column vector b and column vector a are two independent vectors. This embodiment uses an orthogonalization loss function to make the projection matrix of the central feature parameters of each command word category approach the identity matrix, thereby constraining the central feature parameters, weakening the correlation of the central features of different command word categories, and strengthening the independence of the central features of different command words.
[0068] In this embodiment, the expression for the orthogonalization loss function is as follows:
[0069] in, This is the third loss value. for The transpose of the matrix, It is an identity matrix.
[0070] S2402. Adjust the central feature parameters and the model parameters of the first neural network model based on the first loss value, the second loss value, and the third loss value.
[0071] For example, the first, second, and third loss values are substituted into the expression for the second total loss value to calculate the second total loss value. The central feature parameters of each command word category and the model parameters of the first neural network model are then adjusted in reverse using the second total loss value.
[0072] The expression for the second total loss value is as follows:
[0073] in, This is the second total loss value. The parameters are used to balance the orthogonalization loss function, the clustering center loss function, and the first cross-entropy loss function.
[0074] As can be seen from the expression for the second total loss value, when the second total loss value tends to be minimized, the distance between the sample feature and the corresponding central feature tends to be minimized, which reduces the intra-class distance of command words of the same class in the feature space and indirectly increases the inter-class distance of command words of different classes in the feature space; the projection matrix of the central feature tends to be the identity matrix, which increases the distance between the central features of command words of different classes and directly increases the inter-class distance of command words of different classes in the feature space.
[0075] S250. If the first neural network model meets the first preset training conditions, the first neural network model is used as the command word recognition model.
[0076] For example, when the first neural network model converges and stabilizes or the number of training iterations reaches the upper limit, it indicates that the first neural network model has been trained and is then used as the command word recognition model.
[0077] In one embodiment, the first neural network model can be an initial, untrained neural network model. However, the loss function used in this embodiment is relatively complex, and it takes a long time to adjust the initial neural network model into a convergent and stable neural network model based on the aforementioned loss function.
[0078] In another embodiment, a first neural network model is trained on a second neural network model using a cross-entropy loss function. The second neural network model is an initial, untrained neural network model. This embodiment initially trains the first neural network model's discriminative ability using the cross-entropy loss function, and then enhances the first neural network model's discriminative ability by combining the cross-entropy loss function with a focus center loss function, thereby improving model training efficiency. For example, Figure 9 This is a flowchart illustrating the training of a second neural network model based on the cross-entropy loss function, as provided in an embodiment of this application. Figure 9 As shown, the steps for training the second neural network model based on the cross-entropy loss function specifically include S310-S340: S310. Input the sample audio data into the second neural network model to obtain the second result information output by the second neural network model.
[0079] In this embodiment, the samples used to train the second neural network model are the same as those used to train the first neural network model; both are audio data from the training sample set. Similarly, the structure of the second neural network model is the same as that of the command word recognition model.
[0080] S320. Based on the second cross-entropy loss function, determine the fifth loss value according to the second result information and label information of the sample audio data.
[0081] For example, the expression for the second cross-entropy loss function is the same as the expression for the first cross-entropy loss function, and the process for determining the fifth loss value is the same as the process for determining the first loss value, which can be referred to in steps S210-S220.
[0082] S330. Adjust the model parameters of the second neural network model based on the fifth loss value.
[0083] For example, the parameters of the linear transformation layer and the neural network in the second neural network model are adjusted in reverse based on the fifth loss value.
[0084] S340. If the second neural network model meets the second preset training conditions, the second neural network model is used as the first neural network model.
[0085] For example, when the second neural network model converges and stabilizes or the training iterations reach the upper limit, it indicates that the training of the second neural network model is complete, and the trained second neural network model is then used as the first neural network model.
[0086] In another embodiment, a first neural network model is trained on a third neural network model using a cross-entropy loss function combined with a center loss function. The third neural network model can be an initially untrained neural network model or a trained second neural network. If the third neural network model is an initially untrained neural network model, its discriminative ability can be initially trained using the cross-entropy loss function and the center loss function. Then, the discriminative ability of the first neural network model is enhanced by combining the cross-entropy loss function with the center loss function, thereby improving model training efficiency. If the third neural network model is a trained second neural network model, its discriminative ability can be further optimized using the cross-entropy loss function combined with the center loss function. Then, the first neural network model's ability to discriminate against difficult-to-train samples is trained using the cross-entropy loss function combined with the center loss function.
[0087] For example, Figure 10 This is a flowchart illustrating the training of a third neural network model based on the cross-entropy loss function and the center loss function, as provided in an embodiment of this application. Figure 10 As shown, the steps for training the third neural network model based on the sum-center loss function specifically include S410-S440: S410. Input the sample audio data into the third neural network model to obtain the third result information output by the third neural network model.
[0088] In this embodiment, the samples used to train the third neural network model are the same as those used to train the first neural network model; both are audio data from the training sample set. Similarly, the structure of the third neural network model is the same as that of the command word recognition model.
[0089] S420. Based on the third cross-entropy loss function, determine the sixth loss value according to the third result information and label information of the sample audio data.
[0090] For example, the expression for the third cross-entropy loss function is the same as the expression for the first cross-entropy loss function, and the process for determining the sixth loss value is the same as the process for determining the first loss value, which can be referred to in steps S210-S220.
[0091] S430. Based on the second center loss function, determine the seventh loss value according to the second feature parameter of the sample audio data and the center feature parameter of the command word category of the sample audio data.
[0092] For example, the expression for the second center loss function is the same as the expression for the first center loss function, and the process for determining the seventh loss value is the same as the process for determining the fourth loss value, which can be referred to in step S2301.
[0093] S440. Adjust the central feature parameters and the model parameters of the third neural network model based on the sixth and seventh loss values.
[0094] For example, the sixth loss value of all sample audio data in the current batch is summed, and the seventh loss value of all sample audio data in the current batch is summed. The sum of the sixth loss values is multiplied by the parameters of the balancing center loss function and the cross-entropy loss function, and then added to the sum of the seventh loss values to obtain the second total loss value. The center feature parameters of each command word category and the model parameters of the first neural network model are adjusted inversely using the second total loss value.
[0095] In this embodiment, the expression for the third total loss value is as follows:
[0096] S450. If the third neural network model meets the third preset training conditions, the third neural network model shall be used as the first neural network model.
[0097] For example, when the third neural network model converges and stabilizes or the number of training iterations reaches the upper limit, it indicates that the training of the third neural network model is complete, and the trained third neural network model is then used as the first neural network model.
[0098] In one embodiment, the command word recognition model adopts a multi-scale depthwise separable dilated residual TCN model structure, but the command word recognition model is not limited to this model structure. Training and test sets are obtained from an open-source English command word dataset. The command word recognition model is trained in three stages based on the training set. The first training stage uses the cross-entropy loss function (refer to steps S310-S330), the second training stage uses the cross-entropy loss function and the center loss function (refer to steps S410-S450), and the third training stage uses the cross-entropy loss function, the center loss function, and the clustering loss function (refer to steps S210-S250). The trained command word recognition model is then tested using the test set to verify its false recognition accuracy. The test results are shown in the table below. Table 1
[0099] As shown in Table 1, the model trained using the cross-entropy loss function, center loss function, and clustering loss function had a false recognition rate as low as 2.019% on the test set. Compared with the model trained using the cross-entropy loss function, which had a false recognition rate of 2.224% on the test set, the false recognition rate of the model was reduced by 9.2%, effectively improving the model's recognition accuracy.
[0100] S130. Based on the command word result, determine the operation instruction triggered by the voice information.
[0101] For example, the command word category with the highest predicted probability is taken as the command word contained in the audio data to be identified, and the control operation corresponding to the command word is determined so as to trigger the corresponding operation instruction according to the control operation.
[0102] In summary, the voice control method based on command word recognition provided in this application employs a center loss function and a focus loss function during the training process of the command word recognition model. The center loss function can reduce the intra-class distance of similar command words in the feature space, thus indirectly increasing the inter-class distance of different command words, making the feature parameters of different command words more discriminative and improving the discriminative ability of the command word recognition model. For some difficult-to-train samples with low discriminativeness, the focus loss function assigns them a larger weight; for some easily trainable samples with high discriminativeness, the focus loss function assigns them a smaller weight, so that the model training can pay more attention to the feature parameters of difficult-to-train samples. The combined use of the focus loss function and the center loss function can reduce the intra-class distance of similar command words, including difficult-to-train samples, in the feature space, indirectly increasing the inter-class distance of different command words, including difficult-to-train samples, in the feature space. This increases the discriminativeness of the features of difficult-to-train samples, improves the discriminative ability of the command word recognition model, improves the recognition accuracy of the command word recognition model, and avoids misrecognition. By employing the aforementioned techniques, the training effect of optimizing model performance can still be achieved using ordinary samples when training the command word recognition model. This ensures the model's recognition accuracy in complex speech scenarios while improving model training efficiency, thus solving the problem of low model training efficiency in existing technologies.
[0103] Based on the above embodiments, Figure 11 This is a schematic diagram of a voice control device based on command word recognition, provided as an embodiment of this application. (Reference) Figure 11 The voice control device based on command word recognition provided in this embodiment specifically includes: an audio acquisition module 51, a command word recognition module 52, and an operation triggering module 53.
[0104] The audio acquisition module is configured to acquire the audio data to be recognized from the currently input voice information. The command word recognition module is configured to input the audio data to be recognized into a pre-trained command word recognition model to obtain the command word results output by the command word recognition model; the command word recognition model is trained based on the training sample set, and the center loss function and the focus loss function are used during the training process; The operation triggering module is configured to determine the operation command triggered by the voice information based on the command word result.
[0105] Based on the above embodiments, the command word recognition model is composed of a neural network, a pooling layer, and a linear transformation layer connected in series. Accordingly, the command word recognition module includes: a feature extraction submodule, configured to input the audio data to be recognized into the neural network to obtain the first feature parameter output by the neural network; a feature compression submodule, configured to input the first feature parameter into the pooling layer to obtain the second feature parameter output by the pooling layer; and a command word recognition submodule, configured to input the second feature parameter into the linear transformation layer to obtain the command word result output by the linear transformation layer.
[0106] Based on the above embodiments, the voice control device based on command word recognition further includes a first training module, which includes: a first recognition submodule configured to input sample audio data from the training sample set into a first neural network model to obtain first result information output by the first neural network model; a first loss value determination submodule configured to determine a first loss value based on a first cross-entropy loss function, according to the first result information and label information of the sample audio data; a second loss value determination submodule configured to determine a second loss value based on a focus center loss function, according to the second feature parameters of the sample audio data and the center feature parameters of each command word category; the focus center loss function consists of a first center loss function and a focus loss function; a first model parameter adjustment submodule configured to adjust the center feature parameters and the model parameters of the first neural network model according to the first loss value and the second loss value; and a first training end determination submodule configured to use the first neural network model as a command word recognition model when the first neural network model meets the first preset training conditions.
[0107] Based on the above embodiments, the first model parameter adjustment submodule includes: a third loss value determination unit, configured to determine a third loss value based on the orthogonalized loss function and the central feature parameters of each command word category; and a second model parameter adjustment unit, configured to adjust the central feature parameters and the model parameters of the first neural network model based on the first loss value, the second loss value, and the third loss value.
[0108] Based on the above embodiments, the second loss value determination submodule includes: a fourth loss value determination unit, configured to determine a fourth loss value based on a first center loss function, according to the second feature parameters of the sample audio data and the center feature parameters of the command word categories of the sample audio data; a weight coefficient determination unit, configured to determine the weight coefficients of the fourth loss value based on a focus loss function, according to the second feature parameters of the sample audio data and the center feature parameters of each command word category; and a second loss value determination unit, configured to multiply the fourth loss value by the corresponding weight coefficients to obtain a second loss value.
[0109] Based on the above embodiments, the weight coefficient determination unit includes: a feature distance determination subunit, configured to determine the distance between the sample audio data and the center feature parameters of each command word category; a category judgment subunit, configured to determine whether the command word category corresponding to the minimum distance is the command word category of the sample audio data; a first weight determination subunit, configured to determine the weight coefficient as a first preset value when the command word category corresponding to the minimum distance is the command word category of the sample audio data; and a second weight determination subunit, configured to determine the weight coefficient as a second preset value when the command word category corresponding to the minimum distance is not the command word category of the sample audio data, wherein the second preset value is greater than the first preset value.
[0110] Based on the above embodiments, the third loss value determination unit includes: a projection matrix determination subunit, configured to determine the product of the central feature parameter and the corresponding transpose parameter of each command word category; a matrix difference determination subunit, configured to determine the difference between the product corresponding to each command word category and the identity matrix; and a third loss value determination subunit, configured to determine the third loss value based on the sum of the differences.
[0111] Based on the above embodiments, the voice control device based on command word recognition further includes a second training module, which includes: a second recognition submodule configured to input sample audio data into a second neural network model to obtain second result information output by the second neural network model; a fifth loss value determination submodule configured to determine a fifth loss value based on a second cross-entropy loss function, according to the second result information and label information of the sample audio data; a second model parameter adjustment submodule configured to adjust the model parameters of the second neural network model according to the fifth loss value; and a second training end determination submodule configured to use the second neural network model as the first neural network model when the second neural network model meets the second preset training conditions.
[0112] Based on the above embodiments, the voice control device based on command word recognition further includes a third training module, which includes: a third recognition submodule configured to input sample audio data into a third neural network model to obtain third result information output by the third neural network model; a sixth loss value determination submodule configured to determine a sixth loss value based on a third cross-entropy loss function, according to the third result information and label information of the sample audio data; a seventh loss value determination submodule configured to determine a seventh loss value based on a second center loss function, according to the second feature parameters of the sample audio data and the center feature parameters of the command word category of the sample audio data; a third model parameter adjustment submodule configured to adjust the center feature parameters and the model parameters of the third neural network model according to the sixth and seventh loss values; and a third training end determination submodule configured to use the third neural network model as the first neural network model when the third neural network model meets the third preset training conditions.
[0113] The voice control device based on command word recognition provided in this application employs a center loss function and a focus loss function during the training process of the command word recognition model. The center loss function can reduce the intra-class distance of similar command words in the feature space, thus indirectly increasing the inter-class distance of different command words, making the feature parameters of different command words more discriminative and improving the discriminative ability of the command word recognition model. For some difficult-to-train samples with low discriminativeness, the focus loss function assigns them a larger weight; for some easily-trained samples with high discriminativeness, the focus loss function assigns them a smaller weight, so that the model training can pay more attention to the feature parameters of difficult-to-train samples. The combined use of the focus loss function and the center loss function can reduce the intra-class distance of similar command words, including difficult-to-train samples, in the feature space, indirectly increasing the inter-class distance of different command words, including difficult-to-train samples, in the feature space. This increases the discriminativeness of the features of difficult-to-train samples, improves the discriminative ability of the command word recognition model, improves the recognition accuracy of the command word recognition model, and avoids misrecognition. By employing the aforementioned techniques, the training effect of optimizing model performance can still be achieved using ordinary samples when training the command word recognition model. This ensures the model's recognition accuracy in complex speech scenarios while improving model training efficiency, thus solving the problem of low model training efficiency in existing technologies.
[0114] The voice control device based on command word recognition provided in this application embodiment can be used to execute the voice control method based on command word recognition provided in the above embodiment, and has corresponding functions and beneficial effects.
[0115] Figure 12 This is a schematic diagram of the structure of a voice control device based on command word recognition provided in an embodiment of this application. (Refer to...) Figure 12The command word recognition-based voice control device includes a processor 61, a memory 62, a communication device 63, an input device 64, and an output device 65. The number of processors 61 and the number of memories 62 in the command word recognition-based voice control device can be one or more. The processor 61, memory 62, communication device 63, input device 64, and output device 65 of the command word recognition-based voice control device can be connected via a bus or other means.
[0116] The memory 62, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as program instructions / modules corresponding to the command word recognition-based voice control method in any embodiment of this application (e.g., the audio acquisition module 51, command word recognition module 52, and operation triggering module 53 in the command word recognition-based voice control device). The memory 62 may primarily include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a function; the data storage area may store data created based on the use of the device, etc. Furthermore, the memory 62 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0117] The communication device 63 is used for data transmission.
[0118] The processor 61 executes various functional applications and data processing of the device by running software programs, instructions and modules stored in the memory 62, thereby realizing the above-mentioned voice control method based on command word recognition.
[0119] Input device 64 can be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the device. Output device 65 may include display devices such as a display screen.
[0120] The voice control device based on command word recognition provided above can be used to execute the voice control method based on command word recognition provided in the above embodiments, and has corresponding functions and beneficial effects.
[0121] This application embodiment also provides a storage medium containing computer-executable instructions. When executed by a computer processor, the computer-executable instructions are used to execute a voice control method based on command word recognition. The voice control method based on command word recognition includes: obtaining audio data to be recognized from currently input voice information; inputting the audio data to be recognized into a pre-trained command word recognition model to obtain command word results output by the command word recognition model; the command word recognition model is trained based on a training sample set, and a center loss function and a focus loss function are used during the training process; and determining the operation instruction triggered by the voice information based on the command word results.
[0122] Storage medium – any type of memory device or storage device. The term “storage medium” is intended to include: mounting media, such as CD-ROM, floppy disk, or magnetic tape devices; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (e.g., hard disk or optical storage); registers or other similar types of memory elements, etc. Storage medium may also include other types of memory or combinations thereof. Furthermore, storage medium may reside in a first computer system in which the program is executed, or it may reside in a different second computer system connected to the first computer system via a network (such as the Internet). The second computer system can provide program instructions to the first computer for execution. The term “storage medium” can include two or more storage media residing in different locations (e.g., in different computer systems connected via a network). Storage medium may store program instructions (e.g., specifically implemented as a computer program) executable by one or more processors.
[0123] Of course, the computer-executable instructions provided in the embodiments of this application are not limited to the voice control method based on command word recognition as described above, but can also execute related operations in the voice control method based on command word recognition provided in any embodiment of this application.
[0124] The voice control device, storage medium, and voice control equipment based on command word recognition provided in the above embodiments can execute the voice control method based on command word recognition provided in any embodiment of this application. For technical details not described in detail in the above embodiments, please refer to the voice control method based on command word recognition provided in any embodiment of this application.
[0125] The above description is merely a preferred embodiment and the technical principles employed in this application. This application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions that can be made by those skilled in the art will not depart from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of this application. The scope of this application is determined by the scope of the claims.
Claims
1. A voice control method based on command word recognition, characterized in that, include: Obtain the audio data to be recognized from the currently input voice information; The audio data to be recognized is input into a pre-trained command word recognition model to obtain the command word result output by the command word recognition model; the command word recognition model is trained based on the training sample set. Based on the command word result, determine the operation instruction triggered by the voice information; The training process of the command word recognition model includes: inputting sample audio data from the training sample set into a first neural network model to obtain first result information output by the first neural network model and second feature parameters output by the pooling layer in the first neural network model; determining a first loss value based on a first cross-entropy loss function, according to the first result information and label information of the sample audio data; determining a fourth loss value based on a first center loss function, according to the second feature parameters and the center feature parameters of the command word categories of the sample audio data; determining the distance between the second feature parameters and the center feature parameters of each command word category; and determining whether the command word category corresponding to the minimum distance is the sample audio data. The command word category of this audio data; if the command word category corresponding to the minimum distance is the command word category of the sample audio data, the weight coefficient is determined to be a first preset value; if the command word category corresponding to the minimum distance is not the command word category of the sample audio data, the weight coefficient is determined to be a second preset value, the second preset value being greater than the first preset value, the fourth loss value is multiplied by the corresponding weight coefficient to obtain a second loss value, the central feature parameter and the model parameter of the first neural network model are adjusted according to the first loss value and the second loss value; if the first neural network model meets the first preset training conditions, the first neural network model is used as the command word recognition model.
2. The voice control method based on command word recognition according to claim 1, characterized in that, The command word recognition model consists of a neural network, a pooling layer, and a linear transformation layer connected in series. Accordingly, the step of inputting the audio data to be recognized into a pre-trained command word recognition model to obtain the command word result output by the command word recognition model includes: The audio data to be identified is input into the neural network to obtain the first feature parameter output by the neural network; The first feature parameter is input into the pooling layer to obtain the second feature parameter output by the pooling layer; The second feature parameter is input into the linear transformation layer to obtain the command word result output by the linear transformation layer.
3. The voice control method based on command word recognition according to claim 1, characterized in that, The step of adjusting the central feature parameter and the model parameters of the first neural network model based on the first loss value and the second loss value includes: Based on the orthogonalization loss function, a third loss value is determined according to the central feature parameters of each command word category; Based on the first loss value, the second loss value, and the third loss value, adjust the central feature parameter and the model parameters of the first neural network model.
4. The voice control method based on command word recognition according to claim 3, characterized in that, The method based on the orthogonalization loss function, determining the third loss value according to the central feature parameters of each command word category, includes: Determine the product of the central feature parameter and the corresponding transpose parameter for each of the command word categories; Determine the difference between the product and the identity matrix corresponding to each of the command word categories; The third loss value is determined based on the sum of all the aforementioned differences.
5. The voice control method based on command word recognition according to claim 1, characterized in that, Before inputting the sample audio data from the training sample set into the first neural network model, the method further includes: The sample audio data is input into the second neural network model to obtain the second result information output by the second neural network model; Based on the second cross-entropy loss function, the fifth loss value is determined according to the second result information and label information of the sample audio data; Based on the fifth loss value, adjust the model parameters of the second neural network model; If the second neural network model meets the second preset training conditions, the second neural network model is used as the first neural network model.
6. The voice control method based on command word recognition according to claim 1, characterized in that, Before inputting the sample audio data from the training sample set into the first neural network model, the method further includes: The sample audio data is input into the third neural network model to obtain the third result information output by the third neural network model; Based on the third cross-entropy loss function, the sixth loss value is determined according to the third result information and label information of the sample audio data; Based on the second center loss function, a seventh loss value is determined according to the second feature parameter of the sample audio data and the center feature parameter of the command word category of the sample audio data; Based on the sixth loss value and the seventh loss value, adjust the central feature parameter and the model parameter of the third neural network model; If the third neural network model meets the third preset training conditions, the third neural network model will be used as the first neural network model.
7. A voice control device based on command word recognition, characterized in that, include: The audio acquisition module is configured to acquire the audio data to be recognized from the currently input speech information; The command word recognition module is configured to input the audio data to be recognized into a pre-trained command word recognition model to obtain the command word result output by the command word recognition model; The command word recognition model is trained based on a training sample set; The operation triggering module is configured to determine the operation instruction triggered by the voice information based on the command word result; The training module is configured to input sample audio data from the training sample set into a first neural network model to obtain first result information output by the first neural network model and second feature parameters output by the pooling layer in the first neural network model; determine a first loss value based on a first cross-entropy loss function, according to the first result information and label information of the sample audio data; determine a fourth loss value based on a first center loss function, according to the second feature parameters and the center feature parameters of the command word categories of the sample audio data; determine the distance between the second feature parameters and the center feature parameters of each command word category; and determine whether the command word category corresponding to the minimum distance is the sample audio data. The command word category is determined; if the command word category corresponding to the minimum distance is the command word category of the sample audio data, the weight coefficient is determined to be a first preset value; if the command word category corresponding to the minimum distance is not the command word category of the sample audio data, the weight coefficient is determined to be a second preset value, the second preset value being greater than the first preset value, the fourth loss value is multiplied by the corresponding weight coefficient to obtain a second loss value, and the central feature parameter and the model parameter of the first neural network model are adjusted according to the first loss value and the second loss value; if the first neural network model meets the first preset training conditions, the first neural network model is used as the command word recognition model.
8. A voice control device based on command word recognition, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the voice control method based on command word recognition as described in any one of claims 1-6.
9. A storage medium containing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are used to perform the voice control method based on command word recognition as described in any one of claims 1-6.
Citation Information
Patent Citations
Deep neural network training method and device, electronic equipment and storage medium
CN109816092A
Command recognition method and device and computer readable storage medium
CN112669836A
Voice control method and device, equipment and storage medium
CN117636847A
