Detection and Classification of Acoustic Scenes and Events 2022

Challenge

CNN-BASED ANOMALOUS SOUND DETECTION SYSTEM FOR DOMAIN
GENERALIZATION
Technical Report
Hiroki Narita
Aichi Institute of Technology
Graduate School of Business
Administration and Computer Science
Aichi, Japan
hirokin1999@outlook.jp
ABSTRACTThis paper is a technical report for DCASE Challenge 2022 Task 2.
Our submitted model consists of a self-supervised CNN model thatpredicts attribute information. We have ensembled three models
but have not changed the architecture, and have achieved performance improvement only by changing the data augmentation, training method, and anomaly detection method. Self-supervised learning with label information has been a powerful method in previous anomaly detection competitions, and we argue that it is equally
powerful in this competition.
Index Terms— anomalous sound detection, self supervised
learning, domain generalization, DCASE Challenge 2022 Task2
1. INTRODUCTION
The main objective of DCASE Challenge 2022 Task 2[1] is to develop an anomalous sound detection system that supports domaingeneralization. The major difference from the anomalous sound detection task of Challenge 2021 Task 2, which also assumed domain
shifting, is the lack of domain information during inference.
This means that participants cannot develop different models
for each domain, so they need to develop a ”domain generalized”
model. In the past Challenge 2021 Task 2[2], a self-supervised approach was widely used to develop a feature extractor that identifies machine attributes. In this method, anomaly detection is performed by Outlier Exposure (OE)[3] as in the MobileNetV2-based
baseline[1]. Another approach was to apply classical anomaly detection algorithms such as LOF and GMM to the embedding vectorsof the obtained feature extractors[4][5].
Our approach is inspired by these self-supervised learningbased anomaly detection methods. In addition, we aim to improve
performance by ensembling models with different attribute label
classification, data augmentation, and anomaly detector.
2. ANOMALOUS SOUND DETECTION SYSTEMS
2.1. Section and attribute classification
Similar to MobileNetV2-based baseline, our method trains a classifier using the label information contained in each audio data.
Specifically, one sample of 10 seconds of audio is converted toa mel-spectrogram, and a 2D Convolution-based feature extractor

Akira Tamamori
Aichi Institute of Technology
Department of Information Science
Aichi, Japanakira-tamamori@aitech.ac.jp

classifies sections 0-5. The difference from the baseline is that attribute information is trained in addition to the section information
in a multitasking manner; when attribute information is used as a label, all attribute information in the training dataset is considered as acategorical label. That is, all combinations of d1p and d1v information in the attribute csv files provided by the organizer are used (e.g.
f-n A, f-n D, loc B...). The d1v information is used for each machine. In this way, 12-39 classes of attribute labels can be createdfor each machine type. For these 2 types of labels, the following
equation is the loss function using Adacos[6] and Focal Loss[7].
L = FL(Adacossec (z)) + FL(Adacosatt (z))(1)

where z is the output from the feature extractor, FL(·) is the
Focal loss function, and Adacossec/att (·) are AdaCos functions
with different parameters for each with section and attribute labels. EfficientNet-B1 of PyTorch Image Models, pre-trained on ImageNet, was used as the feature extractor.
2.2. Model architectures
Our submitted model is an ensemble of three anomaly detection models, each with different Data Augmentation, training andanomaly detection methods. The methods applied to each model
are listed in Table 1.
2.2.1. CNN-GLOBALIn CNN-GLOBAL, the feature extractor was trained by considering one audio data as one sample. We also employed Mixup[8] andSpecAugment[9] time masking and frequency masking as data extensions. We also adopted Gaussian-AD[10] to calculate anomaly
scores. In computing the anomaly score of Gaussian-AD, the intermediate output of the trained feature extractor is used as the feature value for anomaly detection based on the Mahalanobis distance. The architecture of the feature extractor is shown in Table 2. As shown in Table 2, EfficientNet-B1 consists of 9 stages.
In Gaussian-AD, GlobalAveragePooling is applied to the output ofeach Stage, and the vector of the Channels dimension is used asthe feature (e.g. 32+16+24+40+80+112+192+320+1280=2096). It
then computes the parameters of the multivariate normal distribution (MVG) using all samples in the training dataset. During in-Detection and Classification of Acoustic Scenes and Events 2022

