Papers
Topics
Authors
Recent
Search
2000 character limit reached

SwinECAT: Fine-Grained Fundus Disease Classification

Updated 7 July 2026
  • SwinECAT is a Transformer-based architecture that fuses shifted window self-attention with efficient channel attention for fine-grained fundus disease classification.
  • It employs a four-stage hierarchical backbone with integrated ECA modules, achieving 88.29% accuracy on 9-category fundus image classification.
  • The model effectively captures localized lesions and subtle inter-disease differences while remaining parameter-efficient compared to similar methods.

Searching arXiv for the specified paper to ground the article and verify bibliographic details. SwinECAT is a Transformer-based architecture for fine-grained fundus disease classification that combines the Shifted Window (Swin) Attention mechanism with Efficient Channel Attention (ECA) to address small lesion areas and subtle inter-disease differences in fundus images (Gu et al., 29 Jul 2025). It is evaluated on the Eye Disease Image Dataset (EDID) for 9-category classification and is reported to achieve 88.29\% accuracy, a weighted F1-score of 0.88, and a macro F1-score of 0.90; the same study states that this represents the highest reported performance for 9-category classification on this public dataset (Gu et al., 29 Jul 2025). The model’s defining design choice is the fusion of hierarchical, window-based self-attention for spatial context modeling with lightweight channel reweighting for more discriminative feature representation.

1. Clinical and task context

Fundus image analysis poses specific difficulties for automated diagnosis because some fundus diseases present with small lesion areas and because inter-disease visual differences can be subtle (Gu et al., 29 Jul 2025). In this setting, reduced prediction accuracy and overfitting are identified as central modeling risks. SwinECAT is positioned as a response to those constraints rather than as a general-purpose vision backbone.

The classification task is explicitly more granular than prior work that typically classifies fundus images into 4 to 6 categories. SwinECAT expands the task to 9 distinct types: eight disease categories—Retinitis Pigmentosa, Retinal Detachment, Myopia, Macular Scar, Glaucoma, Optic Disc Edema, Diabetic Retinopathy, and Central Serous Chorioretinopathy—plus healthy fundus. This suggests that the architecture is intended for fine-grained discrimination within ophthalmic image classification rather than only coarse abnormal-versus-normal screening.

The dataset framing is similarly specific. EDID contains 16 242 high-quality fundus images at 2004×16902004\times1690 px, and excluding non-fundus (pterygium) images leaves 16 140 images across the nine classes. Class frequencies are imbalanced, ranging from 606 images for CSC to 3 444 for diabetic retinopathy. A plausible implication is that both per-class sensitivity and aggregate performance need to be interpreted under class imbalance, which is consistent with the paper’s use of both macro and weighted F1.

2. Architectural organization

SwinECAT adopts the four-stage hierarchical backbone of the Swin Transformer, with each stage operating on feature maps of progressively lower spatial resolution and higher channel dimension, much like a Feature Pyramid Network (Gu et al., 29 Jul 2025). This multi-scale hierarchy is not incidental: it provides the structural basis for combining local window attention with progressively broader contextual abstraction.

Within this backbone, each stage alternates a small number of Swin Transformer Blocks with a single ECA block. The stage-wise configuration is: Stage 1, 2 Swin blocks + 1 ECA; Stage 2, 2 Swin blocks + 1 ECA; Stage 3, 6 Swin blocks + 1 ECA; and Stage 4, 2 Swin blocks + 1 ECA. After the final stage, a global pooling layer and a classifier head produce nine-way predictions. This organization indicates that channel recalibration is inserted repeatedly at multiple resolutions rather than only at the network output.

A Swin Transformer Block takes an input feature map X∈RH×W×CX \in \mathbb{R}^{H\times W\times C}, applies LayerNorm, then either Window Multi-Head Self-Attention (W-MSA) or Shifted Window MSA (SW-MSA), adds a residual connection, passes through an MLP, and adds another residual: Z=X+MSA(LN(X))Z = X + \mathrm{MSA}(\mathrm{LN}(X))

X′=Z+MLP(LN(Z))X' = Z + \mathrm{MLP}(\mathrm{LN}(Z))

The alternation between W-MSA and SW-MSA is central to the model’s spatial processing strategy.

3. Shifted Window Attention and spatial modeling

The Swin component is used to capture both local spatial structures and long-range dependencies within fundus images (Gu et al., 29 Jul 2025). In W-MSA, the input XX is divided into HM×WM\tfrac{H}{M}\times\tfrac{W}{M} non-overlapping windows of size M×MM\times M, and each window is flattened into a sequence of length M2M^2. Standard multi-head self-attention is then applied within each window.

For each head hh, the flattened window representation is projected to queries, keys, and values: Q=XWQ,K=XWK,V=XWVQ = X W_Q,\quad K = X W_K,\quad V = X W_V with X∈RH×W×CX \in \mathbb{R}^{H\times W\times C}0, where the per-head dimension is X∈RH×W×CX \in \mathbb{R}^{H\times W\times C}1. The Details section further specifies that attention scores are computed with optional relative position bias X∈RH×W×CX \in \mathbb{R}^{H\times W\times C}2, and the outputs of all heads are concatenated and linearly projected.

SW-MSA is introduced to allow cross-window information flow. The feature map is circularly shifted by X∈RH×W×CX \in \mathbb{R}^{H\times W\times C}3, the same window partitioning and attention are applied, and the result is shifted back. If X∈RH×W×CX \in \mathbb{R}^{H\times W\times C}4 denotes this cyclic shift, SW-MSA computes

X∈RH×W×CX \in \mathbb{R}^{H\times W\times C}5

