Speech synthesis method and device
Through the multi-head attention mechanism and linear transformation technology, it captures the correlation between text and audio features, generates fusion features, solves the problem of inaccurate speech synthesis, and improves the accuracy of speech synthesis and the generalization ability of the model.
Patent Information
- Application Number
- CN202411040850.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-07-31
AI Technical Summary
In existing speech synthesis technology, during the text-to-speech synthesis process, the predicted speech features do not match the real speech features, resulting in a decrease in the accuracy of synthesized speech. There is no effective solution yet.
A multi-head attention mechanism is used to capture the correlation between text features and audio features, and fusion features are generated through weight mapping linear transformation and spline interpolation linear transformation, which are used to generate synthetic speech.
It improves the accuracy of speech synthesis and the generalization ability of the model, enhances the understanding of complex information and the accuracy of information extraction, and solves the problem of inaccurate speech synthesis.
Smart Images

Figure CN118571208B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of speech synthesis technology, and in particular to a speech synthesis method and device. Background Art
[0002] With the rapid development of artificial intelligence technology, AI technology has been widely studied and applied in many fields, among which natural language processing (NLP) and speech processing are particularly important. Through the speech generation model, text can be converted into synthesized speech for users to play. However, the current speech generation technology requires mapping text to speech features first, and then generating speech through these features. In this process, the vocoder needs to be trained to ensure accurate feature mapping. However, in the text-to-speech synthesis process, the predicted speech features are often different from the features extracted from the real speech, and this mismatch will reduce the accuracy of the synthesized speech.
[0003] Currently, no effective solution has been proposed to the problem of inaccurate speech synthesis. Summary of the invention
[0004] The embodiments of the present application provide a speech synthesis method and device, which at least solve the problem of inaccurate speech synthesis.
[0005] According to one aspect of an embodiment of the present application, a speech synthesis method is provided, comprising: in response to a speech synthesis request, parsing text data and audio data from the speech synthesis request, and extracting text features from the text data, and extracting audio features of a target object from the audio data; using a multi-head attention mechanism to capture the correlation between the text features and the audio features to obtain a correlation matrix; dividing the correlation matrix into a first correlation matrix and a second correlation matrix, performing a weight mapping linear transformation on the first correlation matrix, performing a spline interpolation linear transformation on the second correlation matrix, and fusing the results of the weight mapping linear transformation and the results of the spline interpolation linear transformation to obtain a fused feature; based on the fused feature, generating a synthesized speech simulating the target object, wherein the speech content of the synthesized speech is the text content in the text data.
[0006] According to another aspect of an embodiment of the present application, a speech synthesis device is also provided, including: an extraction module, configured to respond to a speech synthesis request, parse text data and audio data from the speech synthesis request, and extract text features from the text data, and extract audio features of a target object from the audio data; an attention module, configured to capture the correlation between the text features and the audio features using a multi-head attention mechanism to obtain a correlation matrix; a fusion module, configured to divide the correlation matrix into a first correlation matrix and a second correlation matrix, perform a weight mapping linear transformation on the first correlation matrix, perform a spline interpolation linear transformation on the second correlation matrix, and fuse the result of the weight mapping linear transformation with the result of the spline interpolation linear transformation to obtain a fusion feature; a synthesis module, configured to generate a synthesized speech simulating the target object based on the fusion feature, wherein the speech content of the synthesized speech is the text content in the text data.
[0007] According to another aspect of the embodiments of the present application, there is also provided an electronic device, comprising: a processor, and a memory for storing a program, wherein the program comprises instructions, and when the instructions are executed by the processor, the processor executes the method in any of the above embodiments.
[0008] According to another aspect of the embodiments of the present application, a non-transitory machine-readable medium storing computer instructions is also provided, where the computer instructions are used to enable a computer to execute the method in any of the above embodiments.
[0009] In an embodiment of the present application, in response to a speech synthesis request, text data and audio data are parsed from the speech synthesis request, and text features are extracted from the text data, and audio features of the target object are extracted from the audio data; the correlation between the text features and the audio features is captured using a multi-head attention mechanism to obtain a correlation matrix; the correlation matrix is divided into a first correlation matrix and a second correlation matrix, the first correlation matrix is subjected to a weight mapping linear transformation, the second correlation matrix is subjected to a spline interpolation linear transformation, and the result of the weight mapping linear transformation and the result of the spline interpolation linear transformation are fused to obtain a fused feature; based on the fused feature, a synthetic speech simulating the target object is generated, wherein the speech content of the synthetic speech is the text content in the text data. Through the above scheme, the problem of inaccurate speech synthesis in the prior art is solved.
[0010] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can be obtained based on these drawings without creative work.
[0012] Figure 1 is a flow chart of a speech synthesis method according to an embodiment of the present application;
[0013] Figure 2 is a flow chart of another speech synthesis method according to an embodiment of the present application;
[0014] Figure 3 is a flow chart of a method for capturing an association relationship between text features and audio features according to an embodiment of the present application;
[0015] Figure 4 is a flow chart of a KAN fusion method according to an embodiment of the present application;
[0016] Figure 5 is a structural schematic diagram of a speech synthesis device according to an embodiment of the present application;
[0017] Figure 6 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0018] Embodiments of the present embodiment will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present embodiment are shown in the accompanying drawings, it should be understood that the present embodiment can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein, which are instead provided for a more thorough and complete understanding of the present embodiment. It should be understood that the drawings and embodiments of the present embodiment are only for exemplary purposes and are not intended to limit the scope of protection of the present embodiment.
[0019] The present application embodiment provides a speech synthesis method, such as Figure 1 As shown, the method includes:
[0020] Step S102, in response to the speech synthesis request, parsing text data and audio data from the speech synthesis request, extracting text features from the text data, and extracting audio features of the target object from the audio data;
[0021] Step S104, using a multi-head attention mechanism to capture the correlation between the text features and the audio features, and obtain a correlation matrix;
[0022] For example, for each attention head, the similarity score matrix and value vector of the text feature and the audio feature are calculated, and an activation function is applied to the similarity score matrix to obtain an attention weight matrix; the value vector is weighted averaged using the attention weight matrix to obtain a weighted value vector; the weighted value vectors of each attention head are concatenated together to obtain the association relationship between the text feature and the audio feature.
[0023] The above scheme is beneficial to enhance multimodal fusion and improve the model's ability to understand complex information by capturing the relationship between text features and audio features. At the same time, the attention mechanism can dynamically allocate weights, allowing the model to focus on important features in the task, improving the accuracy and efficiency of information extraction.
[0024] Step S106, divide the association relationship matrix into a first association matrix and a second association matrix, perform a weight mapping linear transformation on the first association matrix, perform a spline interpolation linear transformation on the second association matrix, and fuse the result of the weight mapping linear transformation with the result of the spline interpolation linear transformation to obtain a fusion feature.
[0025] First, the first association matrix is subjected to the weight mapping linear transformation using a shared basis function and a first weight matrix to obtain the result of the weight mapping linear transformation. For example, based on the basis function parameters of the shared basis function, the shared basis function is applied to each element in the first association matrix to obtain the first characteristic matrix after the shared basis function transformation; the first characteristic matrix after the shared basis function transformation is transformed using a single variable continuous function to obtain a basis function output matrix; the basis function output matrix is subjected to the weight mapping linear transformation using the first weight matrix to obtain the result of the weight mapping linear transformation.
[0026] The above scheme can significantly improve the computational efficiency and simplify the computational process by using the shared basis function and the first weight matrix to perform a weight mapping linear transformation on the first correlation matrix. At the same time, by transforming the matrix elements through the basis function parameters, more feature information can be captured, the generalization ability of the model can be enhanced, and its performance on different data sets can be more robust.
[0027] Then, the second association matrix is subjected to the spline interpolation linear transformation using the spline interpolation function and the second weight matrix to obtain the result of the spline interpolation linear transformation. For example, the spline interpolation function is determined, and the spline interpolation function is applied to the second association matrix to obtain an interpolation function matrix; based on the interpolation function matrix and the second weight matrix, the second association matrix is subjected to the spline interpolation linear transformation to obtain the result of the spline interpolation linear transformation.
[0028] Finally, the result of the weight mapping linear transformation and the result of the spline interpolation linear transformation are fused to obtain a fused feature.
[0029] This solution can improve the accuracy and computational efficiency of data fitting by using the spline interpolation function and the second weight matrix to perform a linear transformation on the second correlation matrix. The spline interpolation function can better capture the nonlinear relationship in the data, thereby enhancing the model's adaptability to complex data patterns while maintaining computational simplicity.
[0030] Step S108: generating a synthesized speech simulating the target object based on the fusion features, wherein the speech content of the synthesized speech is the text content in the text data.
[0031] The present application embodiment provides another speech synthesis method, such as Figure 2 As shown, the method includes:
[0032] Step S202: extracting text features and audio features.
[0033] First, receive a speech synthesis request. The format of the speech synthesis request can include JSON, XML, or multipart / form-data. These formats allow text data and audio data to be passed in one speech synthesis request. Parse the speech synthesis request to extract the required data. If the speech synthesis request uses the JSON format, you can use the JSON parsing library to parse the speech synthesis request into structured data, and then extract the text data and audio data from it. For multipart form data, the audio data in the speech synthesis request is uploaded as a file, and the text data is provided as a field. In this case, using the multipart parsing library can effectively extract this data.
[0034] After extracting the data, the data needs to be verified and preprocessed. For text data, verify that its format is a string and that it cannot be empty. At the same time, the text data needs to be preprocessed, such as removing extra spaces, converting to lowercase, and removing punctuation. Audio data also needs to be preprocessed, including format conversion, sampling rate standardization, or denoising.
[0035] Finally, the audio data is encoded through the Hubert model (Hidden-Unit BERT) to obtain audio features. The text data is pre-trained and optimized through the Robert model (Robustly Optimized BERT Approach) to generate text features. In some embodiments, the text features and the audio features can also be feature encoded separately, and the text features and the audio features after feature encoding can be feature fused.
[0036] Step S204, capturing the correlation between text features and audio features.
[0037] This embodiment uses the Transformer's multi-head attention mechanism to capture the correlation between text features and audio features. Figure 3 As shown, the methods for capturing association relationships include:
[0038] Step S2042, calculate the value vector.
[0039] Perform linear transformation on the input text features and audio features, converting them into query vectors, key vectors, and value vectors respectively. The specific operation is to multiply the input text features and audio features with a set of learnable weight matrices to generate the corresponding query vectors, key vectors, and value vectors. In this way, the original features can be mapped to the new vector space for better calculation and modeling of feature relationships.
[0040] Step S2044, calculating the similarity score matrix.
[0041] For each attention head, the similarity between the query vector and the key vector is calculated. The similarity is calculated by a dot product operation, which multiplies the query vector with the key vector to obtain a similarity score matrix. In order to stabilize the gradient, the scores in the similarity score matrix are scaled. In this way, the similarity between the input text features and audio features can be measured.
[0042] Step S2046, calculate the attention weight matrix.
[0043] The calculated similarity score matrix is converted into an attention weight matrix through the softmax activation function. The softmax function converts the values in the similarity score matrix into a probability distribution so that the sum of all weights is 1, thereby highlighting important feature relationships. In this way, it can ensure that the model can focus on the most important features and ignore irrelevant information, thereby improving the learning effect and generalization ability of the model.
[0044] Step S2048, use the attention weight matrix to perform weighted averaging on the value vector.
[0045] Specifically, each value vector is multiplied by the corresponding attention weight, and then all value vectors are weighted summed to obtain a weighted value vector. In this way, important feature information can be emphasized according to the weights, and unimportant information can be suppressed, so that important features can be more prominently represented when multiple features are fused.
[0046] Step S2049, concatenate the weighted value vectors of each attention head together.
[0047] Each attention head processes different parts of the input data independently. By fusing these outputs, we can integrate information from multiple angles to obtain a more comprehensive feature relationship. In this way, by aggregating the outputs of multiple attention heads, we can capture different aspects of the input data and improve the expressiveness and accuracy of the model.
[0048] In order to prevent the model from overfitting, in some embodiments, a Dropout layer (discarding layer) can also be added after the multi-head attention mechanism. The Dropout layer randomly discards the input of some neurons, forcing the model not to rely on certain specific neurons during the training process, thereby enhancing the generalization ability of the model. This embodiment introduces randomness to prevent the model from overfitting the training data and improve the performance of the model when processing new data.
[0049] This embodiment uses Transformer and multi-head attention mechanism to effectively capture the relationship between text features and audio features and obtain the correlation matrix. In this way, the model can understand multimodal data more comprehensively, improve the effect of feature extraction and relationship modeling, and thus achieve higher detection accuracy and generalization ability in practical applications.
[0050] Step S206, performing KAN fusion.
[0051] In this embodiment, the KAN (Kolmogorov-Arnold Network) model is introduced to combine the weight mapping linear transformation and the spline interpolation linear transformation to generate a fusion feature.
[0052] like Figure 4 As shown, the KAN fusion method includes:
[0053] Step S2062, segmenting the association relationship matrix.
[0054] First, the correlation matrix obtained from the multi-head attention mechanism is divided into a first correlation matrix and a second correlation matrix. In this embodiment, the feature matrix is decomposed and different linear transformation processes can be performed respectively to better capture feature information.
[0055] Step S2064: weight mapping linear transformation.
[0056] In this embodiment, the first correlation matrix is linearly transformed using the shared basis function and the first weight matrix to extract important feature information. The weight mapping linear transformation method includes:
[0057] 1) Apply shared basis functions.
[0058] First, a shared basis function is applied to each element in the first incidence matrix. A shared basis function is a single variable continuous function that is used to capture different features of the input data. The shared basis function accepts the input element and its corresponding parameters and performs a nonlinear transformation on it. The use of shared basis functions can not only improve the expressiveness of the model, but also reduce the number of model parameters because the same basis function is shared by multiple input elements.
[0059] 2) Generate the first characteristic matrix.
[0060] After applying the shared basis function, the first feature matrix after the shared basis function transformation is obtained. This matrix contains the results of each element in the first correlation matrix after the shared basis function transformation. Through nonlinear transformation, the original input data is mapped to a new feature space, so that the subsequent linear transformation can more effectively extract important features. The generated first feature matrix retains the key information in the original input data and expresses it in a form that is more suitable for model processing.
[0061] 3) Weight mapping linear transformation.
[0062] The first feature matrix is transformed using a continuous function of a single variable. First, by calculating the result of the inner layer summation, each element in the first feature matrix is linearly combined with the corresponding basis function parameters. Then, the result of the inner layer summation is linearly transformed using a continuous function of a single variable to generate a basis function output matrix. This process can be understood as linearly projecting the first feature matrix and mapping it to a new feature space.
[0063] Finally, the first weight matrix is used to perform a weight mapping linear transformation on the generated basis function output matrix. Specifically, the basis function output matrix is combined with the first weight matrix, and a weight mapping linear transformation result is obtained through matrix operations. This embodiment further processes the features transformed by the shared basis function to extract more refined feature information. In this way, the features after nonlinear transformation are weighted and summed through linear transformation, thereby obtaining features that can better represent the input data.
[0064] In some embodiments, the linear change of the base weight may be performed based on the following formula:
[0065]
[0066] Among them, f(x) represents the result of the linear transformation of the weight mapping, W represents the first weight matrix, and n represents the element in the first correlation matrix, that is, x p , φ is the shared basis function, which accepts the input element x p and its parameter θ q,p , which share the same shared basis function φ on different q and p, but the parameters of the shared basis function θ q,p will vary depending on q and p. This sharing mechanism reduces the number of model parameters and increases the generalization ability of the model. q Represents a continuous function of a single variable, which is used to perform a linear transformation on the result of the inner summation. q represents the outer summation index, and p represents the component index of the input element.
[0067] In summary, by applying the shared basis function, generating the first feature matrix, and performing the weight mapping linear transformation, the first correlation matrix can be effectively extracted, which can not only capture the complex relationship in the input data, but also reduce the number of model parameters and enhance the generalization ability of the model.
[0068] Step S2066: spline interpolation linear transformation.
[0069] In this embodiment, the second correlation matrix is linearly transformed using a spline interpolation function to better capture the nonlinear characteristics of the input data. The specific process includes determining the spline interpolation function, applying the spline interpolation function to generate an interpolation function matrix, and performing a linear transformation based on the interpolation function matrix and the second weight matrix to generate a final spline interpolation linear transformation result.
[0070] 1) Determine the spline interpolation function.
[0071] Determine the spline interpolation function used for interpolation. Spline interpolation approximates the value of a function through a set of low-degree polynomials to generate a smooth interpolation curve. Specifically, you can choose B-spline or Cubic spline (cubic spline), and determine its related parameters, such as the number of knots and order.
[0072] 2) Apply the spline interpolation function.
[0073] First, generate an interpolation function matrix. The interpolation function matrix is obtained by interpolating each element of the second correlation matrix through the spline interpolation function, and contains the interpolation value of each data point under the spline interpolation function. After that, a linear transformation is performed. The interpolation function matrix is linearly combined with the second weight matrix. Specifically, each interpolation value in the interpolation function matrix is multiplied by the corresponding weight, and then the weighted sum is performed. Through the above steps, the spline interpolation linear transformation result matrix is obtained, which contains the feature information after the spline interpolation function and linear transformation, and can better represent the nonlinear features in the input data.
[0074] This embodiment can effectively extract features from the second correlation matrix by determining a spline interpolation function, applying the spline interpolation function to generate an interpolation function matrix, and performing a linear transformation based on the interpolation function matrix and the second weight matrix. This can not only capture the complex nonlinear relationship in the input data, but also improve the accuracy and stability of the model through reasonable parameter selection and weight setting.
[0075] Step S2068, feature fusion.
[0076] The linear transformation result of weight mapping and the linear transformation result of spline interpolation are fused. The fusion method can use weighted summation or splicing to combine the two transformation results to obtain the final fusion feature. In this way, the advantages of different features are combined to form a more comprehensive feature representation.
[0077] Step S208, synthesizing speech.
[0078] Based on the fusion features, a synthetic speech simulating the target object is generated, wherein the speech content of the synthetic speech is the text content in the text data.
[0079] The present application also provides a speech synthesis device, such as Figure 5As shown, it includes: an extraction module 52 is configured to respond to a speech synthesis request, parse text data and audio data from the speech synthesis request, and extract text features from the text data, and extract audio features of the target object from the audio data; an attention module 54 is configured to use a multi-head attention mechanism to capture the correlation between the text features and the audio features to obtain a correlation matrix; a fusion module 56 is configured to divide the correlation matrix into a first correlation matrix and a second correlation matrix, perform a weight mapping linear transformation on the first correlation matrix, perform a spline interpolation linear transformation on the second correlation matrix, and fuse the results of the weight mapping linear transformation and the results of the spline interpolation linear transformation to obtain a fusion feature; a synthesis module 58 is configured to generate a synthetic speech simulating the target object based on the fusion feature, wherein the speech content of the synthetic speech is the text content in the text data.
[0080] The speech synthesis device provided in the present application is only illustrated by the division of the above-mentioned functional modules. In practical applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the speech synthesis device provided in the above embodiment and the speech synthesis method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0081] Figure 6 FIG. 1 shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present disclosure. It should be noted that: Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0082] like Figure 6 As shown, the electronic device includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage part 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for system operation are also stored. The CPU 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0083] The following components are connected to the I / O interface 1005: an input section 1006 including a keyboard, a mouse, etc.; an output section 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN card, a modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1010 as needed, so that a computer program read therefrom is installed into the storage section 1008 as needed.
[0084] In particular, according to an embodiment of the present disclosure, the process described below with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1009, and / or installed from the removable medium 1011. When the computer program is executed by the central processing unit (CPU) 1001, various functions defined in the method and apparatus of the present application are executed. In some embodiments, the electronic device may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0085] It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0086] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0087] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, and the units described may also be arranged in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0088] As another aspect, the present application further provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device.
[0089] The computer-readable medium carries one or more programs, and when the one or more programs are executed by an electronic device, the electronic device implements the method described in the following embodiments. For example, the electronic device can implement each step of the method embodiment.
[0090] As another aspect, the present application further provides an electronic device, comprising: at least one processor; and a memory connected to the at least one processor in communication. The memory stores a computer program executable by the at least one processor, and the computer program is used to enable the electronic device to perform the method of the embodiment of the present application when executed by the at least one processor.
[0091] As another aspect, the present application further provides a computer program product, including a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to execute the method of the embodiment of the present application.
[0092] It should be noted that the term "including" and its variations used in the embodiments of the present application are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". The modifications of "one" and "multiple" mentioned in the embodiments of the present application are illustrative and not restrictive. Those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0093] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0094] The various steps described in the method implementation methods provided in the embodiments of the present application can be performed in different orders and / or in parallel. In addition, the method implementation methods may include additional steps and / or omit the steps shown. The scope of protection of the present application is not limited in this respect.
[0095] The term "embodiment" in this specification refers to specific features, structures or characteristics described in conjunction with the embodiment that can be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily mean the same embodiment, nor does it mean that it is mutually exclusive with other embodiments and is independent or optional. The various embodiments in this specification are described in a related manner, and the same or similar parts between the various embodiments refer to each other. In particular, for the device, equipment, and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts refer to the partial description of the method embodiment.
[0096] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of patent protection. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the scope of protection of the present application. Therefore, the scope of protection of the present application shall be subject to the attached claims.
Claims
1. A speech synthesis method, characterized in that: include: In response to a speech synthesis request, parsing text data and audio data from the speech synthesis request, extracting text features from the text data, and extracting audio features of a target object from the audio data; A multi-head attention mechanism is used to capture the correlation between the text features and the audio features, and obtain a correlation matrix; The association relationship matrix is divided into a first association matrix and a second association matrix, the first association matrix is subjected to a weight mapping linear transformation, the second association matrix is subjected to a spline interpolation linear transformation, and the result of the weight mapping linear transformation and the result of the spline interpolation linear transformation are fused to obtain a fusion feature; Based on the fusion features, generating a synthesized speech simulating the target object, wherein the speech content of the synthesized speech is the text content in the text data; Among them, performing a weight mapping linear transformation on the first association matrix and performing a spline interpolation linear transformation on the second association matrix includes: performing the weight mapping linear transformation on the first association matrix using a shared basis function and a first weight matrix to obtain a result of the weight mapping linear transformation; performing the spline interpolation linear transformation on the second association matrix using a spline interpolation function and a second weight matrix to obtain a result of the spline interpolation linear transformation; Among them, a multi-head attention mechanism is used to capture the correlation between the text features and the audio features, including: for each attention head, calculating the similarity score matrix and value vector of the text features and the audio features, and applying an activation function to the similarity score matrix to obtain an attention weight matrix, and then using the attention weight matrix to perform weighted averaging on the value vector to obtain a weighted value vector; the weighted value vectors of each attention head are spliced together to obtain the correlation between the text features and the audio features.
2. The method according to claim 1, characterized in that Performing the weight mapping linear transformation on the first association matrix using a shared basis function and a first weight matrix to obtain a result of the weight mapping linear transformation includes: Based on the basis function parameters of the shared basis function, applying the shared basis function to each element in the first incidence matrix to obtain a first characteristic matrix transformed by the shared basis function; Using a single variable continuous function, transforming the first characteristic matrix after the shared basis function transformation to obtain a basis function output matrix; The first weight matrix is used to perform the weight mapping linear transformation on the basis function output matrix to obtain a result of the weight mapping linear transformation.
3. The method according to claim 1, characterized in that The method of performing the spline interpolation linear transformation on the second correlation matrix by using the spline interpolation function and the second weight matrix to obtain the result of the spline interpolation linear transformation includes: Determine the spline interpolation function, and apply the spline interpolation function to the second incidence matrix to obtain an interpolation function matrix; Based on the interpolation function matrix and the second weight matrix, the spline interpolation linear transformation is performed on the second correlation matrix to obtain a result of the spline interpolation linear transformation.
4. The method according to claim 1, characterized in that Before using the multi-head attention mechanism to capture the correlation between the text features and the audio features, the method also includes: performing feature encoding processing on the text features and the audio features respectively, and performing feature fusion on the text features and the audio features after the feature encoding processing.
5. A speech synthesis device, characterized in that: include: An extraction module is configured to parse text data and audio data from the speech synthesis request in response to the speech synthesis request, and extract text features from the text data and extract audio features of a target object from the audio data; An attention module is configured to capture the correlation between the text features and the audio features using a multi-head attention mechanism to obtain a correlation matrix; a fusion module, configured to divide the association relationship matrix into a first association matrix and a second association matrix, perform a weight mapping linear transformation on the first association matrix, perform a spline interpolation linear transformation on the second association matrix, and fuse the result of the weight mapping linear transformation with the result of the spline interpolation linear transformation to obtain a fusion feature; A synthesis module is configured to generate a synthesized speech simulating the target object based on the fusion feature, wherein the speech content of the synthesized speech is the text content in the text data; The fusion module is further configured to: perform the weight mapping linear transformation on the first association matrix using a shared basis function and a first weight matrix to obtain a result of the weight mapping linear transformation; perform the spline interpolation linear transformation on the second association matrix using a spline interpolation function and a second weight matrix to obtain a result of the spline interpolation linear transformation; Among them, the attention module is also configured to: for each attention head, calculate the similarity score matrix and value vector of the text feature and the audio feature, and apply an activation function to the similarity score matrix to obtain an attention weight matrix, and then use the attention weight matrix to perform weighted averaging on the value vector to obtain a weighted value vector; splice the weighted value vectors of each attention head together to obtain the association relationship between the text feature and the audio feature.
6. An electronic device comprising: A processor and a memory storing a program, wherein the program comprises instructions, which, when executed by the processor, cause the processor to perform the method according to any one of claims 1 to 4.
7. A non-transitory machine-readable medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 4.
8. A computer program product, comprising a computer program, characterized in that The computer program is executed by the processor The steps of the method according to any one of claims 1 to 4 are implemented at the same time.
Citation Information
Patent Citations
Multi-modal emotion recognition method based on attention enhancing mechanism
CN112489635A
Polyphone pronunciation error correction method and device based on semantic attention mechanism
CN112908293A
