# Ultrasonic Through-Metal Communication Based on Deep-Learning-Assisted Echo Cancellation
## 2 Materials and Methods
### Echo Cancellation Approach II: DPRNN  
In comparison to traditional recurrent neural networks (RNN), DPRNN is a recently proposed neural network algorithm with much higher computation efficiency for long sequence modeling [31; 32; 33; 34]. RNN readily suffers from gradient vanishing and explosion when handling long sequential data and exhibits long-term dependency. DPRNN handles long sequences in a unique way of segmenting them into shorter sub-sequences of fixed length. This network structure incorporates two types of RNN: an intra-chunk RNN in which the training within sub-sequence is conducted, and an inter-chunk RNN in which  
Figure 5: Internal structure of the LMS adaptive filtering. the modeling operation between sub-sequences is conducted, respectively, responsible for handling local and global information. Each RNN block receives only a small number of time steps throughout the entire sequence and thereby simplifies the optimization training. Considering that ultrasonic communication involves the transmission of long sequential signals, we pioneeringly take advantage of DPRNN as a reasonable approach for echo cancellation. As Figure 6 shows, the DPRNN architecture is comprised of three stages: segmentation, block processing, and overlap-add. In the first stage, the continuous input is divided into overlapped blocks, and then all these blocks are concatenated into a three-dimensional tensor. Secondly, the tensor is passed to stacked DPRNN blocks to iteratively perform local and global modeling. Finally, the output of the last layer is transformed into an output sequence through the overlap-add way. The segmentation operation divides continuous input signals with a feature dimension of \(N\) and a time step of \(L\) into overlapped blocks of length \(K\) and hop size \(P\), where \(K=2P\). This performance results in S blocks with equal size, denoted as \(D_{s}\in R^{N\times K}\), \(s=1,\ldots,S\). Subsequently, all the blocks are concatenated to form a 3D tensor \(T=[D_{1},\ldots,D_{S}]\in R^{N\times K\times S}\). Block processing takes the segmented output \(T\) and passes it through \(B\) DPRNN blocks. Each block accomplishes both intra- and inter-chunk processing, yielding another \(T_{b}\in R^{N\times K\times S}\) with the same shape as the input, where \(b=1,\ldots,B\). The intra-clunk RNN is kept bidirectional, and applied to the second dimension of \(T_{b}\):  
\[U_{b}=f_{b}(T_{b,s}) \tag{11}\]  
Here, \(U_{b}\in R^{H\times K\times S}\) is the output of the intra-chunk RNN, H is the hidden dimension of the RNN, and \(f_{b}(\cdot)\) is the mapping function. \(T_{b,s}=T_{b}[;\cdot,s]\in R^{N\times K}\), \(s=1,\ldots,S\) denotes the sequence corresponding of data block \(s\). The feature dimension of \(U_{b}\) is transformed to match that of \(T_{b}\) using a linear fully-connected (FC) layer, and then layer normalization (LN) is conducted to enhance generalization:  
\[LN\big{(}\hat{U}_{b}\big{)}=\frac{\hat{U}_{b}-\mu\big{(}\hat{U}_{b}\big{)}}{ \sqrt{\sigma\big{(}\hat{U}_{b}\big{)}+\epsilon}}\odot z+r \tag{12}\]  
where \(\hat{U}_{b}=(GU_{b,s}+m)\) is the transformed output, \(G\in R^{N\times H}\) and \(m\in R^{N\times 1}\) are, respectively, the weights and biases of the FC layer, \(z\) and \(r\in R^{N\times 1}\) are scaling factors, \(\mu(\cdot)\) and \(\sigma(\cdot)\) represent, respectively, the mean and variance of the 3D tensor, and \(\odot\) denotes the Hadamard product. A residual connection is established by adding the LN output to its input, formulated as \(\hat{T}_{b}=T_{b}+LN\big{(}\hat{U}_{b}\big{)}\). The intermediate tensor \(\hat{T}_{b}\) is then fed as the  
Figure 6: Block diagram of DPRNN algorithm  
input to the inter-chunk RNN.