## 4 Methodology
### Temporal-Frequency Attention Mechanism  
Attention mechanisms were originally developed for image recognition and sequence modeling tasks, where they demonstrated strong capabilities in capturing long-range dependencies and suppressing irrelevant or redundant information. In recent years, these mechanisms have been increasingly adopted in the field of environmental sound classification to address the limitations of conventional convolutional neural networks (CNNs) in modeling nonstationary and overlapping audio signals. This is particularly valuable for complex urban soundscapes characterized by multiple concurrent sound sources and high background variability. Traditional attention modules such as Squeeze-and-Excitation (SE) and Efficient Channel Attention (ECA) focus primarily on modeling inter-channel dependencies. They typically apply global average pooling followed by a lightweight feed-forward network to learn attention weights, thereby enhancing global channel-wise representations. Whileeffective for global feature recalibration, these methods are inherently limited in capturing the localized temporal and spectral structures that are crucial in audio spectrograms. Convolutional Block Attention Module (CBAM) [42] introduces a spatial attention module on top of channel attention, but it treats the spectrogram as a unified 2D input, without independently modeling temporal and frequency dimensions. As a result, it lacks the ability to highlight important features along each axis. Compared with transformer-based self-attention mechanisms [43], which offer strong global modeling capabilities, these methods have a much lower computational cost. However, transformer modules are often too resource-intensive in terms of memory and computation, making them less suitable for deployment in small-scale ESC datasets or on resource-constrained devices. To address these limitations, [PERSON] et al. [20] introduced a frame-level TF attention mechanism that assigns varying weights to each time frame, highlighting informative acoustic segments and suppressing silent or noisy intervals. Although effective in modeling time-domain importance, such approaches tend to overlook the role of frequency variation--particularly in urban scenes where spectral diversity carries vital discriminative information. To improve spectro-temporal modeling in such scenarios, our proposed TF-Attention is inspired by the dual-branch attention structures introduced in TFCNN by [PERSON] et al. [19] and the TF attention design in [PERSON] et al. [44] for sound event detection. Unlike TFCNN, which separates harmonic and percussive features, or Shen's CRNN-based sequential attention layers, our TF-Attention module explicitly decouples TF attention into parallel branches. This design enables fine-grained weighting across both axes, allowing the model to focus more precisely on discriminative regions in complex spectrograms. To enhance the model's ability to represent complex urban acoustic scenes, we propose a lightweight TF attention module that explicitly models structural dependencies along the temporal and spectral axes. As illustrated in the lower part of Figure 5, the module adopts a dual-branch architecture, where temporal and frequency attention are computed independently and subsequently fused to recalibrate the original feature map. The input  
Figure 5: Architecture of the proposed ResNet-TF model. The top shows the ResNet backbone augmented with temporal–frequency (TF) attention modules inserted after each residual stage. The bottom illustrates the TF-attention mechanism, which separately encodes temporal and spectral dependencies via dual-branch pooling and convolutional pathways. feature map is defined as a three-dimensional tensor: \(X\in\mathbb{R}^{\mathbb{C}\times T\times F}\), where \(C\), \(T\), and \(F\) correspond to the number of channels, temporal frames, and frequency bins, respectively.