Model
CNN-GLOBAL
CNN-LOCAL
CNN-OE

Mixup✓✓✓

Table 1: Methods applied to each model
Training approach
Sliding window Two-step training

Augmentation
SpecAugment
SevenBandParametricEQ✓
frequency mask only✓✓

ference, the Mahalanobis distance from the MVG is calculated andused as the anomaly score.

StageInput
1
2
3
4
5
6
7
8
9

Challenge

Table 2: EfficientNet-B1 architecture
Operator Resolution Channels Layers
224, 313
3Conv112, 157321MBConv
112, 157
162MBConv
56, 7924
3MBConv
28, 4040
3MBConv
14, 2080
4MBConv
14, 20112
4MBConv
7, 10
192
5MBConv
7, 10320
2Conv
7, 101280
12.2.2. CNN-LOCAL
CNN-LOCAL applies an anomaly detection model with a time sliding window as in MobileNetV2-based baseline. Most of the model
details are the same as in CNN-GLOBAL, but the model is randomly cropped from the mel-spectrogram with a time window size
T when training the model. In addition, when computing the MVG
parameters, the model is applied with a hop size H, and the MVGof the training dataset are computed. During inference, the model
is applied with a time window size T to compute the anomaly scorefor each time frame t, and the average anomaly score for all timeframes is used as the final anomaly score. For SpecAugment, only
the frequency dimension was masked to prevent most of the melspectrogram from being masked.

✓✓

Anomaly detector
Gaussian-AD OE✓✓✓

has 6 different domain-shifting attributes called sections and a label
indicating the machine’s state and noise type called Attributes.
The input data is converted to a logmel spectrogram with window size 1024, hop size 512, and 224 melbins. In developing MVG
using the training data, MVG for each section are developed using
samples from each section. In other words, MVG are developed fora total of 6 sections, and anomaly scores are calculated using theMVG corresponding to each section during inference. For CNNLOCAL with a sliding window, T =64 frames are randomly cropped
from the logmel spectrogram timeframe.
When calculating the parameters of MVG, the model is appliedwith a hop width of H=8. During inference, the model is applied to
all time frames and the anomaly score for each time frame is output.
The harmonic mean AUC / pAUC scores for each model are
shown in Table 3, Table 4, Table 5, Table 6, Table 7 and Table 8.
Each value represents the harmonic mean score of the development
dataset, where Total (Ave.) is the average score for each model.
Our best represents the value with the highest score among the threemodels.
4. SUBMISSIONSThe submitted models are shown below. Our submitted models are
the three stand-alone models shown in Table 3 and an ensemble ofall models. In the ensemble, we adopt the model with the highest
score for each machine shown in Our Best.
• Narita AIT task2 1 : CNN-GLOBAL• Narita AIT task2 2 : CNN-LOCAL• Narita AIT task2 3 : CNN-OE• Narita AIT task2 4 : Ensemble
5. CONCLUSION

