Speech emotion conversion method based on StarGAN emotion architecture
Through the speech generator, style encoder and discriminator of the StarGAN speech emotion architecture, combined with adversarial training and loss function optimization, the problems of emotional expression complexity and information loss in speech emotion conversion are solved, achieving high quality and naturalness. Speech emotion conversion promotes the development of human-computer interaction and emotional computing.
Patent Information
- Application Number
- CN202410660260.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-27
- Publication Date
- 2024-09-03
Smart Images

Figure FDA0004859329580000036 
Figure BDA0004859329590000054 
Figure BDA0004859329590000053
Abstract
Description
Technical Field
[0001] The present invention relates to a speech emotion conversion method based on StarGAN emotion architecture, and belongs to the technical field of deep learning and speech processing. Background Art
[0002] With the rapid development of artificial intelligence technology, the way of human-computer interaction is undergoing profound changes. In this change, the importance of emotional expression in voice as an intuitive and natural way of communication has attracted more and more attention. Voice emotion conversion technology aims to convert the emotion in the source voice into another emotion while keeping the voice content unchanged. This technology is of great significance for enhancing the intelligence level of human-computer interaction and improving user experience.
[0003] In the process of researching speech emotion conversion technology, we face multiple challenges. First, emotional expression is highly complex and diverse. Different people may use different speech features when expressing the same emotion, which brings great difficulties to emotion conversion. Secondly, speech itself contains rich acoustic features, such as pitch, volume, speaking speed, etc. These features need to be properly processed in the process of emotion conversion to ensure that the converted speech has the corresponding emotional expression while maintaining content consistency. Finally, speech emotion conversion involves the transmission and conversion of information. How to reduce information loss during the conversion process and maintain the clarity and intelligibility of speech is also an important problem we need to solve. Summary of the invention
[0004] In order to solve the above-mentioned technical problems, the present invention provides a speech emotion conversion method based on the StarGAN emotion architecture.
[0005] The object of the present invention is achieved through the following technical solutions:
[0006] A method for speech emotion conversion based on StarGAN emotion architecture, characterized by comprising the following steps:
[0007] Step 1: Build the SrarGAN speech emotion conversion model, which includes a speech generator, a speech style encoder, and a speech emotion discriminator.
[0008] The speech generator is built on an encoder-decoder architecture, where the encoder first converts input speech features into hidden representations, and then the decoder uses the hidden representations and the style code of the input emotion label to generate the converted speech;
[0009] The speech style encoder is used to capture the key characteristics of speech in a specific domain; its purpose is to ensure the difference between content samples generated by the generator between different style vectors. It analyzes the input speech and extracts emotional style features, thereby guiding the speech generator to generate a new speech emotional style;
[0010] The task of the speech emotion discriminator is to identify whether the speech is real and to determine which domain the speech emotion belongs to;
[0011] Step 2: Training of StarGAN speech emotion conversion model
[0012] 2.1: Perform speech feature extraction, perform feature extraction on the input sample, and obtain the feature set X;
[0013] 2.2: Initialize the StarGAN generator (G) and discriminator (D). The StarGAN generator can be parameterized as G(X,s), where X is the input feature sample set and s is the style vector. The StarGAN discriminator can be parameterized as D(·,y trg )→{0,1}, its goal is to distinguish whether the input sample belongs to the target domain y trg ;
[0014] 2.3: During the training process of the generator, the generator combines the input feature sample set X with the target domain label and creates a feature representation that the generator considers ideal under the target domain and converts it into an output sample;
[0015] 2.4: During the training of the discriminator, the generator is first provided with the feature sample X of the source domain and the style vector s of the target domain as input to obtain the generated target domain speech sample; the generated sample is used as the input of the discriminator D, and the discriminator will try to identify the domain to which the input sample belongs based on its feature vector;
[0016] 2.5: Implement an adversarial feedback loop to continuously iterate and train the generator and discriminator alternately. In each iteration, the generator is first used to generate speech samples, and the discriminator is used to identify them. After obtaining the loss value, the discriminator is updated. Secondly, the loss of the generator is calculated using the updated discriminator in the current round, and the generator is updated. The adversarial training process allows the generator and the discriminator to continuously improve their performance in competition until a dynamic balance point is reached, so that the performance of the generator is sufficient to meet the predetermined performance indicators.
[0017] Step 3: Extract features, set target style encoding, and use the model trained in step 2 to achieve speech style conversion;
[0018] Step 2.1: The speech feature extraction process is as follows:
[0019] Statistical Linear Prediction Coding Coefficients The calculation formula is:
[0020]
[0021] in, is the predicted value of the current sample, a i is the prediction coefficient, x(ni) is the past sample value, e(n) is the error term, and p is the model order;
[0022] The calculation formula of short-time energy E(m) is:
[0023]
[0024] Where E(m) represents the energy of the mth frame, x(m+n) represents the nth sample value of the mth frame, and N is the frame length;
[0025] The calculation formula of loudness characteristic L is:
[0026]
[0027] Where L is the loudness, I is the intensity of the sound, I0 is the reference intensity, and k is a constant.
[0028] The speech generator can perform directional speech style conversion and non-directional speech style conversion; among them, non-directional speech style conversion is to convert the speech sample of the specified source domain into the style of any other domain; directional speech style conversion is to convert the speech sample of the source domain into the style of the specified target domain;
[0029] The speech generator ensures the quality of the output samples by adversarial loss function; specifically, it includes the following two forms:
[0030] (1) In the non-directional speech style, the adversarial loss function is as follows:
[0031]
[0032] (2) In directional speech style transfer, the adversarial loss function is as follows:
[0033]
[0034] Among them, X is the feature set, Y is the label set, s is the style vector, and y src and trg They are represented as the source emotion domain and the target emotion domain, D(·,y trg ) indicates whether the input belongs to the target domain y trg , G(X,s) means accepting the input feature sample set X and style vector s to generate a new speech sample.
[0035] In the speech style encoder step, the following discriminant loss function is used to ensure that the generated speech is as close to the real emotion as possible in terms of emotional expression, so as to improve the quality and naturalness of the generated speech.
[0036] The specific discriminant loss function is as follows:
[0037]
[0038] Where KL(·) is the divergence loss function, F i is the alternative model, and n is the number of alternative models.
[0039] The purpose of the speech emotion discriminator is to compare the actual category distribution with the category distribution of the samples generated by the generator G, and evaluate the performance of the generator G based on the degree of proximity between the two;
[0040] The speech emotion discriminator uses the source classifier loss function to improve the recognition of different categories in the source domain. Its main function is to ensure that the generator can keep the main content of the speech as much as possible during the generator training process when converting the speech emotion. The source classifier loss function is as follows:
[0041]
[0042] Where KL(·) is the divergence loss function, F i is the alternative model, and n is the number of alternative models.
[0043] During the training process of the discriminator, the source classifier loss function is adopted through back propagation. and Perform parameter optimization to update the weights of the discriminator D; where, The calculation formula is as follows:
[0044]
[0045] The calculation formula is as follows:
[0046]
[0047] Where KL(·) is the divergence loss function, F i is the alternative model, and n is the number of alternative models.
[0048] The specific implementation process of step 3 is as follows:
[0049] First, perform speech feature extraction on the input speech sample to form a feature set X′ and specify the target domain style vector s. Specifically, the speech features are quantized into characteristic values such as statistical linear prediction coding coefficients, short-time energy, and loudness.
[0050] Secondly, the extracted feature set X′ and the style vector s of the target emotional domain are input into the trained generator G. The generator G will perform prediction based on the input feature sample set X′ and the target style vector s to create an output in the target emotional domain, namely G(X′,s), thereby obtaining an output sample that converts the input source domain speech sample into the target emotional domain.
[0051] Beneficial effects of the present invention: The present invention generates different methods for different emotional speech by designing the StarGAN loss function, aiming to solve the problems of unsmoothness and unnaturalness in emotional speech generation. The method of the present invention fully draws on the core idea of StarGAN, and makes corresponding improvements and optimizations based on the characteristics of speech emotion conversion. It enriches the technical means in the field of speech emotion conversion and provides new ideas and methods for future research on human-computer interaction, emotional computing, etc. This technology can promote the further development of speech emotion conversion technology and make important contributions to building a more intelligent and natural human-computer interaction system. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 It is a network structure diagram of StarGAN of the present invention. DETAILED DESCRIPTION
[0053] The present invention provides a speech emotion conversion method based on the StarGAN emotion architecture; specifically, it includes the following aspects:
[0054] 1. Design of SrarGAN speech emotion conversion model
[0055] In order to achieve speech conversion between different emotional states, the network architecture is designed and adapted to the characteristics of speech, and style coding is added to extract style codes. This makes the movement of feature space boundaries more targeted and the generated samples more realistic. This network mainly consists of a speech generator, a speech style encoder, and a speech emotion discriminator. The network structure of StarGAN is shown in the figure. Figure 1 shown.
[0056] (1) The speech generator is built on an encoder-decoder architecture. The encoder first converts the input speech features into a hidden representation, and the decoder then uses the hidden representation and the input emotion label's style code to generate the converted speech. The generator can perform directional speech style transfer and non-directional speech style transfer, where non-directional speech style transfer can convert speech samples from a specified source domain into the style of any other domain; directional speech style transfer refers to converting speech samples from the source domain into the style of a specified target domain. Generator loss function: This paper uses an adversarial loss function to ensure the quality of the output samples. In non-directional speech style transfer, the adversarial loss function is as follows:
[0057]
[0058] In directional speech style transfer, the adversarial loss function is as follows:
[0059]
[0060] Among them, X is the feature set, Y is the label set, s is the style vector, and y src and trg They are represented as the source emotion domain and the target emotion domain, D(·,y trg ) indicates whether the input belongs to the target domain y trg , G(X,s) means accepting the input feature sample set X and style vector s to generate a new speech sample.
[0061] (2) The speech style encoder is specially designed to capture the key characteristics of speech in a specific domain. Its purpose is to ensure the difference between content samples generated by the generator G between different style vectors. It analyzes the input speech and extracts emotional style features, which can then be used to guide the generator to generate new speech emotional styles. Discriminator loss function. The specific loss function is as follows:
[0062]
[0063] Where KL(·) is the divergence loss function, F i is the alternative model, and n is the number of alternative models.
[0064] (3) The task of the speech emotion discriminator is to identify whether the speech is real and to determine which domain the speech emotion belongs to. Its purpose is to compare the actual category distribution with the category distribution of the samples generated by the generator G, and to evaluate the performance of the generator G based on the degree of closeness between the two. The speech emotion discriminator improves the recognition of different categories in the source domain through the following source classifier loss function. The source classifier loss function is as follows:
[0065]
[0066] Where KL(·) is the divergence loss function, F i is the alternative model, and n is the number of alternative models.
[0067] 2. Training of StarGAN speech emotion conversion model
[0068] 2.1: Perform speech feature extraction, perform feature extraction on the input sample, and obtain the feature set X. The three features extracted and the corresponding formulas are as follows:
[0069] (1) Statistical linear prediction coding coefficients The calculation formula is:
[0070]
[0071] in, is the predicted value of the current sample, a i is the prediction coefficient, x(ni) is the past sample value, e(n) is the error term, and p is the model order.
[0072] (2) Short-time energy: The calculation formula of short-time energy E(m) is:
[0073]
[0074] Wherein, E(m) represents the energy of the m-th frame, x(m+n) represents the n-th sample value of the m-th frame, and N is the frame length.
[0075] (3) Loudness: The calculation formula of the loudness characteristic L is:
[0076]
[0077] Where L is the loudness, I is the intensity of the sound, I0 is the reference intensity, and k is a constant.
[0078] 2.2: Initialize the StarGAN generator (G) and discriminator (D). The StarGAN generator can be parameterized as G(X,s), where X is the input feature sample set and s is the style vector. The StarGAN discriminator can be parameterized as D(·,y trg )→{0,1}, its goal is to distinguish whether the input sample belongs to the target domain y trg .
[0079] 2.3: During the training process of the generator, the generator combines the input feature sample set X with the target domain label and creates a feature representation that the generator considers ideal under the target domain, which is converted into an output sample. The goal of the generator is to generate speech samples that are sufficient to confuse the discriminator. Therefore, its output is fed to the discriminator, and according to the feedback of the discriminator, the adversarial loss function is used Update the parameter weights of the generator. Among them, the adversarial loss function for non-directional speech style conversion is:
[0080]
[0081] Adversarial loss function for directional speech style transfer:
[0082]
[0083] Among them, X is the feature set, Y is the label set, s is the style vector, and ysrc and trg They are represented as the source emotion domain and the target emotion domain, D(·,y trg ) indicates whether the input belongs to the target domain y trg , G(X,s) means accepting the input feature sample set X and style vector s to generate a new speech sample.
[0084] 2.4: In the training process of the discriminator, the generator is first provided with the feature sample X of the source domain and the style vector s of the target domain as input to obtain the generated target domain speech sample. The generated sample is used as the input of the discriminator D, and the discriminator will try to identify the domain to which the input sample belongs based on its feature vector. And through back propagation, the source classifier loss function is used and Perform parameter optimization to update the weights of the discriminator D. The calculation formula is as follows:
[0085]
[0086] The calculation formula is as follows:
[0087]
[0088] Where KL(·) is the divergence loss function, F i is the alternative model, and n is the number of alternative models.
[0089] 2.5: Implement an adversarial feedback loop to continuously iterate and train the generator and discriminator alternately. In each iteration, the generator is first used to generate speech samples, and the discriminator is used to identify them. After obtaining the loss value, the discriminator is updated. Secondly, the loss of the generator is calculated using the updated discriminator in the current round, and the generator is updated. The adversarial training process allows the generator and the discriminator to continuously improve their performance in competition until a dynamic balance point is reached, so that the performance of the generator is sufficient to meet the predetermined performance indicators.
[0090] 3. The method of the present invention is used to realize speech emotion conversion, which specifically includes extracting features, setting target style coding, and using the trained model to perform speech style conversion. First, speech feature extraction is performed on the input speech sample to form a feature set X', and the target domain style vector s is specified. The speech features can be quantified into characteristic values such as statistical linear prediction coding coefficients, short-term energy, and loudness.
[0091] Secondly, the extracted feature set X′ and the style vector s of the target emotional domain are input into the trained generator G. The generator G will perform prediction based on the input feature sample set X′ and the target style vector s to create an output in the target emotional domain, namely G(X′,s), thereby obtaining an output sample that converts the input source domain speech sample into the target emotional domain.
Claims
1. A speech emotion conversion method based on StarGAN emotion architecture, characterized in that: The steps include: Step 1: Build the SrarGAN speech emotion conversion model, which includes a speech generator, a speech style encoder, and a speech emotion discriminator. The speech generator is built on an encoder-decoder architecture, where the encoder first converts input speech features into hidden representations, and then the decoder uses the hidden representations and the style code of the input emotion label to generate the converted speech; The speech style encoder is used to capture key characteristics of speech in a specific domain; Its purpose is to ensure the difference between content samples generated by the generator between different style vectors. It analyzes the input speech and extracts emotional style features, thereby guiding the speech generator to generate new speech emotional styles. The task of the speech emotion discriminator is to identify whether the speech is real and to determine which domain the speech emotion belongs to; Step 2: Training of StarGAN speech emotion conversion model 2.1: Perform speech feature extraction, extract features from the input sample, and obtain the feature set X; 2.2: Initialize the StarGAN generator (G) and discriminator (D); the StarGAN generator can be parameterized as G(X,s), where X is the input feature sample set and s is the style vector. The StarGAN discriminator can be parameterized as D(·,y trg )→{0,1}, its goal is to distinguish whether the input sample belongs to the target domain y trg ; 2.3: During the training process of the generator, the generator combines the input feature sample set X with the target domain label and creates a feature representation that the generator considers ideal under the target domain and converts it into an output sample; 2.4: During the training of the discriminator, the generator is first provided with the feature sample X of the source domain and the style vector s of the target domain as input to obtain the generated target domain speech sample; the generated sample is used as the input of the discriminator D, and the discriminator will try to identify the domain to which the input sample belongs based on its feature vector; 2.5: Implement an adversarial feedback loop to continuously iterate and train the generator and discriminator alternately. In each iteration, the generator is first used to generate speech samples, and the discriminator is used to identify them. After obtaining the loss value, the discriminator is updated. Secondly, the loss of the generator is calculated using the updated discriminator in the current round, and the generator is updated. The adversarial training process allows the generator and the discriminator to continuously improve their performance in competition until a dynamic balance point is reached, so that the performance of the generator is sufficient to meet the predetermined performance indicators; Step 3: Extract features, set target style encoding, and use the model trained in step 2 to achieve speech style conversion.
2. A method for speech emotion conversion based on StarGAN emotion architecture according to claim 1, characterized in that: The step 2.1: performing speech feature and extraction process is as follows: Statistical Linear Prediction Coding Coefficients The calculation formula is: in, is the predicted value of the current sample, a i is the prediction coefficient, x(ni) is the past sample value, e(n) is the error term, and p is the model order; The calculation formula of short-time energy E(m) is: Where E(m) represents the energy of the mth frame, x(m+n) represents the nth sample value of the mth frame, and N is the frame length; The calculation formula of loudness characteristic L is: Where L is the loudness, I is the intensity of the sound, I0 is the reference intensity, and k is a constant.
3. A method for speech emotion conversion based on StarGAN emotion architecture according to claim 1, characterized in that: The speech generator can perform directional speech style conversion and non-directional speech style conversion; wherein the non-directional speech style conversion is to convert a speech sample of a specified source domain into the style of any other domain; the directional speech style conversion is to convert a speech sample of a source domain into the style of a specified target domain; The speech generator ensures the quality of the output samples by adversarial loss function; specifically, it includes the following two forms: (1) In the non-directional speech style, the adversarial loss function is as follows: (2) In directional speech style transfer, the adversarial loss function is as follows: Among them, X is the feature set, Y is the label set, s is the style vector, and y src and trg They are represented as the source emotion domain and the target emotion domain, D(·,y trg ) indicates whether the input belongs to the target domain y trg , G(X,s) means accepting the input feature sample set X and style vector s to generate a new speech sample.
4. A method for speech emotion conversion based on StarGAN emotion architecture according to claim 1, characterized in that: In the speech style encoder step, the following discriminant loss function is used to ensure that the generated speech is as close to the real emotion as possible in terms of emotional expression, so as to improve the quality and naturalness of the generated speech; The specific discriminant loss function is as follows: Where KL(·) is the divergence loss function, F i is the alternative model, and n is the number of alternative models.
5. A method for speech emotion conversion based on StarGAN emotion architecture according to claim 1, characterized in that: The purpose of the speech emotion discriminator is to compare the actual category distribution with the category distribution of the samples generated by the generator G, and evaluate the performance of the generator G based on the degree of proximity between the two; The source classifier loss function is used in the speech emotion discriminator to improve the recognition of different categories in the source domain, ensuring that the generator can keep the main content of the speech as much as possible during the process of converting speech emotions; the source classifier loss function is as follows: Where KL(·) is the divergence loss function, F i is the alternative model, and n is the number of alternative models.
6. A method for speech emotion conversion based on StarGAN emotion architecture according to claim 1, characterized in that: During the training process of the discriminator, the source classifier loss function is adopted through back propagation. and Perform parameter optimization to update the weights of the discriminator D; where, The calculation formula is as follows: The calculation formula is as follows: Where KL(·) is the divergence loss function, F i is the alternative model, and n is the number of alternative models.
7. A method for speech emotion conversion based on StarGAN emotion architecture according to claim 1, characterized in that: The specific implementation process of step 3 is as follows: First, perform speech feature extraction on the input speech sample to form a feature set X′ and specify the target domain style vector s. Specifically, the speech features are quantized into characteristic values such as statistical linear prediction coding coefficients, short-time energy, and loudness. Secondly, the extracted feature set X′ and the style vector s of the target emotional domain are input into the trained generator G. The generator G will perform prediction based on the input feature sample set X′ and the target style vector s to create an output in the target emotional domain, namely G(X′,s), thereby obtaining an output sample that converts the input source domain speech sample into the target emotional domain.
