Model training method, speaker segmentation method and related device
By using the frame-level features of the speaker recognition model for the training of the speaker segmentation model, and performing model distillation during the training process, the problems of low training efficiency and high cost of the speaker segmentation model are solved, and efficient model training and Accurate identification.
Patent Information
- Application Number
- CN202410340148.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-25
- Publication Date
- 2024-09-17
AI Technical Summary
In the existing technology, the training efficiency of speaker segmentation models is low and the cost is high, mainly because a large amount of manually labeled data is required for training.
By inputting the frame-level features obtained by the speaker recognition model to recognize the voiceprint data into the speaker segmentation model, the model is trained by combining the speech information and time information, reducing the dependence on a large amount of annotated data, and utilizing the internal features of the residual network. Model distillation method reduces the number of parameters to improve training efficiency.
It effectively improves the training efficiency of the speaker segmentation model, saves costs, maintains recognition accuracy, and solves the problem of difficulty and high cost in obtaining data samples.
Smart Images

Figure CN118658482A
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a model training method, a speaker segmentation method and related devices. Background Art
[0002] Speaker segmentation, also known as speaker log, is used to determine who is speaking in a certain period of time in a speech. In real-world applications, this technology can be used together with speech recognition, and the functions of both are usually implemented based on deep learning models. For example, when the audio is mono audio, the speaker role can be identified through the speaker segmentation model, and then the speaker identity can be determined through the speech recognition model. When training the speaker segmentation model, a large amount of manually annotated data is often required as training data. Annotating data is time-consuming and labor-intensive, resulting in low training efficiency of the speaker segmentation model. Therefore, how to improve the efficiency of speaker segmentation model training has become a hot topic of research. Summary of the invention
[0003] The embodiments of the present application provide a model training method, a speaker segmentation method and related devices for improving the efficiency of model training and saving costs.
[0004] In a first aspect, the present application provides a model training method, the method comprising:
[0005] Inputting the voiceprint data sample into the speaker recognition model for recognition processing, and obtaining the frame-level features obtained during the recognition processing of the voiceprint data sample by the speaker recognition model;
[0006] Segmenting and clustering the frame-level features using a speaker segmentation model to obtain a predicted cluster set to which the frame-level features belong; the frame-level features included in the predicted cluster set are predicted to correspond to the first speaker identifier;
[0007] The speaker segmentation model is trained based on the difference between the predicted clustering set and the label set; the label set includes frame-level features corresponding to the target speaker identifier, and the target speaker identifier is used to identify the speaker to which the voiceprint data sample belongs.
[0008] In this method, the frame-level features containing voice information and time information in the speaker recognition model are extracted and input into the speaker segmentation model to train the speaker segmentation model to obtain a trained speaker segmentation model. Since the speaker recognition model is more convenient to extract the frame-level features, and the frame-level features contain voice information and time information and are suitable for training the speaker segmentation model, therefore, the speaker recognition model is combined with the speaker segmentation model, that is, the frame-level features extracted by the speaker recognition model are used as the training parameters of the speaker segmentation model, which can solve the problem that the speaker segmentation model needs a large number of labeled training parameters and save costs.
[0009] In addition, the speaker recognition model can also provide strong prior information for the speaker segmentation model. Therefore, during the training process of the speaker segmentation model, only the parameters of the model need to be fine-tuned, which can improve the efficiency of model training.
[0010] In a second aspect, the present application provides a method for speaker segmentation, the method comprising:
[0011] Input the voiceprint data to be tested into the speaker recognition model for recognition processing, and obtain the frame-level features obtained by the speaker recognition model during the recognition processing of the voiceprint data to be tested;
[0012] Inputting the frame-level features into a speaker segmentation model for segmentation and clustering to obtain at least one predicted clustering set to which the frame-level features belong; the frame-level features included in each predicted clustering set are predicted to correspond to the same speaker identifier;
[0013] At least one predicted cluster set is input into a speech recognition model to obtain identity information of a speaker corresponding to each predicted cluster set.
[0014] In this scheme, the frame-level features in the voiceprint data to be tested extracted by the speaker recognition model are input into the speaker segmentation model for speaker segmentation clustering. The method for obtaining the frame-level features is simple and applicable to the speaker segmentation model, which can save costs. Then, the various predicted clustering sets obtained by the speaker segmentation model are input into the speech recognition model, so as to obtain the identity information of each speaker in the voiceprint data to be tested and the voiceprint data corresponding to the speaker.
[0015] In a third aspect, the present application provides a model training device, comprising:
[0016] An extraction module is used to input the voiceprint data sample into the speaker recognition model for recognition processing, and obtain the frame-level features obtained during the recognition processing of the voiceprint data sample by the speaker recognition model;
[0017] A training module is used to segment and cluster frame-level features using a speaker segmentation model to obtain a predicted cluster set to which the frame-level features belong; the frame-level features included in the predicted cluster set are predicted to correspond to a first speaker identifier; based on the difference between the predicted cluster set and the label set, the speaker segmentation model is trained; the label set includes frame-level features corresponding to a target speaker identifier, and the target speaker identifier is used to identify the speaker to which the voiceprint data sample belongs.
[0018] In a fourth aspect, the present application provides a speaker segmentation device, the device comprising:
[0019] The extraction module is used to: input the voiceprint data to be tested into the speaker recognition model for recognition processing, and obtain the frame-level features obtained by the speaker recognition model during the recognition processing of the voiceprint data to be tested;
[0020] A segmentation module is used to: input the frame-level features into a speaker segmentation model for segmentation and clustering to obtain at least one predicted clustering set to which the frame-level features belong; the frame-level features included in each predicted clustering set are predicted to correspond to the same speaker identifier;
[0021] The recognition module is used to: input at least one predicted cluster set into the speech recognition model to obtain the identity information of the speaker corresponding to each predicted cluster set.
[0022] In a fifth aspect, the present application provides an electronic device comprising at least one processor, which is used to implement a method as described in the first aspect or any optional implementation of the first aspect or the second aspect or any optional implementation of the second aspect when executing a computer program stored in a memory.
[0023] In a sixth aspect, the present application provides a computer-readable storage medium for storing instructions, which, when executed, enables the method in the first aspect or any optional implementation of the first aspect or the second aspect or any optional implementation of the second aspect to be implemented.
[0024] In the seventh aspect, the present application provides a computer program product, which includes computer program code. When the computer code runs on a computer, it enables the computer to execute a method as described in the first aspect or any optional implementation of the first aspect or the second aspect or any optional implementation of the second aspect.
[0025] The technical effects or advantages of one or more technical solutions provided in the second, third, fourth, fifth, sixth and seventh aspects of the embodiments of the present application can be correspondingly explained by the technical effects or advantages of one or more corresponding technical solutions provided in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 is a flow chart of a speaker segmentation method;
[0027] Figure 2 A schematic diagram of an implementation environment applicable to an embodiment of the present application;
[0028] Figure 3 A schematic diagram of an application scenario applicable to an embodiment of the present application;
[0029] Figure 4 A flowchart of a model training method provided in an embodiment of the present application;
[0030] Figure 5 An example diagram of a distillation training provided in an embodiment of the present application;
[0031] Figure 6 An example diagram of a speaker recognition model structure provided in an embodiment of the present application;
[0032] Figure 7 is an example diagram of a residual block structure;
[0033] Figure 8 An example diagram of an overall structure of speaker segmentation provided in an embodiment of the present application;
[0034] Fig. 9 A structural diagram of a model training device provided in an embodiment of the present application;
[0035] Fig.10 A structural diagram of a speaker segmentation device provided in an embodiment of the present application;
[0036] Fig.11 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0037] The technical solution of the present application is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present application and the specific features in the embodiments are detailed descriptions of the technical solution of the present application, rather than limitations on the technical solution of the present application. In the absence of conflict, the embodiments of the present application and the technical features in the embodiments can be combined with each other.
[0038] For ease of understanding, some of the terms in this article are explained below:
[0039] 1) Speaker recognition: also known as voiceprint recognition, used to identify the speakers contained in the voiceprint data, or to identify the identities of the speakers contained in the voiceprint data;
[0040] 2) Speaker segmentation (End-to-end neural speaker diarization with self-attention, EEND): Also known as speaker log, it is used to solve the problem of which speaker spoke at which time. In practical applications, it is usually used together with speech recognition to determine the specific identity and specific speech content of the speaker within a certain period of time. The EEND model structure is relatively simple and suitable for industrial applications, but it is highly dependent on training data. In addition, when training the speaker segmentation model, a large amount of manually labeled data is often required as training data. The labeled data needs to be labeled with the speaker ID, the start time and the end time of the speaker's speech, etc. This kind of labeling is time-consuming and labor-intensive, and the labeling cost is high, which leads to low training efficiency and high cost of the speaker segmentation model.
[0041] 3) Transformer: A time series model with a self-attention mechanism, which can effectively encode time series information in the encoder (i.e., the attention layer and the feedforward network layer). It has good processing capabilities and high speed for time series information, and is therefore widely used in natural language processing, computer vision, machine translation, and speech recognition.
[0042] See also Figure 1 , which is a flow chart of a speaker segmentation method. The method extracts the mixed STFT (Short-time Fourier Transform) features of the training mixed speech and the reference features in the reference speech respectively; generates a mask of the reference speech through a three-layer fully connected network; multiplies the mask with the mixed STFT features to obtain the segmented STFT features of the speaker to be identified; finally, the segmented STFT features are subjected to ISTFT (Inverse Short-time Fourier Transform) to obtain the segmented speech of the speaker to be segmented in the training mixed speech, and the required speaker segmentation model is obtained based on the segmented speech of the speaker to be segmented.
[0043] Although this method uses a deep learning model, the data samples for training the speaker segmentation model rely on real training data. Therefore, when training data is lacking, the model is difficult to achieve the expected effect.
[0044] At present, voiceprint recognition data is often easy to obtain, because voiceprint recognition data only requires knowing that the audio belongs to an independent speaker, and it is easy to obtain a speaker recognition model with better results through training. The tasks performed by the speaker segmentation model and the speaker recognition model are similar, and both require judging the speaker's voice.
[0045] In view of this, the embodiment of the present application proposes a model training scheme, which inputs the data (such as the output frame-level features) in the process of the speaker recognition model identifying the voiceprint data into the speaker segmentation model as the training data of the speaker segmentation model, so that the speaker segmentation model is trained based on the data of the speaker recognition model. This scheme can solve the problem of difficulty and high cost in obtaining data samples for the speaker segmentation model in the prior art.
[0046] Furthermore, the frame-level feature vector contains the feature vectors of speech information and time information, which is suitable for training the speaker segmentation model. It can also effectively utilize the information of voiceprint recognition data to improve the training efficiency of the speaker segmentation model. It does not require a large amount of manually annotated training data and can also save costs.
[0047] In addition, in order to address the problem that the addition of a speaker recognition model causes a sharp increase in the amount of training parameters of a speaker segmentation model, the present application also trains the speaker recognition model based on a model distillation method within a residual network. While reducing the amount of parameters output by the speaker recognition model, it can maintain the stability of the recognition accuracy of the speaker recognition model, thereby improving the efficiency of model training and saving costs.
[0048] See also Figure 2 , which is a schematic diagram of an implementation environment applicable to an embodiment of the present application.
[0049] In one implementation, the speaker segmentation model training method, speaker recognition model training method and speaker segmentation method provided in the embodiments of the present application can be applied to the same electronic device, which can be Figure 2 The server 210 shown in the figure can be connected to the terminal device 220 via a network; wherein the network can include various connection types, such as wired communication links, wireless communication links, etc., which are not limited in this application. Optionally, in other embodiments, the electronic device can also be a smart phone, a computer, etc.
[0050] It should be understood that Figure 2 The server 210, network and terminal device 220 are only illustrative. According to actual needs, there can be any number of servers, networks and terminal devices. Exemplarily, the server 210 can be a physical server, or a server cluster composed of multiple servers, etc., and the terminal device 220 can be a mobile phone, a tablet, a computer and other devices. It is understandable that the embodiment of the present application can also allow multiple terminal devices 220 to access the server 210 at the same time.
[0051] In some embodiments, the terminal device 220 can record the user's voice to obtain the user's audio data. Further, the terminal device 220 sends the user's audio data to the server 210 through the network. After the server 210 receives the user's audio data, the user's audio data can be processed by the speaker segmentation method provided in the embodiment of the present application.
[0052] As another implementation manner, the speaker segmentation model training method, speaker recognition model training method and speaker segmentation method provided in the present application can be respectively applied to different electronic devices, for example, the speaker segmentation model training method is applied to electronic device A, the speaker recognition model training method is applied to electronic device B, and the speaker segmentation method is applied to electronic device C, etc. In addition, any two of the speaker segmentation model training method, speaker recognition model training method and speaker segmentation method provided in the embodiments of the present application can be applied to the same electronic device. For example, the speaker segmentation model training method and the speaker recognition model training method are applied to electronic device A, and the speaker segmentation method is applied to electronic device B, or the speaker segmentation model training method and the speaker segmentation method are applied to electronic device A, and the speaker recognition model training method is applied to electronic device B, or the speaker recognition model training method and the speaker segmentation method are applied to electronic device A, and the speaker segmentation model training method is applied to electronic device B. The embodiments of the present application do not limit the electronic devices to which the above three methods are applied.
[0053] The embodiments of the present application can be applied to various scenarios of speaker segmentation, such as: quality inspection scenarios of financial customer service, criminal investigation scenarios, online conference scenarios, etc.; for example, in a scenario where multiple people are talking, such as Figure 3 As shown, the mono audio data is input into the speaker segmentation module, and the speaker segmentation module first extracts features from the mono audio data through a speaker recognition model to obtain frame-level features, and inputs the frame-level features into the speaker segmentation model. The speaker segmentation model performs segmentation and clustering on the frame-level features, and can obtain a set A and a set B with speaker identification (only used to distinguish different speakers), wherein each set includes at least one frame-level feature corresponding to the speaker identification of the set, and the speaker segmentation module inputs the set A and the set B into the speech recognition model for speech recognition, and can determine the speaker A of the set A and the specific speech content corresponding to the speaker A, as well as the speaker B of the set B and the specific speech content corresponding to the speaker B.
[0054] See also Figure 4 , is a flow chart of a model training method provided in an embodiment of the present application. The execution subject of the method can be any electronic device with processing capabilities, such as a smart phone, a computer, an intelligent robot, etc. The method includes steps S401 to S403:
[0055] S401: Input the voiceprint data sample into the speaker recognition model for recognition processing, and obtain the frame-level features obtained in the process of the speaker recognition model performing recognition processing on the voiceprint data sample.
[0056] The frame-level features include voice information and time information. The voiceprint data sample may be a plurality of voiceprint data samples, and each voiceprint data sample corresponds to the mono voiceprint data of a single speaker.
[0057] Exemplarily, voiceprint data samples can be automatically acquired based on specific application scenarios. For example, in the scenario of quality inspection of financial customer service violations, the audio of the corresponding speaker can be directly obtained through the customer service agent number, and the voiceprint data in the audio can be extracted; there is no need to manually collect audio or manually label speakers, which can save costs and human resources.
[0058] Exemplarily, the voiceprint data sample can also be obtained by extracting features from audio files through toolkits such as kaldi, espnet, librosa, or through a python algorithm. The voiceprint data sample can be an fbank40 feature or an fbank80 feature, which is not limited in this embodiment of the present application.
[0059] In a possible embodiment, the frame-level feature may be a voiceprint vector corresponding to the voiceprint data sample. Specifically, the speaker recognition model may extract features from the input voiceprint data sample to obtain a voiceprint vector, and use the frame-level voiceprint vector as the frame-level feature.
[0060] In this embodiment, the voiceprint vector is used as a frame-level feature, which can facilitate the subsequent training of the speaker segmentation model based on the voiceprint vector. The efficiency and reliability of the speaker segmentation model can be improved by using the data information of voiceprint recognition.
[0061] In a possible embodiment, the speaker recognition model may be a residual model of a pyramid structure, such as a resnet34 model. The speaker recognition model is used to extract features of the voiceprint data samples input into the speaker recognition model, and the voiceprint vector (i.e., frame-level features) output by the residual block in the speaker recognition model may be obtained. For example, if the speaker recognition model includes N residual blocks (N is a positive integer) connected in sequence, the input of the Mth residual block is the output of the M-1th residual block (M is a positive integer greater than 1 and not greater than N), and the input of the first residual block is the voiceprint data sample. The above frame-level features may be the voiceprint vector output by the Nth residual block.
[0062] In this embodiment, the vector output by the residual block is a frame-level feature vector, that is, it contains voice information and time information, and is suitable as a training parameter for the speaker segmentation model. In addition, the vector output by the Nth residual block (i.e., the last residual block) among the N residual blocks is a deeper vector, which contains richer voice features (i.e., more voice information is extracted). Therefore, the voiceprint vector output by the Nth residual block in the speaker recognition model is used as the training data of the speaker segmentation model, which can improve the efficiency and accuracy of the speaker segmentation model training.
[0063] It can be understood that if the actual scenario does not have high requirements for the speech features contained in the frame-level features, in order to save costs or further reduce the number of parameters of the frame-level features, the voiceprint vector output by any residual block in the N residual blocks can also be extracted as training data for the speaker segmentation model, such as the first residual block, the second residual block, etc.; if the actual scenario has high requirements for the speech features contained in the frame-level features, in order to improve the accuracy of segmentation and clustering of the speaker segmentation model, the voiceprint vectors output by each residual block in the N residual blocks can also be spliced (that is, the shallow vectors and the deep vectors are aggregated) to obtain a spliced vector with richer features, and the spliced vector is output as training data for the speaker segmentation model. The embodiments of the present application do not limit this.
[0064] S402: Segment and cluster the frame-level features using a speaker segmentation model to obtain a predicted cluster set to which the frame-level features belong; the frame-level features included in the predicted cluster set are predicted to correspond to the first speaker identifier.
[0065] The speaker identifier is used to distinguish different speakers.
[0066] Exemplarily, if the input frame-level features only contain the voiceprint vector of the first speaker and the voiceprint vector of the background noise, the speaker segmentation model segments and clusters the input frame-level features, and aggregates at least one frame-level feature corresponding to the first speaker identifier to obtain a predicted cluster set corresponding to the first speaker identifier; if the input frame-level features contain voiceprint vectors of multiple speakers, the speaker segmentation model segments and clusters the input frame-level features according to different speaker identifiers, and aggregates at least one frame-level feature corresponding to the same speaker identifier to obtain multiple predicted cluster sets corresponding to different speaker identifiers, each predicted cluster set including at least one frame-level feature of the speaker identifier corresponding to the predicted cluster set.
[0067] S403: training a speaker segmentation model based on the difference between the predicted cluster set and the label set; the label set includes frame-level features corresponding to a target speaker identifier, and the target speaker identifier is used to identify the speaker to which the voiceprint data sample belongs.
[0068] Optionally, a softmax loss function is used to participate in the training of the speaker segmentation model. Since the softmax loss function has the invariance of label permutation, that is, when calculating the loss value between the predicted cluster set and the label set, the speaker identifiers corresponding to each predicted cluster set are swapped. For example, speaker 1 corresponding to the first predicted cluster set is replaced by speaker 2 corresponding to the first predicted cluster set, and speaker 2 corresponding to the second predicted cluster set is replaced by speaker 1 corresponding to the second predicted cluster set. This does not affect the calculation of the loss value. Since the speaker identifier is only used to distinguish different speakers, the use of the softmax loss function can avoid the phenomenon of huge loss values due to the arrangement problem of the speaker identifier. In addition, other loss functions can be selected to participate in the training of the speaker segmentation model according to actual conditions, and the embodiments of the present application are not limited to this.
[0069] In this embodiment, the frame-level features containing voice information and time information in the speaker recognition model are extracted and input into the speaker segmentation model to train the speaker segmentation model to obtain a trained speaker segmentation model. Since the speaker recognition model is more convenient for extracting the frame-level features, and the frame-level features contain voice information and time information and are suitable for training the speaker segmentation model, the speaker recognition model is combined with the speaker segmentation model, that is, the frame-level features extracted by the speaker recognition model are used as training parameters of the speaker segmentation model, which can solve the problem that the speaker segmentation model needs a large number of labeled training parameters and save costs.
[0070] In addition, the speaker recognition model can also provide strong prior information for the speaker segmentation model. Therefore, during the training process of the speaker segmentation model, only the parameters of the model need to be fine-tuned, which can improve the efficiency of model training.
[0071] In one possible design, the addition of a speaker recognition model may cause a sharp increase in the number of training parameters of the speaker segmentation model. For example, the number of voiceprint vectors output by the resnet34 model after each residual block processing will increase exponentially, resulting in a sharp increase in the number of parameters of the output frame-level features. As a result, when training the speaker segmentation model, higher requirements are placed on the speaker segmentation model, the training complexity is higher, and the complexity of the trained speaker segmentation model is higher. In practical applications, the rate of speaker segmentation is reduced, making it difficult to meet real-time requirements.
[0072] In view of this, before the speaker recognition model performs recognition processing on the voiceprint data sample, the embodiment of the present application can also perform distillation training on the speaker recognition model to reduce the number of parameters of the frame-level features output by the speaker recognition model while maintaining the stability of the recognition accuracy of the speaker recognition model. Figure 5Taking the distillation training example graph shown as an example, the method may include:
[0073] The student model is distilled and trained based on the voiceprint data training samples, the teacher model and the first loss function to obtain a speaker recognition model.
[0074] Among them, both the teacher model and the student model include N residual blocks; the residual blocks of the teacher model correspond to the residual blocks of the student model one by one, and for each group of corresponding residual blocks, the network width of the residual blocks in the teacher model is greater than the network width of the residual blocks in the student model; N is a positive integer.
[0075] Exemplarily, first, 150,000 hours of voiceprint data from about 200,000 people are used as voiceprint data samples and a preset loss function is used to train the teacher model, and the teacher model is saved after the loss value converges; the teacher model can amplify the input voiceprint data samples by changing parameters, such as increasing the speaking speed, increasing data disturbance, etc., to amplify the voiceprint data samples, thereby avoiding the impact on subsequent model training due to lack of training data.
[0076] Then, a student model is constructed based on the teacher model, and the student model is trained by distillation based on the teacher model and a preset loss function, so that the output vector of the student model is close to the teacher model, thereby obtaining a trained student model, i.e., a speaker recognition model.
[0077] Exemplarily, the teacher model and the student model are both pyramid-structured resnet34 models, that is, both include four residual blocks connected in sequence; the network width (that is, the number of channels) of the teacher model is [64, 128, 256, 512], and the network width of the student model is [16, 32, 64, 128], that is, the network width of the first residual block in the teacher model is 64, the network width of the second residual block is 128, the network width of the third residual block is 256, and the network width of the fourth residual block is 512; while the network width of the first residual block in the student model is 16, the network width of the second residual block is 32, the network width of the third residual block is 64, and the network width of the fourth residual block is 128; it can be understood that the smaller the network width (that is, the number of channels), the fewer the output parameters.
[0078] In a possible embodiment, the structure of the speaker recognition model is as follows: Figure 6As shown, the speaker recognition model includes: a residual block (ResNet) 1, a residual block 2, a residual block 3, a residual block 4, a segment-level pooling layer (pooling), a linear layer (Linear) connected in sequence, and a concatenated linear layer (Concat&Linear) and a softmax activation function connected to the residual block 1, the residual block 2, the residual block 3, the residual block 4, the segment-level pooling layer, and the linear layer; the input of the speaker recognition model can be fbank80 features;
[0079] Among them, the structure of the residual block is as follows Figure 7 As shown, it includes two convolutional layers (weight layers), two relu (Rectified Linear Unit) activation functions and an adder, x represents the input vector (which can be a voiceprint data sample or the output vector of the previous residual block), F(x) is the intermediate layer result (that is, the output result of the second convolutional layer), and F(x)+x is the output vector of the residual block; the first convolutional layer is used to downsample the input vector x for feature extraction (downsampling is used to determine the output feature map size according to a preset step size), and the second convolutional layer is used to further extract features from the vector input to the second convolutional layer without downsampling to obtain F(x); the relu activation function is used to perform nonlinear mapping on the output result of the convolutional layer, such as setting the negative values in the output result of the convolutional layer to 0 and keeping the positive values unchanged, etc., which can enhance the expressiveness and robustness of the model;
[0080] The segment-level pooling layer downsamples the frame-level vector output by the residual block 4 (calculates the average value or the maximum value, etc.), reduces the amount of calculation, and obtains the segment-level vector;
[0081] The linear layer performs linear combination or linear transformation (such as matrix multiplication) on the vectors output by the segment-level pooling layer, which can map the vectors input to the linear layer to a higher-dimensional feature space, thereby obtaining richer feature information;
[0082] The splicing linear layer is used to splice the output vector of each residual block, the output vector of the segment-level pooling layer, and the output vector of the linear layer (for example, splicing from the channel dimension, or splicing from the quantity dimension, with all dimensions equal except the splicing dimension) to obtain a spliced vector, and then perform a linear transformation on the spliced vector; that is, aggregating multiple shallow and deep vectors in the speaker recognition model can play the role of multi-layer feature supervision and obtain a richer feature vector;
[0083] The Softmax activation function is used to classify the vectors output by the spliced linear layer (for example, calculate the probability distribution) and output the voiceprint recognition result.
[0084] In this embodiment, the student model is distilled and trained using a teacher model and a preset loss function, and the network structures of the teacher model and the student model differ in that the network width of any residual block in the teacher model is greater than the network width of the residual block corresponding to the any residual block in the student model. The distillation training can reduce the amount of parameters (i.e., the number of frame-level features) output by the speaker recognition model (i.e., the trained student model), but keep the recognition accuracy of the speaker recognition model stable, thereby improving the efficiency of subsequent speaker segmentation model training.
[0085] In a possible embodiment, the student model is distilled and trained based on the voiceprint data training sample, the teacher model and the first loss function to obtain a speaker recognition model, which may specifically include:
[0086] Inputting the voiceprint data training sample into the teacher model and the student model;
[0087] Obtaining an output vector of feature extraction of the voiceprint data training sample by each of the N residual blocks in the teacher model and an output vector of feature extraction of the voiceprint data training sample by each of the N residual blocks in the student model; wherein, in the teacher model and the student model, the input of the latter residual block is the output of the previous residual block; and the input of the first residual block is the voiceprint data training sample;
[0088] For each residual block of the teacher model, a first loss value between an input vector of the residual block and an input vector of a corresponding residual block in the student model is calculated based on a first loss function; and a second loss value between an output vector of the residual block and an output vector of a corresponding residual block in the student model is calculated based on the first loss function;
[0089] Adjust the parameters of the N residual blocks in the student model according to the first loss values and the second loss values of the N residual blocks in the teacher model.
[0090] For example, Figure 5 As shown, the KL (Kullback-Leibler) divergence loss value between the input vector of the residual block 1 in the teacher model and the input vector of the residual block 1 of the student model, and the KL divergence loss value between the output vector of the residual block 1 in the teacher model and the output vector of the residual block 1 of the student model are calculated; the parameters of the residual block of the student model, such as the step size, the convolution kernel size, the number of convolution kernels, etc., are adjusted according to the two KL divergence loss values; the two KL divergence loss values are both less than the preset value (that is, the two KL divergence loss values converge);
[0091] It is understandable that Figure 7 The residual block structure example shown, the input vector of the residual block is the vector x before the residual structure, and the output vector of the residual block is the output vector F(x)+x of the residual structure;
[0092] The preset values of the two KL divergence loss values may be the same or different; the method for calculating the loss value may be the above-mentioned calculation of the KL divergence loss value (the weight of the KL divergence loss function is 0.3, which may of course be adjusted according to actual conditions), or other methods such as calculating the cross entropy loss value, the mean square error loss value, etc. may be used, and the method for calculating the loss value of the input vector between the two residual blocks 1 and the method for calculating the loss value of the output vector between the two residual blocks 1 may be the same or different, and the embodiments of the present application do not limit this;
[0093] The methods for calculating the loss values of other residual blocks can refer to the method for calculating the loss value of residual block 1, and the embodiments of the present application will not go into details.
[0094] In this embodiment, by calculating the first loss value and the second loss value, and adjusting the parameters of the N residual blocks in the student model according to the first loss value and the second loss value, the output vector of the Nth residual block is more accurate, and then the output vector of the Nth residual block is used as the training parameter of the speaker segmentation model, which can improve the efficiency of speaker segmentation model training.
[0095] In a possible embodiment, the student model may be trained based on the voiceprint data training sample and the second loss function to obtain a speaker recognition model, and the method includes:
[0096] Obtain predicted speaker recognition output by the student model for the voiceprint data training sample; calculate a third loss value between the predicted speaker identifier and the speaker identifier corresponding to the voiceprint data training sample based on the second loss function; adjust the parameters of N residual blocks in the student model according to the third loss value until the third loss value converges.
[0097] Exemplarily, a third loss value between the predicted speaker identifier output by the student model and the speaker identifier corresponding to the voiceprint data training sample can be calculated based on the softmax loss function, and the weight of the softmax loss function can be 0.7, or can be adjusted according to actual conditions; according to the third loss value, the parameters of the N residual blocks in the student model, such as the step size, the number of convolution kernels, the size of the convolution kernel, etc., are adjusted until the third loss value is less than the preset value (that is, the third loss value converges);
[0098] It can be understood that the second loss function can be the above-mentioned softmax loss function, or other loss functions, such as norm loss function, mean square error loss function, etc., and this application does not limit this.
[0099] In this embodiment, a third loss value is calculated, that is, the loss value between the predicted speaker identifier output by the student model and the speaker identifier corresponding to the voiceprint data sample is calculated, and the parameters of the N residual blocks in the student model are adjusted according to the third loss value until the third loss value converges, so that the output vector of the Nth residual block has higher accuracy, and then the output vector of the Nth residual block is used as a training parameter of the speaker segmentation model, which can improve the efficiency of speaker segmentation model training.
[0100] In a possible design, after obtaining the trained speaker segmentation model and speaker recognition model, based on these two models, the present application also provides a speaker segmentation method. Figure 8 Taking the example of the overall structure of speaker segmentation and the financial customer service violation quality inspection scenario as examples, the method may include:
[0101] 1. Input the voiceprint data to be tested into the speaker recognition model for recognition processing, and obtain the frame-level features obtained by the speaker recognition model during the recognition processing of the voiceprint data to be tested.
[0102] Exemplarily, the voiceprint data to be tested (for example, the fbank80 features of a 20s monophonic audio data, including the fbank80 features of the audio data of the customer service and the client) is input into Figure 6 In the speaker recognition model shown, the voiceprint vector output by the residual block 4 in the speaker recognition model is obtained;
[0103] 2. Input the frame-level features into the speaker segmentation model for segmentation and clustering to obtain at least one predicted clustering set to which the frame-level features belong; the frame-level features included in each predicted clustering set are predicted to correspond to the same speaker identifier.
[0104] Exemplarily, the speaker segmentation model may be an EEND (End-to-end neural speaker diarization with self-attention) model, which includes a transformer model with a multi-layer structure, each layer including an attention layer and a feedforward network layer. Figure 8 Only one layer of transformer is used as an example;
[0105] Among them, the attention layer is used to calculate the similarity between every two frame-level features and separate the frame-level features corresponding to two speakers. For example, the frame-level features include voiceprint vectors extracted from a section of audio data of customer service and customers and arranged in chronological order. Assuming that the first frame-level feature to the third frame-level feature are the voiceprint vectors corresponding to the customer service, the fourth frame-level feature to the fifth frame-level feature are the voiceprint vectors corresponding to the customer, and the sixth frame-level feature and the seventh frame-level feature are the voiceprint vectors corresponding to the customer service, then the attention layer calculates the similarity between two adjacent frame-level features, and when the similarity of the two adjacent frame-level features is lower than a preset value, the two adjacent frame-level features are divided into frame-level features corresponding to the two speakers; that is, the third frame-level feature and the fourth frame-level feature are divided, and the fifth frame-level feature and the sixth frame-level feature are divided; and by calculating the similarity between every two frame-level features, the first frame-level feature to the third frame-level feature and the sixth frame-level feature and the seventh frame-level feature can be marked as the voiceprint vector corresponding to speaker 1, and the fourth frame-level feature to the fifth frame-level feature can be marked as the voiceprint vector corresponding to speaker 2;
[0106] The feedforward network layer extracts all frame-level features labeled as the same speaker based on the annotation of each frame-level feature in the attention layer, and aggregates all frame-level features of the same speaker to obtain a prediction cluster set with the speaker ID; for example, the first frame-level feature to the third frame-level feature and the sixth frame-level feature and the seventh frame-level feature are aggregated together to obtain a prediction cluster set with the speaker 1 ID, and the fourth frame-level feature to the fifth frame-level feature are aggregated together to obtain a prediction cluster set with the speaker 2 ID.
[0107] 3. Input at least one predicted cluster set into the speech recognition model to obtain the identity information of the speaker corresponding to each predicted cluster set.
[0108] Exemplarily, the speaker segmentation model inputs the predicted cluster set with the speaker 1 identifier and the predicted cluster set with the speaker 2 identifier into different speech recognition models respectively, or inputs them into the same speech recognition model one after another. The speech recognition model identifies the voiceprint vectors (i.e., frame-level features) in each predicted cluster set to obtain the identity information of the speaker corresponding to each predicted cluster set. For example, speaker 1 is the customer service representative and speaker 2 is the customer. Then, the time period and specific content of the customer service representative's speech can be obtained to determine whether the customer service representative is involved in any violation.
[0109] In this embodiment, the voiceprint data to be tested is processed by a speaker recognition model to obtain frame-level features, which are then input into a speaker segmentation model for processing to obtain various predicted cluster sets, and then the various predicted cluster sets are respectively input into different speech recognition models, or are successively input into the same speech recognition model to obtain the identity information of the speaker corresponding to each predicted cluster set, thereby achieving speaker segmentation, clustering and identification, and further determining which speaker said what in each time period in the voiceprint data to be tested.
[0110] Of course, the above methods are only examples and are not limited to these.
[0111] It can be understood that the various embodiments given above can be implemented separately or in combination with each other.
[0112] The method provided by the embodiment of the present application is introduced above, and the device provided by the embodiment of the present application is introduced below.
[0113] Based on the same technical concept, see Fig. 9 , which is a structural diagram of a model training device provided in an embodiment of the present application, and the device includes modules / units / technical means for executing the method performed by an electronic device with processing capabilities in the above method embodiment.
[0114] Exemplarily, the device 900 may include:
[0115] The extraction module 901 is used to input the voiceprint data sample into the speaker recognition model for recognition processing, and obtain the frame-level features obtained during the recognition processing of the voiceprint data sample by the speaker recognition model;
[0116] The training module 902 is used to segment and cluster the frame-level features using the speaker segmentation model to obtain a predicted cluster set to which the frame-level features belong; the frame-level features included in the predicted cluster set are predicted to correspond to the first speaker identifier; based on the difference between the predicted cluster set and the label set, the speaker segmentation model is trained; the label set includes the frame-level features corresponding to the target speaker identifier, and the target speaker identifier is used to identify the speaker to which the voiceprint data sample belongs.
[0117] It should be understood that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.
[0118] Based on the same technical concept, see Fig.10 , is a structural diagram of a speaker segmentation device provided in an embodiment of the present application, and the device includes modules / units / technical means for executing the method executed by an electronic device with processing capabilities in the above method embodiment.
[0119] Exemplarily, the apparatus 1000 may include:
[0120] The extraction module 1001 is used to: input the voiceprint data to be tested into the speaker recognition model for recognition processing, and obtain the frame-level features obtained by the speaker recognition model in the process of recognizing the voiceprint data to be tested;
[0121] The segmentation module 1002 is used to: input the frame-level features into the speaker segmentation model for segmentation and clustering, and obtain at least one predicted cluster set to which the frame-level features belong; the frame-level features included in each predicted cluster set are predicted to correspond to the same speaker identifier;
[0122] The recognition module 1003 is used to: input at least one predicted cluster set into the speech recognition model to obtain the identity information of the speaker corresponding to each predicted cluster set.
[0123] It should be understood that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.
[0124] Based on the same technical concept, see Fig.11 The embodiment of the present application also provides an electronic device 1100, comprising: at least one processor 1101; and a communication interface 1103 communicatively connected to the at least one processor 1101; the at least one processor 1101 executes instructions stored in the memory 1102, so that the electronic device 1100 executes the method steps performed by the electronic device in the above method embodiment through the communication interface 1103.
[0125] Optionally, the memory 1102 is located outside the electronic device 1100 .
[0126] Optionally, the electronic device 1100 includes the memory 1102, the memory 1102 is connected to the at least one processor 1101, and the memory 1102 has instructions that can be executed by the at least one processor 1101. Fig.11 The dashed lines indicate that the memory 1102 is optional for the electronic device 1100 .
[0127] The at least one processor 1101 and the memory 1102 may be coupled via an interface circuit or may be integrated together, which is not limited here.
[0128] The specific connection medium between the at least one processor 1101, the memory 1102 and the communication interface 1103 is not limited in the embodiment of the present application. Fig.11 In the embodiment, at least one processor 1101, a memory 1102 and a communication interface 1103 are connected via a bus 1104. The bus 1104 is connected to Fig.11 The connection between other components is only for schematic illustration and is not intended to be limiting. The bus part can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.11 It is represented by only one thick line, but it does not mean that there is only one bus or one type of bus.
[0129] It should be understood that the processor mentioned in the embodiments of the present application can be implemented by hardware or by software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented by software, the processor can be a general-purpose processor implemented by reading software code stored in a memory.
[0130] Exemplarily, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0131] It should be understood that the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct RAM bus random access memory (DR RAM).
[0132] It should be noted that when the processor is a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, the memory (storage module) can be integrated into the processor.
[0133] It should be noted that the memory described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0134] Based on the same technical concept, an embodiment of the present application also provides a computer-readable storage medium, which is used to store instructions. When the instructions are executed, the computer executes the method steps executed by any device in the above method example.
[0135] Based on the same technical concept, an embodiment of the present application also provides a computer program product, including computer program code, which, when running on a computer, enables the computer to execute the above method, which is the method steps executed by any device in the embodiment.
[0136] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0137] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0138] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0139] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0140] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A model training method, characterized in that: include: Inputting the voiceprint data sample into a speaker recognition model for recognition processing, and obtaining frame-level features obtained during the recognition processing of the voiceprint data sample by the speaker recognition model; Segmenting and clustering the frame-level features using a speaker segmentation model to obtain a predicted cluster set to which the frame-level features belong; the frame-level features included in the predicted cluster set are predicted to correspond to a first speaker identifier; The speaker segmentation model is trained based on the difference between the predicted cluster set and the label set; the label set includes frame-level features corresponding to the target speaker identifier, and the target speaker identifier is used to identify the speaker to which the voiceprint data sample belongs.
2. The method according to claim 1, characterized in that Before the voiceprint data sample is input into the speaker recognition model for recognition processing, the method further includes: The student model is distilled and trained based on the voiceprint data training samples, the teacher model and the first loss function, and / or the student model is trained based on the voiceprint data training samples and the second loss function to obtain a speaker recognition model; wherein the teacher model and the student model both include N residual blocks; the residual blocks of the teacher model correspond to the residual blocks of the student model one-to-one, and for each group of corresponding residual blocks, the network width of the residual blocks in the teacher model is greater than the network width of the residual blocks in the student model; N is a positive integer.
3. The method according to claim 2, characterized in that The acquiring of frame-level features obtained during the process of the speaker recognition model performing recognition processing on the voiceprint data sample comprises: The speaker recognition model performs feature extraction on the voiceprint data sample to obtain a voiceprint vector output by the Nth residual block in the speaker recognition model; The voiceprint vector is used as the frame level feature.
4. The method according to claim 2, characterized in that The method of performing distillation training on the student model based on the voiceprint data training sample, the teacher model and the first loss function to obtain a speaker recognition model includes: Inputting the voiceprint data training sample into the teacher model and the student model; Obtaining an output vector of feature extraction of the voiceprint data training sample by each of the N residual blocks of the teacher model, and obtaining an output vector of feature extraction of the voiceprint data training sample by each of the N residual blocks of the student model; wherein, in the teacher model and the student model, the input of the latter residual block is the output of the previous residual block; and the input of the first residual block is the voiceprint data training sample; For each residual block of the teacher model, a first loss value between an input vector of the residual block and an input vector of a corresponding residual block in the student model is calculated based on the first loss function; and a second loss value between an output vector of the residual block and an output vector of a corresponding residual block in the student model is calculated based on the first loss function; Adjust parameters of the N residual blocks in the student model according to the first loss values and the second loss values of the N residual blocks in the teacher model.
5. The method according to claim 2, characterized in that The performing distillation training on the student model based on the voiceprint data training sample and the second loss function comprises: Obtaining a predicted speaker identifier output by the student model for speaker prediction of the voiceprint data training sample; Calculating a third loss value between the predicted speaker identifier and the speaker identifier corresponding to the voiceprint data training sample based on the second loss function; Adjust the parameters of the N residual blocks in the student model according to the third loss value until the third loss value converges.
6. A speaker segmentation method, characterized in that: The method comprises: Inputting the voiceprint data to be tested into a speaker recognition model for recognition processing, and obtaining frame-level features obtained during the recognition processing of the voiceprint data to be tested by the speaker recognition model; Inputting the frame-level features into a speaker segmentation model for segmentation and clustering to obtain at least one predicted clustering set to which the frame-level features belong; the frame-level features included in each predicted clustering set are predicted to correspond to the same speaker identifier; The at least one predicted cluster set is input into a speech recognition model to obtain the identity information of the speaker corresponding to each predicted cluster set.
7. A model training device, characterized in that: include: An extraction module is used to: input the voiceprint data sample into a speaker recognition model for recognition processing, and obtain frame-level features obtained during the recognition processing of the voiceprint data sample by the speaker recognition model; A training module is used to: use a speaker segmentation model to segment and cluster the frame-level features to obtain a predicted cluster set to which the frame-level features belong; the frame-level features included in the predicted cluster set are predicted to correspond to a first speaker identifier; based on the difference between the predicted cluster set and a label set, the speaker segmentation model is trained; the label set is the frame-level features corresponding to the target speaker identifier, and the target speaker identifier is used to identify the speaker to whom the voiceprint data sample belongs.
8. A speaker segmentation device, characterized in that: include: The extraction module is used to: input the voiceprint data to be tested into the speaker recognition model for recognition processing, and obtain the frame-level features obtained in the process of the speaker recognition model performing recognition processing on the voiceprint data to be tested; A segmentation module, used to: input the frame-level features into a speaker segmentation model for segmentation and clustering, and obtain at least one predicted clustering set to which the frame-level features belong; the frame-level features included in each predicted clustering set are predicted to correspond to the same speaker identifier; The recognition module is used to: input the at least one predicted cluster set into a speech recognition model to obtain the identity information of the speaker corresponding to each predicted cluster set.
9. An electronic device, characterized in that: The electronic device comprises at least one processor, and the at least one processor is used to implement the method according to any one of claims 1 to 5 or claim 6 when executing a computer program stored in a memory.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store instructions, and when the instructions are executed, the method according to any one of claims 1 to 5 or claim 6 is implemented.
11. A computer program product, characterized in that The computer program product comprises: a computer program code, and when the computer program code is run on a computer, the computer is enabled to execute the method according to any one of claims 1 to 5 or claim 6.
