A method for generating real-time adversarial samples of a phoneme template and a computer readable medium
By using a real-time adversarial example generation method based on phoneme templates, the problems of real-time performance, universality, and compression resistance in network voice calls are solved. The method generates adversarial examples that can be transferred between different ASR models and are compression resistant, thus achieving effective protection of call privacy.
Patent Information
- Application Number
- CN202311466244.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-02
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-11-02
AI Technical Summary
Existing adversarial example generation techniques cannot simultaneously satisfy real-time performance, universality, and compression resistance in online voice calls, and therefore cannot effectively protect call privacy.
A real-time adversarial example generation method using phoneme templates is proposed. Through Mel filter bank feature extraction, random forest classifier training, and differential evolution algorithm optimization, adversarial examples that can be transferred between different ASR models and are resistant to compression are generated.
It enables the real-time generation of general, compression-resistant adversarial examples, which can effectively protect users' call privacy and security, and enhance the attack capability of adversarial examples and the privacy protection of voice calls.
Smart Images

Figure CN117672260B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital media processing technology, and in particular to a method for generating adversarial samples of phoneme templates in real time and a computer-readable medium. Background Technology
[0002] Internet voice calls have become an important means of social communication. However, given the widespread eavesdropping on current internet communications, any voice call carries the risk of privacy breaches, making privacy protection during calls an urgent priority. The primary method for large-scale call eavesdropping is to use Automatic Speech Recognition (ASR) systems to convert speech into text. Therefore, ASR adversarial example generation technology is a feasible means of protecting voice privacy.
[0003] Traditional adversarial example generation techniques mainly include: deep learning network-based adversarial example generation and speech signal processing-based adversarial example generation. The idea behind deep learning network-based adversarial example generation is to obtain the gradient information of the target ASR model and use this gradient information to generate perturbations to influence the decision space of the template ASR model. Based on the method of obtaining the target model's gradient, it can be classified as direct attack and indirect attack. A direct attack means the target ASR model is white-box to the attacker, who can directly obtain the gradient information to generate adversarial examples. An indirect attack means the attacker cannot obtain any information about the target ASR model and can only continuously access and query the target ASR model through gradient estimation methods to generate effective adversarial examples. Speech signal processing-based adversarial example generation techniques exploit the differences between the human auditory system (HAP) and the feature extraction algorithms of the ASR model. They use speech signal processing techniques to modify the original audio, forcing the ASR model to misidentify speech, while the HAP can correctly identify the speech content.
[0004] When applying existing adversarial example generation techniques to protect privacy in online voice calls, the applicant of this invention has found that the existing methods have at least the following technical problems:
[0005] VoIP calls are real-time, which requires that the latency of generating adversarial examples cannot exceed the call latency; the adversarial ASR system is unknown during the call, which requires that the adversarial examples be universal; the voice signal is compressed during network transmission, which requires that the adversarial examples be compression resistant.
[0006] However, existing adversarial example generation techniques cannot simultaneously address the three problems in network voice call scenarios. To address these issues, this invention proposes a real-time, compression-resistant adversarial example generation technique based on phoneme templates. This invention not only generates adversarial examples in real time, but also allows these generated adversarial examples to be used across different ASR models. Furthermore, the adversarial examples generated by this invention remain effective against ASR models even after compression using common compression algorithms. Summary of the Invention
[0007] To address the problems of existing technologies, this invention proposes a method for generating adversarial examples of phoneme templates in real time and a computer-readable medium.
[0008] The technical solution of this invention is a method for real-time adversarial example generation of phoneme templates, characterized in that:
[0009] The sliding window amplitude spectrum of each frame of each WAV audio signal is extracted using a Mel filter bank to obtain the Mel features of the sliding window amplitude spectrum of each frame of each WAV audio signal, and the true phoneme labels of the sliding window amplitude spectrum of each frame of each WAV audio signal are labeled.
[0010] A random forest classifier trains multiple decision tree classifiers, and the trained random forest classifier is constructed from the multiple decision tree classifiers.
[0011] The trained single-frame phoneme recognizer is used for classification and recognition to obtain the predicted phoneme labels of the sliding window amplitude spectrum of each frame of each speech training sample in the speech training set and the predicted phoneme labels of the sliding window amplitude spectrum of each frame of each speech test sample in the speech test set.
[0012] In the energy spectrum of each audio signal of each speaker, the same sub-bands are filtered, accumulated, and averaged to obtain the energy of each sub-band of each speaker. The energy of each sub-band of multiple speakers is averaged to obtain the energy mean of each sub-band. The b-variance test value of each sub-band is then calculated.
[0013] An adversarial sample set is generated and the word error rate and signal-to-noise ratio are calculated respectively. The optimization objectives are to maximize the word error rate and maximize the signal-to-noise ratio. The threshold of each phoneme label is used as the optimization solution object and the differential evolution algorithm is used to optimize and solve the problem. The optimized threshold of each phoneme label is obtained. The optimal phoneme template is constructed by using the optimized thresholds of all phoneme labels.
[0014] The specific implementation steps of this invention are as follows:
[0015] Step 1: Acquire multiple WAV audio signals, and perform short-time Fourier transform on each WAV audio signal sequentially to obtain the multi-frame sliding window amplitude spectrum and multi-frame sliding window phase spectrum of each WAV audio signal; extract the features of each frame sliding window amplitude spectrum of each WAV audio signal through a Mel filter bank to obtain the Mel features of each frame sliding window amplitude spectrum of each WAV audio signal, and label the true phoneme labels of each frame sliding window amplitude spectrum of each WAV audio signal.
[0016] Step 2: Construct a random forest classifier. Input the Mel features of all sliding window amplitude spectra of all WAV audio signals and the true phoneme labels of all sliding window amplitude spectra of all WAV audio signals as training sets into the random forest classifier. The random forest classifier trains multiple decision tree classifiers, and the trained random forest classifier is constructed from the multiple decision tree classifiers.
[0017] Step 3: Acquire multiple speech audio signals and divide them into a speech training set and a speech test set. Process each speech training sample in the speech training set and each test sample in the speech test set sequentially through Step 1 to obtain the sliding window amplitude spectrum, sliding window phase spectrum, and Mel features of each frame of the sliding window amplitude spectrum for each speech training sample in the speech training set, and the sliding window amplitude spectrum, sliding window phase spectrum, and Mel features of each frame of the sliding window amplitude spectrum for each speech test sample in the speech test set. Input the Mel features of each frame of the sliding window amplitude spectrum for each speech training sample in the speech training set and the sliding window amplitude spectrum for each speech test sample in the speech test set into the trained single-frame phoneme recognizer for classification and recognition to obtain the predicted phoneme labels of each frame of the sliding window amplitude spectrum for each speech training sample in the speech training set and the predicted phoneme labels of each frame of the sliding window amplitude spectrum for each speech test sample in the speech test set.
[0018] Step 4: Acquire multiple audio signals from multiple speakers. Perform a short-time Fourier transform on each audio signal from each speaker to obtain a multi-frame sliding window amplitude spectrum for each audio signal from each speaker. Further convert the amplitude spectrum of each frame sliding window of each audio signal from each speaker to obtain the energy spectrum of each frame sliding window of each audio signal from each speaker. Filter the same sub-frequency bands in the multi-frame sliding window energy spectrum of each audio signal from each speaker to obtain the energy of the same sub-frequency band in each frame sliding window of each audio signal from each speaker. Accumulate the energy of the same sub-frequency bands in the multi-frame sliding window of each audio signal from each speaker to obtain the energy of each sub-frequency band of each audio signal from each speaker. Calculate the mean of the energy of each sub-frequency band of multiple audio signals from each speaker to obtain the energy mean of each sub-frequency band. Further calculate the b-variance test value of each sub-frequency band.
[0019] Step 5: Construct thresholds by combining the sliding window amplitude spectrum, sliding window phase spectrum, predicted phoneme label, and threshold of each phoneme label for each frame of the sliding window amplitude spectrum of each speech training sample in the speech training set, the sliding window amplitude spectrum, predicted phoneme label, sliding window phase spectrum, and the semantic content feature cluster obtained in Step 4 to generate an adversarial sample set and calculate the word error rate and signal-to-noise ratio respectively. Taking the maximization of word error rate and the maximization of signal-to-noise ratio as optimization objectives, the threshold of each phoneme label is used as the optimization solution object and the differential evolution algorithm is used to optimize and solve it to obtain the optimized threshold of each phoneme label. The optimal phoneme template is constructed by using the optimized thresholds of all phoneme labels.
[0020] Preferably, the random forest classifier in step 2 trains multiple decision tree classifiers, as follows:
[0021] During training, each decision tree randomly draws samples from the training set using a method with replacement, randomly selects a portion of the Mel features from all sliding window amplitude spectra of all WAV audio signals as input features, uses the CART algorithm for feature selection, and uses the selected features as tree nodes.
[0022] Each tree node represents any one of the Mel features of the sliding window amplitude spectrum of all WAV audio signals; during classification, binary tree classification is performed according to the tree nodes; all sliding window amplitude spectra of all WAV audio signals that belong to the feature represented by the tree node are in one class, and all sliding window amplitude spectra of all WAV audio signals that do not belong to the feature represented by the tree node are in another class.
[0023] Calculate the Gini coefficients corresponding to the Mel features of all sliding window amplitude spectra of all WAV audio signals. Then, using a greedy algorithm, select the Mel feature with the smallest Gini coefficient as the feature for the current decision tree node split. The formula for calculating the Gini coefficient is as follows:
[0024]
[0025] Among them, P size f represents the total number of actual phoneme tags in step 1. a This indicates the probability of phoneme label 'a' appearing in the classification result after using the current feature for classification.
[0026] When using the random forest classifier, each decision tree classifier will output its result, and the result with the highest probability will be selected as the final result of the random forest classifier.
[0027] Preferably, step 4, which involves calculating the variance test value of the k-th sub-band, is as follows:
[0028]
[0029] Where k is in the range of 1≤k≤B size B size Indicates the total number of sub-bands; f b,c,k f represents the energy of the k-th sub-band of the c-th audio signal from the b-th speaker. b,k f represents the energy of the k-th sub-band of the b-th speaker. k Value represents the average energy of the k-th sub-band. k Value represents the variance test value of the energy of the k-th sub-band, M represents the number of speakers, and N represents the number of audio signals per speaker; k The lower the value, the more clustered the semantic content features of that sub-band; ultimately, the Value is selected. k Sub-bands with values below a certain threshold form a set of frequency bands, which is called a semantic content feature clustering frequency band group.
[0030] Preferably, the construction threshold in step 5 is:
[0031] For each phoneme tag, a value is randomly initialized, called the threshold;
[0032] Step 5, generating the adversarial example set, is as follows:
[0033] For each speech training sample in the speech training set obtained in step 3, firstly, inverse STFT transformation is performed by combining the sliding window amplitude spectrum and the sliding window phase spectrum of each frame of each speech training sample in the speech training set to obtain the original speech audio signal of each speech training sample in the speech training set.
[0034] Traverse the sliding window amplitude spectrum of each frame of each speech training sample in the speech training set; for the phoneme label of the sliding window amplitude spectrum of each frame of each speech training sample in the speech training set, determine the relationship between the value in the sliding window amplitude spectrum of each frame of each speech training sample in the speech training set and the threshold of the corresponding phoneme label in the phoneme template within the frequency band group obtained in step 4. If the value is less than the threshold, set it to 0; if it is greater than the threshold, do not process it. After processing in the above manner, a new sliding window amplitude spectrum of each frame of each speech training sample in the speech training set is obtained; perform inverse STFT transform on the new sliding window amplitude spectrum of each frame of each speech training sample in the speech training set and the corresponding sliding window phase spectrum of each frame of each speech training sample in the speech training set to obtain a new speech audio signal of each speech training sample in the speech training set. The new speech audio signal is called an adversarial sample, and the set of all new speech audio signals is called the adversarial sample set.
[0035] Step 5, which involves calculating the word error rate, is detailed below:
[0036] The original audio signal of each speech training sample in the speech training set and the content of each adversarial sample in the adversarial sample set are identified by the speech recognition algorithm to obtain the corresponding content text; the content text of the original audio signal of each speech training sample in the speech training set is used as the reference text, and the content text of each adversarial sample in the adversarial sample set is used as the generated text.
[0037] Calculate the word error rate of the l-th speech training sample in the speech training set:
[0038]
[0039] Where the range of l is 1≤l≤A size A size S represents the total number of speech training samples; l M represents the number of different words that were replaced with in the generated text from the reference text, and M represents the number of words that were deleted from the generated text from the reference text. l Z represents the number of extra words inserted after comparing the generated text with the reference text. l This indicates the total number of words in the reference text.
[0040] Step 5, calculating the signal-to-noise ratio, is as follows:
[0041] For each speech training sample in the speech training set obtained in step 3, the original speech audio signal and the adversarial sample of each speech training sample in the speech training set are obtained; the signal-to-noise ratio of each speech training sample in the speech training set is calculated by taking each sampling point of the original speech audio signal and each sampling point of the adversarial sample of each speech training sample in the speech training set as input.
[0042] Calculate the signal-to-noise ratio of the l-th speech training sample in the speech training set:
[0043]
[0044] Where the range of l is 1≤l≤A size E l,d E′ is the d-th sampling point of the l-th speech training sample in the speech training set. l,d A is the d-th sampling point of the l-th adversarial example in the speech training set. l It is the total number of sampling points for the l-th speech training sample in the speech training set;
[0045] The word error rate is defined as WER;
[0046] The signal-to-noise ratio is defined as SNR.
[0047] Step 5 involves optimizing the solution using the differential evolution algorithm, as detailed below:
[0048] Step 5.1: Initialize the DE algorithm parameters of the established phoneme template model.
[0049] Step 5.2: Generate an initial population based on the phoneme template model. Each individual in the population represents a phoneme template.
[0050] Step 5.3: Perform a mutation operation on each original individual in the population to obtain mutated individuals.
[0051] Step 5.4: Perform a crossover operation on each original individual and its corresponding mutated individual in the population to obtain the crossover individuals.
[0052] Step 5.5: Using each cross individual, i.e., the phoneme template, combined with the predicted phoneme labels of each frame of the sliding window amplitude spectrum, each frame of the sliding window phase spectrum, and each frame of the sliding window amplitude spectrum of each speech training sample obtained in Step 3, generate an adversarial example set according to the aforementioned method and calculate the WER and SNR of each speech training sample in the speech training set. Add the WER and SNR of each speech training sample in the speech training set and take the average to obtain the individual's WER and SNR.
[0053] Step 5.6: Based on the WER and SNR of each individual, use the Pareto optimization strategy to generate a new generation of population.
[0054] Step 5.7: Check if the maximum number of iterations has been reached. If the condition is met, output the optimal solution, which is the current optimal solution of the population at the time of iteration termination; if the maximum number of iterations has not been reached, go to step 5.3.
[0055] Preferably, the phoneme template model established in step 5.1 is as follows:
[0056] Based on the total number P of real phoneme tags in step 1 size The number of frequency band groups F in step 4 size Minimum value of threshold Maximum threshold Create a phoneme template: I t , where t represents the current iteration number. The i-th individual in the population is denoted as I. t,i I t,i It is a dimension with F rows size P, the number of columns size The matrix, where each value represents a threshold, has a range of... I t,i,j Let I be the vector containing the phoneme label j in the phoneme template with population index i in t iterations. Each frequency band in the band group corresponds to a threshold; therefore, I... t,i,j The dimension is 1*F size .
[0057] Step 5.1 involves initializing the DE algorithm parameters:
[0058] The population size is N, the maximum number of iterations is T, the scaling factor is F, and the crossover probability is CR.
[0059] As a preferred option, step 5.2, which initializes the phoneme vector of the i-th individual in the population with phoneme label j, is as follows:
[0060]
[0061] Here, rand(·) represents a function that generates random numbers;
[0062] Preferably, step 5.3, in the t-th iteration, performs a mutation operation on the phoneme vector of the i-th individual in the population with phoneme label j, specifically as follows:
[0063]
[0064] {(i, j)|i=1, 2, 3...N; j=1, 2...P size}
[0065] Here, r1, r2, and r3 represent distinct individuals randomly selected from the current population. They satisfy r1≠r2≠r3≠i, meaning the total population size must satisfy N≥4. F is the scaling factor. All phoneme vectors in the individual I matrix will be randomly modified during the mutation operation, ultimately generating mutated individuals.
[0066] Preferably, in step 5.4, the crossover operation performed on the phoneme vector with phoneme label j for the i-th individual in the population during the t-th iteration is as follows:
[0067]
[0068] Among them, I t,i,j v represents the original phoneme vector with phoneme label j for the i-th individual in the population during the t-th iteration; t+1,i,j u represents the mutated phoneme vector of the i-th individual in the population with phoneme label j in the t-th iteration. t+1,ij Let represent the new phoneme vector with phoneme label j for the i-th individual in the population during the t-th iteration. Crossover is performed on a per-phoneme-vector basis. When the crossover condition is met, the new individual replaces the original individual's phoneme vector with the j-th phoneme vector from the mutated individuals; this is called crossover. CR is the crossover probability; a larger CR indicates a higher likelihood of replacement. rand Represents {1, 2, 3, ..., P} size The random integer in} serves to ensure that at least one phoneme vector in the new individual comes from mutation during the crossover process.
[0069] Step 5.5, which calculates WER and SNR for each individual in the population, is as follows:
[0070] Following the steps described above for calculating WER and SNR, calculate the WER and SNR of each speech training sample in the speech training set, add up the WER and SNR of each speech training sample in the speech training set and calculate the average to obtain the individual's WER and SNR.
[0071] The specific optimization process in step 5.6 is as follows:
[0072] For each new individual, the WER and SNR are denoted as the solution R′ = {WER, SNR}. In the Pareto optimization policy, when R1 WER ≥R2 WER andR1 SNR ≥R2 SNRWhen R1 dominates R2, it is called R1 dominating R2. The process involves determining whether the solution R′ of the new individual dominates the solution R of the original individual. If domination occurs, the new individual replaces the original individual and adds it to the new generation. If domination does not occur, the diversity between the original and new individuals is compared, and the individual with higher diversity is selected to join the new generation. Diversity is evaluated using the sum of the Euclidean distances between the individual and all individuals in the Pareto front solution. The Pareto front solution is the solution consisting of all non-dominant individuals in each generation. Calculating individual diversity involves calculating the Euclidean distances between all thresholds in the individual and the corresponding thresholds in each Pareto front solution, summing the results, and a larger sum indicates stronger individual diversity. After evaluation, a new generation of the population and a new generation of Pareto front solutions are generated.
[0073] After step 5.7 reaches the maximum number of iterations, the final Pareto front solution becomes the candidate set of the optimal phoneme template. When multiple volumes exist in the Pareto front solution, the following steps are performed:
[0074] For each individual in the Pareto front solution, following the method in step 5.5, and combining the predicted phoneme labels of each frame of the sliding window amplitude spectrum, each frame of the sliding window phase spectrum, and each frame of the sliding window amplitude spectrum of each speech training sample in the speech test set obtained in step 3, calculate the WER and SNR of each speech training sample in the speech test set. Add the WER and SNR of each speech training sample in the speech test set and take the average to obtain the individual's WER and SNR. Add the individual's WER and SNR as the evaluation index to evaluate the individuals in the Pareto front solution, and select the individual with the largest index as the final phoneme template.
[0075] The present invention also provides a computer-readable medium storing a computer program executed by an electronic device, wherein when the computer program is run on the electronic device, it performs the steps of the real-time adversarial sample generation method for the phoneme template.
[0076] This invention employs the phoneme template concept and uses a differential evolution algorithm based on multi-objective optimization to generate phoneme templates. A phoneme template refers to the set of thresholds corresponding to each phoneme. These phoneme thresholds guide the filter to filter phoneme frames in the amplitude spectrum of the audio signal. When generating adversarial examples, the phoneme template guides the filter to remove unnecessary signals from the speech to generate adversarial examples. Compared with existing adversarial example generation methods based on speech signal processing, the phoneme template concept introduced in this invention improves both the real-time performance and versatility of adversarial examples, achieving the goal of real-time generation of universal adversarial examples. Simultaneously, this invention also proposes an adversarial example generation technique based on semantic feature aggregation. It uses variance testing to obtain frequency bands of semantic feature aggregation, concentrating attacks on these frequency bands to improve the attack capability of adversarial examples. Following the above steps, this invention can generate universal, compression-resistant adversarial examples in real time, effectively protecting user privacy and security in various voice call scenarios. Attached Figure Description
[0077] Figure 1 : Flowchart of the method according to an embodiment of the present invention.
[0078] Figure 2 Figure 1: Results of variance analysis in an embodiment of the present invention. Detailed Implementation
[0079] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0080] In specific implementation, the method proposed in the technical solution of this invention can be automatically executed by those skilled in the art using computer software technology. System devices for implementing the method, such as computer-readable storage media storing the corresponding computer program of the technical solution of this invention and computer equipment including the computer program running the corresponding computer program, should also be within the protection scope of this invention.
[0081] Traditional adversarial example generation methods are unsuitable for privacy protection in online voice calls. Deep learning-based adversarial example generation techniques suffer from high time consumption, poor versatility, and inability to resist compression; existing speech signal processing-based adversarial example generation techniques suffer from insufficient real-time performance and poor speech quality. This invention proposes a real-time, compression-resistant adversarial example generation technique based on phoneme templates to address the shortcomings of traditional methods.
[0082] This embodiment is based on the TIMIT, NTT-VR, and LibriSpeech datasets, and DeepSpeech (an ASR model).
[0083] The following is combined with Figure 1-2 The present invention specifically describes a method for generating adversarial samples against compression using phoneme templates and a computer-readable medium. The specific implementation steps are as follows:
[0084] Step 1: Acquire multiple WAV audio signals, and perform short-time Fourier transform on each WAV audio signal sequentially to obtain the multi-frame sliding window amplitude spectrum and multi-frame sliding window phase spectrum of each WAV audio signal; extract the features of each frame sliding window amplitude spectrum of each WAV audio signal through a Mel filter bank to obtain the Mel features of each frame sliding window amplitude spectrum of each WAV audio signal, and label the true phoneme labels of each frame sliding window amplitude spectrum of each WAV audio signal.
[0085] Step 2: Construct a random forest classifier. Input the Mel features of all sliding window amplitude spectra of all WAV audio signals and the true phoneme labels of all sliding window amplitude spectra of all WAV audio signals as training sets into the random forest classifier. The random forest classifier trains multiple decision tree classifiers, and the trained random forest classifier is constructed from the multiple decision tree classifiers.
[0086] Step 2 involves training multiple decision tree classifiers using a random forest classifier, as detailed below:
[0087] During training, each decision tree randomly draws samples from the training set using a method with replacement, randomly selects a portion of the Mel features from all sliding window amplitude spectra of all WAV audio signals as input features, uses the CART algorithm for feature selection, and uses the selected features as tree nodes.
[0088] Each tree node represents any one of the Mel features of the sliding window amplitude spectrum of all WAV audio signals; during classification, binary tree classification is performed according to the tree nodes; all sliding window amplitude spectra of all WAV audio signals that belong to the feature represented by the tree node are in one class, and all sliding window amplitude spectra of all WAV audio signals that do not belong to the feature represented by the tree node are in another class.
[0089] Calculate the Gini coefficients corresponding to the Mel features of all sliding window amplitude spectra of all WAV audio signals. Then, using a greedy algorithm, select the Mel feature with the smallest Gini coefficient as the feature for the current decision tree node split. The formula for calculating the Gini coefficient is as follows:
[0090]
[0091] Among them, Psize =33 represents the total number of actual phoneme tags in step 1, f a This indicates the probability of phoneme label 'a' appearing in the classification result after using the current feature for classification.
[0092] When using the random forest classifier, each decision tree classifier will output its result, and the result with the highest probability will be selected as the final result of the random forest classifier.
[0093] Step 3: Acquire multiple speech audio signals and divide them into a speech training set and a speech test set. Process each speech training sample in the speech training set and each test sample in the speech test set sequentially through Step 1 to obtain the sliding window amplitude spectrum, sliding window phase spectrum, and Mel features of each frame of the sliding window amplitude spectrum for each speech training sample in the speech training set, and the sliding window amplitude spectrum, sliding window phase spectrum, and Mel features of each frame of the sliding window amplitude spectrum for each speech test sample in the speech test set. Input the Mel features of each frame of the sliding window amplitude spectrum for each speech training sample in the speech training set and the sliding window amplitude spectrum for each speech test sample in the speech test set into the trained single-frame phoneme recognizer for classification and recognition to obtain the predicted phoneme labels of each frame of the sliding window amplitude spectrum for each speech training sample in the speech training set and the predicted phoneme labels of each frame of the sliding window amplitude spectrum for each speech test sample in the speech test set.
[0094] Step 4: Acquire multiple audio signals from multiple speakers. Perform a short-time Fourier transform on each audio signal from each speaker to obtain a multi-frame sliding window amplitude spectrum for each audio signal from each speaker. Further convert the amplitude spectrum of each frame sliding window of each audio signal from each speaker to obtain the energy spectrum of each frame sliding window of each audio signal from each speaker. Filter the same sub-frequency bands in the multi-frame sliding window energy spectrum of each audio signal from each speaker to obtain the energy of the same sub-frequency band in each frame sliding window of each audio signal from each speaker. Accumulate the energy of the same sub-frequency bands in the multi-frame sliding window of each audio signal from each speaker to obtain the energy of each sub-frequency band of each audio signal from each speaker. Calculate the mean of the energy of each sub-frequency band of multiple audio signals from each speaker to obtain the energy mean of each sub-frequency band. Further calculate the b-variance test value of each sub-frequency band.
[0095] Step 4 involves calculating the variance test value of the k-th sub-band, as detailed below:
[0096]
[0097] Where k is in the range of 1≤k≤B size B size =256 represents the total number of sub-bands; f b,c,k f represents the energy of the k-th sub-band of the c-th audio signal from the b-th speaker. b,k f represents the energy of the k-th sub-band of the b-th speaker. k Value represents the average energy of the k-th sub-band. k Value represents the variance test value of the energy of the k-th sub-band, M represents the number of speakers, and N represents the number of audio signals per speaker; k The lower the value, the more clustered the semantic content features of that sub-band; ultimately, the Value is selected. k Sub-bands with values below a certain threshold form a set of frequency bands, which is called a semantic content feature cluster frequency band group.
[0098] Step 5: For each phoneme label, randomly initialize a value called the threshold; combine the sliding window amplitude spectrum, sliding window phase spectrum, predicted phoneme label of each frame of sliding window amplitude spectrum of each speech training sample in the speech training set, the threshold of each phoneme label, the sliding window amplitude spectrum, predicted phoneme label of each frame of sliding window amplitude spectrum of each frame of sliding window phase spectrum of each speech test sample in the speech test set, and the semantic content feature cluster obtained in Step 4 to generate an adversarial sample set and calculate the word error rate and signal-to-noise ratio respectively. With maximizing the word error rate and maximizing the signal-to-noise ratio as the optimization objectives, the threshold of each phoneme label is used as the optimization solution object and the differential evolution algorithm is used to optimize and solve it to obtain the optimized threshold of each phoneme label. Construct the optimal phoneme template through the optimized thresholds of all phoneme labels.
[0099] Step 5, generating the adversarial example set, is as follows:
[0100] For each speech training sample in the speech training set obtained in step 3, firstly, inverse STFT transformation is performed by combining the sliding window amplitude spectrum and the sliding window phase spectrum of each frame of each speech training sample in the speech training set to obtain the original speech audio signal of each speech training sample in the speech training set.
[0101] Traverse the sliding window amplitude spectrum of each frame of each speech training sample in the speech training set; for the phoneme label of the sliding window amplitude spectrum of each frame of each speech training sample in the speech training set, determine the relationship between the value in the sliding window amplitude spectrum of each frame of each speech training sample in the speech training set and the threshold of the corresponding phoneme label in the phoneme template within the frequency band group obtained in step 4. If the value is less than the threshold, set it to 0; if it is greater than the threshold, do not process it. After processing in the above manner, a new sliding window amplitude spectrum of each frame of each speech training sample in the speech training set is obtained; perform inverse STFT transform on the new sliding window amplitude spectrum of each frame of each speech training sample in the speech training set and the corresponding sliding window phase spectrum of each frame of each speech training sample in the speech training set to obtain a new speech audio signal of each speech training sample in the speech training set. The new speech audio signal is called an adversarial sample, and the set of all new speech audio signals is called the adversarial sample set.
[0102] Step 5, which involves calculating the word error rate, is detailed below:
[0103] The original audio signal of each speech training sample in the speech training set and the content of each adversarial sample in the adversarial sample set are identified by the speech recognition algorithm to obtain the corresponding content text; the content text of the original audio signal of each speech training sample in the speech training set is used as the reference text, and the content text of each adversarial sample in the adversarial sample set is used as the generated text.
[0104] Calculate the word error rate of the l-th speech training sample in the speech training set:
[0105]
[0106] Where the range of l is 1≤l≤A size A size S represents the total number of speech training samples; l M represents the number of different words that were replaced with in the generated text from the reference text, and M represents the number of words that were deleted from the generated text from the reference text. l Z represents the number of extra words inserted after comparing the generated text with the reference text. l This indicates the total number of words in the reference text.
[0107] Step 5, calculating the signal-to-noise ratio, is as follows:
[0108] For each speech training sample in the speech training set obtained in step 3, the original speech audio signal and the adversarial sample of each speech training sample in the speech training set are obtained; the signal-to-noise ratio of each speech training sample in the speech training set is calculated by taking each sampling point of the original speech audio signal and each sampling point of the adversarial sample of each speech training sample in the speech training set as input.
[0109] Calculate the signal-to-noise ratio of the l-th speech training sample in the speech training set:
[0110]
[0111] Where the range of l is 1≤l≤A size E l,d E′ is the d-th sampling point of the l-th speech training sample in the speech training set. l,d A is the d-th sampling point of the l-th adversarial example in the speech training set. l It is the total number of sampling points for the l-th speech training sample in the speech training set;
[0112] The word error rate is defined as WER;
[0113] The signal-to-noise ratio is defined as SNR.
[0114] Step 5 involves optimizing the solution using the differential evolution algorithm, as detailed below:
[0115] Step 5.1: Initialize the DE algorithm parameters of the established phoneme template model.
[0116] Step 5.2: Generate an initial population based on the phoneme template model. Each individual in the population represents a phoneme template.
[0117] Step 5.3: Perform a mutation operation on each original individual in the population to obtain mutated individuals.
[0118] Step 5.4: Perform a crossover operation on each original individual and its corresponding mutated individual in the population to obtain the crossover individuals.
[0119] Step 5.5: Using each cross individual, i.e., the phoneme template, combined with the predicted phoneme labels of each frame of the sliding window amplitude spectrum, each frame of the sliding window phase spectrum, and each frame of the sliding window amplitude spectrum of each speech training sample obtained in Step 3, generate an adversarial example set according to the aforementioned method and calculate the WER and SNR of each speech training sample in the speech training set. Add the WER and SNR of each speech training sample in the speech training set and take the average to obtain the individual's WER and SNR.
[0120] Step 5.6: Based on the WER and SNR of each individual, use the Pareto optimization strategy to generate a new generation of population.
[0121] Step 5.7: Check if the maximum number of iterations has been reached. If the condition is met, output the optimal solution, which is the current optimal solution of the population at the time of iteration termination; if the maximum number of iterations has not been reached, go to step 5.3.
[0122] The phoneme template model established in step 5.1 is as follows:
[0123] Based on the total number P of real phoneme tags in step 1 size The number of frequency band groups F in step 4 size =3. Minimum value of the threshold Threshold maximum value Create a phoneme template: I t , where t represents the current iteration number. The i-th individual in the population is denoted as I. t,i I t,i It is a dimension with F rows size P, the number of columns size The matrix, where each value represents a threshold, has a range of... I t,i,j Let I be the vector containing the phoneme label j in the phoneme template with population index i in t iterations. Each frequency band in the band group corresponds to a threshold; therefore, I... t,i,j The dimension is 1*F size .
[0124] Step 5.1 involves initializing the DE algorithm parameters:
[0125] The population size is N=30, the maximum number of iterations is T=50, the scaling factor is F=0.5, and the crossover probability is CR=0.8.
[0126] Step 5.2 The specific process of initializing the phoneme vector with phoneme label j for the i-th individual in the population is as follows:
[0127]
[0128] Here, rand(·) represents a function that generates random numbers;
[0129] Preferably, step 5.3, in the t-th iteration, performs a mutation operation on the phoneme vector of the i-th individual in the population with phoneme label j, specifically as follows:
[0130]
[0131] {(i, j)|i=1, 2, 3...N; j=1, 2...P size}
[0132] Here, r1, r2, and r3 represent distinct individuals randomly selected from the current population. They satisfy r1≠r2≠r3≠i, meaning the total population size must satisfy N≥4. F is the scaling factor. All phoneme vectors in the individual I matrix will be randomly modified during the mutation operation, ultimately generating mutated individuals.
[0133] Step 5.4, in the t-th iteration, specifically performs a crossover operation on the phoneme vector of the i-th individual in the population with phoneme label j, as follows:
[0134]
[0135] Among them, I t,i,j This represents the original phoneme vector with phoneme label j for the i-th individual in the population during the t-th iteration; v t+1,i,j u represents the mutated phoneme vector of the i-th individual in the population with phoneme label j in the t-th iteration. t+1,i,j Let represent the new phoneme vector with phoneme label j for the i-th individual in the population during the t-th iteration. Crossover is performed on a per-phoneme-vector basis. When the crossover condition is met, the new individual replaces the original individual's phoneme vector with the j-th phoneme vector from the mutated individuals; this is called crossover. CR is the crossover probability; a larger CR indicates a higher likelihood of replacement. rand Represents {1, 2, 3, ..., P} size The random integer in} serves to ensure that at least one phoneme vector in the new individual comes from mutation during the crossover process.
[0136] Step 5.5, which calculates WER and SNR for each individual in the population, is as follows:
[0137] Following the steps described above for calculating WER and SNR, calculate the WER and SNR of each speech training sample in the speech training set, add up the WER and SNR of each speech training sample in the speech training set and calculate the average to obtain the individual's WER and SNR.
[0138] The specific optimization process in step 5.6 is as follows:
[0139] For each new individual, the WER and SNR are denoted as the solution R′ = {WER, SNR}. In the Pareto optimization policy, when R1 WER ≥R2 WER andR1 SNR ≥R2 SNRWhen R1 dominates R2, it is called R1 dominating R2. The process involves determining whether the solution R′ of the new individual dominates the solution R of the original individual. If domination occurs, the new individual replaces the original individual and adds it to the new generation. If domination does not occur, the diversity between the original and new individuals is compared, and the individual with higher diversity is selected to join the new generation. Diversity is evaluated using the sum of the Euclidean distances between the individual and all individuals in the Pareto front solution. The Pareto front solution is the solution consisting of all non-dominant individuals in each generation. Calculating individual diversity involves calculating the Euclidean distances between all thresholds in the individual and the corresponding thresholds in each Pareto front solution, summing the results, and a larger sum indicates stronger individual diversity. After evaluation, a new generation of the population and a new generation of Pareto front solutions are generated.
[0140] After step 5.7 reaches the maximum number of iterations, the final Pareto front solution becomes the candidate set of the optimal phoneme template. When multiple volumes exist in the Pareto front solution, the following steps are performed:
[0141] For each individual in the Pareto front solution, following the method in step 5.5, and combining the predicted phoneme labels of each frame of the sliding window amplitude spectrum, each frame of the sliding window phase spectrum, and each frame of the sliding window amplitude spectrum of each speech training sample in the speech test set obtained in step 3, calculate the WER and SNR of each speech training sample in the speech test set. Add the WER and SNR of each speech training sample in the speech test set and take the average to obtain the individual's WER and SNR. Add the individual's WER and SNR as the evaluation index to evaluate the individuals in the Pareto front solution, and select the individual with the largest index as the final phoneme template.
[0142] Table 1: Comparison of Experimental Results
[0143]
[0144]
[0145] Table 1 compares this invention with two state-of-the-art voice privacy protection methods: NVC and Kenansville. The anti-ASR recognition effect refers to the WER (Warranty Error Rate) of the DeepSpeech recognition result after generating adversarial samples using the corresponding method and inputting the adversarial samples into the DeepSpeech recognition result; the anti-compression effect refers to the WER of the DeepSpeech recognition result after compressing the previously obtained adversarial samples using the AAC method. The final results show that this invention has advantages such as real-time performance, anti-compression, and anti-ASR recognition, and can effectively protect call privacy and security.
[0146] The computer-readable medium is a server workstation;
[0147] The server workstation stores a computer program executed by the electronic device. When the computer program runs on the electronic device, it causes the electronic device to execute the steps of the anti-compression adversarial sample generation method for phoneme templates according to the embodiments of the present invention.
[0148] It should be understood that any parts not described in detail in this specification belong to the prior art.
[0149] It should be understood that the above description of the preferred embodiments is quite detailed, but it should not be considered as a limitation on the scope of protection of this invention. Those skilled in the art, under the guidance of this invention, can make substitutions or modifications without departing from the scope of protection of the claims of this invention, and all such substitutions or modifications fall within the scope of protection of this invention. The scope of protection of this invention should be determined by the appended claims.
Claims
1. A method for real-time adversarial example generation of phoneme templates, characterized in that: The sliding window amplitude spectrum of each frame of each WAV audio signal is extracted using a Mel filter bank to obtain the Mel features of the sliding window amplitude spectrum of each frame of each WAV audio signal, and the true phoneme labels of the sliding window amplitude spectrum of each frame of each WAV audio signal are labeled. A random forest classifier trains multiple decision tree classifiers, and the trained random forest classifier is constructed from the multiple decision tree classifiers. The trained single-frame phoneme recognizer is used for classification and recognition to obtain the predicted phoneme labels of the sliding window amplitude spectrum of each frame of each speech training sample in the speech training set and the predicted phoneme labels of the sliding window amplitude spectrum of each frame of each speech test sample in the speech test set. In the energy spectrum of each audio signal of each speaker, the same sub-bands are filtered, accumulated, and averaged to obtain the energy of each sub-band of each speaker. The energy of each sub-band of multiple speakers is averaged to obtain the energy mean of each sub-band. The b-variance test value of each sub-band is then calculated. An adversarial sample set is generated and the word error rate and signal-to-noise ratio are calculated respectively. The optimization objectives are to maximize the word error rate and maximize the signal-to-noise ratio. The threshold of each phoneme label is used as the optimization solution object and the differential evolution algorithm is used to optimize and solve the problem to obtain the optimized threshold of each phoneme label. The optimal phoneme template is constructed by using the optimized thresholds of all phoneme labels.
2. The method for real-time adversarial example generation of phoneme templates according to claim 1, characterized in that, Includes the following steps: Step 1: Acquire multiple WAV audio signals, and perform short-time Fourier transform on each WAV audio signal sequentially to obtain the multi-frame sliding window amplitude spectrum and multi-frame sliding window phase spectrum of each WAV audio signal; extract the features of each frame sliding window amplitude spectrum of each WAV audio signal through a Mel filter bank to obtain the Mel features of each frame sliding window amplitude spectrum of each WAV audio signal, and label the true phoneme labels of each frame sliding window amplitude spectrum of each WAV audio signal. Step 2: Construct a random forest classifier. Input the Mel features of all sliding window amplitude spectra of all WAV audio signals and the true phoneme labels of all sliding window amplitude spectra of all WAV audio signals as training sets into the random forest classifier. The random forest classifier trains multiple decision tree classifiers, and the trained random forest classifier is constructed from the multiple decision tree classifiers. Step 3: Acquire multiple speech audio signals and divide them into a speech training set and a speech test set. Process each speech training sample in the speech training set and each test sample in the speech test set sequentially through Step 1 to obtain the sliding window amplitude spectrum, sliding window phase spectrum, and Mel features of each frame of the sliding window amplitude spectrum for each speech training sample in the speech training set, and the sliding window amplitude spectrum, sliding window phase spectrum, and Mel features of each frame of the sliding window amplitude spectrum for each speech test sample in the speech test set. Input the Mel features of each frame of the sliding window amplitude spectrum for each speech training sample in the speech training set and the sliding window amplitude spectrum for each speech test sample in the speech test set into the trained single-frame phoneme recognizer for classification and recognition to obtain the predicted phoneme labels of each frame of the sliding window amplitude spectrum for each speech training sample in the speech training set and the predicted phoneme labels of each frame of the sliding window amplitude spectrum for each speech test sample in the speech test set. Step 4: Acquire multiple audio signals from multiple speakers. Perform a short-time Fourier transform on each audio signal from each speaker to obtain a multi-frame sliding window amplitude spectrum for each audio signal from each speaker. Further convert the amplitude spectrum of each frame sliding window of each audio signal from each speaker to obtain the energy spectrum of each frame sliding window of each audio signal from each speaker. Filter the same sub-frequency bands in the multi-frame sliding window energy spectrum of each audio signal from each speaker to obtain the energy of the same sub-frequency band in each frame sliding window of each audio signal from each speaker. Accumulate the energy of the same sub-frequency bands in the multi-frame sliding window of each audio signal from each speaker to obtain the energy of each sub-frequency band of each audio signal from each speaker. Calculate the mean of the energy of each sub-frequency band of multiple audio signals from each speaker to obtain the energy mean of each sub-frequency band. Further calculate the b-variance test value of each sub-frequency band. Step 5: Construct thresholds by combining the sliding window amplitude spectrum, sliding window phase spectrum, predicted phoneme label, and threshold of each phoneme label for each frame of the sliding window amplitude spectrum of each speech training sample in the speech training set, the sliding window amplitude spectrum, predicted phoneme label, sliding window phase spectrum, and the semantic content feature aggregation band group obtained in Step 4 for each speech test sample in the speech test set. Generate an adversarial example set and calculate the word error rate and signal-to-noise ratio respectively. Maximize the word error rate and maximize the signal-to-noise ratio as optimization objectives. Use the threshold of each phoneme label as the optimization solution object and perform differential evolution algorithm optimization to obtain the optimized threshold of each phoneme label. Construct the optimal phoneme template through the optimized thresholds of all phoneme labels.
3. The method for real-time adversarial example generation of phoneme templates according to claim 2, characterized in that: Step 2 involves training multiple decision tree classifiers using a random forest classifier, as detailed below: During training, each decision tree randomly draws samples from the training set using a method with replacement, randomly selects a portion of the Mel features from all sliding window amplitude spectra of all WAV audio signals as input features, uses the CART algorithm for feature selection, and uses the selected features as tree nodes. Each tree node represents any one of the Mel features of the sliding window amplitude spectrum of all WAV audio signals; during classification, binary tree classification is performed according to the tree nodes; all sliding window amplitude spectra of all WAV audio signals that belong to the feature represented by the tree node are in one class, and all sliding window amplitude spectra of all WAV audio signals that do not belong to the feature represented by the tree node are in another class. Calculate the Gini coefficients corresponding to the Mel features of all sliding window amplitude spectra of all WAV audio signals. Then, using a greedy algorithm, select the Mel feature with the smallest Gini coefficient as the feature for the current decision tree node split. The formula for calculating the Gini coefficient is as follows: Among them, P size f represents the total number of actual phoneme tags in step 1. a This indicates the probability of phoneme label 'a' appearing in the classification result after using the current feature for classification. When using a random forest classifier, each decision tree classifier will output its result, and the result with the highest probability will be selected as the final result of the random forest classifier.
4. The method for real-time adversarial example generation of phoneme templates according to claim 3, characterized in that: Step 4 involves calculating the variance test value of the k-th sub-band, as detailed below: Where k is in the range of 1≤k≤B size B size Indicates the total number of sub-bands; f b,c,k f represents the energy of the k-th sub-band of the c-th audio signal from the b-th speaker. b,k f represents the energy of the k-th sub-band of the b-th speaker. k Value represents the average energy of the k-th sub-band. k Value represents the variance test value of the energy of the k-th sub-band, M represents the number of speakers, and N represents the number of audio signals per speaker; k The lower the value, the more clustered the semantic content features of that sub-band; ultimately, the Value is selected. k Sub-bands with values below a certain threshold form a set of frequency bands, which is called a semantic content feature clustering frequency band group.
5. The method for real-time adversarial example generation of phoneme templates according to claim 4, characterized in that, The construction threshold mentioned in step 5 is: For each phoneme tag, a value is randomly initialized, called the threshold; Step 5, generating the adversarial example set, is as follows: For each speech training sample in the speech training set obtained in step 3, firstly, inverse STFT transformation is performed by combining the sliding window amplitude spectrum and the sliding window phase spectrum of each frame of each speech training sample in the speech training set to obtain the original speech audio signal of each speech training sample in the speech training set. Traverse the sliding window amplitude spectrum of each frame of each speech training sample in the speech training set; for the phoneme label of the sliding window amplitude spectrum of each frame of each speech training sample in the speech training set, determine the relationship between the value in the sliding window amplitude spectrum of each frame of each speech training sample in the speech training set and the threshold of the corresponding phoneme label in the phoneme template within the frequency band group obtained in step 4. If the value is less than the threshold, set it to 0; if it is greater than the threshold, do not process it. After processing in the above manner, obtain the new sliding window amplitude spectrum of each frame of each speech training sample in the speech training set; perform inverse STFT transform on the new sliding window amplitude spectrum of each frame of each speech training sample in the speech training set and the corresponding sliding window phase spectrum of each frame of each speech training sample in the speech training set to obtain the new speech audio signal of each speech training sample in the speech training set. The new speech audio signal is called the adversarial sample, and the set of all new speech audio signals is called the adversarial sample set.
6. The method for real-time adversarial example generation of phoneme templates according to claim 5, characterized in that, Step 5, which involves calculating the word error rate, is detailed below: The original audio signal of each speech training sample in the speech training set and the content of each adversarial sample in the adversarial sample set are identified by the speech recognition algorithm to obtain the corresponding content text; the content text of the original audio signal of each speech training sample in the speech training set is used as the reference text, and the content text of each adversarial sample in the adversarial sample set is used as the generated text. Calculate the word error rate of the l-th speech training sample in the speech training set: Where the range of l is 1≤l≤A size A size S represents the total number of speech training samples; l M represents the number of different words that were replaced with in the generated text from the reference text, and M represents the number of words that were deleted from the generated text from the reference text. l Z represents the number of extra words inserted after comparing the generated text with the reference text. l This indicates the total number of words in the reference text.
7. The method for real-time adversarial example generation of phoneme templates according to claim 6, characterized in that, Step 5, calculating the signal-to-noise ratio, is as follows: For each speech training sample in the speech training set obtained in step 3, the original speech audio signal and the adversarial sample of each speech training sample in the speech training set are obtained. The signal-to-noise ratio of each speech training sample in the speech training set is calculated by taking each sampling point of the original speech audio signal of each speech training sample in the speech training set and each sampling point of the adversarial sample of each speech training sample in the speech training set as input. Calculate the signal-to-noise ratio of the l-th speech training sample in the speech training set: Where the range of l is 1≤l≤A size E l,d E′ is the d-th sampling point of the l-th speech training sample in the speech training set. l,d A is the d-th sampling point of the l-th adversarial example in the speech training set. l It is the total number of sampling points for the l-th speech training sample in the speech training set; The word error rate is defined as WER; Signal-to-noise ratio (SNR) is defined as the signal-to-noise ratio.
8. The method for real-time adversarial example generation of phoneme templates according to claim 7, characterized in that, Step 5 involves optimizing the solution using the differential evolution algorithm, as detailed below: Step 5.1: Initialize the DE algorithm parameters for the established phoneme template model; Step 5.2: Generate an initial population based on the phoneme template model; each individual in the population represents a phoneme template; Step 5.3: Perform a mutation operation on each original individual in the population to obtain mutated individuals; Step 5.4: Perform a crossover operation on each original individual and its corresponding mutated individual in the population to obtain the crossover individuals; Step 5.5: Using each cross individual, i.e. phoneme template, combined with the predicted phoneme labels of each frame of sliding window amplitude spectrum, each frame of sliding window phase spectrum, and each frame of sliding window amplitude spectrum of each speech training sample in the speech training set obtained in Step 3, generate an adversarial example set according to the aforementioned method and calculate the WER and SNR of each speech training sample in the speech training set. Add the WER and SNR of each speech training sample in the speech training set and calculate the average to obtain the individual's WER and SNR. Step 5.6: Based on the WER and SNR of each individual, use the Pareto optimization strategy to generate a new generation of population; Step 5.7: Check if the maximum number of iterations has been reached. If the condition is met, output the optimal solution, which is the current optimal solution of the population when the iteration terminates; if the maximum number of iterations has not been reached, go to step 5.
3.
9. The method for real-time adversarial example generation of phoneme templates according to claim 8, characterized in that, The phoneme template model established in step 5.1 is as follows: Based on the total number P of real phoneme tags in step 1 size The number of frequency band groups F in step 4 size Minimum value of threshold Threshold maximum value Create a phoneme template: I t , where t represents the current iteration number; The i-th individual in the population is denoted as I. t,i I t,i It is a dimension with F rows size P, the number of columns size The matrix, where each value represents a threshold, has a range of... I t,i,j Let I be the vector containing the phoneme label j in the phoneme template with population index i in t iterations; each frequency band in the frequency band group corresponds to a threshold, therefore, I t,i,j The dimension is 1*F size ; Step 5.1 involves initializing the DE algorithm parameters: The population size is N, the maximum number of iterations is T, the scaling factor is F, and the crossover probability is CR; Step 5.2 The specific process of initializing the phoneme vector with phoneme label j for the i-th individual in the population is as follows: Here, rand(·) represents a function that generates random numbers; Step 5.3 In the t-th iteration, the mutation operation is performed on the phoneme vector of the i-th individual in the population with phoneme label j. Specifically: Where r1, r2, r3 represent distinct individuals randomly selected from the current population; they satisfy r1≠r2≠r3≠i, which means that the total population must satisfy N≥4; F is the scaling factor; all phoneme vectors in the individual I matrix will be randomly changed during the mutation operation, ultimately generating mutated individuals; Step 5.4, in the t-th iteration, specifically performs a crossover operation on the phoneme vector of the i-th individual in the population with phoneme label j, as follows: Among them, I t,i,j v represents the original phoneme vector with phoneme label j for the i-th individual in the population during the t-th iteration; t+1,i,j u represents the mutated phoneme vector of the i-th individual in the population with phoneme label j in the t-th iteration. t+1,i,j Let represent the new phoneme vector with phoneme label j for the i-th individual in the t-th iteration; crossover is performed on a per-phoneme-vector basis; when the crossover condition is met, the new individual replaces the original individual's phoneme vector with the j-th phoneme vector from the mutated individual, which is called crossover; CR is the crossover probability, and the larger the CR, the easier it is for replacement to occur; d rand Represents {1,2,3...,P} size The random integer in} serves to ensure that at least one phoneme vector in the new individual comes from mutation during the crossover process; Step 5.5, which calculates WER and SNR for each individual in the population, is as follows: Following the steps described above for calculating WER and SNR, calculate the WER and SNR of each speech training sample in the speech training set, add up the WER and SNR of each speech training sample in the speech training set and calculate the average to obtain the individual's WER and SNR. The specific optimization process in step 5.6 is as follows: For each new individual, the WER and SNR are denoted as the solution R′ = {WER, SNR}; in the Pareto optimization strategy, when R1 WER ≥R2 WER and R1 SNR ≥R2 sNR When R1 dominates R2, it is called R1 dominating R2. The process involves determining whether the solution R′ of the new individual dominates the solution R of the original individual. If domination occurs, the new individual replaces the original individual and adds it to the next generation of the population. If domination does not occur, the diversity between the original and new individuals is compared, and individuals with higher diversity are selected to join the next generation. Diversity is evaluated using the sum of Euclidean distances between the individual and all individuals in the Pareto front solution. The Pareto front solution refers to the solution composed of all non-dominant individuals in each generation of the population. The process of calculating individual diversity involves calculating the Euclidean distance between all thresholds in the individual and the corresponding threshold in each Pareto front solution, summing the results, and a larger sum indicates stronger individual diversity. After evaluation, a new generation of the population and a new generation of Pareto front solutions are generated. After step 5.7 reaches the maximum number of iterations, the final Pareto front solution is the candidate set of the optimal phoneme template; when there are multiple volumes in the Pareto front solution, the following steps are performed: For each individual in the Pareto front solution, following the method in step 5.5, and combining the predicted phoneme labels of each frame of the sliding window amplitude spectrum, each frame of the sliding window phase spectrum, and each frame of the sliding window amplitude spectrum of each speech training sample in the speech test set obtained in step 3, calculate the WER and SNR of each speech training sample in the speech test set. Add the WER and SNR of each speech training sample in the speech test set and take the average to obtain the individual's WER and SNR. Add the individual's WER and SNR as the evaluation index to evaluate the individuals in the Pareto front solution, and select the individual with the largest index as the final phoneme template.
10. The method for real-time adversarial example generation of phoneme templates according to claim 9, characterized in that... , A computer-readable medium, characterized in that, It stores a computer program executed by an electronic device, which, when run on the electronic device, causes the electronic device to perform the steps of the method as described in any one of claims 1-9.
Citation Information
Patent Citations
Speech recognition attack defense method and device based on gradient estimation and CTC algorithm
CN110444208A
Sample generation method and apparatus
WO2022105693A1
