Graph neural networks for sound source localization on distributed
  microphone networks
Distributed Microphone Arrays (DMAs) present many challenges with respect to
centralized microphone arrays. An important requirement of applications on
these arrays is handling a variable number of input channels. We consider the
use of Graph Neural Networks (GNNs) as a solution to this challenge. We present
a localization method using the Relation Network GNN, which we show shares many
similarities to classical signal processing algorithms for Sound Source
Localization (SSL). We apply our method for the task of SSL and validate it
experimentally using an unseen number of microphones. We test different feature
extractors and show that our approach significantly outperforms classical
baselines.
Eric Grinstein, Mike Brookes, Patrick A. Naylor
# Graph Neural Networks for Sound Source Localization on Distributed Microphone Networks

###### Abstract

Distributed Microphone Arrays (DMAs) present many challenges with respect to centralized microphone arrays. An important requirement of applications on these arrays is handling a variable number of input channels. We consider the use of Graph Neural Networks (GNNs) as a solution to this challenge. We present a localization method using the Relation Network GNN, which we show shares many similarities to classical signal processing algorithms for Sound Source Localization (SSL). We apply our method for the task of SSL and validate it experimentally using an unseen number of microphones. We test different feature extractors and show that our approach significantly outperforms classical baselines.

Eric Grinstein 1, Mike Brookes, Patrick A. Naylor Department of Electrical and Electronic Engineering, Imperial College London, U.K.

Footnote 1: Contact: e.grinstein@imperial.ac.uk

Footnote 2: This project has received funding from the European Union’s Horizon 2020 research and innovation programme under the Marie Słodowska-Curie grant agreement No 956369

## 1 Introduction

Distributed Microphone Array (DMA) signal processing [1] is an active field in the acoustic signal processing community, with important applications in speech enhancement, noise reduction and Sound Source Localization (SSL) [1, 2, 3]. In contrast to centralized microphone arrays [4], DMAs may be created through the wireless connection of multiple distributed devices such as cell phones, laptops and virtual assistants. In this context, they are also frequently referred to as Ad-hoc microphone arrays, or Wireless Acoustic Sensor Networks (WASNs).

Although DMAs bring advantages in terms of acoustic coverage with respect to centralized arrays, they also bring challenges. One such challenge forms the focus of this paper, namely, having a dynamic number of input microphone channels, as a DMA may be created using the devices present in a dynamic scene. This number may change in runtime due to many reasons, including software or hardware failures of individual devices, battery depletion, or the device being removed from the scene. This restricts the application of many of the deep learning methods that have been successfully applied to centralized microphone networks such as [5, 6], which require a static input size. Conversely, classical SSL approaches such as [7] are able to function on an arbitrary number of microphones.

In this work, we propose the use of Graph Neural Networks (GNNs) [8, 9, 10] as a suitable way of processing DMA signals for the task of SSL. We adopt a GNN variant called the Relation network (RelNet) [10]. We validate our approach for the task of localizing a single static source in multiple scenarios, showing it to outperform the baselines. The main contribution of this work is the first application of GNNs for the task of SSL, allowing our method to handle a variable number of microphone channels. Furthermore, our approach can work on unseen microphone coordinates and room dimensions through a metadata fusion procedure.

This paper continues by providing a problem statement in Sec. 2. Sec. 3 includes a review of related work on DMAs using deep learning, as well as a review of classical SSL methods and the RelNet GNN, which serve as building blocks for our model. In Sec. 4, we describe our proposed approach. Sec. 5 describes our experimental validation, and Sec. 6 presents the results and Sec. 7 concludes the paper.

Figure 1: (a): Example of a graph of distributed microphones. (b): Representation of the GNN-SLF model for three microphones. The computation of the heatmaps is described in Sec. 4.
## 2 Problem Statement

Our goal is to estimate the 2D coordinates \(\hat{\mathbf{p}}_{s}\) of a sound source located at \(\mathbf{p}_{s}=[p_{s}^{x}\,p_{s}^{y}]^{T}\) within a reverberant room of known dimensions \(\mathbf{d}=[d^{x}\,d^{y}\,d^{z}]^{T}\). The source emits a special signal \(s(t)\) at instant \(t\). Besides the source, \(M\) microphones are present in the room, where microphone \(m\) has a known position \(\mathbf{p}_{m}=[p_{m}^{x}\,p_{m}^{y}\,p_{m}^{z}]^{T}\), and receives a signal \(x_{m}(t)\) modeled as

\[x_{m}(t)=a_{m}s(t-\tau_{m})+\epsilon_{m}(t), \tag{1}\]

