A forged voice detection method and electronic device
By performing silence frame detection and masking on the training speech signal, the robustness of the forged speech detection system is improved, the robustness problem of deep learning forged speech detection in complex scenarios is solved, and higher detection accuracy and stability are achieved.
Patent Information
- Application Number
- CN202310496296.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-05
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2043-05-05
AI Technical Summary
Existing deep learning-based forgery detection technologies have poor robustness in complex scenarios, especially when facing cross-channel and unknown algorithms, their performance degrades significantly.
By performing silence frame detection and zero-value masking on the training speech signal, effective features are extracted, and a deep neural network is used for training to improve the robustness of the forged speech detection system.
It improves the accuracy and stability of fake speech detection in complex scenarios, enhances the adaptability to unknown algorithms, and reduces overfitting.
Smart Images

Figure CN119559964B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of acoustics, and more particularly to a method and electronic device for detecting fake speech. Background Technology
[0002] With the rapid development of speech synthesis and speech conversion technologies, high-quality forged speech can be easily generated using deep learning methods. While speech generation and other technologies have brought convenience to fields such as voice interaction, they can also be maliciously used for telecommunications fraud, propaganda, and defamation, threatening social stability and the safety of people's lives and property. The main goal of forged speech detection technology is to efficiently and accurately identify forged speech automatically. A typical forged speech detection system generally consists of two parts: a front-end feature extraction unit and a back-end classifier. The front-end analyzes the speech signal to extract discriminative features, while the back-end uses a classifier to determine whether the speech is real or forged. In recent years, deep learning-based systems have gradually become mainstream. The front-end extracts high-dimensional speech features such as spectrograms, while the back-end learns high-level representations of these features through deep neural networks for classification. However, current deep learning-based forged speech detection technologies have poor robustness, especially when facing cross-channel and unknown algorithm scenarios, where performance degrades significantly. Summary of the Invention
[0003] The purpose of this application is to enhance the robustness of current deep neural network-based fake speech detection systems in complex scenarios.
[0004] In a first aspect, embodiments of this application provide a robust method for detecting forged speech in complex scenarios, comprising: a training phase, wherein a first speech signal is acquired for training; silence frames and speech frames in the first speech signal are determined; the silence frames of the first speech signal are zero-value masked; features of the masked first speech signal are obtained; the features are input into a forged speech detection model for training to obtain a trained forged speech detection model; and an inference phase, wherein the inference phase comprises: acquiring target speech for testing; zero-value masking of the target speech; obtaining features of the target speech; inputting the features of the target speech into the trained forged speech detection model; and outputting the detection result of the target speech, wherein the detection result includes whether the target speech is forged speech or the target speech is genuine speech.
[0005] Therefore, this application embodiment detects and masks silence frames in both training and target speech, so that the speech retains the silence duration while removing the silence content, thereby preventing the deep neural network from overfitting to the silence content and improving the robustness of the fake speech detection system.
[0006] In some feasible implementations, determining the silence frames and speech frames in the first speech signal includes: dividing the first speech signal into multiple frames, dividing each frame by frequency to obtain multiple sub-bands; calculating the logarithmic energy of each sub-band; calculating the sum of the logarithmic energies of each sub-band to obtain the total energy of each frame; determining the current frame as a silence frame when the total energy of the current frame is less than a first threshold; and determining the current frame as a speech frame when the total energy of the current frame is greater than the first threshold, performing local and global decisions based on the logarithmic energy of each sub-band of the current frame, and determining the current frame as a speech frame based on the local and global decision results.
[0007] Therefore, in this embodiment of the application, silence detection is performed on speech to distinguish between silence frames and speech frames.
[0008] In some feasible implementations, determining the silence frames and speech frames in the first speech signal includes: dividing the first speech signal with a Nyquist frequency of 4 kHz to obtain six sub-bands: 80–250 Hz, 250–500 Hz, 500–1 kHz, 1 kHz–2 kHz, 2 kHz–3 kHz, and 3 kHz–4 kHz.
[0009] Therefore, the embodiments of this application obtain valid speech information based on the Nyquist sampling theorem.
[0010] In some feasible implementations, local and global decisions are made based on the logarithmic energy of each sub-band of the current frame, including: calculating the log-likelihood ratio of the energy of each sub-band of the current frame using a Gaussian mixture model; making a local decision based on the log-likelihood ratio of each sub-band and a second threshold, wherein the result of the local decision is a speech frame or a silence frame; calculating a weighted sum of the log-likelihood ratios of each sub-band of the current frame; making a global decision based on the weighted sum and a third threshold, wherein the result of the global decision is a speech frame or a silence frame; and determining the decision result of the current frame as a speech frame if the result of the local decision is a speech frame or the result of the global decision is a speech frame.
[0011] Therefore, by performing local and global analysis of speech energy distribution, the decision result of the current speech frame can be accurately determined as the speech frame.
[0012] In some feasible implementations, zero-value temporal masking is performed on the silence frames of the first speech signal, including: smoothing based on the decision result of each frame and setting the value of the silence frames to 0.
[0013] Therefore, the embodiments of this application directly optimize the speech signal by detecting and masking silent frames, forcing the model to pay more attention to the non-silent parts of the fake speech.
[0014] In some feasible implementations, the features are spectrogram features. Obtaining features of the first speech signal includes: obtaining a second speech signal from the first speech signal after pre-emphasis masking; and performing a short-time Fourier transform on the second speech signal to obtain spectrogram features.
[0015] Therefore, the embodiments of this application optimize the speech signal while obtaining information such as the speech rhythm contained in the silence duration, which can effectively improve the robustness of the system.
[0016] In some feasible implementations, the feature is the linear frequency cepstral coefficient feature. Obtaining the feature of the first speech signal includes: passing the spectrogram feature through a set of linearly distributed filters to obtain filter bank features; and obtaining the linear frequency cepstral coefficient feature by taking the logarithm and discrete cosine transform based on the filter bank features.
[0017] Therefore, the embodiments of this application can extract more effective features and alleviate overfitting.
[0018] In some feasible implementations, the features are spectrogram features. The features are input into the spoofing detection model for training to obtain a trained spoofing detection model. This includes: inputting the spectrogram features into a squeeze-excitation network, using residual connections to deepen the network depth to obtain embedded features; feeding the embedded features into a binary classification linear layer to obtain classification results; and training the squeeze-excitation network and the binary classification linear layer using the Adam optimizer and the angle loss function to obtain a trained spoofing detection model.
[0019] Therefore, in this embodiment of the application, spectrogram features are fed into a Squeeze-Excitation Network (SENet), residual connections are used to deepen the network depth, and the gradient vanishing problem is alleviated. The squeeze-excitation operation increases the weight of effective channel features.
[0020] In some feasible implementations, the feature is the linear frequency cepstral coefficient feature. The feature is input into the forged speech detection model for training, resulting in a trained forged speech detection model. This includes: inputting the linear frequency cepstral coefficient feature into a lightweight convolutional neural network; the lightweight convolutional neural network outputting embedded features through a maximum feature mapping operation; feeding the embedded features into a binary classification linear layer to obtain the classification result; and training the lightweight convolutional neural network and the binary classification linear layer using the Adam optimizer and an angular loss function to obtain the trained forged speech detection model.
[0021] Therefore, the embodiments of this application can reduce model parameters and alleviate overfitting while extracting effective features.
[0022] Secondly, embodiments of this application provide a forged speech detection device, which includes a training module and an inference module. The training module acquires a first speech signal for training; determines silence frames and speech frames in the first speech signal; performs zero-value masking on the silence frames of the first speech signal; acquires features of the masked first speech signal; inputs the features into a forged speech detection model for training, obtaining a trained forged speech detection model; the inference module acquires target speech, acquires features of the target speech; inputs the features of the target speech into the trained forged speech detection model, and outputs the detection result of the target speech, which includes whether the target speech is forged speech or genuine speech. Its beneficial effects are as described in the first aspect and will not be repeated here.
[0023] Thirdly, embodiments of this application provide an electronic device, including: at least one memory for storing a program; and at least one processor for executing the program stored in the memory, wherein when the program stored in the memory is executed, the processor is configured to execute a method as described in any of the first aspects.
[0024] Fourthly, embodiments of this application provide a readable storage medium storing a computer program; the computer program is used to implement the method described in any of the embodiments of the first aspect above.
[0025] Fifthly, embodiments of this application provide a computer program product, the computer program product including instructions, which, when executed, cause a computer to perform the method of any of the embodiments of the first aspect described above. Attached Figure Description
[0026] To more clearly illustrate the technical solutions of the various embodiments disclosed in this specification, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only a few embodiments disclosed in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] The accompanying drawings used in the description of the embodiments or prior art are briefly introduced below.
[0028] Figure 1 A flowchart of a method for detecting fake voice is provided for embodiments of this application;
[0029] Figure 2 A flowchart of the training phase of the forged speech detection method is provided for embodiments of this application;
[0030] Figure 3 A schematic diagram of a device for detecting fake voice is provided for an embodiment of this application;
[0031] Figure 4A schematic diagram of an electronic device provided in this application. Detailed Implementation
[0032] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions in the embodiments of this application will be described below with reference to the accompanying drawings.
[0033] In the description of the embodiments of this application, the words "exemplary," "for example," or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplary," "for example," or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the words "exemplary," "for example," or "for instance" is intended to present the relevant concepts in a specific manner.
[0034] In the description of the embodiments in this application, the term "and / or" is merely a description of the association relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, B existing alone, and A and B existing simultaneously. Furthermore, unless otherwise stated, the term "multiple" means two or more. For example, multiple systems refer to two or more systems, and multiple terminals refer to two or more terminals.
[0035] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and their variations all mean "including but not limited to," unless otherwise specifically emphasized.
[0036] In the description of the embodiments in this application, "some embodiments" are mentioned, which describe a subset of all possible embodiments. However, it is understood that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.
[0037] In the description of the embodiments of this application, the terms "first, second, third, etc." or module A, module B, module C, etc. are used only to distinguish similar objects and do not represent a specific ordering of objects. It is understood that, where permitted, a specific order or sequence can be interchanged so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0038] In the description of the embodiments of this application, the reference numerals for the steps, such as S110, S120, etc., do not necessarily indicate that the steps will be executed in this manner. Where permissible, the order of the steps can be interchanged or executed simultaneously.
[0039] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0040] Figure 1 A flowchart illustrating a method for detecting fake voice in an embodiment of this application is provided. Figure 1 As shown, the process includes: a training phase, the steps of which include: S11, acquiring a first speech signal for training; S12, determining the silence frames and speech frames in the first speech signal, and performing zero-value masking on the silence frames of the first speech signal; S13, acquiring the features of the masked first speech signal; S14, inputting the features into the fake speech detection model for training, and obtaining the trained fake speech detection model; and an inference phase, the steps of which include: S15, acquiring the target speech and obtaining the features of the target speech; S16, inputting the features of the target speech into the trained fake speech detection model, and outputting the detection result of the target speech, which includes whether the target speech is fake speech or the target speech is real speech.
[0041] The following describes a method for detecting fake voice based on embodiments of this application.
[0042] S11, During the training phase, the first speech signal for training is acquired.
[0043] In practical applications, commonly used telephone and other channel voices are 8kHz, so training and testing voices can be downsampled to 8kHz for ease of application.
[0044] In this embodiment, the sampling frequency of the training speech can be determined to be 8kHz. If the sampling frequency is higher than 8kHz, the sampling frequency is reduced to 8kHz for downsampling to obtain the first speech signal for training.
[0045] S12, determine the silence frames and speech frames in the first speech signal, and perform zero-value masking on the silence frames.
[0046] In this embodiment, silence detection is performed on the training speech to distinguish between silence frames and speech frames, and zero-value masking is applied to the silence frames. Figure 2 As shown, a noise test can be performed through the following steps S121-S128.
[0047] S121, the training speech obtained by downsampling frequency is divided into frames, and the training speech is divided into multiple frames.
[0048] For example, a 20ms training audio is divided into 5 frames, each with a duration of 4ms.
[0049] S122 divides each frame into multiple sub-bands.
[0050] Based on the Nyquist sampling theorem, the effective information frequency of an 8kHz signal is less than half the sampling rate. In this embodiment, each frame of the training speech is divided into six sub-bands: 80–250Hz, 250–500Hz, 500–1kHz, 1kHz–2kHz, 2kHz–3kHz, and 3kHz–4kHz.
[0051] S123, calculate the logarithmic energy of each subband; sum the logarithmic energies of each subband to obtain the total energy of each frame.
[0052] For example, the logarithmic energy of each of the six subbands (80-250Hz, 250-500Hz, 500-1kHz, 1k-2kHz, 2k-3kHz, and 3k-4kHz) is calculated, and the sum of the logarithmic energies of the six subbands is calculated to obtain the total energy of each frame.
[0053] S124, determine the total energy of each frame. If the total energy of the current frame is greater than the first threshold, proceed to S125. If the total energy of the current frame is less than the first threshold, determine the current frame as a silent frame.
[0054] S125, when the total energy of the current frame is greater than the first threshold, perform local and global decisions based on the logarithmic energy of each sub-band of the current frame, and determine whether the current frame is a speech frame based on the local decision results and the global decision results.
[0055] In this embodiment, a Gaussian mixture model representing the distributions of noise and speech is used. The log-likelihood ratio of each sub-band energy in the current frame is calculated using the Gaussian mixture model. A local decision is made based on the log-likelihood ratio of each sub-band and a second threshold, resulting in either a speech frame or a silence frame. A global decision is made based on the weighted sum of the log-likelihood ratios of multiple sub-bands and a third threshold, resulting in either a speech frame or a silence frame.
[0056] Perform an OR operation on the local and global decision results to obtain the decision result for the current frame.
[0057] For example, if the local decision result is a silent frame and the global decision result is a speech frame, then the current frame is a speech frame; if the local decision result is a speech frame and the global decision result is a silent frame, then the current frame is a speech frame; if the local decision result is a speech frame and the global decision result is a speech frame, then the current frame is a speech frame; if the local decision result is a silent frame and the global decision result is a silent frame, then the current frame is a silent frame.
[0058] S126, Tag the frames based on the decision results of each frame to determine the silence frames and speech frames in the first speech signal.
[0059] S127, Smooth the results based on the judgment of each frame to obtain the global silence detection result, and set the value of the silence frame to 0.
[0060] In some implementations, the average of the decision results of five adjacent frames is taken by sliding a window and then rounded to obtain the global silence detection result.
[0061] S128, determine the minimum logarithmic energy among multiple subbands in each frame, and update the Gaussian mixture model parameters based on the minimum value.
[0062] In some implementations, for each subband, the minimum logarithmic energy of the first 16 logarithmic values within 100 frames can be calculated, and the mean and variance of the Gaussian mixture model can be updated using the Expectation-Maximum (EM) algorithm. Updating the Gaussian mixture model parameters can improve the accuracy of silence detection using the Gaussian mixture model.
[0063] S13, acquire the features of the masked first speech signal.
[0064] In some implementations, training can be performed through the following steps.
[0065] S131, the masked first speech signal is pre-emphasized to obtain the second speech signal. The pre-emphasis formula is:
[0066] y(n)=x(n)-0.97·x(n-1) (1)
[0067] Where x(n) is the masked speech of the nth sample, x(n-1) is the masked speech of the (n-1)th sample, and y(n) is the pre-emphasized speech of the nth sample.
[0068] S132, the pre-emphasized speech y(n) is transformed to obtain features. In some embodiments, the first speech signal after pre-emphasis masking can be used to obtain the second speech signal; the second speech signal is then subjected to a short-time Fourier transform to obtain spectrogram features.
[0069] In some implementations, the spectrogram features can be passed through a set of linearly distributed filters to obtain filter bank features; the linear frequency cepstral coefficient features can be obtained by taking the logarithm and discrete cosine transform based on the filter bank features.
[0070] S14, input the features into the fake speech detection model for training, and obtain the trained fake speech detection model.
[0071] In this embodiment, features are input into a deep neural network to extract embedded features. These embedded features are then input into a binary classification linear layer, which outputs classification results, namely the likelihood values for silence and speech. The deep neural network and the binary classification linear layer are trained using the Adam optimizer to update parameters, resulting in a trained fake speech detection model.
[0072] During the verification phase, labeled verification speech is collected. The labeled verification speech undergoes silence detection and feature extraction to obtain its speech features. These speech features are then input into a trained forgery detection model to obtain the verification result.
[0073] S15, the steps of the inference stage include: collecting target speech, obtaining the features of target speech; inputting the features of target speech into the trained fake speech detection model, and outputting the detection result of target speech, which includes whether the target speech is fake speech, real speech, or speech.
[0074] Example 1
[0075] Embodiment 1 of this application provides a method for detecting fake voice, targeting complex scenarios, including:
[0076] S21, Acquire speech signals to obtain training speech; wherein, the sampling frequency of the training speech is 8kHz, and if the sampling frequency is higher than 8kHz, the sampling frequency is reduced to 8kHz. The training speech can be used as the first speech signal.
[0077] S22, divide the training speech with a Nyquist frequency of 4kHz into two parts: 0-2kHz and 2k-4kHz. Then, divide the 2k-4kHz part into two parts: 2k-3kHz and 3k-4kHz.
[0078] Within the 0–2kHz range, it is first divided into two parts: 0–1kHz and 1k–2kHz. Then, 0–250Hz and 250–500Hz are selected from the 0–1kHz range. Finally, the 0–250Hz range is high-pass filtered to obtain a sub-band of 80–250Hz. Thus, a total of six sub-bands are obtained: 80–250Hz, 250–500Hz, 500–1kHz, 1k–2kHz, 2k–3kHz, and 3k–4kHz.
[0079] S23, perform silence detection on the training speech, and mark the silence frames and speech frames in the training speech; perform zero-value temporal masking on the silence frames in the training speech to obtain the masked speech.
[0080] For detailed implementation methods, please refer to steps S121-S128, which will not be repeated here.
[0081] S24, extract the features of each frame of the masked speech.
[0082] In Embodiment 1 of this application, the masked training speech is pre-emphasized, and the pre-emphasis formula can be referred to formula (1).
[0083] The spectrogram features are obtained by performing a Short-Time Fourier Transform (SFT) on the pre-emphasized training speech. The SFT is defined as follows:
[0084]
[0085] Where x(τ) is a single-frame speech signal, h(τ-t) is the analysis window function, τ is the offset, and f is the sampling frequency.
[0086] In one implementation, the spectrogram features can be passed through a set of linearly distributed filters to obtain filter bank features, and then the logarithm and discrete cosine transform can be performed based on the filter bank features to obtain the linear frequency cepstral coefficient features.
[0087] S25. Spectrogram features or linear frequency cepstral coefficient features are input into a deep neural network, which outputs embedded features. These embedded features are then fed into a binary classification linear layer to obtain the classification result, which is the likelihood value of natural speech. Natural speech refers to non-forged speech.
[0088] Generally, deep neural networks that take the original waveform as input first perform filtering and feature extraction through SincNet, and then feed it into the embedded features extracted by subsequent convolutional neural networks or graph networks.
[0089] In one implementation, spectrogram features can be input into a squeeze-excitation network, residual connections can be used to deepen the network to obtain embedded features, and the embedded features can be fed into a binary classification linear layer to obtain a classification result, which is the likelihood value of natural speech.
[0090] During training, the squeeze-excitation network and linear layers are trained using the Adam optimizer and the angular loss function (Angular Softmax, A-Softmax) to obtain the fake speech detection model.
[0091] The formula for the Adam optimizer is:
[0092]
[0093] m t =β1m t-1 +(1-β1)g t (4)
[0094]
[0095] In formula (3), g(t) is the loss function. For model parameters θ t gradient, To find the partial derivative, in formula (4), m... t β1 is the first moment estimate of the gradient at time t in momentum form, and β1 is the exponential decay that controls the first moment estimate. In formula (5), v t It is the second moment estimate of the gradient at time t in momentum form. In formula (6) It is the first-order moment estimate after bias correction. In formula (7) β2 is the second-moment estimate after bias correction, and β2 is the exponential decay of the second-moment estimate. Formula (8) is the update formula for the model parameters, and η is the learning rate.
[0096] The formula for calculating the A-Softmax loss function is:
[0097]
[0098] Where ||x i ‖ represents the modulus of the embedded feature. k∈[0,m-1], m is an integer and m≥1, here we choose m=4.
[0099] The optimizer parameters are: β1 = 0.9, β2 = 0.999, ∈ = 10 -8 The weight decays to 10. -4 During training, the learning rate is first increased to 1e-3 through warm-up, and then decreased exponentially for a total of 12 training cycles.
[0100] In Embodiment 1 of this application, spectrogram features are fed into a Squeeze-Excitation Network (SENet), and residual connections are used to deepen the network depth, thereby alleviating the gradient vanishing problem. The squeeze-excitation operation increases the weight of effective channel features.
[0101] The squeezing operation in the squeeze-excitation network compresses features along the spatial dimension, turning each two-dimensional feature channel into a real number that represents the global distribution of the response on the feature channel, and also allows layers closer to the input to obtain the global receptive field.
[0102] The activation operation is similar to the gate mechanism in a recurrent neural network. By learning the weight parameters, it explicitly models the correlation between feature channels, generates weights for each feature channel, and then applies the weights to the previous features channel by channel through multiplication, thus completing the recalibration of the original features in the channel dimension.
[0103] In some implementations, linear frequency cepstral coefficient features can be fed into a lightweight convolutional neural network (CNN), which outputs embedded features through a maximum feature mapping operation. These embedded features are then fed into a binary classification linear layer to obtain a classification result, which is the likelihood value of the natural speech. During training, the lightweight CNN and the binary classification linear layer are trained using the Adam optimizer and an angular loss function to obtain a trained forged speech detection model. This approach reduces model parameters while extracting effective features, mitigating overfitting.
[0104] During the inference phase, target speech for testing is collected, and silence frames and speech frames in the target speech are identified; zero-value masking is performed on the target speech to obtain the features of the masked target speech; the features of the target speech are input into the trained fake speech detection model to obtain the detection result of whether the target speech is fake speech.
[0105] The implementation method for collecting the target speech used in the test can be referred to in step S11; the implementation method for determining the silence frames and speech frames in the target speech and for zero-value masking of the target speech can be referred to in steps S121-S128; the implementation method for obtaining the features of the masked target speech can be referred to in steps S131-S132; these will not be elaborated here.
[0106] This application embodiment improves the robustness of the forged speech detection system to complex scenarios and unknown algorithms by performing zero-value masking on the silence frames of training speech and target speech.
[0107] This application's embodiments, by detecting and masking silence frames, force the model to focus more on the non-silent parts of the forged speech, while preserving information such as speech rhythm contained in the silence duration, effectively improving the system's robustness. Furthermore, this application's embodiments directly optimize the speech signal, independent of subsequent feature extraction and modeling, thus making it applicable to various forged speech detection systems and exhibiting good generalization ability.
[0108] Figure 3 This is a schematic diagram of a forged voice detection device provided in this application. Figure 3 As shown, the device 30 includes a training module 31 and an inference module 32. The training module 31 acquires a first speech signal for training; determines silence frames and speech frames in the first speech signal; performs zero-value masking on the silence frames of the first speech signal; obtains the features of the masked first speech signal; inputs the features into a forged speech detection model for training, obtaining a trained forged speech detection model. The inference module 32 acquires target speech, obtains the features of the target speech; inputs the features of the target speech into the trained forged speech detection model, and outputs the detection result of the target speech, which includes whether the target speech is forged speech or genuine speech.
[0109] In some implementations, the training module 31 divides the first speech signal into multiple frames, divides each frame into multiple sub-bands, calculates the logarithmic energy of each sub-band, calculates the sum of the logarithmic energies of each sub-band to obtain the total energy of each frame, determines the current frame as a silent frame when the total energy of the current frame is less than a first threshold, and determines the current frame as a speech frame when the total energy of the current frame is greater than the first threshold, performs local and global decisions based on the logarithmic energy of each sub-band of the current frame, and determines the current frame as a speech frame based on the local and global decision results.
[0110] In some implementations, the training module 31 divides the first speech signal with a Nyquist frequency of 4 kHz to obtain six sub-bands: 80–250 Hz, 250–500 Hz, 500–1 kHz, 1 kHz–2 kHz, 2 kHz–3 kHz, and 3 kHz–4 kHz.
[0111] In some implementations, the training module 31 performs local and global decisions based on the logarithmic energy of each sub-band of the current frame, including: calculating the log-likelihood ratio of each sub-band energy of the current frame using a Gaussian mixture model; performing a local decision based on the log-likelihood ratio of each sub-band and a second threshold, wherein the result of the local decision is a speech frame or a silence frame; calculating a weighted sum of the log-likelihood ratios of each sub-band of the current frame; performing a global decision based on the weighted sum and a third threshold, wherein the result of the global decision is a speech frame or a silence frame; and determining the decision result of the current frame as a speech frame if the result of the local decision is a speech frame or the result of the global decision is a speech frame.
[0112] In some implementations, the training module 31 performs zero-value time-domain masking on the silence frames of the first speech signal, including: smoothing based on the decision result of each frame and setting the value of the silence frames to 0.
[0113] In some implementations, the features are spectrogram features. The training module obtains the features of the first speech signal by: obtaining a second speech signal from the first speech signal after pre-emphasis masking; and performing a short-time Fourier transform on the second speech signal to obtain spectrogram features.
[0114] In some implementations, the feature is the linear frequency cepstral coefficient feature. The training module obtains the feature of the first speech signal by: passing the spectrogram feature through a set of linearly distributed filters to obtain filter bank features; and obtaining the linear frequency cepstral coefficient feature by taking the logarithm and discrete cosine transform based on the filter bank features.
[0115] In some implementations, the features are spectrogram features. The training module inputs the features into the spoofing detection model for training, and obtains a trained spoofing detection model. This includes: inputting the spectrogram features into a squeeze-excitation network, using residual connections to deepen the network depth to obtain embedded features; feeding the embedded features into a binary classification linear layer to obtain classification results; and training the squeeze-excitation network and the binary classification linear layer using the Adam optimizer and the angle loss function to obtain a trained spoofing detection model.
[0116] In some implementations, the features are linear frequency cepstral coefficient features. The training module inputs the features into the forged speech detection model for training, and obtains a trained forged speech detection model. This includes: inputting the linear frequency cepstral coefficient features into a lightweight convolutional neural network; the lightweight convolutional neural network outputting embedded features through a maximum feature mapping operation; feeding the embedded features into a binary classification linear layer to obtain a classification result; and training the lightweight convolutional neural network and the binary classification linear layer using the Adam optimizer and an angle loss function to obtain a trained forged speech detection model.
[0117] Figure 4 This is a schematic diagram of an electronic device provided in this application. Figure 4 As shown, the electronic device 100 includes a bus 102, a processor 104, a memory 106, and a communication interface 108. The processor 104, the memory 106, and the communication interface 108 communicate with each other via the bus 102. The electronic device 100 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in the electronic device 100.
[0118] Bus 102 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, Figure 4 The bus 102 may be represented by a single line, but this does not mean that there is only one bus or one type of bus. The bus 102 may include a path for transmitting information between various components of the electronic device 100 (e.g., memory 106, processor 104, communication interface 108).
[0119] The processor 104 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0120] Memory 106 may include volatile memory, such as random access memory (RAM). Memory 106 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0121] The memory 106 stores executable program code, and the processor 104 executes the executable program code to implement the functions of the aforementioned training module 31 and inference module 32 respectively. That is, the memory 106 stores instructions for executing the container state detection method.
[0122] The communication interface 108 uses transceiver modules such as, but not limited to, network interface cards and transceivers to enable communication between the electronic device 100 and other devices or communication networks.
[0123] The electronic devices provided in this application embodiment, such as mobile phones, computers, servers, smart home devices, and vehicles, can execute the solutions shown in the above method embodiments. Their implementation principles and beneficial effects are similar and will not be repeated here.
[0124] It is understood that the various numerical designations used in the embodiments of this application are merely for descriptive convenience and are not intended to limit the scope of the embodiments of this application.
Claims
1. A method for detecting forged voice, characterized in that, The method includes: The training phase includes: Acquire the first speech signal for training; Identify the silence frames and speech frames in the first speech signal; Zero-value masking is applied to the silence frames of the first speech signal; Obtain the features of the masked first speech signal; The features are input into the fake speech detection model for training to obtain a trained fake speech detection model. The reasoning phase includes: Collect target speech for testing, and determine the silence frames and speech frames in the target speech; perform zero-value masking on the target speech, and obtain the features of the masked target speech; input the features of the target speech into a trained fake speech detection model, and output the detection result of the target speech, the detection result including whether the target speech is fake speech or the target speech is real speech.
2. The method for detecting fake voice according to claim 1, characterized in that, Determining the silence frames and speech frames in the first speech signal includes: The first speech signal is divided into multiple frames, and each frame is further divided into multiple sub-bands. Calculate the logarithmic energy of each sub-band; sum the logarithmic energies of each sub-band to obtain the total energy of each frame; When the total energy of the current frame is less than a first threshold, the current frame is determined to be a silent frame; When the total energy of the current frame is greater than a first threshold, local and global decisions are made based on the logarithmic energy of each sub-band of the current frame, and the current frame is determined to be a speech frame based on the local and global decision results.
3. The method for detecting fake voice according to claim 1, characterized in that, Determining the silence frames and speech frames in the first speech signal includes: The first speech signal with a Nyquist frequency of 4kHz was divided to obtain six sub-bands: 80-250Hz, 250-500Hz, 500-1kHz, 1kHz-2kHz, 2kHz-3kHz, and 3kHz-4kHz.
4. The method for detecting fake voice according to claim 2, characterized in that, The step of performing local and global decisions based on the logarithmic energy of each sub-band of the current frame includes: The log-likelihood ratio of each sub-band energy in the current frame is calculated using a Gaussian mixture model. A local decision is made based on the log-likelihood ratio of each sub-band and a second threshold. The result of the local decision is either a speech frame or a silence frame. Calculate the weighted sum of the log-likelihood ratios of each sub-band of the current frame, and make a global decision based on the weighted sum and a third threshold. The result of the global decision is a speech frame or a silence frame. If the result of the local decision is a speech frame or the result of the global decision is a speech frame, then the decision result of the current frame is determined to be a speech frame.
5. The method for detecting fake voice according to any one of claims 1-3, characterized in that, The step of performing zero-value temporal masking on the silence frames of the first speech signal includes: Smoothing is performed based on the decision result of each frame, and the value of the silent frame is set to 0.
6. The method for detecting fake voice according to any one of claims 1-3, characterized in that, The feature is a spectrogram feature, and the acquisition of the features of the masked first speech signal includes: The masked first speech signal is pre-emphasized to obtain the second speech signal; The second speech signal is subjected to a short-time Fourier transform to obtain spectrogram features.
7. The method for detecting fake voice according to claim 6, characterized in that, The aforementioned feature is the linear frequency cepstral coefficient feature, and the acquisition of the features of the first speech signal includes: The spectrogram features are passed through a set of linearly distributed filters to obtain filter bank features; Based on the characteristics of the filter bank, logarithmic and discrete cosine transforms are performed to obtain the characteristics of the linear frequency cepstral coefficients.
8. The method for detecting fake voice according to any one of claims 1-3, characterized in that, The feature is a spectrogram feature. The step of inputting the feature into the forged speech detection model for training, to obtain a trained forged speech detection model, includes: The spectrogram features are input into a squeeze-excitation network, and residual connections are used to deepen the network depth to obtain embedded features. The embedded features are fed into a binary classification linear layer to obtain the classification result; The squeeze-excitation network and the binary classification linear layer are trained using the Adam optimizer and the angle loss function to obtain a trained fake speech detection model.
9. The method for detecting fake voice according to any one of claims 1-3, characterized in that, The feature is a linear frequency cepstral coefficient feature. The step of inputting the feature into a forged speech detection model for training, to obtain a trained forged speech detection model, includes: The linear frequency cepstral coefficient features are input into a lightweight convolutional neural network; The lightweight convolutional neural network outputs embedded features through a maximum feature mapping operation; The embedded features are fed into a binary classification linear layer to obtain the classification result; The lightweight convolutional neural network and the binary classification linear layer are trained using the Adam optimizer and the angle loss function to obtain a trained fake speech detection model.
10. An electronic device, characterized in that, include: At least one memory for storing programs; At least one processor is configured to execute a program stored in the memory, wherein when the program stored in the memory is executed, the processor is configured to perform the method as described in any one of claims 1-9.