# A Progressively Expanded Database for Automated Lung Sound Analysis: An Update
## 2 Materials and Methods
### Benchmarking of HF_Lung_V2  
The convolutional neural network with bidirectional gated recurrent unit (CNN-BiGRU) model is presented in Figure 3. The formulas of ReLU [32] and Sigmoid [32] layers are as follows:  
\[\text{ReLU (x)}=\text{max (x, 0)}, \tag{1}\]  
\[\text{Sigmoid (x)}=1/(1+\exp{(-\text{x})}). \tag{2}\]  
The CNN-BiGRU model outperformed all benchmark models used in our previous study [18]. Therefore, the model was used to benchmark HF_Lung_V2 in the present study.  
Figure 4 shows the pipeline for preprocessing, deep-learning processing, and post-processing. All the codes were written using Python 3.7. During the preprocessing, we first used a 10 th-order Butterworth high-pass filter with a cutoff frequency of 80 Hz to process the raw 15-s signal. Then, we computed the spectrogram of the filtered signal using short-time Fourier transform (nfft = 256, window length = 256, window type = hann, overlap = 0.75). The output of the short-time Fourier transform was a 938 \(\times\) 129 array,  
Figure 3: Architecture of the CNN–BiGRU model. This figure is adapted from our previous study under a Creative Commons Attribution (CC BY) license [18].  
where 938 was the number of time segments and 129 was the number of frequency bins. Next, Mel-frequency cepstral coefficients (MFCCs) [33], including 20 static, 20 delta, and 20 delta-delta coefficients were calculated for each time segment. Finally, we calculated energy summation in four frequency bands, 0-250, 250-500, 500-1000, and 0-2000 Hz, for each time segment. Min-max normalization was applied to each of the spectrogram, MFCCs, and energy summation. Then, the concatenation of normalized spectrogram, MFCCs, and energy summation, a 938 \(\times\) 193 array, were fed as input to train the CNN-BiGRU model and generate the results of segment prediction. We used Tensorflow 2.10 framework to construct the layers of neural networks. During training, we used [PERSON] as the optimizer, and batch size was set to 64. We set the initial learning rate to 0.0001 with a step decay (0.2\(\times\)) when the validation loss did not decrease for 10 epochs. The learning process stopped when no improvement occurred over 50 consecutive epochs. The training was done on an Ubuntu 18.04 server provided by the National Center for High-Performance Computing in Taiwan (Taiwan Computing Cloud (TWCC)). It was equipped with an Intel(R) Xeon(R) Gold 6154 @3.00 GHz CPU with 90 GB RAM. We used the CUDA 10, and CuDNN 7 library to execute the training and inference on an NVIDIA Titan V100 graphics card for GPU acceleration. Finally, we refined the results of segment prediction by merging the connected segments with positive prediction and those with an interval smaller than 0.5 s to generate the detected events. Subsequently, the events with a duration smaller than 0.05 s were seen as burst noises and removed. More details can be found in our previous study [18].  
Subject-wise five-fold cross-validation was conducted during the training process. To obtain more stable results, this procedure was repeated thrice. To mitigate data imbalance, we used the audio files containing at least one event of CASs and DASs to train and test the respective models.