where \(a_{m}\) is a scaling factor representing the attenuation suffered by the wave propagating from \(\mathbf{p}_{s}\) to \(\mathbf{p}_{m}\). \(\tau_{m}\) represents the time delay taken for a sound wave to propagate from the source to the microphone, and \(\epsilon_{m}\) models the noise and reverberation. We assume \(\tau_{m}\) to be equal to \(c^{-1}\|\mathbf{p}_{m}-\mathbf{p}_{s}\|_{2}\), the distance between the source and the microphone divided by the speed of sound \(c\).

In our method and baselines, the microphone signals are sampled and processed in frames of size \(L\), defined as \(\mathbf{x}_{m}(t)=[x_{m}(t-(L-1)T_{s})...x_{m}(t)]^{T}\), where \(T_{s}\) is the sample period. Finally, we also define a metadata vector \(\mathbf{\phi}\) as

\[\mathbf{\phi}=[p_{1}^{x}\,p_{1}^{y}...d^{y}\,d^{z}]^{T}, \tag{2}\]

which serves as a secondary input to our method, allowing it to function on any room dimensions and microphone coordinates.

## 3 Related Work

### Classical SSL methods

Our proposed method can be seen as a generalization of classical grid-based SSL methods such as the Time-Difference-of-Arrival (TDOA) [11, 12], Spatial Likelihood Function (SLF) [7, 13] and energy-based [14] approaches. These approaches share many similarities, which are summarized by their shared behaviour described in Alg. 1.

```
functionestimate_source_location(\(\mathbf{X},\mathbf{\phi}\)) \(\mathbf{u}\leftarrow\mathbf{0}\) for each\(i\in[1..M]\)do for each\(j\in[(i+1)..M]\)do \(\mathbf{u}\leftarrow\mathcal{F}(\mathbf{x}_{i},\mathbf{x}_{j};\mathbf{\phi}(i,j))\) return\(\mathcal{G}(\mathbf{u})\)
```

**Algorithm 1** Classical SSL methods

Alg. 1 starts with the creation of an empty grid \(\mathbf{u}\), which we assume to be a flattened 2D for our applications. The next step consists of computing a _relation_\(\mathcal{F}\) between each pair of microphones \((i,j)\) available, using their signals \((\mathbf{x}_{i},\mathbf{x}_{j})\) as well as the _metadata_ available \(\mathbf{\phi}\), consisting of the microphone and room dimensions and the speed of sound. These relations consist of assigning, for each cell within the grid, a value expressing how likely a source is to be in a particular grid cell.

The relations between all pairs are aggregated through summation (or multiplication, see [13]) to generate a heatmap gathering all pairwise information. Depending on whether the problem is formulated using a Least-Squares (LS) or Maximum Likelihood (ML) approach, the minimum or maximum value of the grid will respectively correspond to the location of the source [11]. \(\mathcal{G}\) is therefore a peak-picking function, whose goal is to select the grid cell where the source is located.

The TDOA, SLF and energy-based methods differ mainly by the function \(\mathcal{F}\) computed. Each cell within the grid represents a candidate source location which has a theoretical TDOA between the two microphones. In the TDOA method, each grid cell is assigned the distance between its theoretical TDOA and the measured TDOA, computed by picking the peak of the generalized cross-correlation function between the microphones' signals, typically computed using the Generalized Cross-Correlation with Phase Transform (GCC-PHAT) [15].

In the SLF method, each cell receives the cross-correlation value at the lag corresponding to its TDOA. SLF is shown to be equivalent to Steered Response Power (SRP) [16]. Finally, the energy-based method uses a metric based on the ratio of the two microphone signals' energies. In Fig. 0(a), the edges of the graph represent maps computed using the SLF method.

### Neural network methods for DMA signal processing

Classical SSL methods normally do not account for room reverberation, which may divert the heatmap's peak from the true source location, or reduce its sharpness. Neural networks can become robust to reverberation if trained on suitable scenarios. Here we review works on neural networks for DMAs.

In [17], an attention-based neural network capable of handling connection failures is proposed for the task of speech enhancement. Unlike our method, this network is limited to a maximum number of input microphones channels. In [18] and [19], variable-input processing is achieved through a global average pooling scheme.

Two works have explored GNNs for acoustic signal processing. In [20], a GNN is used to profile noise within a railway setting. However, their work the source signal to be known beforehand, limiting its application in many scenarios. This restriction is not present in our proposed approach. In [2], a Graph Convolutional Network (GCN) [21] is used in con
junction with an encoder-decoder network for the task of speech enhancement. Conversely, we do not use an encoder-decoder and explore the Relation Network GNN, which we show to be well suited for the task of SSL.

### Relation Networks

We choose the Relation network (RelNet) [10] as our graph network architecture due its conceptual similarities to classical SSL methods. RelNets were introduced in the context of visual question answering. The input of the network consists of a set of _nodes_, represented by feature vectors \(\mathbf{X}=\{\mathbf{x}_{1},\mathbf{x}_{2},...,\mathbf{x}_{M}\}\). The network \(\mathcal{RN}\) may be summarized as