By alternating W-MSA and SW-MSA, the Swin blocks are described as capturing both strong local structure and longer-range dependencies at linear computational cost in X∈RH×W×CX \in \mathbb{R}^{H\times W\times C}6. In the fundus setting, this directly targets the coexistence of localized lesions and broader anatomical context.

4. Efficient Channel Attention and feature recalibration

After each group of Swin blocks in a stage, SwinECAT applies an ECA module to the corresponding multi-scale feature map X∈RH×W×CX \in \mathbb{R}^{H\times W\times C}7 (Gu et al., 29 Jul 2025). The ECA mechanism first performs global average pooling along the spatial dimensions to produce a channel descriptor X∈RH×W×CX \in \mathbb{R}^{H\times W\times C}8: X∈RH×W×CX \in \mathbb{R}^{H\times W\times C}9

The pooled descriptor is then processed by a 1D convolution across channels with adaptive kernel size Z=X+MSA(LN(X))Z = X + \mathrm{MSA}(\mathrm{LN}(X))0, followed by a sigmoid activation, producing channel weights Z=X+MSA(LN(X))Z = X + \mathrm{MSA}(\mathrm{LN}(X))1: Z=X+MSA(LN(X))Z = X + \mathrm{MSA}(\mathrm{LN}(X))2 In practice, Z=X+MSA(LN(X))Z = X + \mathrm{MSA}(\mathrm{LN}(X))3 is selected via a simple mapping from Z=X+MSA(LN(X))Z = X + \mathrm{MSA}(\mathrm{LN}(X))4, for example Z=X+MSA(LN(X))Z = X + \mathrm{MSA}(\mathrm{LN}(X))5 made odd, and remains small so that the overhead is negligible. The original feature map is then recalibrated channelwise: Z=X+MSA(LN(X))Z = X + \mathrm{MSA}(\mathrm{LN}(X))6

Functionally, ECA is inserted to guide attention toward critical feature channels and thereby enable more discriminative feature representation. The Details section characterizes this as a minor parameter increase, stated as approximately Z=X+MSA(LN(X))Z = X + \mathrm{MSA}(\mathrm{LN}(X))7 M per ECA block. This suggests that the intended role of ECA is complementary rather than substitutive: spatial modeling remains the responsibility of the Swin backbone, while ECA adaptively re-weights channels most relevant to distinguishing subtle fundus lesions.

5. Dataset protocol and empirical results

The experimental protocol uses an 80\% training, 10\% validation, and 10\% test split while preserving class proportions (Gu et al., 29 Jul 2025). Training uses cross-entropy loss, the Adam optimizer, learning rate Z=X+MSA(LN(X))Z = X + \mathrm{MSA}(\mathrm{LN}(X))8, and batch size 32 for train, validation, and test. Early stopping is triggered if validation loss does not improve for 3 epochs. Input preprocessing resizes the shorter side to 256 px, applies a center crop of Z=X+MSA(LN(X))Z = X + \mathrm{MSA}(\mathrm{LN}(X))9, normalizes by dataset mean and standard deviation, and uses random shuffling with multithreaded loading.

On the held-out test set, SwinECAT achieves 88.29\% accuracy, macro-averaged F1 of 0.9000, and weighted-averaged F1 of 0.8830. The study reports that the classification results significantly outperform the baseline Swin Transformer and multiple compared baseline models.

Model Performance Params
ResNet50 83.27 Acc; 0.8426 Macro F1; 0.8319 Weighted F1 23.5 M
ViT 85.01 Acc; 0.8752 Macro F1; 0.8510 Weighted F1 21.7 M
BEiT 85.32 Acc; 0.8691 Macro F1; 0.8530 Weighted F1 85.8 M
MaxViT 86.49 Acc; 0.8859 Macro F1; 0.8653 Weighted F1 30.4 M
Swin Transformer 86.56 Acc; 0.8849 Macro F1; 0.8654 Weighted F1 27.5 M
MaxViT + ResNet18 87.42 Acc; 0.8936 Macro F1; 0.8774 Weighted F1 42.1 M
CNN + Transformer 79.93 Acc; 0.8160 Macro F1; 0.8000 Weighted F1 76.1 M
SwinECAT 88.29 Acc; 0.9000 Macro F1; 0.8830 Weighted F1 28.3 M

The ablation study replaces each stage’s ECA module with identity, corresponding to the baseline Swin Transformer. Under this change, accuracy drops from 88.29\% to 86.56\%, and macro F1 drops from 0.9000 to 0.8849. The reported interpretation is that ECA provides a complementary benefit to spatial attention.

6. Significance, limitations, and prospective extensions

The main finding is that combining local windowed self-attention, shifted-window cross-region context, and lightweight channel attention yields state-of-the-art 9-way fundus-disease classification accuracy while remaining parameter-efficient (Gu et al., 29 Jul 2025). The paper identifies three principal strengths: capturing subtle local lesions via windowed self-attention, dynamically emphasizing informative channels with minimal overhead, and robustness across both common and rare disease classes as reflected in balanced macro and weighted metrics.

At the same time, the limitations are explicit. SwinECAT is a single-modality model operating on 2D fundus images, and it relies on supervised training. A common misunderstanding would be to treat it as a multimodal ophthalmic framework or as a method designed around unlabeled pretraining; the reported system is neither. The paper instead states that it may benefit from self-supervised pre-training on large ophthalmic datasets.

Future directions are also specified in concrete terms: multi-modal fusion, including patient metadata and video sequences; semi- or self-supervised pre-training to leverage large unlabeled medical-image corpora; and further architectural slimming or neural-architecture search for deployment on edge devices. These directions suggest that the present model is best understood as a high-performing supervised baseline for fine-grained 9-class fundus classification, with a modular design that could plausibly be extended to broader ophthalmic pipelines.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to SwinECAT.