2.2.3. CNN-OE
CNN-OE adopts Outlier Exposure (OE) as the anomaly detector,
but most of the methods are the same as CNN-GLOBAL. In thismodel, the weights learned in CNN-GLOBAL are fine-tuned (twostep training). SevenBandParametricEQ from Audiomentations[11]is used as the data enhancement method, which applies filters toseven different frequency bands and adjusts the volume randomly.
In CNN-OE training, SevenBandParametricEQ is randomly applied
at sampling time (p=0.5) and labeled as a new section. For example,
if it is applied to the section 0 sample, it is learned as the 6th classlabel, resulting in a total of 12 section labels. However, the Attributelabel is not changed and the original label is used.
3. EVALUATION EXPERIMENT
The dataset used was the DCASE2022 Task2 Dataset. This dataset
consists of MIMII DG [12]and ToyADMOS2[13] and contains
sounds produced by 5 industrial products and 2 toys. Each machineThis paper presented a self-supervised CNN model trained using
three different methods. The models presented focused on modifying the data augmentation, training approach, and anomaly detection methods. In addition, the ensemble achieved an AUC of79.73% and pAUC of 70.65% on the development dataset. However, the model presented does not directly adapt to domain shifts.
Therefore, further performance improvements can be expected byintroducing a Few shot domain adaptation method or adopting amore domain-robust architecture.
6. REFERENCES[1] K. Dohi, K. Imoto, N. Harada, D. Niizumi, Y. Koizumi,
T. Nishida, H. Purohit, T. Endo, M. Yamamoto, andY. Kawaguchi, “Description and discussion on DCASE 2022
challenge task 2: Unsupervised anomalous sound detection
for machine condition monitoring applying domain generalization techniques,” In arXiv e-prints: 2206.05876, 2022.

Detection and Classification of Acoustic Scenes and Events 2022

[2] Y. Kawaguchi, K. Imoto, Y. Koizumi, N. Harada, D. Niizumi,
K. Dohi, R. Tanabe, H. Purohit, and T. Endo, “Descriptionand discussion on dcase 2021 challenge task 2: Unsupervised
anomalous sound detection for machine condition monitoring
under domain shifted conditions.”[3] D. Hendrycks, M. Mazeika, and T. Dietterich, “Deepanomaly detection with outlier exposure,” arXiv preprint
arXiv:1812.04606, 2018.
[4] K. Morita, T. Yano, and K. Tran, “Anomalous sound detection using cnn-based features by self supervised learning,”
DCASE2021 Challenge, Tech. Rep., July 2021.
[5] K. Wilkinghoff, “Utilizing sub-cluster adacos for anomalous sound detection under domain shifted conditions,”
DCASE2021 Challenge, Tech. Rep., July 2021.
[6] X. Zhang, R. Zhao, Y. Qiao, X. Wang, and H. Li, “Adacos:
Adaptively scaling cosine logits for effectively learning deep
face representations,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2019,
pp. 10 823–10 832.
[7] T.-Y. Lin, P. Goyal, R. Girshick, K. He, and P. Dollár, “Focalloss for dense object detection,” in Proceedings of the IEEE
international conference on computer vision, 2017, pp. 2980–2988.
[8] H. Zhang, M. Cisse, Y. N. Dauphin, and D. Lopez-Paz,“mixup: Beyond empirical risk minimization,” in International Conference on Learning Representations, 2018.
[9] D. S. Park, W. Chan, Y. Zhang, C.-C. Chiu, B. Zoph, E. D.
Cubuk, and Q. V. Le, “Specaugment: A simple data augmentation method for automatic speech recognition,” 2019.
[10] O. Rippel, P. Mertens, and D. Merhof, “Modeling the distribution of normal data in pre-trained deep features for anomaly
detection,” in 2020 25th International Conference on Pattern
Recognition (ICPR). IEEE, 2021, pp. 6726–6733.
[11] I. Jordal, A. Tamazian, E. T. Chourdakis, C. Angonin,askskro, N. Karpov, O. Sarioglu, kvilouras, E. B. Çoban,F. Mirus, J.-Y. Lee, K. Choi, MarvinLvn, SolomidHero, andT. Alumäe, “iver56/audiomentations: v0.25.0,” May 2022.
[Online]. Available: https://doi.org/10.5281/zenodo.6594177[12] K. Dohi, T. Nishida, H. Purohit, R. Tanabe, T. Endo, M. Yamamoto, Y. Nikaido, and Y. Kawaguchi, “MIMII DG: Sounddataset for malfunctioning industrial machine investigationand inspection for domain generalization task,” In arXiv eprints: 2205.13879, 2022.
[13] N. Harada, D. Niizumi, D. Takeuchi, Y. Ohishi, M. Yasuda,and S. Saito, “ToyADMOS2: Another dataset of miniaturemachine operating sounds for anomalous sound detection under domain shift conditions,” in Proceedings of the 6th Detection and Classification of Acoustic Scenes and Events 2021Workshop (DCASE2021), Barcelona, Spain, November 2021,
pp. 1–5.