\[\hat{\mathbf{y}}=\mathcal{RN}(\mathbf{X})=\mathcal{G}\bigg{(}\sum_{i\neq j}\mathcal{F }(\mathbf{x}_{i},\mathbf{x}_{j})\bigg{)}, \tag{3}\]

where (3), \(\mathcal{F}\) generates a _relation_ between nodes \((i,j)\). These relations are summed together, and this sum is the input to \(\mathcal{G}\), which produces the answer \(\hat{\mathbf{y}}\) to the target question. The nodes \(\mathbf{x}_{i}\) and the relations \(\mathcal{F}(\mathbf{x}_{i},\mathbf{x}_{j})\) can be seen as a complete undirected graph \(\mathbf{G}=(\{\mathbf{x}_{i}\},\{\mathcal{F}(\mathbf{x}_{i},\mathbf{x}_{j})\})\). As in [10], we implement both \(\mathcal{F}\) and \(\mathcal{G}\) as Multi-layer Perceptrons (MLPs), trained jointly using backpropagation.

## 4 Method

A diagram of our proposed network is shown in Fig. 1. Using a RelNet allows our approach to first process pairs of microphone signals into features, and later combine them through summation. This allows it to function on a variable number of input microphones. Furthermore, our method can operate on unknown room dimensions and microphone coordinates by combining this metadata \(\mathbf{\phi}\) before estimating the source location.

The input to our method consists of the set of \(M\) microphone signal frames \(\{\mathbf{x}_{m}\}\), where \(\mathbf{x}_{m}\) is a vector of size \(L\) representing a frame of recordings, and a metadata vector \(\mathbf{\phi}\) containing relevant information such as the microphone coordinates and room dimensions. We define the relation function \(\mathcal{F}\) as

\[\mathcal{F}(\mathbf{x}_{i},\mathbf{x}_{j};\mathbf{\phi})=\text{MLP}(\mathcal{H}(\mathbf{x}_{i },\mathbf{x}_{j};\mathbf{\phi})), \tag{4}\]

Where MLP is a multi-layer perceptron and \(\mathcal{H}\) is a preprocessing or feature extraction function. The inclusion of a preprocessing function allows us to use the classical features such as GCC-PHAT or SLF. Conversely, post-processing these functions using a MLP allows us to improve these features by introducing learned rules, as we will show for the application of SSL.

In turn, the relation fusion function is chosen as \(\mathcal{G}(\mathbf{u})=\text{MLP}(\mathbf{u})\), where \(\mathbf{u}\) represents the sum of all pairs of relations as in Alg. 1. This function is a substitution of the peak-picking algorithm in Alg. 1, expanding its functionality for other possible applications.

As in [10], we train the weights \(\mathbf{w}_{\mathcal{F}}\) and \(\mathbf{w}_{\mathcal{G}}\) of the MLPs in \(\mathcal{F}\) and \(\mathcal{G}\) jointly through a gradient-based procedure, by minimizing an application-specific loss function \(\mathcal{L}(y,\hat{y})\) between the network output \(\hat{y}\) and target \(y\):

\[\begin{split}\mathbf{w}_{\mathcal{F}}&=\mathbf{w}_{ \mathcal{F}}-\lambda_{\mathcal{F}}\frac{\partial\mathcal{L}(\mathbf{y},\hat{\mathbf{y} })}{\partial\mathbf{w}_{\mathcal{F}}}\\ \mathbf{w}_{\mathcal{G}}&=\mathbf{w}_{\mathcal{G}}-\lambda_{ \mathcal{G}}\frac{\partial\mathcal{L}(\mathbf{y},\hat{\mathbf{y}})}{\partial\mathbf{w}_{ \mathcal{G}}},\end{split} \tag{5}\]

Where \((\lambda_{\mathcal{F}},\lambda_{\mathcal{G}})\) are the learning rates, usually defined by the optimizer used, such as Adam [22].

We experiment with two preprocessing functions \(\mathcal{H}\) for our relation function \(\mathcal{F}\). The first is the cross-correlation between the two microphones, computed using the GCC-PHAT method. In this case, the network needs to learn to map time lags into space. As an alternative, we project the cross-correlation into space using the SLF method. The output of this method is a flattened \(N\times N\) grid or a \(N^{2}\) vector. In this case, the network needs to learn to denoise the maps which may have been corrupted by reverberation.

A final step in the feature extraction step is concatenating the microphone coordinates of the pair as well as its room dimensions into the features. This is especially important for the GCC-PHAT feature extractor, as the network must learn how to project the temporal information into space.

The target of the MLP of function \(\mathcal{G}\) is to further enhance the summed maps produced by \(\mathcal{F}\). Its output has the same size as \(\mathcal{F}\), representing a flattened \(N\times N\) grid of cells centered at coordinates \(\{\mathbf{p}_{u,v}\}\) within the room. The target value \(y(u,v)\) of each grid cell \((u,v)\) is computed as

