# You Only Hear Once: A YOLO-like Algorithm for Audio Segmentation and Sound Event Detection
## 2 You Only Hear Once (YOHO)
### Network Architecture  
The network architectures used by different versions of YOLO [22; 29] were large and not suitable for our smaller training datasets. Therefore, we adapted the MobileNet architecture [30] for our task. We modified the final layers of MobileNet to realize the YOHO algorithm. MobileNet has also been employed for audio classification by YamNet [31], which only detects audio classes, but not their segmentation boundaries.  
As shown in Table 1, YOHO is purely a convolutional neural network (CNN). We divide the table into two parts--the upper half comprising the original layers of the MobileNet architecture and the bottom half containing the layers that we have added. We use log-mel spectrograms as input features. The input dimension depends on the duration of the audio example and specifications of the mel spectrogram. Here, we explain the  
Figure 1: A comparison of segmentation-by-classification and YOHO.  
network for music-speech detection, whose input contains 801 times steps and 64 frequency bins. After reshaping the mel spectrogram to 801 \(\times\) 64 \(\times\) 1, we perform a 2D convolution with a stride of 2. Hence, the time dimension and frequency dimension are reduced by half. The MobileNet architecture uses many depthwise-separable convolutions [32] with 3 \(\times\) 3 filters followed by pointwise convolutions with 1 \(\times\) 1 filters. All convolutions except the final layer were fitted with ReLu activations and batch normalization [33]. Each time we adopt a stride of 2, there is a reduction in the time and frequency dimensions. As shown in the lower half of Table 1, we gradually reduce the number of filters from 1024 to 256.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Layer Type** & **Filters** & **Shape/Stride** & **Output Shape** \\ \hline Reshape & - & - & 801 \(\times\) 64 \(\times\) 1 \\ \hline Conv2D & 32 & 3 \(\times\) 3/2 & 401 \(\times\) 32 \(\times\) 32 \\ \hline Conv2D-dw & - & 3 \(\times\) 3 & 401 \(\times\)  
Subsequently, we flatten the last two dimensions. The final layer is a 1D convolution with six filters. The output shape is 26 \(\times\) 6, where 26 stands for the number of time steps. This layer is similar to a convolutional implementation of sliding windows [34] along the time dimension. At each time step, the first neuron performs a binary classification that detects the presence of an acoustic class. The second and third neurons perform regression for the start and endpoints for the respective acoustic class. Figure 2 illustrates the output layer of the YOHO algorithm.  
In this context, we are dealing with two acoustic classes--music and speech. Therefore, the output has six neurons at each time step. For example, if the length of an audio example is 8 s, each time step in the output corresponds to 0.307 s because there are 26 divisions. We applied sigmoid activations for all neurons in the output layer. Hence, we normalized the regression outputs between 0 and 1. Moreover, even if the input shape of the neural network is different, for example \(257\times 40\), the neural network and the parameters of convolutional layers still remain exactly the same. The only difference would be the output shape of the neural network, which depends on the number of time steps in the input and the number of unique audio classes in the output.