ChallengeDetection and Classification of Acoustic Scenes and Events 2022

Challenge

Table 3: Harmonic mean AUC (Total)

Model
CNN-Global
CNN-Local
CNN-OE
Our Best

ToyCar
37.55
81.44
68.34
81.44

ToyTrain
55.64
66.12
63.82
66.12

Model
CNN-Global
CNN-Local
CNN-OE
Our Best

ToyCar
53.21
61.58
62.21
62.21

ToyTrain
50.69
60.51
56.50
60.51

Model
CNN-Global
CNN-Local
CNN-OE
Our Best

ToyCar
25.43
81.21
61.04
81.21

ToyTrain
55.40
75.10
67.36
75.10

ModelCNN-Global
CNN-Local
CNN-OE
Our Best

ToyCar
71.75
81.68
77.60
81.68

ToyTrain
55.88
50.67
60.62
60.62

Model
CNN-Global
CNN-Local
CNN-OE
Our Best

ToyCar
50.31
63.12
58.25
63.12

ToyTrain
48.58
63.35
56.87
63.35

Model
CNN-Global
CNN-Local
CNN-OE
Our Best

ToyCar
56.47
60.11
66.74
66.74

ToyTrain
53.00
50.05
56.15
56.15

bearing
71.52
75.64
53.86
75.64

fan
26.62
27.02
75.35
75.35

gearbox
85.92
81.63
86.54
86.54

slider
78.89
78.31
88.32
88.32

valve
84.71
72.53
67.88
84.71

Total (Ave.)
62.98
68.96
72.01
79.73

slider
69.67
68.05
77.59
77.59

valve
75.78
60.73
58.23
75.78

Total (Ave.)
63.61
63.80
66.36
70.65

slider
94.04
93.34
94.17
94.17

valve
91.64
85.26
71.31
91.64

Total (Ave.)
61.91
71.98
73.33
81.74

slider
67.95
67.44
83.15
83.15

valve
78.75
63.11
64.77
78.75

Total (Ave.)
71.28
68.84
71.21
79.08

slider
93.73
88.25
86.96
93.73

valve
83.18
63.71
59.34
83.18

Total (Ave.)
68.40
68.50
68.14
74.53

slider
55.45
55.38
70.04
70.04

valve
69.60
58.01
57.15
69.60

Total (Ave.)
61.10
59.74
65.05
69.03

Table 4: Harmonic mean pAUC (Total)bearing
70.92
72.39
63.92
72.39

fan
61.81
61.65
72.01
72.01

gearbox
63.17
61.67
74.05
74.05

Table 5: Harmonic mean AUC (Source)

bearing
59.94
65.90
56.15
65.90

fan
17.76
18.32
74.97
74.97

gearbox
89.20
84.71
88.28
89.20

Table 6: Harmonic mean AUC (Target)

bearing
88.64
88.76
51.75
88.76

fan
53.10
51.48
75.74
75.74

gearbox
82.87
78.77
84.87
84.87

Table 7: Harmonic mean pAUC (Source)

bearing
65.40
66.15
63.35
66.15

fan
62.33
62.1272.07
72.07

gearbox
75.30
72.76
80.11
80.11

Table 8: Harmonic mean pAUC (Target)

bearing
77.47
79.93
64.49
79.93

fan
61.29
61.19
71.94
71.94

gearbox
54.41
53.51
68.84
68.84