\[y(u,v)=e^{-\|\mathbf{p}_{u,v}-\mathbf{p}_{s}\|_{2}}, \tag{6}\]

where \(\mathbf{p}_{s}\) is the target source location. Note the maximum value of 1 occurs when \(\mathbf{p}_{u,v}=\mathbf{p}_{s}\) and approaches 0 exponentially as the distance between \(\mathbf{p}_{u,v}\) and \(\mathbf{p}_{s}\) increases. We use the mean absolute error between the network output and target as our loss function. This formulation allows for detection of multiple sources, which can be extracted through peak-picking. However, in this work, we focus on the detection of a single source.

## 5 Experimentation

This section describes our experiments with our proposed network for SSL described in the previous section. We refer to our proposed methods as GNN-GCC for the network using the GCC-PHAT feature
extractor and GNN-SLF for the one using the SLF extractor. We compare our approach with two baselines, the classical Time-Difference-of-Arrival (TDOA)-based and Spatial Likelihood Function (SLF)-based approaches, as described in Sec. 3. We provide a public repository containing all methods on Github 1

Footnote 1: [https://github.com/egrinstein/gnn_ssl](https://github.com/egrinstein/gnn_ssl)

### Dataset

We test our approach using synthetically generated data using the image source method [23], generated using the Pyroomacoustics library [24]. To demonstrate that our approach is able to operate with a different number of microphones than it was trained on, the training set for our GNN uses training examples containing \(\{5,7\}\) microphones, while the test set examples contain \(\{4,5,6,7\}\) microphones.

For each dataset sample, we randomly select two numbers from a uniform distribution in the interval [3, 6] m representing the room's width and length. The room's height is uniformly selected from the interval [2, 4] m. The room's reverberation time is sampled uniformly from the interval [0.3, 0.6] s using Eyring's formula [25]. We place the microphones and source randomly within the room, with the restriction of each device being at least 0.5 m from each other and the room's walls. Each source is set to play a speech sample from the VCTK corpus [26]. The Signal-to-Noise Ratio (SNR) in each microphone is set at 30 dB, simulated by adding White Gaussian Noise (WGN) independently to each channel to the auralizations generated using the image source method. The training, validation and test datasets contain respectively 15,000, 5000 and 10,000 examples.

### Method hyperparameters

We train the networks for a maximum of 100 epochs with early stopping if the validation loss stops increasing after 3 epochs. We employ a learning rate of 0.0005 using the Adam optimizer [22]. We use a batch size of 32. These parameters were chosen empirically. All grids used are of dimensions \(25\times 25\). Our input frame size used is L=500 ms. For the GCC-PHAT method, we use a Discrete Fourier Transform (DFT) of \(1,024\) samples. Since the maximum TDOA value is bounded by the room's diagonal, we only select the central 200 correlation bins, similar to [27]. In our proposed method, our relation function's MLP contains 3 layers, each of output size 625. The function \(\mathcal{G}\)'s MLP consists of 3 layers, all with an output size of 625 neurons. We use a ReLU activation function for all layers except for the output, which uses no activation.

The grids computed in the SLF and TDOA baselines as well as the feature extractor in the GNN-SLF method have a size of \(25\times 25\). The source estimation procedure in the baselines and proposed methods consists of picking the location of the highest value in the SLF method, and the lowest on in the SLF method.

## 6 Results

The metric used to evaluate the methods consists of the mean euclidean distance between the estimated and true source location on the test set. The results are shown in Fig. 2. Note that although we test all methods on unseen simulations containing \(\{4,5,6,7\}\) microphones, our method was only trained using examples containing \(\{5,7\}\) microphones. To ensure a fair comparison, the networks were trained multiple times. The black bars show their standard deviation.

We can see that the GNN-SLF method outperforms all others, demonstrating the effectiveness of the approach. The biggest relative improvement of 29% with respect to classical SLF is observed for four microphones. An explanation is that when there are fewer measurements available improving or discarding them becomes crucial, which may be the operation being performed by the network. We also see that GNN-GCC performed poorly, only surpassing the TDOA baseline. This indicates that requiring the network to learn to map time delays to spatial position is a more demanding task than dealing with the already spatialized information.

## 7 Conclusion and Future Work

We applied the RelNet, a type of GNN for the task of SSL on distributed microphone arrays. Our results show the RelNet is able to significantly improve the localization performance over classical localization algorithms, achieving a 29% improvement in the case of 4 microphones. We also show the method generalizing to an unseen number of microphones. Future directions include testing approach for localizing multiple sources and learning graph topologies different than the complete graph.

Figure 2: Localization error for our proposed methods and baselines.