Gender recognition model processing methods, devices, computer equipment and storage media
By constructing a gender recognition model using fundamental frequency parameters and Mel frequency composite features, and by adjusting the model loss, the problem of low gender recognition accuracy in existing technologies is solved, and higher gender recognition accuracy is achieved.
Patent Information
- Application Number
- CN202310368697.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-06
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2043-04-06
AI Technical Summary
Among existing gender recognition technologies, Gaussian mixture models based on Mel frequency cepstral coefficients have poor recognition accuracy, resulting in low gender recognition accuracy.
A gender recognition model is constructed using fundamental frequency parameters and Mel frequency composite features, including Mel frequency cepstral coefficients and their first and second order difference parameters. The initial gender recognition model is then adjusted by model loss until the training stopping condition is met.
This improves the accuracy of the gender recognition model and ensures accurate gender identification.
Smart Images

Figure CN116631436B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a gender recognition model processing method, apparatus, computer equipment, and storage medium. Background Technology
[0002] Speech-based gender recognition is an important application of speech recognition. It does not restrict the content of the speech; by analyzing the speech data, it determines whether the speaker is male or female, and then performs further business processing based on the gender recognition result. For example, in the financial and insurance fields, customer gender can be identified based on their speech, and customer profiles can be built, identity verification can be performed, and business operations can be carried out based on the gender recognition results.
[0003] Among existing gender recognition technologies, the most common approach is to extract Mel-frequency cepstral coefficients (MFCCs) from speech and directly train a Gaussian mixture model (GMM). This approach relies solely on MFCCs for gender recognition, and the training process is relatively simple, resulting in poor accuracy of the trained Gaussian mixture model and a low accuracy rate for gender recognition. Summary of the Invention
[0004] The purpose of this application is to provide a gender recognition model processing method, apparatus, computer equipment, and storage medium to solve the problem of low accuracy in gender recognition.
[0005] To address the aforementioned technical problems, this application provides a gender recognition model processing method, which employs the following technical solution:
[0006] Obtain training audio with gender labels;
[0007] Obtain the fundamental frequency parameters and Mel frequency composite features of the training speech, wherein the Mel frequency composite features include Mel frequency cepstral coefficients and their corresponding first-order difference parameters and second-order difference parameters;
[0008] The fundamental frequency parameter and the Mel frequency composite feature are input into the initial gender recognition model to obtain the predicted gender;
[0009] The hypothetical gender is determined based on the fundamental frequency parameter, and the model loss is calculated based on the gender combination type formed by the gender label, the hypothetical gender, and the predicted gender.
[0010] The initial gender recognition model is adjusted based on the model loss until the model loss meets the preset training stopping condition, thus obtaining the gender recognition model.
[0011] The user's voice is acquired, and the gender is identified by the gender recognition model to obtain the gender recognition result.
[0012] To address the aforementioned technical problems, this application also provides a gender recognition model processing device, which employs the following technical solution:
[0013] The training acquisition module is used to acquire training audio with gender labels;
[0014] The feature extraction module is used to obtain the fundamental frequency parameters and Mel frequency composite features of the training speech, wherein the Mel frequency composite features include Mel frequency cepstral coefficients and their corresponding first-order difference parameters and second-order difference parameters;
[0015] A gender prediction module is used to input the fundamental frequency parameter and the Mel frequency composite feature into an initial gender recognition model to obtain a predicted gender.
[0016] The loss calculation module is used to determine the hypothesized gender based on the fundamental frequency parameter, and to calculate the model loss according to the gender combination type formed by the gender label, the hypothesized gender, and the predicted gender;
[0017] The model adjustment module is used to adjust the initial gender recognition model according to the model loss until the model loss meets the preset training stopping condition to obtain the gender recognition model.
[0018] The gender recognition module is used to acquire the user's voice to be recognized, and to perform gender recognition on the user's voice through the gender recognition model to obtain the gender recognition result.
[0019] To address the aforementioned technical problems, this application also provides a computer device that employs the following technical solution:
[0020] Obtain training audio with gender labels;
[0021] Obtain the fundamental frequency parameters and Mel frequency composite features of the training speech, wherein the Mel frequency composite features include Mel frequency cepstral coefficients and their corresponding first-order difference parameters and second-order difference parameters;
[0022] The fundamental frequency parameter and the Mel frequency composite feature are input into the initial gender recognition model to obtain the predicted gender;
[0023] The hypothetical gender is determined based on the fundamental frequency parameter, and the model loss is calculated based on the gender combination type formed by the gender label, the hypothetical gender, and the predicted gender.
[0024] The initial gender recognition model is adjusted based on the model loss until the model loss meets the preset training stopping condition, thus obtaining the gender recognition model.
[0025] The user's voice is acquired, and the gender is identified by the gender recognition model to obtain the gender recognition result.
[0026] To address the aforementioned technical problems, this application also provides a computer-readable storage medium, employing the technical solution described below:
[0027] Obtain training audio with gender labels;
[0028] Obtain the fundamental frequency parameters and Mel frequency composite features of the training speech, wherein the Mel frequency composite features include Mel frequency cepstral coefficients and their corresponding first-order difference parameters and second-order difference parameters;
[0029] The fundamental frequency parameter and the Mel frequency composite feature are input into the initial gender recognition model to obtain the predicted gender;
[0030] The hypothetical gender is determined based on the fundamental frequency parameter, and the model loss is calculated based on the gender combination type formed by the gender label, the hypothetical gender, and the predicted gender.
[0031] The initial gender recognition model is adjusted based on the model loss until the model loss meets the preset training stopping condition, thus obtaining the gender recognition model.
[0032] The user's voice is acquired, and the gender is identified by the gender recognition model to obtain the gender recognition result.
[0033] Compared with existing technologies, the embodiments of this application have the following main advantages: They acquire training speech with gender labels and extract fundamental frequency parameters and Mel frequency composite features. The Mel frequency composite features include Mel frequency cepstral coefficients and their first-order and second-order difference parameters. Extracting multiple speech features enhances the richness of the model's input information, ensuring the accuracy of gender recognition. The fundamental frequency parameters and Mel frequency composite features are input into the initial gender recognition model to obtain the predicted gender. Gender labels, hypothetical gender, and predicted gender constitute a gender combination type. The gender label is the speaker's actual gender, the hypothetical gender is assumed based on the fundamental frequency parameters and the rules governing male and female speech, and the predicted gender is the gender predicted by the model. The consistency of the gender combination type constituted by these three factors determines the uncertainty brought by the training speech, and different model losses determine the model's learning and attention levels to the training speech. The model loss is used to adjust the initial gender recognition model until the model loss meets the preset training stopping condition, thus obtaining a gender recognition model. This improves the accuracy of the gender recognition model, thereby improving the accuracy of gender recognition of user speech. Attached Figure Description
[0034] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0035] Figure 1 This is an exemplary system architecture diagram to which this application can be applied;
[0036] Figure 2 This is a flowchart of an embodiment of the gender recognition model processing method according to this application;
[0037] Figure 3 This is a schematic diagram of the structure of an embodiment of the gender recognition model processing device according to this application;
[0038] Figure 4 This is a schematic diagram of the structure of one embodiment of the computer device according to this application. Detailed Implementation
[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 pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0040] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0041] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0042] like Figure 1As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0043] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc.
[0044] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc.
[0045] Server 105 can be a server that provides various services, such as a backend server that supports the pages displayed on terminal devices 101, 102, and 103.
[0046] It should be noted that the gender recognition model processing method provided in this application embodiment is generally executed by a server, and correspondingly, the gender recognition model processing device is generally set in the server.
[0047] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0048] Continue to refer to Figure 2 The diagram illustrates a flowchart of an embodiment of the gender recognition model processing method according to this application. The gender recognition model processing method includes the following steps:
[0049] Step S201: Obtain training audio with gender labels.
[0050] In this embodiment, the gender recognition model processing method runs on an electronic device (e.g., Figure 1The server shown can communicate with the terminal via wired or wireless connection. It should be noted that the aforementioned wireless connection methods may include, but are not limited to, 3G / 4G / 5G connections, WiFi connections, Bluetooth connections, WiMAX connections, Zigbee connections, UWB (ultra wideband) connections, and other currently known or future wireless connection methods.
[0051] Specifically, the first step is to obtain training audio with gender labels. The training audio can be obtained by recording the voice of a real person, and the gender label is used to record whether the person is male or female.
[0052] It should be emphasized that, to further ensure the privacy and security of the training audio, the training audio can also be stored in a blockchain node.
[0053] The blockchain referred to in this application is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0054] Step S202: Obtain the fundamental frequency parameters and Mel frequency composite features of the training speech, wherein the Mel frequency composite features include Mel frequency cepstral coefficients and their corresponding first-order difference parameters and second-order difference parameters.
[0055] Specifically, the fundamental frequency parameter and Mel frequency composite features of the training speech are extracted. The training speech can be composed of audio signals (sine wave signals) of different frequencies. The sine wave signal with the lowest frequency is the fundamental frequency, and the magnitude of the fundamental frequency is the fundamental frequency parameter.
[0056] Mel-frequency composite features consist of a variety of feature data, which may include Mel-frequency cepstral coefficients (MFCCs) and their corresponding first-order and second-order difference parameters.
[0057] In one embodiment, when extracting Mel-frequency cepstral coefficients, the training speech is first preprocessed. Preprocessing includes pre-emphasis, framing, and windowing operations. Pre-emphasis involves passing the audio to be processed through a high-pass filter. The purpose of pre-emphasis is to boost the high-frequency components, flattening the spectrum of the audio and maintaining it across the entire frequency band from low to high frequencies, allowing for spectrum calculation with the same signal-to-noise ratio. Framing is a common operation in audio signal processing. In this application, each frame of the audio signal can correspond to Mel-frequency cepstral coefficients. Windowing multiplies each frame by a Hamming window to increase the continuity between the left and right ends of the frame.
[0058] Since it's often difficult to discern the characteristics of an audio signal from its time-domain transformations, it's typically converted to an energy distribution in the frequency domain for observation. Different energy distributions represent different audio characteristics. Therefore, after multiplying by a Hamming window, each frame undergoes a Fast Fourier Transform (FFT) to obtain the energy distribution in the frequency spectrum. The preprocessed audio is then subjected to an FFT to obtain its frequency-domain representation, and the power spectrum is obtained by taking the square of the modulus of the frequency-domain spectrum.
[0059] The server inputs the power spectrum into a set of Mel-scaled triangular filter banks, then calculates the logarithmic energy of the output signal of each filter bank. The logarithmic energy is then substituted into a discrete cosine transform to obtain the Mel-frequency cepstral coefficients. The Mel-frequency cepstral coefficients can be 24-dimensional.
[0060] Step S203: Input the fundamental frequency parameter and the Mel frequency composite feature into the initial gender recognition model to obtain the predicted gender.
[0061] The initial gender recognition model can be a gender recognition model that has not yet been trained.
[0062] Specifically, the fundamental frequency parameter and the composite feature of the Mel frequency are output to the initial gender recognition model. The initial gender recognition model predicts gender based on the fundamental frequency parameter and the composite feature of the Mel frequency, thus obtaining the predicted gender.
[0063] In one embodiment, the initial gender recognition model can be built based on Convolutional Neural Networks (CNNs). The fundamental frequency parameter and Mel frequency composite feature are input into the initial gender recognition model, and after passing through a Dense layer, a Softmax layer is used to output a 2D label to obtain the predicted gender.
[0064] Step S204: Determine the hypothesized gender based on the fundamental frequency parameter, and calculate the model loss based on the gender combination type consisting of the gender label, hypothesized gender, and predicted gender.
[0065] Specifically, due to physiological differences between men and women, the voices produced by men and women differ. Generally, men's voices have a lower pitch, while women's voices have a higher pitch. This difference in pitch can be reflected in the fundamental frequency parameter; that is, the fundamental frequency parameter of male voices is usually lower, and the fundamental frequency parameter of female voices is usually higher. Therefore, the gender of the speaker can be assumed based on the fundamental frequency parameter.
[0066] Thus, for the same training speech segment, we obtain three gender-related pieces of information: gender label, hypothetical gender, and predicted gender, which can constitute gender combination types. Different gender combination types are calculated using different methods when calculating the model loss.
[0067] For example, for a training speech with a gender label of male and a low fundamental frequency parameter, the model outputs a predicted gender of male. This results in gender combination types: male, male, male. In this training speech, the gender assumption based on the fundamental frequency parameter aligns well with the characteristics of male and female voices, and the model prediction is correct. This training speech introduces less uncertainty, requires fewer features for the model to learn, and results in less model loss.
[0068] For a training speech segment labeled as male, with a high fundamental frequency parameter, we assume the gender is female. The model outputs a predicted gender as female. Thus, there are gender combination types: male, female, female. In this training speech segment, the gender assumption based on the fundamental frequency parameter contradicts the pattern of male and female voice characteristics, and the model makes an incorrect prediction. This training speech segment introduces significant uncertainty, and the model needs to learn many features from this segment. Therefore, this speech sample needs to be given more attention during training, and the model loss caused by the training speech segment is substantial.
[0069] Step S205: Adjust the initial gender recognition model according to the model loss until the model loss meets the preset training stopping condition to obtain the gender recognition model.
[0070] Specifically, with the goal of reducing model loss, the model parameters of the initial gender recognition model are adjusted based on the model loss. After the parameter adjustment, the training speech is re-inputted into the model for iterative training until the obtained model loss meets the preset training stopping condition, at which point the training stops and the gender recognition model is obtained. The training stopping condition can be that the model loss reaches convergence.
[0071] Step S206: Obtain the user's voice to be identified, and perform gender recognition on the user's voice using a gender recognition model to obtain the gender recognition result.
[0072] Specifically, in application, the user's voice is acquired, and the user's voice is input into the trained gender recognition model. The gender recognition model processes the user's voice and outputs the gender recognition result.
[0073] In this embodiment, training speech with gender labels is acquired, and fundamental frequency parameters and Mel frequency composite features are extracted. The Mel frequency composite features include Mel frequency cepstral coefficients and their first-order and second-order difference parameters. Multiple speech features are extracted to improve the richness of the model input information and ensure the accuracy of gender recognition. The fundamental frequency parameters and Mel frequency composite features are input into the initial gender recognition model to obtain the predicted gender. Gender labels, hypothetical gender, and predicted gender constitute gender combination types. The gender label is the speaker's actual gender, the hypothetical gender is the gender assumed based on the fundamental frequency parameters and the male-female speech patterns, and the predicted gender is the gender predicted by the model. The consistency of the gender combination types formed by the three determines the uncertainty brought by the training speech, and different model losses are used to determine the model's learning degree and attention degree to the training speech. The model loss is used to adjust the initial gender recognition model until the model loss meets the preset training stopping condition to obtain the gender recognition model, which improves the accuracy of the gender recognition model and thus improves the accuracy of gender recognition of user speech.
[0074] Furthermore, before step S201, the process may include: acquiring initial speech with gender labels; performing speech endpoint detection on the initial speech to obtain endpoint detection results; extracting human voice segments from the initial speech based on the endpoint detection results; and obtaining training speech based on the gender labels and human voice segments.
[0075] Specifically, the initial speech with gender labels is obtained, and voice activity detection (VAD) is performed on the initial speech to obtain the endpoint detection results. The endpoint detection results can record which segments in the initial speech contain the speaker's voice.
[0076] Based on the endpoint detection results, human voice segments containing the speaker's voice are extracted from the initial speech. The original gender label is used as the label for the human voice segments to obtain the training speech.
[0077] In this embodiment, speech endpoint detection is performed on the initial speech, and human voice segments are extracted from the initial speech based on the endpoint detection results. Training speech is obtained based on gender labels, avoiding the subsequent model from recognizing all speech segments, but only recognizing the part containing the speaker's voice, thus improving the speed of gender recognition.
[0078] Furthermore, step S202 may include: obtaining the fundamental frequency parameters and Mel frequency cepstral coefficients of the training speech; calculating the first-order difference parameters of the Mel frequency cepstral coefficients, and calculating the second-order difference parameters of the Mel frequency cepstral coefficients based on the first-order difference parameters; assigning weights to the Mel frequency cepstral coefficients, the first-order difference parameters, and the second-order difference parameters respectively; and constructing Mel frequency composite features based on the weighted Mel frequency cepstral coefficients, the first-order difference parameters, and the second-order difference parameters.
[0079] Specifically, after obtaining the training speech, the fundamental frequency parameter pitch and Mel frequency cepstral coefficients of the training speech are first extracted. Then, the first difference of the Mel frequency cepstral coefficients is calculated to obtain the first difference parameter. After obtaining the first difference parameter of the Mel frequency cepstral coefficients, the second difference of the Mel frequency cepstral coefficients is calculated to obtain the second difference parameter.
[0080] In this application, weights are assigned to the Mel frequency cepstral coefficients, first-order difference parameters, and second-order difference parameters. The weights can be preset to distinguish the importance of these parameters. The weighted Mel frequency cepstral coefficients, first-order difference parameters, and second-order difference parameters can be combined to form a Mel frequency composite feature.
[0081] In this embodiment, the fundamental frequency parameters and Mel frequency cepstral coefficients of the training speech are obtained, and then the first-order and second-order difference parameters of the Mel frequency cepstral coefficients are calculated. Weights are assigned to the Mel frequency cepstral coefficients, the first-order difference parameters, and the second-order difference parameters to distinguish their importance. The weighted Mel frequency cepstral coefficients, the first-order difference parameters, and the second-order difference parameters can be combined to form Mel frequency composite features. The fundamental frequency parameters and Mel frequency composite features improve the richness of the model input and ensure the accuracy of gender recognition.
[0082] Furthermore, the above-mentioned step of determining the assumed gender based on the base frequency parameter may include: when the base frequency parameter belongs to a preset first frequency range, the assumed gender is set to male; when the base frequency parameter belongs to a preset second frequency range, the assumed gender is randomly set to male or female; when the base frequency parameter belongs to a preset third frequency range, the assumed gender is set to female, wherein the first frequency range, the second frequency range, and the third frequency range are sequentially adjacent.
[0083] Specifically, this application pre-defines a first frequency range, a second frequency range, and a third frequency range. The three frequency ranges are sequentially adjacent on a one-dimensional coordinate system with the right as the positive direction. It can be understood that the frequency point in the first frequency range is lower than the frequency point in the second frequency range, and the frequency point in the second frequency range is lower than the frequency point in the third frequency range.
[0084] Male speech is generally lower in pitch than female speech; therefore, the fundamental frequency parameter of male speech is generally lower than that of female speech. However, there exists an interval B where speech with a fundamental frequency parameter in interval B may originate from either male or female speakers. Interval B is the second frequency interval mentioned above. Simultaneously, there exists an interval A where speech with a fundamental frequency parameter in interval A has a higher probability of originating from male speakers. Interval A is the second frequency interval mentioned above. Similarly, there exists an interval C where speech with a fundamental frequency parameter in interval C has a higher probability of originating from female speakers. Interval C is the third frequency interval mentioned above.
[0085] Therefore, when the fundamental frequency parameter belongs to the first frequency range, the assumed gender is set to male; when the fundamental frequency parameter belongs to the second frequency range, the assumed gender is randomly set to male or female; when the fundamental frequency parameter belongs to the third frequency range, the assumed gender is set to female.
[0086] In this embodiment, the hypothetical gender is determined based on the frequency range in which the fundamental frequency parameter is located, which conforms to the objective laws of male and female voice characteristics and ensures the rationality of the hypothetical gender.
[0087] Furthermore, the steps described above for calculating the model loss based on the gender combination type consisting of gender label, assumed gender, and predicted gender may include: determining the gender combination type consisting of gender label, assumed gender, and predicted gender; calculating the prediction error based on gender label and predicted gender; obtaining the correction factor corresponding to the gender combination type; and obtaining the model loss based on the prediction error and the correction factor.
[0088] Specifically, different gender labels, hypothetical gender, and predicted gender can constitute different gender combination types. For example, the gender combination types "male, male, male", "male, male, female", "male, female, male" and "male, female, female" belong to different gender combination types.
[0089] The prediction error is calculated based on the gender label and the predicted gender. Then, a correction factor corresponding to the gender type combination is obtained. The correction factor acts as an incentive, forcing the model to make more accurate predictions for the training speech. The prediction error and the correction factor together constitute the model loss.
[0090] In one embodiment, different gender type combinations have different correction factors. For example, for the gender type combination "male, male, male", the assumed gender does not deviate from the pattern of male and female voice features, and the predicted gender is not wrong. The model does not show a large deviation on this training speech, and its correction factor can be smaller. For the gender type combination "male, female, female", the assumed gender deviates from the pattern of male and female voice features, and the predicted gender is also wrong. The model does not show a large deviation on this training speech, and this training speech has high learning value. Its correction factor can be larger.
[0091] In one embodiment, the correction factor can be a multiplier value, which is multiplied by the prediction error to obtain the model loss; or, the correction factor can be numerical information of the same dimension as the prediction error, which can be added to the prediction error to obtain the model loss.
[0092] In this embodiment, the gender combination type consisting of gender label, hypothetical gender, and predicted gender is determined. The prediction error is calculated based on the gender label and predicted gender, and an additional correction factor corresponding to the gender combination type is obtained. The prediction error and correction factor constitute the model loss and are applied to the initial gender recognition model, making the model more accurate in predicting gender and improving the accuracy of gender recognition.
[0093] Furthermore, the steps described above for calculating the prediction error based on the gender label and the predicted gender may include: calculating the prediction sub-error based on the gender label and the predicted gender according to a preset error calculation method, wherein the number of prediction sub-errors is more than one; assigning error weights to each prediction sub-error; and calculating the prediction error based on each prediction sub-error with its error weight.
[0094] Specifically, the prediction error in this application can be composed of multiple prediction sub-errors, each with a preset error calculation method. For example, the prediction sub-error can be the binary cross-entropy loss BCELoss or the mean squared error (MSE). Error weights can be assigned to each prediction sub-error, and then the prediction sub-errors with error weights can be weighted to obtain the prediction error.
[0095] In this embodiment, multiple prediction sub-errors are calculated, error weights are added to the prediction sub-errors, and the prediction error is obtained by calculating the prediction sub-errors with error weights. This allows for consideration of the error from multiple dimensions, thereby improving the accuracy of prediction error calculation.
[0096] Furthermore, step S206 may include: performing voice endpoint detection on the user's speech to obtain endpoint detection results; extracting human voice segments from the user's speech based on the endpoint detection results; extracting the fundamental frequency parameters and Mel frequency composite features of the human voice segments, wherein the Mel frequency composite features include Mel frequency cepstral coefficients and their corresponding first-order difference parameters and second-order difference parameters; and inputting the fundamental frequency parameters and Mel frequency composite features into the gender recognition model to obtain gender recognition results.
[0097] Specifically, in application, user speech is acquired, and speech endpoint detection is performed on the user speech to obtain endpoint detection results. Based on the endpoint detection results, human voice segments are extracted from the user speech, and then the fundamental frequency parameters and Mel-frequency composite features of the human voice segments are extracted. The Mel-frequency composite features include the Mel-frequency cepstral coefficients of the human voice segments, and their corresponding first-order difference parameters and second-order difference parameters. The Mel-frequency cepstral coefficients, first-order difference parameters, and second-order difference parameters may be weighted.
[0098] By inputting the fundamental frequency parameter and Mel-frequency composite feature into the trained gender recognition model, a gender recognition result can be obtained. The server can then perform further business processing based on the gender recognition result, such as building user profiles and conducting targeted communication and product recommendations based on the gender recognition result.
[0099] In this embodiment, voice endpoint detection is performed on the user's voice to obtain the endpoint detection result. Based on the endpoint detection result, human voice segments are extracted from the user's voice. Only the fundamental frequency parameter and Mel frequency composite feature of the human voice segments are extracted, which can reduce the amount of computation and improve the speed of gender recognition. At the same time, multiple voice features are extracted to ensure the accuracy of the gender recognition result output by the gender recognition model.
[0100] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.
[0101] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0102] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing related hardware with computer-readable instructions. These computer-readable instructions can be stored in a computer-readable storage medium. When executed, the program can include the processes of the embodiments of the above methods. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).
[0103] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0104] Further reference Figure 3 As a response to the above Figure 2 The implementation of the method shown in this application provides an embodiment of a gender recognition model processing device, which is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0105] like Figure 3 As shown, the gender recognition model processing device 300 described in this embodiment includes: a training acquisition module 301, a feature extraction module 302, a gender prediction module 303, a loss calculation module 304, a model adjustment module 305, and a gender recognition module 306, wherein:
[0106] The training acquisition module 301 is used to acquire training speech with gender labels.
[0107] The feature extraction module 302 is used to obtain the fundamental frequency parameters and Mel frequency composite features of the training speech, wherein the Mel frequency composite features include Mel frequency cepstral coefficients and their corresponding first-order difference parameters and second-order difference parameters.
[0108] The gender prediction module 303 is used to input the fundamental frequency parameter and the composite feature of the Mel frequency into the initial gender recognition model to obtain the predicted gender.
[0109] The loss calculation module 304 is used to determine the hypothesized gender based on the fundamental frequency parameter, and to calculate the model loss according to the gender combination type consisting of the gender label, the hypothesized gender, and the predicted gender.
[0110] The model adjustment module 305 is used to adjust the initial gender recognition model according to the model loss until the model loss meets the preset training stopping condition, thus obtaining the gender recognition model.
[0111] The gender recognition module 306 is used to acquire the user's voice to be recognized, and to perform gender recognition on the user's voice through a gender recognition model to obtain the gender recognition result.
[0112] In this embodiment, training speech with gender labels is acquired, and fundamental frequency parameters and Mel frequency composite features are extracted. The Mel frequency composite features include Mel frequency cepstral coefficients and their first-order and second-order difference parameters. Multiple speech features are extracted to improve the richness of the model input information and ensure the accuracy of gender recognition. The fundamental frequency parameters and Mel frequency composite features are input into the initial gender recognition model to obtain the predicted gender. Gender labels, hypothetical gender, and predicted gender constitute gender combination types. The gender label is the speaker's actual gender, the hypothetical gender is the gender assumed based on the fundamental frequency parameters and the male-female speech patterns, and the predicted gender is the gender predicted by the model. The consistency of the gender combination types formed by the three determines the uncertainty brought by the training speech, and different model losses are used to determine the model's learning degree and attention degree to the training speech. The model loss is used to adjust the initial gender recognition model until the model loss meets the preset training stopping condition to obtain the gender recognition model, which improves the accuracy of the gender recognition model and thus improves the accuracy of gender recognition of user speech.
[0113] In some optional implementations of this embodiment, the gender recognition model processing device 300 may further include: an initial acquisition module, an endpoint detection module, and a training generation module, wherein:
[0114] The initial acquisition module is used to acquire initial voice recordings with gender tags.
[0115] The endpoint detection module is used to perform voice endpoint detection on the initial speech and obtain the endpoint detection results.
[0116] The training generation module is used to extract human voice segments from the initial speech based on the endpoint detection results, and to obtain training speech based on gender labels and human voice segments.
[0117] In this embodiment, speech endpoint detection is performed on the initial speech, and human voice segments are extracted from the initial speech based on the endpoint detection results. Training speech is obtained based on gender labels, avoiding the subsequent model from recognizing all speech segments, but only recognizing the part containing the speaker's voice, thus improving the speed of gender recognition.
[0118] In some optional implementations of this embodiment, the feature extraction module 302 may include: a feature acquisition submodule, a difference calculation submodule, a weight allocation submodule, and a composite construction submodule, wherein:
[0119] The feature acquisition submodule is used to acquire the fundamental frequency parameters and Mel frequency cepstral coefficients of the training speech.
[0120] The differential calculation submodule is used to calculate the first-order differential parameters of the Mel frequency cepstral coefficients and, based on the first-order differential parameters, calculate the second-order differential parameters of the Mel frequency cepstral coefficients.
[0121] The weight allocation submodule is used to assign weights to the Mel frequency cepstral coefficients, first-order difference parameters, and second-order difference parameters, respectively.
[0122] The composite construction submodule is used to construct Mel frequency composite features based on weighted Mel frequency cepstral coefficients, first-order difference parameters, and second-order difference parameters.
[0123] In this embodiment, the fundamental frequency parameters and Mel frequency cepstral coefficients of the training speech are obtained, and then the first-order and second-order difference parameters of the Mel frequency cepstral coefficients are calculated. Weights are assigned to the Mel frequency cepstral coefficients, the first-order difference parameters, and the second-order difference parameters to distinguish their importance. The weighted Mel frequency cepstral coefficients, the first-order difference parameters, and the second-order difference parameters can be combined to form Mel frequency composite features. The fundamental frequency parameters and Mel frequency composite features improve the richness of the model input and ensure the accuracy of gender recognition.
[0124] In some optional implementations of this embodiment, the loss calculation module 304 may include: a first setting submodule, a second setting submodule, and a third setting submodule, wherein:
[0125] The first setting submodule is used to set the assumed gender to male when the base frequency parameter belongs to the preset first frequency range.
[0126] The second setting submodule is used to randomly set the assumed gender to male or female when the base frequency parameter belongs to the preset second frequency range.
[0127] The third setting submodule is used to set the assumed gender to female when the base frequency parameter belongs to the preset third frequency range, wherein the first frequency range, the second frequency range and the third frequency range are adjacent in sequence.
[0128] In this embodiment, the hypothetical gender is determined based on the frequency range in which the fundamental frequency parameter is located, which conforms to the objective laws of male and female voice characteristics and ensures the rationality of the hypothetical gender.
[0129] In some optional implementations of this embodiment, the loss calculation module 304 may further include: a type determination submodule, an error calculation submodule, a factor acquisition submodule, and a loss calculation submodule, wherein:
[0130] The type determination submodule is used to determine the type of gender combination consisting of gender label, hypothetical gender, and predicted gender.
[0131] The error calculation submodule is used to calculate the prediction error based on the gender label and the predicted gender.
[0132] The factor acquisition submodule is used to obtain the correction factor corresponding to the gender combination type.
[0133] The loss calculation submodule is used to obtain the model loss based on the prediction error and correction factor.
[0134] In this embodiment, the gender combination type consisting of gender label, hypothetical gender, and predicted gender is determined. The prediction error is calculated based on the gender label and predicted gender, and an additional correction factor corresponding to the gender combination type is obtained. The prediction error and correction factor constitute the model loss and are applied to the initial gender recognition model, making the model more accurate in predicting gender and improving the accuracy of gender recognition.
[0135] In some optional implementations of this embodiment, the error calculation submodule may include: a sub-error calculation unit, a weight allocation unit, and an error calculation unit, wherein:
[0136] The sub-error calculation unit is used to calculate the prediction sub-error according to the gender label and the predicted gender in accordance with the preset error calculation method, wherein the number of prediction sub-errors is more than one.
[0137] The weighting unit is used to assign error weights to each prediction sub-error.
[0138] The error calculation unit is used to calculate the prediction error based on the errors of each prediction sub-error with error weights.
[0139] In this embodiment, multiple prediction sub-errors are calculated, error weights are added to the prediction sub-errors, and the prediction error is obtained by calculating the prediction sub-errors with error weights. This allows for consideration of the error from multiple dimensions, thereby improving the accuracy of prediction error calculation.
[0140] In some optional implementations of this embodiment, the gender recognition module 306 may include: a detection submodule, a voice extraction submodule, a feature extraction submodule, and a gender recognition submodule, wherein:
[0141] The detection submodule is used to perform voice endpoint detection on the user's voice and obtain the endpoint detection results.
[0142] The voice extraction submodule is used to extract human voice segments from user speech based on endpoint detection results.
[0143] The feature extraction submodule is used to extract the fundamental frequency parameters and Mel frequency composite features of human speech segments. The Mel frequency composite features include Mel frequency cepstral coefficients and their corresponding first-order and second-order difference parameters.
[0144] The gender recognition submodule is used to input the fundamental frequency parameter and Mel frequency composite feature into the gender recognition model to obtain the gender recognition result.
[0145] In this embodiment, voice endpoint detection is performed on the user's voice to obtain the endpoint detection result. Based on the endpoint detection result, human voice segments are extracted from the user's voice. Only the fundamental frequency parameter and Mel frequency composite feature of the human voice segments are extracted, which can reduce the amount of computation and improve the speed of gender recognition. At the same time, multiple voice features are extracted to ensure the accuracy of the gender recognition result output by the gender recognition model.
[0146] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.
[0147] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected via a system bus. It should be noted that only the computer device 4 with components 41-43 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0148] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.
[0149] The memory 41 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as the hard disk or memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 4. Of course, the memory 41 may also include both the internal storage unit and its external storage device of the computer device 4. In this embodiment, the memory 41 is typically used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions for gender recognition model processing methods. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or will be output.
[0150] In some embodiments, the processor 42 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to execute computer-readable instructions stored in the memory 41 or to process data, for example, to execute computer-readable instructions for the gender recognition model processing method.
[0151] The network interface 43 may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 4 and other electronic devices.
[0152] The computer device provided in this embodiment can execute the above-described gender recognition model processing method. Here, the gender recognition model processing method can be any of the gender recognition model processing methods described in the various embodiments above.
[0153] In this embodiment, training speech with gender labels is acquired, and fundamental frequency parameters and Mel frequency composite features are extracted. The Mel frequency composite features include Mel frequency cepstral coefficients and their first-order and second-order difference parameters. Multiple speech features are extracted to improve the richness of the model input information and ensure the accuracy of gender recognition. The fundamental frequency parameters and Mel frequency composite features are input into the initial gender recognition model to obtain the predicted gender. Gender labels, hypothetical gender, and predicted gender constitute gender combination types. The gender label is the speaker's actual gender, the hypothetical gender is the gender assumed based on the fundamental frequency parameters and the male-female speech patterns, and the predicted gender is the gender predicted by the model. The consistency of the gender combination types formed by the three determines the uncertainty brought by the training speech, and different model losses are used to determine the model's learning degree and attention degree to the training speech. The model loss is used to adjust the initial gender recognition model until the model loss meets the preset training stopping condition to obtain the gender recognition model, which improves the accuracy of the gender recognition model and thus improves the accuracy of gender recognition of user speech.
[0154] This application also provides another embodiment, namely, providing a computer-readable storage medium storing computer-readable instructions that can be executed by at least one processor to cause the at least one processor to perform the steps of the gender recognition model processing method described above.
[0155] In this embodiment, training speech with gender labels is acquired, and fundamental frequency parameters and Mel frequency composite features are extracted. The Mel frequency composite features include Mel frequency cepstral coefficients and their first-order and second-order difference parameters. Multiple speech features are extracted to improve the richness of the model input information and ensure the accuracy of gender recognition. The fundamental frequency parameters and Mel frequency composite features are input into the initial gender recognition model to obtain the predicted gender. Gender labels, hypothetical gender, and predicted gender constitute gender combination types. The gender label is the speaker's actual gender, the hypothetical gender is the gender assumed based on the fundamental frequency parameters and the male-female speech patterns, and the predicted gender is the gender predicted by the model. The consistency of the gender combination types formed by the three determines the uncertainty brought by the training speech, and different model losses are used to determine the model's learning degree and attention degree to the training speech. The model loss is used to adjust the initial gender recognition model until the model loss meets the preset training stopping condition to obtain the gender recognition model, which improves the accuracy of the gender recognition model and thus improves the accuracy of gender recognition of user speech.
[0156] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0157] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.
Claims
1. A method for processing a gender recognition model, characterized in that, Includes the following steps: Obtain training audio with gender labels; Obtain the fundamental frequency parameters and Mel frequency composite features of the training speech, wherein the Mel frequency composite features include Mel frequency cepstral coefficients and their corresponding first-order difference parameters and second-order difference parameters; The fundamental frequency parameter and the Mel frequency composite feature are input into the initial gender recognition model to obtain the predicted gender; The hypothetical gender is determined based on the fundamental frequency parameter, and the model loss is calculated based on the gender combination type formed by the gender label, the hypothetical gender, and the predicted gender. The initial gender recognition model is adjusted based on the model loss until the model loss meets the preset training stopping condition, thus obtaining the gender recognition model. Acquire the user's voice to be identified, and perform gender recognition on the user's voice using the gender recognition model to obtain the gender recognition result; The step of calculating the model loss based on the gender combination type formed by the gender label, the hypothesized gender, and the predicted gender includes: Determine the type of gender combination formed by the gender label, the hypothetical gender, and the predicted gender; Calculate the prediction error based on the gender label and the predicted gender; Obtain the correction factor corresponding to the gender combination type; The model loss is obtained based on the prediction error and the correction factor; Different gender combinations have different correction factors. For models that do not show significant deviation in training speech, the correction factor is set to be smaller; for models that show significant deviation in training speech, the correction factor is set to be larger.
2. The gender recognition model processing method according to claim 1, characterized in that, Prior to the step of obtaining the training speech with gender labels, the method also includes: Get the initial voice with gender tags; Perform speech endpoint detection on the initial speech to obtain endpoint detection results; Based on the endpoint detection results, extract the human voice segment from the initial speech, and obtain the training speech based on the gender label and the human voice segment.
3. The gender recognition model processing method according to claim 1, characterized in that, The step of obtaining the fundamental frequency parameters and Mel frequency composite features of the training speech includes: Obtain the fundamental frequency parameters and Mel frequency cepstral coefficients of the training speech; Calculate the first-order difference parameter of the Mel frequency cepstral coefficients, and calculate the second-order difference parameter of the Mel frequency cepstral coefficients based on the first-order difference parameter; Weights are assigned to the Mel frequency cepstral coefficients, the first-order difference parameter, and the second-order difference parameter, respectively; Mel frequency composite features are constructed based on the weighted Mel frequency cepstral coefficients, the first-order difference parameter, and the second-order difference parameter.
4. The gender recognition model processing method according to claim 1, characterized in that, The step of determining the hypothetical gender based on the fundamental frequency parameter includes: When the base frequency parameter belongs to a preset first frequency range, the assumed gender is set to male; When the base frequency parameter belongs to the preset second frequency range, the assumed gender is randomly set to male or female; When the base frequency parameter belongs to a preset third frequency range, the assumed gender is set to female, wherein the first frequency range, the second frequency range, and the third frequency range are sequentially adjacent.
5. The gender recognition model processing method according to claim 1, characterized in that, The step of calculating the prediction error based on the gender label and the predicted gender includes: According to a preset error calculation method, a prediction sub-error is calculated based on the gender label and the predicted gender, wherein the number of prediction sub-errors is more than one; Assign error weights to each prediction sub-error; The prediction error is calculated based on each prediction sub-error with error weights.
6. The gender recognition model processing method according to claim 1, characterized in that, The step of performing gender recognition on the user's voice using the gender recognition model to obtain the gender recognition result includes: Perform voice endpoint detection on the user's voice to obtain endpoint detection results; Based on the endpoint detection results, extract human voice segments from the user's speech; Extract the fundamental frequency parameters and Mel frequency composite features of the human voice speech segment, wherein the Mel frequency composite features include Mel frequency cepstral coefficients and their corresponding first-order difference parameters and second-order difference parameters; The fundamental frequency parameter and the Mel frequency composite feature are input into the gender recognition model to obtain the gender recognition result.
7. A gender recognition model processing device, characterized in that, include: The training acquisition module is used to acquire training audio with gender labels; The feature extraction module is used to obtain the fundamental frequency parameters and Mel frequency composite features of the training speech, wherein the Mel frequency composite features include Mel frequency cepstral coefficients and their corresponding first-order difference parameters and second-order difference parameters; A gender prediction module is used to input the fundamental frequency parameter and the Mel frequency composite feature into an initial gender recognition model to obtain a predicted gender. The loss calculation module is used to determine the hypothesized gender based on the fundamental frequency parameter, and to calculate the model loss according to the gender combination type formed by the gender label, the hypothesized gender, and the predicted gender; The model adjustment module is used to adjust the initial gender recognition model according to the model loss until the model loss meets the preset training stopping condition to obtain the gender recognition model. The gender recognition module is used to acquire the user's voice to be recognized, and to perform gender recognition on the user's voice through the gender recognition model to obtain the gender recognition result. The loss calculation module further includes: a type determination submodule, an error calculation submodule, a factor acquisition submodule, and a loss calculation submodule, wherein: The type determination submodule is used to determine the type of gender combination consisting of gender label, hypothetical gender, and predicted gender; The error calculation submodule is used to calculate the prediction error based on the gender label and the predicted gender. The factor acquisition submodule is used to acquire the correction factor corresponding to the gender combination type; The loss calculation submodule is used to obtain the model loss based on the prediction error and correction factor. Different gender combinations have different correction factors. For models that do not show significant deviation in training speech, the correction factor is set to be smaller; for models that show significant deviation in training speech, the correction factor is set to be larger.
8. A computer device comprising a memory and a processor, the memory storing computer-readable instructions, wherein the processor, when executing the computer-readable instructions, implements the steps of the gender recognition model processing method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the gender recognition model processing method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Loss function optimization method and device, computer equipment and storage medium
CN109815332A
A voice-based gender identification method using a pitch feature vector and a support vector machine(SVM)
KR1020080077880A