A Dual-Path Framework with Frequency-and-Time Excited Network for Anomalous Sound Detection
Yucong Zhang Juan Liu Yao Tian Haifeng Liu Ming Li



[
    [
    September 9, 2024
=====================


§ ABSTRACT 
In contrast to human speech, machine-generated sounds of the same type often exhibit consistent frequency characteristics and discernible temporal periodicity. However, leveraging these dual attributes in anomaly detection remains relatively under-explored. In this paper, we propose an automated dual-path framework that learns prominent frequency and temporal patterns for diverse machine types. One pathway uses a novel Frequency-and-Time Excited Network (FTE-Net) to learn the salient features across frequency and time axes of the spectrogram. It incorporates a Frequency-and-Time Chunkwise Encoder (FTC-Encoder) and an excitation network. The other pathway uses a 1D convolutional network for utterance-level spectrum. Experimental results on the DCASE 2023 task 2 dataset show the state-of-the-art performance of our proposed method. Moreover, visualizations of the intermediate feature maps in the excitation network are provided to illustrate the effectiveness of our method.



Anomalous sound detection, squeeze and excitation, frequency pattern analysis, temporal periodicity analysis





§ INTRODUCTION



Anomalous sound detection (ASD) is a task to distinguish anomalous sounds from normal ones. It is useful to monitor a machine's condition and detect malfunctions of an operating machine before it is damaged. ASD is a challenging task and is often regarded as an unsupervised learning problem <cit.>, given the rare occurrence and high diversity of anomalous events. Furthermore, in real-world scenarios, machines may operate under different settings and environmental conditions, leading to potential domain shifts <cit.>, thereby increasing the difficulty of the ASD task.


To address the lack of anomalous data, conventional ASD systems adopt a generative method <cit.> to model the distribution of normal data. Recently, self-supervised methods <cit.> are getting more attention, which is widely adopted by top-ranked teams <cit.> in recent DCASE[DCASE: Detection and Classification of Acoustic Scenes and Events, <https://dcase.community>] challenges. These systems train a feature extractor on normal data to obtain expressive embeddings, and use distance metrics to assess the abnormality by comparing test embeddings with normal ones. Despite the success of these systems, the frequency patterns and temporal periodicity remain relatively under-explored when modeling machine sounds.



Some recent studies have investigated the efficacy of frequency patterns in machine-generated sounds. In DCASE 2022 Challenge, the first-ranking team <cit.> builds customized high-pass filters for individual machine types, enhancing ASD performance by applying them before the Mel filters. Additionally, experiments conducted by <cit.> demonstrate notable high-frequency characteristics produced by certain machine types. Nevertheless, these approaches rely on manually constructed filters to leverage frequency patterns, limiting their adaptability to new machine types.



To automatically explore the frequency patterns, one possible solution is to learn the patterns with deep learning. Recently, researchers in <cit.> have explored automated analysis of frequency patterns on top of their prior work <cit.>. They introduce a multi-head self-attention <cit.> to adaptively filter the log-Mel spectrogram. Their experimental results demonstrate the feasibility of integrating frequency pattern analysis into the training process of ASD.




In this paper, we propose a novel framework that leverages both the frequency and temporal characteristics. We use the framework from <cit.> as the backbone, dealing with both frame-level spectrogram and utterance-level spectrum. Different from <cit.>, we employ a Frequency-and-Time Excited Network (FTE-Net) in the spectrogram pathway to enrich the learnt representation by capturing salient patterns in both the frequency and time domains. To the best of our knowledge, our work is the first to integrate both frequency and temporal pattern analysis of a spectrogram within a deep-learning framework for machine ASD.





§ METHODS




Our proposed framework uses <cit.> as the backbone, integrating a 1D convolutional network for utterance-level spectrum and an FTE-Net for frame-level spectrogram. The FTE-Net incorporates a Frequency-and-Time Chunkwise Encoder (FTC-Encoder) and an excitation network. The overall structure of our method is depicted in Fig. <ref>. In section <ref>, we introduce the backbone framework <cit.> and briefly explain the difference between theirs <cit.> and ours. In section <ref>, we introduce the proposed FTE-Net module and explain in detail the FTC-Encoder and the excitation network in the module.




 §.§ Backbone framework



The backbone framework is a dual-path ASD framework <cit.>, designed to process both the frame-level spectrogram and utterance-level spectrum of machine-generated sounds in separate paths. The spectrum is processed by three 1D convolutional layers and five dense layers, and the spectrogram is processed by four ResNet <cit.> layers. Comparing to using only the spectrogram, empirical results from top-ranked teams <cit.> show that by adopting such dual-path structure that handles the spectrogram and spectrum separately can produce better results.

In this work, we replace the network used in the spectrogram pathway of <cit.> with a novel FTE-Net, aiming to learn frequency and temporal patterns.




 §.§ Frequency-and-Time Excited Network (FTE-Net)



The FTE-Net is a two-branch network. One branch employs an FTC-Encoder, and the other branch uses an excitation network. The FTC-Encoder allows the network to learn the potential patterns within small intervals of frequency or time, while the excitation network is used to filter out unrelated information and enhance the useful patterns in a global context.




  §.§.§ Frequency-and-Time Chunkwise Encoder (FTC-Encoder)






The FTC-Encoder is designed to process spectrogram data in a chunkwise manner, with separate pathways dedicated to handle frequency chunks and time chunks respectively. The goal of this module is to capture potential patterns within short frequency bands and time intervals. 

In the frequency pathway, the input spectrogram X∈ℝ^F × T is equally segmented into N overlapping frequency bands, denoted as f_i ∈ℝ^F/N× T. These frequency bands f_1, f_2, ⋯, f_N are subsequently merged to create a band-wise 3D feature matrix M_f ∈ℝ^N ×F/N× T. Finally, M_f is passed through a 2D convolution network (as shown in Table <ref>) to get the embedding z_f∈ℝ^d, with the number of chunks serving as the number of input channels. The first Conv2D and MaxPooling layer uses large kernel size, aiming to reduce the dimension of the input. The last MaxPooling layer is used to flatten the feature maps.

Similar strategies are applied to the dual pathway along the time axis, using the same structure after splitting the spectrogram into small time segments.




  §.§.§ Excitation network






The detailed structure of the excitation network is shown in Table <ref>. Modified squeeze-and-excitation (SE) <cit.> modules are integrated between ResNet blocks to form the excited block. While the conventional SE generates a mask (w_c) to adjust channel-wise feature maps, we introduce two additional masks, namely the frequency excitation mask (w_f) and the time excitation mask (w_t). As shown in Fig. <ref>, given an input x∈ℝ^C× H× W, where H and W are the dimensions along the frequency and time axis, the excitation map is formulated as follows:

    w_i = 1/1+exp(-(a_i· W^T+b)),   a_i=S_i(x)

where S_i is a 2D average pooling operation, cancelling out the dimension other than i. W and b are learning parameters. The output is aggregated using the excitation maps as follows:

    y = x + ∑_i∈{c,f,t} w_i(x)· x,

where w_c, w_f, and w_t represent the excitation masks for channel, frequency, and time respectively. 

As a result, the output embeddings (z_f,z_t) of the FTC-Encoder,  the embedding (z_s) of the excitation network are concatenated before passing to a linear layer to get the spectrogram embedding (z_gram). Meanwhile, the spectrum embedding (z_trum) is generated by the 1D convolutional network. To train the embeddings, z_gram and z_trum are stacked together, used as an input to a linear classifier to classify different machines.




§ EXPERIMENTS







 §.§ Dataset



The experiments are conducted on the DCASE 2023 Task 2 dataset <cit.>, which comprises audio clips from seven distinct machine types. Each machine type has roughly 1,000 audio clips, including 990 clips of source data and 10 clips of target data. Each audio clip lasts 6 to 18 seconds with a sampling rate of 16 kHz. The dataset includes a development dataset, an additional dataset, and an evaluation dataset. To compare with other systems in the challenge, 
the model is trained using the training portion of the development dataset and the additional dataset, while performance evaluation is conducted on the evaluation dataset. It is important to note that only normal machine sounds are used for training.




 §.§ Implementation details


For data processing, we use linear magnitude spectrograms and spectrum as the inputs. The spectrogram is obtained by Short-time Fourier Transform, with the sampling window size and hop length set to 1024 and 512 respectively. The entire signal is used to obtain the utterance-level spectrum. In our experiments, we repeat and clip the audio to force its length to be 18 seconds.

In terms of 



the training strategy, we use the sub-cluster AdaCos <cit.> as the loss function to train the model. Wave-level mixup <cit.> strategy is adopted as the data augmentation. We set the number of classes to match the joint categories of machine types and attributes. The model is optimized with the ADAM optimizer <cit.> with a learning rate of 0.001. We set the batch size to 64 and train the model for 100 epochs.

The ASD results are generated by measuring the cosine distance between the prototypes of normal embeddings with the test embeddings for each machine type. Each machine type has 26 prototypes, including 16 center embeddings generated by K-Means on the source domain, and all the 10 embeddings from the target domain. 

The results are evaluated using the official scripts[Official scripts available at <https://github.com/nttcslab/dcase2023_task2_evaluator>].  

Three commonly used metrics are adopted for evaluating the ASD performance in this paper: AUC, pAUC and the integrated scores. AUC is divided into source AUC and target AUC for the data in separate domains. pAUC is calculated as the AUC over a low false-positive-rate (FPR) range [0, 0.1]. The integrated score is the harmonic mean of AUC and pAUC across all machine types, which is the official score used for ranking.









 §.§ Performance comparison and ablation studies


We compare the performance of our proposed framework with the top 4 teams <cit.> in the DCASE 2023 challenge. As presented in Table <ref>, our method surpasses all teams across all evaluation metrics. Notably, our approach exhibits a superior performance with a 4.3% absolute improvement over the first-ranking team <cit.> and a substantial 10.22% absolute improvement over the official system <cit.> in terms of the integrated score. The self-implement baseline shown in the table is re-implementation of <cit.> with more ResNet blocks added to the spectrogram branch. The results indicate that the proposed FTE-Net leads to improvements in the overall ASD performance.

Moreover, we find that the proposed framework exhibits a noteworthy capacity for domain generalization. As observed in Table <ref>, despite a moderate reduction in the source AUC compared to the baseline system, our framework demonstrates a substantial improvement in terms of the target AUC. We argue that the inferior performance of the source AUC is likely attributed to overfitting of the baseline system to the source data, given that the source and target domains feature a highly imbalanced ratio. An indicator of the overfitting phenomenon in the baseline system is the significant disparity between the source and target AUC values presented in the table. In contrast, the proposed FTE-Net exhibits a relatively minor difference, showing its generalization ability.





To show the effectiveness of the individual modules in FTE-Net, we conduct some ablation studies. In Table <ref>, we show that the best performance is achieved by using all the modules. In Table <ref>, we conduct an excitation mechanism ablation study. Our findings demonstrate that employing more excitation maps results in improved performance. Notably, frequency excitation maps outperform time excitation maps in terms of ASD performance.








 §.§ Visualization analysis


To illustrate the impact of excitation mechanism in the excitation network, we present spectrogram comparisons before and after applying the excitation maps. In this example featuring a fan shown in Fig. <ref>, we observe that the original spectrogram undergoes enhancement both in terms of frequency and time, highlighting the effectiveness of our method. Particularly, in the frequency excitation map shown in Fig. <ref> (a), our network predominantly focuses on the high-frequency band, in accordance with the results given by recent discoveries <cit.>. This indicates that our method effectively generates excitation maps conducive to machine sound modeling.

From Fig. <ref> (a) and (b), frequency and temporal patterns can be highlighted. For example, despite the enhancement of the high frequency, some prominent frequency patterns in the middle range of the spectrogram are highlighted while some of them are filtered out. Additionally, despite the simple temporal periodicity, much more complicated temporal patterns within tiny time segments are shown. These patterns hold potential as features for analyzing sounds emitted by specific machine types in future research.




§ CONCLUSION



In our paper, we introduce a novel dual-path framework for anomaly detection in machine-generated sounds, which has the ability to leverage distinctive frequency and temporal patterns found in machine sounds. One pathway employs the Frequency-and-Time Excited Network (FTE-Net) to capture features across both frequency and time axes of the spectrogram. The other pathway utilizes a 1D convolutional network for utterance-level spectrum. The experiments on the DCASE 2023 task 2 dataset shows that our framework achieves state-of-the-art performance, demonstrating the effectiveness of leveraging dual attributes for machine ASD.












IEEEtran


