The speaker diarization task consists in establishing “who spoke when” in a given audio recording [25, 1]. Despite having been investigated for decades, diarization is still an unsolved problem in many real scenarios, as highlighted by the recent DIHARD I and DIHARD II challenges .
Typically, speaker diarization is addressed integrating several different components: voice activity detection, speaker change detection, feature extraction and clustering. Most of the research works in literature focus on extracting highly discriminative feature vectors. The first example in this direction are i-vectors[15, 6], which represent a given utterance with a single fixed-dimensional feature vector. The recent rise of neural paradigms has led to the introduction of a variety of approaches to extract the so-called speaker embeddings. These are, typically, derived from the outputs of the inner layers of a neural network trained on a speaker classification task . The most popular embeddings are d-vectors  and x-vectors [11, 24].
Conversely, not much progress has been done with regard to clustering. In most of the approaches, this stage is still based on the Agglomerative Hierachical Clustering (AHC)  in combination with Probabilistic Linear Discriminat Analysis (PLDA) scoring 
. Recently, spectral clustering, and variatioanl bayesian clustering [7, 8] have been introduced, showing promising result. Also, alternatives to the PLDA scoring have been introduced using neural networks that learn how to score two speech segments , using siamese networks  or Bi-LSTMs 
. Nevertheless, clustering remains unsupervised and heavily dependent on fine-tuned hyperparameters (e.g. thresholds to stop clustering).
Recently, efforts have been made to formulate clustering in a supervised learning framework [2, 10, 28]. Supervised clustering is attractive because it can be optimized on the diarization metrics directly, or learning context dependent parameters. Additionally, supervision allows to improve performance by learning from the increasing amount of data at our disposal. For example,  tackles the diarization problem as a classification task, while  uses a permutation invariant loss and a clustering loss to dynamically identify speakers. Both  and  assume that the number of speaker is known apriori or at least bounded. This assumption is removed in the UIS-RNN : a fully supervised approach which handles an unbound number of speakers using an online generative process. Speaker distributions are modelled with multiple instances of a parameter-sharing Recurrent Neural Network (RNN). A further, strong advantage of  over traditional clustering algorithms is the fact that decoding is online using beam search . Though online diarization had already been explored, using both unsupervised [12, 17, 9] and supervised  paradigms, the UIS-RNN stands out in terms of performance, outperforming the previous offline state of the art on telephone data.
Although these are very interesting results, an online system that works well across multiple domains still remains an open problem. As a matter of fact, diarization systems presented in the literature appear to work relatively well on domains with a low number of speakers and no overlapping speech, like telephone data, while performance tends to deteriorate in more challenging contexts such as meetings or dinner parties.
In this paper we present an evolution of the UIS-RNN , which substantially improves the performance. First of all, we introduce a new loss function for training the RNN that models speakers, which provides faster convergence, encouraging the network to find deeper minima, and generalizes better on the evaluation set. Secondly, we propose a semantically grounded formulation for the unseen speaker intervention probability that is easy to calculate and improves performance in inference. In addition we train on fixed-length speech segments, and let the neural network aggregate embeddings, removing the constraint on speaker change information in inference. Finally, we shed light on the performance of the proposed method with respect to the original UIS-RNN in a multi-domain scenario through extensive testing on the DIHARD datasets. We also make our results reproducible, since we use a publicly available embedding extractor and fully disclose our code111The first author performed this work as an intern at PerVoice and Fondazione Bruno Kessler. The implementation of this paper is available at: https://github.com/DonkeyShot21/uis-rnn-sml.
2 Proposed approach
Given a set of embeddings and the related speaker labels , where is the total number of observations, we can cast the diarization problem in a probabilistic framework, looking for the sequence of speaker labels that maximizes the joint probability:
where is a hidden binary indicator of speaker change and denotes all observations up to included. In the original definition of the UIS-RNN , the speaker change term of eq. 2 is modelled by a coin flipping process where the only parameter is , the transition probability. The speaker assignment term is implemented as a distance dependent Chinese Restaurant Processes (ddCRP) , a Bayesian nonparametric process that guides how speakers interleave in the time domain. Finally, the sequence generation part of eq. 2 is modelled using an RNN, specifically a Gated Recurrent Unit (GRU
), that parametrizes the distribution of embeddings assuming a Gaussian distribution as follows:
where is the averaged output of the neural network with parameters instantiated for speaker .
2.1 Original UIS-RNN training
Given a dataset , including sequences of embeddings and related label, the optimal set of network parameters can be obtained minimizing the following negative log likelihood :
Given speakers and permutations applied to the data for augmentation purposes, is a set of single speaker sequences, where each sequence is obtained by concatenating a random permutation of the embeddings generated by the -th speaker. and are respectively the length and the -th embedding of sequence .
Note that, since the sequences are shuffled, the network can not learn any causal relationship between observations and how to predict the next embedding. Basically, the network is trained to generate samples from an auxiliary distribution with expectation equal to . Therefore, the network will learn to predict the mean of the distribution of the embeddings. Figure 1 graphically describes the training presented in  and implemented in .
2.2 Sample Mean Loss training: UIS-RNN-SML
In this section we propose a modified loss that relies on more accurate targets for the network output. Rather than adjusting the network by comparing the mean of its outputs with the next observed embedding, we define a MSE loss with respect to the actual mean of the speaker embeddings of a given speaker. This results in defining a predictor of the mean of the embedding distribution, having seen only a small sample of it. More formally, we replace the MSE loss in eq. 5 with:
where is a function that maps each index to the embedding distribution of the speaker who generated the observations in .
In practice, the actual probability distribution of the embeddings is not available. In addition, given the limited amount of labelled data, using the bare mean over the sequence would lead to overfitting. Therefore, we build the ground truth for the network by estimating the mean over a collection of unseen samples we draw randomly with replacement from the permuted sequence itself. In formulas, given a generic sequenceand a subset of randomly sampled embeddings, we estimate the mean of the embeddings as: Eq. 6 is then rewritten leading to our Sample Mean Loss (SML) definition:
where we denote the ordered set as . Figure 2 depicts the proposed training approach for a generic sequence .
2.3 New speaker probability
One of the most interesting advantages of the UIS-RNN  over other supervised methods, like , is its ability to model an unbounded number of speakers. This is achieved using a ddCRP model  that provides the probability of switching back to a previously seen speaker proportionally to the number of turns of that speaker and accounts for the probability of a new speaker joining the conversation. Assuming speakers are numerated in order of appearance starting from , we let:
where is the number of blocks of contiguous utterances of speaker . The probability of switching to a new speaker is controlled by the parameter which is critical for the correct functioning of the whole framework: large values of force the model to over estimate the number of speakers, instantiating several networks; conversely small values result in limiting the number of speakers by merging clusters.
With respect to the estimation performed in , we propose the following analytical formulation for :
This formulation has the advantage that it can be derived from eq. 9
, and therefore it is semantically coherent with the role of the parameter. In addition, the value of the parameter is estimated straight from the data, independently of any the error metric or heuristic.
3 Experiments and results
We train and evaluate our method on the data used in the DIHARD-II challenge . The challenge features two audio input conditions: single channel and multi-channel. We focus on single channel data with reference Speech Activity Detection (SAD), as per the track 1 of the competition. The dataset is divided into two subsets, development and evaluation, each consisting of selections of 5-10 minute audio files sampled from 11 different conversational domains for a total of approximately 2 hours of audio.
Using stratified holdout, we further split the development set into training set (80%) and validation set (20%). Also, we randomize the holdout procedure, such that for every experiment we get a different data partitioning. Stratification is performed over the set of domains, according to their frequency in the whole development set.
Although the proposed approach does not handle cases where multiple speakers are active simultaneously, we do not exclude overlapping speech segment from the training material. In fact, we observed that considering multi-speaker segments as a separate speaker slightly improves performance.
3.2 Experimental setup
We use as speaker embeddings of our supervised diarization system x-vectors  using the pre-trained models available in the Kaldi diarization recipe . X-vectors with dimension 512 are extracted from non-overlapped 1 second speech segments and are subsequently reduced to dimension 200 with Principal Component Analysis (PCA) before feeding them to the model.
For what concerns the sequence generation component, our network resembles the architecture presented in . However, since we are using different features, x-vectors on fixed-length segments instead of d-vectors extracted from ground truth speaker segments, we explored several configurations varying the sizes of the layers. We found that reasonable results are obtained using one recurrent and one fully connected layer with 200 units each.
The other two parameters, and for the speaker change and the speaker assignment components respectively, are estimated using their analytical formulations. For the transition probability we apply the same formula as in , while for we use eq. 10
. We also explored some search based techniques for hyperparameter optimization, like grid search and line search, but we found they do not provide noticeable improvements in performance. Furthermore, the value for the variance of the observationsis optimized during training using Adam, as in .
Apart from the SML loss, two more regularization losses help the model to converge 
. The first one is a simple L2 loss on the parameters of the GRU, the second one uses an inverse gamma distribution to regularize the value ofthat would otherwise diverge to very large values.
In inference we use beam search with beam size . Unlike in , in our dataset we can not consider the number of speakers to be bounded. This makes inference expensive.
Networks are trained several times using Adam optimizer and the best model is selection by measuring the Diarization Error Rate (DER) on the validation set, using a smaller beam width () to reduce the computational cost.
DER is measured using dscore , the official scoring tool of DIHARD-II competition which does not account for any forgiveness collar, considering also overlapped speech segment. However, since none of the methods under evaluation handle overlapped speech we also report performance without overlap.
|Method||DER||DER - no overlap|
|Cum. mean + beam search||34.0||26.7|
|UIS-RNN + eq.10||30.3||22.8|
|UIS-RNN-SML + eq.10||27.3||19.4|
|PLDA + AHC  (offline)||26.1||17.7|
Table 1 reports the performance of our proposed UIS-RNN-SML, based on SML and estimation, in comparison against two online baselines. The first one is a naïve implementation in which the GRU is replaced by a simple cumulative mean of the embeddings (Cum. mean + beam search in Table 1). This naïve baseline helps highlighting the contribution of the neural network, disentangling it from the other components of the framework. The second is the original UIS-RNN , using the implementation provided in . To give an idea of how difficult the task is, we also report the offline baseline provided in the DIHARD-II challenge , which performs diarization by scoring the x-vectors with PLDA , and clustering using AHC .
The naïve implemenation based on cumulative mean with beam search is outperformed by the UIS-RNN by a large margin, with and without overlapping speech segments. This confirms that the simple mean of a partial sequence of embeddings does not properly model the speaker and that the neural network makes an active contribution. A further small but significative DER reduction, both with and without overlap, with respect to the original implementation is provided by estimating with eq. 10 (third row in Table 1).
Finally, a larger leap in performance is achieved by replacing the original loss function with the SML we proposed. Note that the UIS-RNN-SML achieves similar performance to the offline baseline used in DIHARD-II , although online unsupervised clustering algorithms usually perform significantly worse than offline clustering algorithms. The performance improvement is due the regularizing effect introduced by the SML in training. We observed that, keeping learning rate and batch size fixed, training with SML is much less noisy than the original one: using the more accurate supervision given by the sample mean results in better gradients, which in turn helps convergence to deeper minima. The stabilizing effect of the SML is evident in Fig. 4 where we report the variance of the means of the speaker clusters generated by the network during training. Models trained with eq. 7 exhibit less output variance compared to those trained with eq. 5. This behaviour turns out to be very beneficial in the decoding phase when the means of the clusters should not change dramatically while the sequence unfolds.
For a better understanding of the behaviour of our proposed method, Fig. 3 reports the DER for each context in the dataset. Our method is better than the original UIS-RNN in all the most challenging contexts, except for “socio field” and “child”, where our performance is basically aligned to the other methods. We observe a small performance deterioration in “Audiobooks”. This occurs because the UIS-RNN-SML, predicting the mean more accurately, produces slightly smaller values for the cluster variance . Although this is beneficial in most cases, it can marginally reduce performance in contexts with very low number of speakers. This disadvantage can be partially alleviated by defining context dependent and .
Finally we evaluate the impact of the number of samples used to estimate the mean of the distribution. Fig. 5 shows the DER on the whole evaluation set for different values of . On these data, provides the lower DER, but values from 2 to 4 produce very similar results. Unsurprisingly, performance degrades using larger values for , due to overfitting, because the sample mean approximates the real mean too tightly. Note that the case
would be equivalent to the UIS-RNN except for the fact that observations are sampled with replacement. This gives a considerable improvement (27.83% against 30.3%) because outliers of the speaker clusters are less likely to be observed by the network as targets during training, reducing the overall variance of the output.
In this paper we presented an evolution of a supervised speaker diarization system where the clustering module is replaced by a trainable model called unbounded interleaved-state RNN. Specifically, we proposed a modified loss function that stimulates the neural network to model speakers more accurately. In addition, we introduced a semantically grounded formulation for the estimation of the parameter that controls the speaker assignment probability. We evaluated the proposed online diariaztion approach on the DIHARD-II multi-domain data, showing, through extensive experiments, that it outperforms the original UIS-RNN formulation. Finally, we fully disclose our code and trained models to make our results reproducible.
-  (2012-02) Speaker diarization: a review of recent research. IEEE Transactions on Audio, Speech, and Language Processing 20 (2), pp. 356–370. Cited by: §1.
-  (2017) Deep learning approaches for online speaker diarization. Cited by: §1.
Distance dependent chinese restaurant processes.
Journal of Machine Learning Research12 (Aug), pp. 2461–2488. Cited by: §2.3, §2.
-  (2005-06) Learning a similarity metric discriminatively, with application to face verification. In , Vol. 1, pp. 539–546 vol. 1. Cited by: §1.
-  (2018) VoxCeleb2: deep speaker recognition. In INTERSPEECH, Cited by: §1.
-  (2011) Front-end factor analysis for speaker verification. IEEE Transactions on Audio, Speech, and Language Processing 19 (4), pp. 788–798. Cited by: §1.
-  (2018-06) Speaker diarization based on bayesian hmm with eigenvoice priors. In Speaker Odissey, pp. 147–154. Cited by: §1.
-  (2019) Bayesian HMM Based x-Vector Clustering for Speaker Diarization. In INTERSPEECH, pp. 346–350. External Links: Cited by: §1.
-  (2017) Developing on-line speaker diarization system. In INTERSPEECH, Cited by: §1.
-  (2019-09) End-to-end neural speaker diarization with permutation-free objectives. INTERSPEECH. External Links: Cited by: §1, §2.3.
-  (2017) Speaker diarization using deep neural network embeddings. In International Conference on Acoustics, Speech and Signal Processing, pp. 4930–4934. Cited by: §1.
-  (2010) GMM-UBM based open-set online speaker diarization. In Eleventh Annual Conference of the International Speech Communication Association, Cited by: §1.
-  Official library for the Unbounded Interleaved-State Recurrent Neural Network (UIS-RNN) algorithm. Note: https://github.com/google/uis-rnn (Oct. 2019) Cited by: §2.1, §2.1, §3.2, §3.3, Table 1.
Strategies to improve the robustness of agglomerative hierarchical clustering under data source variation for speaker diarization. IEEE Transactions on Audio, Speech, and Language Processing 16 (8), pp. 1590–1601. Cited by: §1, §3.3.
-  (2008) A study of interspeaker variability in speaker verification. IEEE Transactions on Audio, Speech, and Language Processing 16 (5), pp. 980–988. Cited by: §1.
-  (2019) LSTM Based Similarity Measurement with Spectral Clustering for Speaker Diarization. In INTERSPEECH, pp. 366–370. Cited by: §1.
-  (2018) Links: a high-dimensional online clustering method. arXiv preprint arXiv:1801.10123. Cited by: §1.
-  (1977) Speech understanding systems: report of a steering committee. Artificial Intelligence 9 (3), pp. 307 – 316. Cited by: §1.
-  dscore, official scoring tool for DIHARD-II. Note: https://github.com/nryant/dscore (Oct. 2019) Cited by: §3.2.
-  (2006) A spectral clustering approach to speaker diarization. In Ninth International Conference on Spoken Language Processing, Cited by: §1.
The kaldi speech recognition toolkit.
Workshop on Automatic Speech Recognition and Understanding, Cited by: §3.2.
-  (2019) The Second DIHARD Diarization Challenge: Dataset, Task, and Baselines. In INTERSPEECH, pp. 978–982. External Links: Cited by: §1, §3.1, §3.3, §3.3, Table 1.
-  (2014) Speaker diarization with PLDA i-vector scoring and unsupervised calibration. In Spoken Language Technology Workshop, pp. 413–417. Cited by: §1, §3.3.
-  (2018) Diarization is hard: some experiences and lessons learned for the JHU team in the inaugural DIHARD challenge. In INTERSPEECH, pp. 2808–2812. External Links: Cited by: §1, §3.2.
-  (2006) An overview of automatic speaker diarization systems. IEEE Transactions on audio, speech, and language processing 14 (5), pp. 1557–1565. Cited by: §1.
-  (2014) Deep neural networks for small footprint text-dependent speaker verification. In International Conference on Acoustics, Speech and Signal Processing, pp. 4052–4056. Cited by: §1.
-  (2018) Speaker diarization with lstm. In International Conference on Acoustics, Speech and Signal Processing, pp. 5239–5243. Cited by: §1.
-  (2019) Fully supervised speaker diarization. In International Conference on Acoustics, Speech and Signal Processing, pp. 6301–6305. Cited by: §1, §1, §2.1, §2.1, §2.3, §2.3, §2, §3.2, §3.2, §3.2, §3.3, Table 1.
-  (2018) Self-attentive speaker embeddings for text-independent speaker verification. In INTERSPEECH, pp. 3573–3577. Cited by: §1.