## 5 Audio Event-Based Classification
The spectrograms shed light on the frequency distribution and energy patterns within the audio, whereas the class activation maps provided probabilistic evaluations of various audio event categories. An example of YAMNet's output, as applied to a representative audio segment, is depicted in Figure 8. In conjunction with our use of YAMNet for audio event classification, we adapted the YOLOv8 model to operate within the auditory domain, leveraging its well-known capabilities in visual object detection. Our approach involved segmenting the audio data into 5 s intervals and transforming them into spectrograms for subsequent analysis. For training and validation, we employed the ESC-50 dataset, which provides a diverse range of audio recordings spanning 50 distinct categories. However, to align our model's focus with the specific objectives of our environmental audio classification study, we selectively trained and validated only 13 classes from the ESC-50 dataset that were most relevant to our work. Table 2 presents a selection of class events identifiable by the models, derived from two datasets that were used in our study. Figure 8: Audio analysis visualizations generated using YAMNet. The top panel shows the normalized stereo waveform of the audio chunk. The middle panel presents the corresponding spectrogram, indicating frequency content over time with color intensity representing energy levels. The bottom panel illustrates the class activation map, displaying the probabilities of various audio event classes detected across the audio timeline. We adapted the work by [46] for transforming audio signals into their visual representations, specifically spectrograms, to facilitate the classification of environmental sounds. The methodology involves several computational steps and mathematical transformations, as detailed below:  
1. **Fourier Transformation:** The audio signal is processed through a Fourier transformation, decomposing a function of time (the audio signal) into its constituent frequencies. The Fourier transform \(F(\omega)\) of a signal \(x(t)\) is given by the following: \[F(\omega)=\int_{-\infty}^{\infty}x(t)e^{-j\omega t}\,dt\] We apply a window function to the signal before performing the Fourier transform to mitigate spectral leakage. 2. **Windowing and Frame Segmentation:** The audio signal is segmented into overlapping frames, and a Hanning window is applied to each frame. The Hanning window \(w[n]\) is defined as: \[w[n]=0.5-0.5\cos\left(\frac{2\pi n}{N-1}\right)\] where \(N\) is the window length. This windowing smooths the signal within each frame, reducing boundary discontinuities. 3. **Spectrogram Creation and Logarithmic Scaling:** The spectrogram is generated by computing the Fast Fourier Transform (FFT) of each windowed frame then applying logarithmic scaling to the frequency axis. The spectrogram \(S(t,f)\) can be represented as follows: \[S(t,f)=\left|\text{FFT}\{x(t)\cdot w(t)\}\right|^{2}\] Logarithmic scaling emphasizes lower frequencies, aligning the representation closer to human auditory perception. 4. **Decibel Conversion:** The magnitude of the FFT is converted to decibels (dB), a logarithmic unit expressing the ratio of a physical quantity relative to a specified reference level. The conversion to decibels is given by the following: \[dB=20\log_{10}\left(\frac{\left|S(t,f)\right|}{\text{ref}}\right)\] where ref is the reference power level. 5. **Visual Representation:** The resulting spectrogram is converted to an image using a color map. This visual representation facilitates an intuitive understanding of the sound's characteristics, including frequency content and temporal evolution. Through this approach, we have trained a YOLOv8 model to identify different sounds based on their visual representation. The training trajectory showed a consistent reduction in loss and a corresponding increase in accuracy, culminating in a top-one accuracy of 69.2% and a top-five accuracy of 92.3% as depicted in Figure 9a.