Frequency-domain multi-scale hybrid attention for pathological image classification Authors: Yang Zhang, Junjie Li, Qiushi Wang, Luyan Zhang, Lingjiang Deng, Qiyun Tian, Feixu Lu, Gang Li, Chuanyun Xu, Fanghong Zhang, Hualiang Xiao Published: 2026 ABSTRACT AbstractPathological image classification is critical for early cancer diagnosis and precise subtyping. However, pathological images exhibit significant heterogeneity and complex textures. Existing methods often fail to fully exploit local details, while frequency-domain approaches lack effective inter-subband interaction, hindering the fusion of global context and local fine-grained information. To address this, this study propose a Multi-scale Frequency-domain Hybrid Attention mechanism (MFHA). MFHA uses wavelet transform to decompose images into low-frequency subbands (global structure) and high-frequency subbands (microscopic details). By integrating multi-scale convolutions with subband fusion, it enhances high-frequency feature representation, enabling effective joint modeling of global structure and local texture. This study further introduce a spatial attention module with cosine similarity and multi-dimensional statistics to improve feature robustness and discriminability. Experiments show that our method outperforms baselines on multiple pathological datasets, with accuracy gains of 1.97% and 2.71%. This work provides a novel perspective for pathological image feature co-modeling, boosting classification accuracy and robustness. The code is available at https://github.com/AnaStartz/WSI-processing-framework.Keywords: Computational pathology, Wavelet transform, Multi-scale, Attention, Feature enhancementSubject terms: Cancer, Computational biology and bioinformatics, Engineering, Mathematics and computing Introduction Pathological image classification serves as a core technical foundation for early cancer screening, precise subtyping, and prognostic assessment. Its diagnostic accuracy directly determines the scientific validity of clinical treatment strategies and the improvement of patients’ quality of life1. According to global cancer burden data released by the World Health Organization’s International Agency for Research on Cancer (IARC), cancer incidence and mortality rates remain persistently high2. As the “gold standard” for tumor diagnosis, pathological classification can accurately determine critical information such as tumor benign or malignant status, histological type, and staging, thereby providing the essential basis for personalized treatment3,4.With the maturation and widespread adoption of whole slide imaging (WSI) technology5,6, digital pathology has laid a solid data foundation for algorithmic models, propelling the extensive application of artificial intelligence in translational medicine and clinical practice7. Early pathological image classification primarily relied on Convolutional Neural Networks (CNNs), which, leveraging their unique advantages, became the core technical architecture in this field8–11. However, CNNs mainly focus on extracting local features. While they can effectively capture detailed information such as cell morphology, they struggle to establish long-range global dependencies. This limitation constrains their analytical capability when processing pathological images characterized by complex spatial structures and contextual dependencies8,12. To overcome these limitations, researchers have attempted to enhance multi-scale feature representation capability through methods such as multi-receptive-field adaptive path aggregation13,14 and graph convolutional networks fused with adaptive filters and aggregators15. By introducing attention mechanisms to optimize feature selection and expand the receptive field, the representation of key regions is strengthened16; however, such improvements are still confined to spatial-domain feature reconstruction and struggle to overcome the inherent bottleneck of spatial-domain modeling. The emergence of Transformer in the field of pathological imaging has fundamentally reshaped the local perception-based modeling paradigm of CNNs17–19. By leveraging the self-attention mechanism, Transformer inherently possesses a global field of view across the entire image, enabling efficient capture of long-range feature dependencies between tissue regions. Supported by large-scale pre-training data, it demonstrates powerful cross-scene generalization capability, propelling pathological image analysis from local perception into a new stage of global contextual reasoning. However, Transformer-based models lack the strong inductive bias inherent to CNNs, resulting in insufficient sensitivity to local image features. This limitation makes them prone to errors in tasks requiring precise identification of lesion boundaries or detection of subtle pathological changes20. In recent years, frequency-domain analysis techniques have garnered increasing attention in pathological imaging and emerged as a significant direction to compensate for the limitations of spatial-domain modeling21–23. Through techniques such as the Fourier transform and wavelet decomposition, frequency-domain analysis maps images from the spatial domain to the frequency domain. Signals of different frequencies can capture the periodic textures and multi-scale structural features of tissues, effectively addressing the shortcomings of CNNs and Transformers in collaboratively capturing global structures and local details24,25. The low-frequency components possess excellent high-frequency noise suppression characteristics, enabling them to mitigate the impact of interfering factors such as staining variations and imaging device noise in pathological images. This enhances the model’s adaptability to data distribution differences and alleviates generalization challenges caused by clinical data heterogeneity. The high-frequency components are highly sensitive to subtle textures and abrupt structural changes in images, allowing them to effectively extract key discriminative features for pathological diagnosis, such as nuclear atypia and glandular arrangement disorders26. However, the majority of existing research methods tend to focus on the global modeling and interaction of pathological images27–31, often falling short in sufficiently mining the discriminative high-frequency detailed features within the images, such as nuclear morphology and local textures. This inadequacy makes it difficult to effectively capture fine-grained differences. Furthermore, current frequency-domain analysis methods mostly remain at the level of single-scale decomposition or simple subband concatenation25,32,33, lacking a mechanism for deep interaction and optimization of multi-scale frequency-domain features. This limitation hinders flexible adaptation to the complex clinical scenarios inherent in pathological images, which are characterized by strong heterogeneity in cell morphology and varying lesion sizes, consequently constraining the improvement of classification accuracy and robustness. To address the aforementioned challenges, this study proposes a Multi-scale Frequency-domain Hybrid Attention (MFHA) mechanism. It aims to decouple and fuse multi-scale information from frequency subbands through frequency-domain techniques, thereby achieving efficient synergistic representation of cytomorphological information and global context, and enhancing the recognition accuracy for small lesions and subtle morphological variations. Figure 1 illustrates the core concept of the MFHA framework. Specifically, MFHA employs the wavelet transform to decompose the input into low-frequency subbands carrying global information and high-frequency subbands containing detailed information. By fusing information from different subbands and leveraging the Multi-scale Hybrid Attention (MHA) module, it achieves multi-level feature integration. This process simultaneously enhances fine-grained image features and filters out noise, thereby strengthening the expressive capability for detailed characteristics. Furthermore, this study introduces a fusion strategy incorporating cosine similarity and multi-dimensional statistical features. This strategy optimizes feature representation robustness by measuring feature relevance and supplementing statistical information. The main contributions of this study are summarized as follows: To address the issues of insufficient utilization of detailed information and simplistic use of subbands, a novel Multi-scale Frequency-domain Hybrid Attention (MFHA) mechanism is proposed. This mechanism employs wavelet transform to decompose pathological images in the frequency domain. By integrating multi-scale convolution and a subband fusion strategy, it explicitly enhances high-frequency detailed features, thereby achieving synergistic representation of global semantics and local details. To address the issues of insufficient utilization of detailed information and simplistic use of subbands, a novel Multi-scale Frequency-domain Hybrid Attention (MFHA) mechanism is proposed. This mechanism employs wavelet transform to decompose pathological images in the frequency domain. By integrating multi-scale convolution and a subband fusion strategy, it explicitly enhances high-frequency detailed features, thereby achieving synergistic representation of global semantics and local details. A spatial attention module incorporating cosine similarity and multi-dimensional statistical features is designed. This module enhances the robustness and discriminative power of feature representation by measuring feature relevance and incorporating statistical distribution information. A spatial attention module incorporating cosine similarity and multi-dimensional statistical features is designed. This module enhances the robustness and discriminative power of feature representation by measuring feature relevance and incorporating statistical distribution information. A lightweight, plug-and-play MFHA module was constructed and systematically validated. The module can be flexibly embedded into various backbone networks. Experiments demonstrate that it improves model classification performance with minimal computational overhead, confirming the method’s effectiveness and practicality. A lightweight, plug-and-play MFHA module was constructed and systematically validated. The module can be flexibly embedded into various backbone networks. Experiments demonstrate that it improves model classification performance with minimal computational overhead, confirming the method’s effectiveness and practicality. MFHA leverages the directional decomposition capability of wavelet transform to break down complex images into distinct hierarchical subbands (LL, HL, LH, and HH). Multi-scale convolution is then applied to each subband to capture features ranging from fine-grained to coarse-grained, thereby providing a more refined feature representation. Related work This section primarily reviews and summarizes wavelet-based methods in pathological image analysis, aiming to discuss their limitations and challenges. Wavelet decomposition, as an image preprocessing technique that achieves feature enhancement through spatial-frequency domain transformation, has provided robust support for anomaly recognition and classification in pathological images through its ingenious integration with convolutional operations34–38. Furthermore, the need to reduce false positive/false negative detection rates has further propelled the application of wavelet decomposition39. Early studies, such as the application of the Curvelet transform, demonstrated that wavelet decomposition can effectively preserve edge details of malignant pulmonary nodules, significantly reducing classification error rates. Further advancing this line of research, the Non-Subsampled Dual-Tree Complex Contourlet Transform (NSDTCT) captured micro-calcifications and spiculation signs within high-frequency subbands, improving the discrimination accuracy for benign and malignant nodules to 98.37%40, highlighting the critical value of high-frequency components for pathological diagnosis. Addressing the core challenges of feature enhancement and network optimization in breast cancer detection, Oyelade O N et al.41 introduced a Wavelet-CNN-Wavelet architecture. This framework employs a hybrid preprocessing mechanism combining Seam Carving and wavelet decomposition for feature selection, and designs a novel WT function to replace the ReLU activation function, achieving an accuracy of up to 99% on multiple relevant datasets. Meanwhile, Das A et al.42 employed a Wavelet Convolutional Neural Network (WCNN) to address the limitation of traditional CNNs relying solely on spatial domain features. Their approach integrates wavelet filters and convolutional filters in parallel at each layer, simultaneously capturing both frequency-domain and spatial-domain features of pathological images. After four layers of hybrid feature extraction, their method achieved a classification accuracy of 98.4% on the Kaggle Breast Histopathology dataset. Trivizakis E et al.43 extracted multi-scale pathological features by combining Wavelet Packet Transform (WPT) with Local Binary Patterns (LBP), Gabor filters, and Gray Level Co-occurrence Matrix (GLCM), realizing a 10-fold cross-validation accuracy of 95.3% in colorectal cancer (CRC) histopathological image classification. Ataky S T M et al.44 extracted information-theoretic features from DWT subbands while also deriving biodiversity metrics from original channels. These features were then combined and classified using Gradient Boosted Decision Trees (GBDT). Their method leverages ecological models to capture multi-scale non-linear interactions within textures, enabling the efficient characterization of complex textural properties in histopathological images without requiring data augmentation. This approach achieved outstanding performance on CRC (AUC=0.994) and BreakHis (AUC=0.98) datasets. Addressing the issues of strong subjectivity and low efficiency in manual assessment for prostate cancer Gleason grading, Ali U et al.45 overcame the limitation of traditional DWT decomposing only low-frequency subbands. They performed a 3-level full subband decomposition using Discrete Wavelet Packet Decomposition (DWPD), extracted texture features such as contrast and correlation from each subband using GLCM, and subsequently employed an SVM for cancer grading. While the aforementioned methods have improved model performance to some extent, most fail to fully exploit the information within the subbands obtained from wavelet decomposition, particularly the high-frequency subbands containing subtle morphological features. These subbands are often merely used as auxiliary features or fused through simple channel concatenation, without adequately mining the discriminative details such as cell edge textures embedded within them. Secondly, these methods lack effective mechanisms for cross-subband interaction and multi-scale fusion, making it difficult to achieve synergistic optimization between local details and global structure. This results in an inability to balance global semantic comprehension with local detail enhancement. Furthermore, when confronted with challenges like staining variations and noise interference, the robustness of feature representations in existing methods still proves insufficient. These limitations collectively constrain the model’s holistic understanding and discriminative capability regarding the multi-scale features in pathological images. Inspired by Hwang S et al.46, this study proposes a Multi-scale Frequency-domain Hybrid Attention (MFHA) mechanism. This mechanism employs the wavelet transform to achieve frequency-domain decomposition of the image structure. It designs cross-subband interaction and multi-scale fusion strategies aimed at enhancing high-frequency detailed features and promoting the deep integration of local and global information, thereby improving the model’s ability to discern subtle differences and its classification accuracy for pathological images. Furthermore, the mechanism incorporates spatial attention to integrate cosine similarity and multi-dimensional statistical features, achieving a more robust multi-scale feature representation in complex pathological scenarios. Proposed method This section details the specifications of the MFHA mechanism. To address the issues of insufficient utilization of subband information and the difficulty in achieving synergy between local details and global structure in existing methods, the MFHA mechanism employs the wavelet transform to decompose the input features in the frequency domain. The image is decomposed into low-frequency subbands, which carry the global structure, and high-frequency subbands, which contain cellular textures and edge information, thereby enabling explicit modeling of detailed features. Building upon this, a multi-branch convolutional architecture and a hybrid attention mechanism are introduced. These components extract multi-scale local features from receptive fields of varying sizes, while simultaneously enhancing the discriminative details within the high-frequency subbands. Furthermore, through a high-frequency information-guided upsampling process and a spatial attention module, the detail reconstruction capability and feature representation robustness are further strengthened, and noise interference is suppressed. Figure 2 shows the overall architecture of MFHA with a modular structure. Given a feature map , where H × W represents spatial resolution and C denotes the number of channels, MFHA differs from traditional attention mechanisms in that it does not perform computations based on all channels. Instead, it selects the top-N high-weight channels from the feature map F via the Channel Select module to form a sub-feature map . Then, is decoupled into LL, LH, HL, and HH sub-bands through wavelet decomposition; these sub-bands are processed by MHA to enhance information in each sub-band and suppress noise, and the enhanced feature is obtained after passing through the upsampling (Wave Up) module. Finally, is processed by a unique Spatial Attention to generate a multi-scale attention feature map , which is multiplied by the original feature map F and combined with a residual connection to yield the enhanced feature map . Details of each component will be elaborated on in the following sections. Overall Architecture of the Multi-scale Frequency-domain Hybrid Attention (MFHA). The input features first undergo channel selection. They are then decomposed into low-frequency and high-frequency subbands via the wavelet transform. Subsequently, multi-scale convolutions are applied to generate attention maps for feature modulation. Following this, the inverse wavelet transform is employed to restore the spatial dimensions. Finally, the processed features are output through a spatial attention module for feature enhancement. Channel select block The Channel Select module adaptively filters out channels with higher contribution to the pathological image classification task based on channel weights. Through this targeted channel selection and dimensionality reduction, the network is able to focus on discriminative features while effectively reducing subsequent computational overhead. As shown in Figure 3, given an input feature map F: Where GAP(· ) denotes global average pooling, represents a ReLU non-linear activation function, stands for the Sigmoid function, and TopN(· ) indicates selecting the indices corresponding to the top N maximum values. Channel Select module: The input feature map extracts channel weights after spatial compression and channel transformation, and selects the top N important channels. Specifically, for the input feature map , the global pooling operation first compresses the spatial information of each channel into a channel-level descriptor, aiming to achieve the goal of aggregating the global features of each channel. This process is expressed as follows: Where denotes the pooled channel descriptor, and represents the value of the c-th channel at position (i, j) in the feature map. Subsequently, the channel transformation function is utilized to learn the interdependencies between channels: Where , , and are learnable weight matrices, r denotes the reduction ratio. The final output maintains a transformed vector of dimension . Subsequently, based on the magnitude of the weights, N channels (where N < C) are selected from the C channels, generating a selection indicator . Finally, based on this indicator, the corresponding channels of the original feature map are extracted to obtain the output : Where refers to (3); TopN denotes selecting the indices corresponding to the top N maximum values; and denotes the channel index set. Wavelet decomposition block To address challenges in pathological image analysis, such as varying lesion sizes, diverse morphological presentations, and the difficulty in achieving synergistic representation of local details and global semantics, this study introduces the wavelet decomposition module. This module aims to explicitly separate, fuse, and enhance information from different hierarchical subbands by performing frequency-domain decomposition on the input features. Wavelet transform decomposes an image into low-frequency components, which carry the overall structure, and high-frequency components, which contain detailed information such as edges and textures. This process establishes a structured frequency-domain representation as a foundation for subsequent multi-scale feature fusion and detail enhancement. Corresponding to the green dashed box in Figure 2, this section will sequentially elaborate on the complete workflow, including subband decomposition, multi-scale information fusion, and attention-based enhancement. Specifically, the given feature map undergoes Haar Discrete Wavelet Transform (DWT) to be decomposed into four wavelet sub-bands. To elaborate, DWT utilizes a low-pass filter and a high-pass filter to construct four convolutional kernels with a stride of 2 (denoted as and ). These kernels then perform convolution on the rows and columns of the feature map sequentially, followed by downsampling with a stride of 2 to generate four wavelet sub-bands, namely and . Among these, is the low-frequency approximation component, which retains the main structural information of the feature map at the coarse-grained level, and are high-frequency components that capture high-frequency information corresponding to vertical edges, horizontal edges, and diagonal details respectively, providing detailed information of the feature map at the fine-grained level. Following the completion of frequency-domain subband decomposition, to achieve effective synergy and enhancement of multi-scale information, this study further designs a strategy for subband enhancement and multi-scale perception that integrates both high- and low-frequency information. Specifically, low-frequency information is first incorporated into the high-frequency subbands and to generate . This aims to enable the network to simultaneously utilize low-frequency global context and high-frequency details in subsequent processing, thereby preventing feature fragmentation. Subsequently, these features are fed into the Multi-scale Hybrid Attention (MHA) module. The MHA module explicitly extracts local features under different receptive fields by deploying parallel convolutional layers with kernel sizes of 3, 5, and 7. This enables the capture of multi-granularity information from the same feature region, enhancing the module’s ability to represent multi-scale characteristics in complex scenarios. This process can be formulated as: Where , , and denote convolutional operations with kernel sizes of 3, 5, and 7 respectively, represents point-wise convolution. At this stage, the model constructs a hierarchical feature representation ranging from pixel-level details to region-level structures by applying multi-scale convolution to the subbands obtained from wavelet decomposition. This mechanism, which combines frequency-domain decomposition with spatial multi-receptive-field analysis, serves as the key to achieving robust multi-scale representational capability. Subsequently, and are fused to generate an attention map , and the channel attention mechanism is introduced to highlight and distinguish channels of key features. This facilitates strengthening channels containing structural information in subsequent image reconstruction, enabling the model to utilize features more efficiently and optimize overall performance. This process can be expressed as: Where denotes point-wise convolution, and are the same as those in (2) and (3). Note that, to balance computational efficiency and representational effectiveness, here expands the feature channels to twice the original number (i.e., ).The high-frequency component extracts detailed information through a 3×3 convolution, denoted as . Since it contains relatively more noise information, it is not utilized when generating the attention map. Finally, the original 4 wavelet sub-bands are concatenated along the channel dimension, and the channels are compressed to 2N via point-wise convolution, thereby forming compressed information that includes the 4 original wavelet sub-bands (e.g., high-frequency information, low-frequency information, and noise). Subsequently, is multiplied by the generated attention map and combined with a residual connection to enhance the features of each sub-band, this step is denoted as: Where . Meanwhile, an enhanced set of high-frequency subbands (hi-subs) is returned, which includes three enhanced high-frequency components, namely , , and . These subbands are used to guide the subsequent upsampling module by providing it with precise frequency detail cues. Upsampling block To fully leverage the reversible properties of the wavelet transform, this study introduces the dual upsampling module Wave Up, based on the fusion mechanism described by Hwang S et al.46. Its architecture is illustrated in Figure 4. Wave Up consists of two submodules, the Inverse Discrete Wavelet Transform (IDWT) and PixelShuffle along with a fusion module. Its computational workflow is as follows. Fusion Mechanism-based Wave Up Dual Upsampling Module: It adopts a dual-branch parallel structure: one branch restores the original image size via IDWT, while the other branch upsamples to the same size through the modified PixShuffle. After the two branches are concatenated, the features are enhanced and optimized by the Fusion feature fusion module. Given the feature map , it is split along the channel dimension into and . Subsequently, a 1×1 convolution operation is used to expand the number of feature channels of before being passed to the PixelShuffle layer. Meanwhile, is merged with the high-frequency components hi-subs returned from the wavelet decomposition module, and then input to the IDWT layer: Where denotes a 1×1 convolution. Subsequently, and are concatenated, and co-attention is employed to achieve efficient feature fusion. The Fusion module comprises Contrastive Context Attention (CCA)47 and slightly modified Fused-MBConv (FMBConv)48 layers. The interaction of dual upsampling features generates channel-wise co-attention scores, which are used to re-calibrate the concatenated features. This process can be expressed as: After that, the feature map is split along the channel dimension; following an element-wise addition operation on the split parts, the result is input to the FMBConv layer: In the formula, denotes the output of the Wave Up module. This module retains the advantage of IDWT in achieving lossless reconstruction of global structure, while overcoming the detail loss issue associated with single upsampling methods through supplementation from high-frequency components. It thereby achieves a balance between efficient dimensionality increase and the preservation of fine-grained features. Spatial attention block To address issues such as weak semantic and structural correlations among multi-scale features after wavelet transform and the susceptibility of detailed information to noise interference, this study designs a spatial attention module that integrates similarity measures and multi-dimensional statistical features. This module aims to enhance the robustness and discriminative power of feature representation by quantitatively assessing semantic consistency between features and reinforcing discriminative regions through multi-dimensional statistical characterization. As illustrated in Figure 5, the module adopts a dual-branch parallel architecture: one branch calculates the correlation between local and global features via cosine similarity to measure the degree of semantic matching. The other branch extracts multi-dimensional statistical features to characterize the distribution properties and saliency of the features. These two streams of information are then concatenated and fused through multi-scale convolution to generate a spatial attention weight map. This map is used to recalibrate the input features, highlighting crucial regions and suppressing irrelevant responses. The Spatial Attention module adopts a dual-branch parallel structure: one branch extracts multi-dimensional statistical features of the feature map, while the other branch supplements spatial correlation information via cosine similarity. The two branches are then concatenated and fed into a multi-scale convolution to capture dependencies across different spatial scales. Finally, a spatial attention map is generated to enhance the feature representation of key regions. In detail, global average pooling is applied to the feature map to obtain the channel descriptor . Subsequently, the cosine similarity between the global feature Z and the local feature is computed along the channel dimension to measure the correlation and consistency between features. This provides a “matching degree” basis for subsequent feature fusion and alleviates interference from invalid or conflicting features. The process is expressed as follows: In the formula, denotes the feature vector at position k, and CosSim(· ) denotes the cosine similarity calculation function. However, this operation may risk weakening the response intensity of certain special features (e.g., corners, edges) in the feature map . To address this, this study introduces multi-dimensional statistical features to avoid such an issue: max pooling is used to capture salient values in the channel dimension; average pooling preserves the overall trend; standard pooling measures fluctuations of local features; and L2 norm measures the magnitude of feature vectors. A larger L2 norm indicates that the feature vector has greater “energy” and may contain more important information. These are denoted as respectively, and then combined with . Through multi-scale convolution, the model can simultaneously capture feature correlation and multi-dimensional statistical features-this not only enables it to identify which features are semantically matched but also supplements information such as global, local, and fluctuation-related details. This constructs more robust feature representations and enhances the module’s adaptability to complex scenarios and its capability for feature parsing. The process can be expressed as: Where ,, denotes point-wise convolution. Then, a normalization operation is performed on to stabilize the distribution, after passing through the Sigmoid function, a spatial attention map is generated. Pseudo-code implementation of MFHA To clearly illustrate the overall computational workflow of MFHA, this section describes its execution process in the form of algorithm pseudo-code. The design of MFHA follows a progressive feature enhancement framework, decomposing input features into sub-bands of different frequencies via the wavelet transform, thereby achieving collaborative optimization of local details and global semantics. Algorithm 1 illustrates the computational workflow of MFHA. It takes a feature map F and a channel selection number N as input, and outputs an enhanced feature map F', which is jointly refined in both the frequency and spatial domains. Residual connections are employed between modules to maintain gradient flow and feature reuse, ultimately yielding an enhanced feature representation. The algorithm exhibits excellent plug-and-play compatibility and can be seamlessly integrated into mainstream backbone networks, such as CNNs or Transformers, significantly improving the model’s ability to perceive subtle features in pathological images with minimal additional computational cost. Multi-scale Frequency-domain Hybrid Attention (MFHA). Experiments Datasets This study utilizes two datasets to evaluate the performance of MFHA: the publicly available Sipakmed dataset49 and a set of 2012 H&E-stained whole-slide images (WSIs) of lung cancer pathological specimens for gene mutation prediction, provided by a medical center in Chongqing, China. SipakMed is a classic public dataset of cervical cytology smears, comprising five classes of samples: Normal, Inflammation, Light Dysplasia, Moderate Dysplasia, and Severe Dysplasia/Carcinoma in situ. The dataset consists of 4,049 isolated cell images cropped from 966 cell cluster images and is primarily designed for cell-image-level classification tasks to evaluate a model’s ability to distinguish the subtle morphological differences among cervical cells at various lesion grades. The core challenges of this dataset lie in the blurred morphological boundaries between lesional and normal cells, the high morphological heterogeneity among cells of the same lesion class, and the noise interference introduced by uneven smear staining. The lung cancer gene mutation pathological image dataset is shown in Table 1. This dataset is divided into 12 categories, encompassing various types of gene mutations. However, it is a highly class-imbalanced dataset (for instance, the EGFR genotype accounts for nearly 50% of the entire dataset). Therefore, to ensure experimental rationality and fairness, this study processes the dataset into two distinct binary classification subsets: one classifying cases with any gene mutation versus those without any gene mutation, and another specifically classifying cases with an EGFR mutation versus those without an EGFR mutation (as detailed in Table 2). This approach aims to balance the class distribution as much as possible and to thoroughly evaluate the model’s performance. Table 1Initial WSI lung cancer gene mutation dataset.GenotypeNumberEpidermal Growth Factor Receptor(EGFR)947Wild Type(WT)584Kirsten Rat Sarcoma viral oncogene(KRAS)208Anaplastic Lymphoma Kinase(ALK)120Human Epidermal growth factor Receptor 2(HER2)35Mesenchymal Epithelial Transition factor(MET)26B-Raf proto-oncogene serine/threonine-protein kinase(BRAF)22C-ros oncogene 1(ROS1)21Rearranged during Transfection(RET)19Phosphatidylinositol-4,5-Bisphosphate 3-Kinase catalytic subunit alpha(PIK3CA)13Merge mutations13Neuroblastoma RAS viral oncogene(NRAS)4 Initial WSI lung cancer gene mutation dataset. Table 2Partition of Lung Cancer Pathology Dataset.Data TypeGenotypeNumberGene Mutation DatasetCases with Gene Mutation1428Cases without Gene Mutation584EGFR Mutation DatasetCases with EGFR Mutation947Cases without EGFR Mutation1065 Partition of Lung Cancer Pathology Dataset. Experimental on gene mutation Implementation details on gene mutation WSI pathological image classification adopts the mainstream two-stage processing method, consisting of a patch-level feature encoder and a slide-level global aggregation encoder50,51. To effectively preserve and enhance high-frequency detail information before the Transformer performs feature aggregation, this study integrates MFHA with Swin Transformer52 to construct a novel hybrid encoding network, MFTrans, which serves as the feature encoder (Figure 6). Compared to traditional shallow sub-band concatenation methods or single-channel/spatial attention mechanisms, MFHA employs explicit cross-sub-band attention modeling and multi-receptive-field feature fusion, enabling the MFTrans network to capture subtle morphological features at the cellular level through MFHA while leveraging the Transformer architecture to model long-range dependencies and global contextual relationships. The global aggregation encoder adopts a LongNet-based53 global aggregation encoder54 for feature integration across the whole slide. WSI pathological analysis and diagnosis pipeline: (a) Feature encoder incorporating the MFHA mechanism; (b) Global aggregation encoder built upon LongNet. Specifically, background processing is first performed on the input WSI to remove blank background regions without pathological significance through edge detection, retaining only effective tissue regions that contain tumor and normal tissue. To control the H&E staining heterogeneity and batch effects caused by differences in slide preparation batches, staining equipment, and operators, this study applies the Macenko stain normalization method to standardize all effective tissue regions. This method estimates the reference stain vectors of hematoxylin (nuclear stain) and eosin (cytoplasmic/stromal stain) in the image via non-negative matrix factorization, transforms the original image into a unified standard stain space, effectively eliminates non-pathological interference such as staining intensity variations, hue deviations, and contrast differences, enhances the feature consistency of pathological images from different sources, and provides stable and reliable input for subsequent feature extraction. Subsequently, the standardized tissue regions are divided into multiple 224×224 pixel patches (MPP=1.0). These patches are fed into a feature encoder based on the MFTrans architecture (Figure 6a), which first enhances texture information and global correlations through MFHA, then extracts features via a 4-stage Swin Transformer to generate patch-level embedding representations. This encoder was not pre-trained using contrastive learning; instead, it was first pre-trained on ImageNet-1K with an image size of 224×224 and a batch size of 128 for 120 epochs, and then further trained on the pathology dataset LDCH55 to adapt to pathological features. Subsequently, the patch-level embeddings are passed into a global aggregation encoder (Figure 6b), which is loaded with pre-trained LongNet weights54. During encoding, the Dilated Attention53 mechanism is adopted to capture long-range cross-patch dependencies, ultimately yielding target tile embeddings and completing the extraction of semantic embeddings from local to global. It should be noted that, due to computational resource constraints, this experiment only trains the final classification head on the lung cancer gene mutation WSI dataset, without performing end-to-end fine-tuning of the patch-level feature encoder and the slide-level global aggregation encoder. Although this experimental setup allows for a fair comparison of the inherent representational capacity of different feature extractors under strictly controlled variables, eliminating the interference caused by differences in fine-tuning strategies, it also introduces certain limitations. Since the pre-trained encoder has not undergone targeted domain adaptation to the lung cancer gene mutation pathology data in this study, it may fail to fully capture morphological features specific to lung cancer tissue, such as glandular structural variations and nuclear atypia, as well as the subtle pathological patterns corresponding to different gene mutation types, thereby limiting the upper bound of the model’s classification performance to some extent. Moreover, this frozen-encoder training approach weakens the model’s ability to learn the distribution characteristics of the current dataset, which may adversely affect its cross-domain generalization capability on heterogeneous lung cancer pathology data collected from different medical centers and using different staining equipment. Future research will, when computational resources permit, carry out hierarchical joint fine-tuning of the encoder and the classification head, progressively unfreezing network layers and adopting a low learning rate optimization strategy, so as to further tap the model’s performance potential and enhance its clinical utility while avoiding overfitting. The classification task employs the Adam56 optimizer with an initial learning rate of 0.002, a batch size of 1, and cross-entropy as the loss function, and is trained for 40 epochs on a 4×DCU 16G computing node. To rigorously prevent patient-level data leakage, a common issue in pathological image analysis, this study adopts a strict patient-wise two-fold Monte Carlo Cross Validation (MCCV)57 strategy: in each fold, the patient cohort is independently and randomly partitioned into a training set and a test set at a ratio of 7:3, ensuring that all whole slide images and their derived image patches from the same patient belong exclusively to a single set, thereby completely eliminating the possibility of the same patient’s data appearing in both the training and test sets. A total of 2,012 independent patients (each corresponding to one H&E-stained lung cancer WSI) are included in this study, with approximately 1,408 patients in the training set and 604 patients in the test set per fold. During training, a weighted sampling strategy based on class distribution is adopted to mitigate the inherent class imbalance problem of the dataset. Experimental results on gene mutation To comprehensively validate the model’s performance on pathological images, this study selected widely-used evaluation metrics in the field, Accuracy (ACC), Balanced Accuracy (BACC), Area Under the ROC Curve (AUROC), and Area Under the PR Curve (AUPRC), to assess the feature extraction performance of MFTrans and the baseline model CTransPath28 on both datasets. Specifically, identical WSI partitions were processed to extract pathological features using MFTrans and the baseline model, respectively, as the patch-level encoder. These features were then passed through the same slide-level encoder for final classification. The results are presented in Table 3. Overall, MFTrans demonstrates more stable performance and outperforms the baseline CTransPath across all evaluation metrics, with its advantage being more pronounced on the gene mutation dataset. For this specific task, MFTrans achieved a BACC of 0.6689, representing an improvement of approximately 1.59% over CTransPath (0.6531). Its average AUROC reached 0.7321, exceeding the baseline by about 1.2%, while the average AUPRC improved by 2.69%. This indicates that MFTrans offers superior overall classification stability when capturing relevant pathological features, which is closely related to its designed MFHA mechanism. By decomposing low-frequency global semantics and high-frequency detail information via the wavelet transform, and combining multi-scale convolutions with dual upsampling fusion to enhance the perception of high-frequency components, MFHA can effectively amplify subtle morphological features associated with mutations in pathological images (such as cellular texture and edge structures) while filtering out noise interference. This, in turn, improves the model’s recognition accuracy for positive samples. In the EGFR mutation dataset, MFTrans’s advantages, while relatively moderate, remain clear, with average improvements of 0.48% in BACC, 1.17% in AUROC, and 0.56% in AUPRC. Table 3Experimental results of pathological image classification for gene mutations.Classification taskModelFoldBACCACCAUROCAUPRCBinary classification of gene mutationsMFTrans(Ours)1Fold0.6710700.6749590.7327070.7162732Fold0.6667930.6616670.7314280.707776Average0.6689320.6683130.7320670.712025CTranspath1Fold0.6466750.6436980.7186330.6820912Fold0.6594520.6533330.7215270.688081Average0.6530640.6485160.7200800.685086EGFR mutation binary classificationMFTrans(Ours)1Fold0.6403380.6261330.6899090.6788042Fold0.6486880.6295670.6899250.679252Average0.6445130.6278500.6899170.679028CTranspath1Fold0.6377160.6206240.6750290.6692832Fold0.6415310.6216670.6813310.677568Average0.6396240.6211450.6781800.673425 Experimental results of pathological image classification for gene mutations. It is noteworthy that in the EGFR mutation dataset, despite a more balanced sample ratio (approximately 1:1.12) compared to the general gene mutation dataset, the magnitude and absolute values of the model’s performance improvement are lower than those observed in the general gene mutation task. An in-depth analysis suggests that this phenomenon may be related to the complexity of pathological features and the inherent differences in task nature. Specifically, in the general gene mutation classification task, the positive class encompasses various types of gene mutations. These mutations may manifest through significant common pathological features (such as abnormal cell proliferation, disorganized tissue structure, and nuclear morphological distortion), and the differences between positive samples and the negative class (wild-type, WT) samples are more pronounced in terms of both global semantics and local details. The MFHA mechanism in MFTrans effectively captures these shared characteristics by decomposing and fusing low-frequency global information and high-frequency details via the wavelet transform, learning multi-level semantic features. Simultaneously, the dual upsampling fusion reinforces the perception of high-frequency components, further amplifying the morphological differences associated with mutations, leading to superior performance in this task. In contrast, EGFR mutation represents a single type of genetic alteration. Its pathological features might be more subtle and exhibit a higher degree of overlap with the characteristics of negative class samples. For instance, pathological patterns of other mutations like KRAS or ALK might partially resemble those of EGFR mutations, increasing the difficulty of feature discrimination. Secondly, the composition of the negative class in this dataset is more complex. This category includes not only wild-type (WT) samples but also samples with other gene mutations. These samples do not present a single pathological pattern; instead, they exhibit diverse morphological features, resulting in a more dispersed feature distribution. This effectively requires the model to identify a single target feature from a variety of non-target characteristics, necessitating handling more complex feature distribution overlaps. Consequently, the absolute values of the overall performance metrics are lower in this task compared to the previous one. Experimental on sipakmed Implementation details on sipakmed This experiment focuses on the comparative validation of backbone networks and attention mechanisms. Given the lightweight and plug-and-play nature of MFHA, it was simply embedded into the backbone networks of ResNet58 and Vision Transformer59 (Figure 7a,b) for performance comparison with mainstream attention mechanisms and wavelet-transform-related methods in recent years. MFHA mechanism embedding location. To ensure that integrating MFHA into the backbone network effectively enhances the extraction of detailed features, this study designed corresponding embedding strategies tailored to the architectural characteristics of ResNet and Transformer. Specifically, as the bottleneck layers of ResNet are key nodes for feature transformation and information fusion, MFHA was embedded between these bottleneck layers. This utilizes MFHA to augment local details during the feature flow process, preventing the dilution of detailed information caused by deep networks. Conversely, ViT primarily relies on the self-attention mechanism to model global dependencies and is relatively less sensitive to local high-frequency details in the input features. Therefore, MFHA was placed at the beginning of the network to perform frequency-domain decomposition and detail enhancement on the raw input before global feature extraction, thereby providing richer and more discriminative feature representations for subsequent attention layers. The dataset was divided into training and test sets in an 8:2 ratio. During training, a batch size of 128 was used with the Adam optimizer, a learning rate of 0.001, and weight decay of 1e-4. The cross-entropy loss function was employed for 120 training epochs. Evaluation was conducted using four metrics: Accuracy, F1 Score, Precision, and Recall. Experimental results on sipakmed The experimental results are shown in Table 4. Both the ResNet and Transformer networks integrated with MFHA outperformed other mainstream attention mechanisms and traditional networks, with Accuracy increasing by 5.3% and 2.7% respectively compared to their baselines. This further demonstrates the effectiveness of MFHA in enhancing the representational capacity of models. Table 4Experimental Results of Spiakmed Pathological Image Classification.MetricsAccuracyF1 ScorePrecisionRecallMGMacAlexnet6090.8641980.9121840.9154740.91200457.020.71VGG166186.0493830.8625940.8636040.863616134.2815.52ResNet5890.2469140.9028410.9036290.90776611.691.83ResNet-CBAM1692.7901230.9295920.9202210.92918311.781.83ResNet-BAM6293.5802470.9381570.9377530.93907411.711.83ResNet-ECA6379.7530860.8000970.8068360.79953711.181.83ResNet-SE6491.8148150.9106890.9124180.91991411.781.83ResNet-SGE6593.5802470.9385150.9392250.93926911.691.83ResNet-SK6690.2469140.9028410.9036290.90776611.691.83ResNet-DA6790.8641980.9127900.9193260.91232611.82.77ResNet-MFHA(Ours)95.5555560.9572560.9587060.95737911.731.83ViT5992.3456790.9252540.9266370.92562622.053.22SwinT6891.2345680.9143900.9160870.91635125.514.1EVT6994.5851850.9437600.9449280.9437090.426.85EVIT7092.5925930.9273300.9293670.92810421.672.81CSWIN7188.0246910.8840670.8951640.88386621.814.1SWIN5291.3580250.9188480.9271940.91661227.524.38DAWN7292.2222220.9269220.9348330.9264611.037.49ViT-MFHA(Ours)95.0617280.9519770.9523970.95301322.053.28Note: M represents millions of parameters; GMac refers to giga multiply-accumulate operations. Experimental Results of Spiakmed Pathological Image Classification. Note: M represents millions of parameters; GMac refers to giga multiply-accumulate operations. Specifically, lesion features in cervical tissue, such as nuclear enlargement and disordered cell arrangement, are primarily reflected in high-frequency components, whereas the overall tissue structure constitutes low-frequency information. MFHA employs wavelet decomposition to separate features into low-frequency global (LL) sub-bands and high-frequency edge-detail (LH/HL) sub-bands. It then fuses these different sub-bands to capture multi-level semantics. Its dual upsampling fusion mechanism selectively enhances high-frequency details while simultaneously filtering out staining noise. The spatial attention module integrates cosine similarity with multi-dimensional statistical features, which helps measure the alignment between global and local characteristics while capturing cell density fluctuations, thereby strengthening the features within lesion regions. In comparison, mechanisms like CBAM rely solely on spatial-domain weighting and struggle to distinguish meaningful high-frequency details from noise. Transformer variants such as ViT, although effective at modeling global dependencies, exhibit limited capability in resolving high-frequency microscopic features, a gap that MFHA is designed to address. Furthermore, the increase in parameter count and computational cost of MFHA compared to other methods is minimal and almost negligible. This indicates that its performance improvement does not rely on additional computational overhead but stems from its unique feature enhancement mechanism and local-global collaborative modeling capability. Ablation experiments and interpretability To validate the effectiveness of each core module in MFHA, this study conducts an ablation experiment using ResNet as the backbone network on the Sipakmed pathological dataset. Performance changes are compared by incrementally adding the wavelet-guided up/downsampling module (Wavelet) and the spatial attention module (Spatial). The experimental results are presented in Table 5. It can be observed that when only the Wavelet module was added, the model’s accuracy increased by 2.22% and the F1-score improved by 2.43%, indicating that wavelet decomposition enhances high-frequency details and that multi-scale fusion effectively captures pathological features. When only the Spatial module was added, accuracy improved by 3.21% and the F1-score increased by 3.33%, validating that the spatial attention mechanism constructs robust representations through cosine similarity and multi-dimensional statistical features. When both the Wavelet and Spatial modules were combined, accuracy further increased to 95.56%, and the F1-score reached 0.9573, significantly outperforming the individual modules. This demonstrates that the frequency-domain features provided by wavelet decomposition offer more precise guidance for spatial attention, while spatial attention reinforces the weighting of key areas in the frequency domain, resulting in a synergistic optimization of frequency-domain analysis and spatial focusing. Table 5Experimental Results of MFHA Ablation Study.MetricsAccuracyF1 ScorePrecisionRecallResNet90.2469140.9028410.9036290.907766ResNet+Wavelet92.4691360.9271110.9279970.928651ResNet+Spatial93.4567900.9361500.9357120.937244ResNet+Wavelet+Spatial95.5555560.9572560.9587060.957379 Experimental Results of MFHA Ablation Study. Furthermore, to visually demonstrate the feature learning mechanism of MFHA, this study employs Gradient-weighted Class Activation Mapping (Grad-CAM)73,74 to generate heatmaps, comparing the focus differences between a standard ResNet and ResNet-MFHA on key features. The results are shown in Figure 8. Taking a sample of “Severe Dysplasia” from the Sipakmed dataset as an example in pathological image analysis, the heatmap from the standard ResNet shows blurred distinction between lesioned areas and normal glands. In contrast, the heatmap generated by MFHA accurately localizes lesioned regions characterized by enlarged nuclei and disordered cell arrangement. Comparative visualization examples of Grad-CAM for ResNet-MFHA and ResNet. Conclusion This study addresses the key issues of insufficient utilization of detailed information and the lack of multi-scale interaction in frequency-domain methods for pathological image classification, proposing a Multi-scale Frequency-domain Hybrid Attention mechanism (MFHA). This mechanism employs the wavelet transform to decompose images into low-frequency global structural and high-frequency local detail sub-bands. By integrating multi-scale convolution and sub-band fusion strategies, it effectively enhances high-frequency discriminative features, achieving deep synergistic representation of global semantics and local details. Furthermore, a spatial attention module that incorporates cosine similarity and multi-dimensional statistical features is introduced to enhance the robustness and discriminative power of features in complex pathological scenarios. Experiments conducted on the public Sipakmed dataset and a lung cancer gene mutation pathological dataset demonstrate that MFHA outperforms existing methods across multiple evaluation metrics, validating its effectiveness in fine-grained pathological image classification tasks. Despite the promising performance demonstrated by MFHA in the experiments, this study has several limitations. First, although the wavelet decomposition and reconstruction processes in MFHA preserve most high-frequency information, the completeness of detail reconstruction could be further improved under conditions of extreme noise or significant staining variation. Second, the current method primarily processes individual pathological images and does not yet fully consider the spatial contextual relationships and multi-scale semantic continuity across different regions within a whole-slide image, leaving room for further refinement in the coherence of the overall diagnostic logic. Future work will explore the following directions in depth. First, we aim to extend the applicability of MFHA to heterogeneous pathological data collected from multiple centers and devices, further enhancing the model’s clinical generalization capability through domain adaptation or meta-learning strategies. Second, we will pursue deeper integration of MFHA with architectures such as Vision Transformers and Graph Neural Networks to construct a unified framework capable of simultaneously modeling local details, long-range dependencies, and topological relationships. Third, we will explore the application of MFHA to a wider range of fine-grained pathological classification tasks, such as tumor subtype grading, immunohistochemical prediction, and prognostic assessment, to promote its practical implementation in precision medicine. Acknowledgements We also thank the National Advanced Computing Taiyuan Center and Taihang Laboratory in Shanxi Province (Advanced Computing Laboratory in Shanxi Province) for providing computational resources for this study. Author contributions All authors have made significant contributions to the design, implementation, and writing of this study. Yang Zhang assisted in refining the research plan and supplementing and improving the technical route. Junjie Li undertook the collection and collation of datasets, the overall design of experiments, model training and performance validation, and was responsible for writing the first draft of the paper. Qiushi Wang, Luyan Zhang, Lingjiang Deng, Qiyun Tian, Feixu Lu, and Gang Li participated in technical discussions during the research process, assisted in the verification and analysis of experimental results as well as the revision and improvement of the paper, and provided valuable suggestions for model optimization and data reliability verification. Corresponding authors Chuanyun Xu, Fanghong Zhang, and Hualiang Xiao were responsible for the planning of the overall research direction and top-level design, guided the proposal and optimization of core innovations, coordinated the formulation of experimental schemes and the demonstration of results, and undertook the overall review, revision, and finalization of the paper, ensuring the scientificity, rigor, and innovation of the research. Funding This research was supported by China Chongqing Municipal Science and Technology Bureau, grant number CSTB2024NSCQLZX0043, CSTB2023NSCQ-LZX0139; Chongqing University of Technology graduate education high-quality development project, grant number gzlsz202304, gzlkc202401, gzltd202502; Chongqing University of Technology Chongqing LINGLUE Technology Co., LTD. Electronic Information (artificial intelligence) graduate joint training base. Data availability Due to strict ethical restrictions in medical research and requirements for protecting patient privacy, the WSI lung cancer dataset cannot be publicly shared or distributed. Data are however available from the authors upon reasonable request. The SipakMed public dataset can be obtained from https://www.kaggle.com/datasets/prahladmehandiratta/cervical-cancer-largest-dataset-sipakmed/data. Code availability All the code related to the research is publicly available on GitHub. The code repository can be accessed via the following link: https://github.com/AnaStartz/WSI-processing-framework. Declarations Ethics approval and consent to participate The experimental protocols involving human biological samples were reviewed and approved by the Ethics Committee of the Army Characteristic Medical Center of the Chinese People’s Liberation Army (Approval No. Yiyan Lunshen (2024) No. 169). This study strictly complied with the ethical principles set forth in the Declaration of Helsinki (2013 revision) and the Measures for the Ethical Review of Life Science and Medical Research Involving Human Subjects (2023 version). Informed consent was waived for this study, as approved by the ethics committee, and all tissue samples were de-identified to protect participant privacy. Written informed consent was obtained from all participants after detailed explanation of the research purpose, specimen usage, and potential risks. Competing interests The authors declare no competing interests. Footnotes Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. These authors contributed equally: Yang Zhang and Junjie Li. Contributor Information Chuanyun Xu, Email: xcy@cqnu.edu.cn. Fanghong Zhang, Email: fanghong.zhang@cqnu.edu.cn. Hualiang Xiao, Email: dpbl_xhl@tmmu.edu.cn. References Associated Data Data Availability Statement Due to strict ethical restrictions in medical research and requirements for protecting patient privacy, the WSI lung cancer dataset cannot be publicly shared or distributed. Data are however available from the authors upon reasonable request. The SipakMed public dataset can be obtained from https://www.kaggle.com/datasets/prahladmehandiratta/cervical-cancer-largest-dataset-sipakmed/data. All the code related to the research is publicly available on GitHub. The code repository can be accessed via the following link: https://github.com/AnaStartz/WSI-processing-framework.