Lung cancer mortality is closely tied to late-stage diagnosis of pulmonary nodules. Early detection of lung nodules measuring 3-30 mm in diameter can improve five-year survival rates from below 15% to approximately 85%, making automated nodule detection in CT scans a critical clinical priority. NSCLC represents approximately 80% of all lung cancer cases, and CT imaging is the cornerstone modality for its diagnosis and staging.
Manual analysis of CT images is time-consuming, susceptible to inter-reader variability, and limited by radiologist expertise and workload. While deep learning-based computer-aided detection systems have significantly improved diagnostic reproducibility, challenges remain in accurately differentiating benign from malignant nodules due to their morphological similarities, surrounding tissue complexity, and variations in nodule size, texture, and location relative to blood vessels and bronchi.
Existing deep learning frameworks often treat preprocessing, segmentation, and classification as independent tasks, resulting in feature loss between stages and inconsistent performance under heterogeneous imaging conditions. Static architectures lack the adaptability to handle diverse datasets, and limited explainability restricts clinical adoption.
This study proposes a unified multi-phase pipeline that integrates preprocessing, segmentation, and classification with shared feature representations across stages, adaptive multi-scale attention mechanisms, and automated hyperparameter optimization -- directly addressing the limitations of prior isolated-task approaches.
SEPE selectively amplifies nodule boundaries while suppressing irrelevant noise. The Sparse Edge-Preserving Enhancement technique is applied to raw CT images before segmentation. Unlike conventional Gaussian or median smoothing filters that reduce noise at the cost of erasing subtle intensity transitions, SEPE uses adaptive gradient-based weighting that enhances edges selectively while maintaining smoothness in uniform regions.
The enhancement formula computes an enhanced output by adding a locally weighted residual between the original image and its Gaussian-smoothed version. The weighting function uses the exponential of the negative squared gradient magnitude, meaning that low-gradient smooth areas receive stronger smoothing while high-gradient edge regions are protected from smoothing. A Laplacian regularization term further suppresses enhancement in textured noise-rich areas.
The combined effect of SEPE is sharper and more distinguishable nodule boundaries with improved contrast-to-noise ratio and structural similarity compared to standard filters. This is particularly beneficial for small or low-contrast nodules where boundary definition is critical for accurate segmentation. The enhanced images are normalized to a fixed intensity range and resized to uniform spatial resolution before entering the segmentation stage.
The two benchmark datasets used for evaluation were LUNA16 and LIDC-IDRI. LUNA16 contains 888 thoracic CT scans with 1,186 annotated nodules of diameter 3 mm or larger. LIDC-IDRI contains 1,018 CT scans with 2,529 annotated nodules reviewed by four independent radiologists. Patient-level data splitting into 70% training, 15% validation, and 15% testing was used to prevent data leakage.
DeepLabv3+ was extended with two specialized modules for nodule segmentation. The Atrous Spatial Pyramid Pooling module applies parallel dilated convolutions at dilation rates of 6, 12, and 18, enabling simultaneous capture of fine-grained local details and broad contextual information. This multi-scale feature representation allows accurate segmentation of nodules across a wide range of sizes and shapes, followed by global average pooling to inject global context into the representation.
The Refined Boundary Decoder module complements ASPP by focusing specifically on boundary precision. An edge detection layer generates a gradient magnitude map highlighting high-contrast transitions at nodule margins. This edge map is fused with the decoder output, and the combined features pass through multiple 3x3 convolutional layers with bilinear upsampling to produce precise boundary delineations even for irregularly shaped or poorly defined lesions.
A boundary-aware composite loss function was used during training, combining a segmentation term that minimizes pixel-wise classification errors with an edge prediction term that penalizes boundary inaccuracies. Weighted balance between these two loss components ensures that the model prioritizes boundary precision without sacrificing overall segmentation coverage.
Four pretrained encoder backbones were evaluated within this DeepLabv3+ framework: EfficientNetV2, DenseNet-201, ResNet-101, and InceptionV3. EfficientNetV2 consistently outperformed the others, achieving a Dice coefficient of 98.75% and IoU of 97.88% on LUNA16, and 98.92% Dice and 98.21% IoU on LIDC-IDRI, with Hausdorff distances below 2.03 mm on both datasets.
The Multiscale Adaptive Swin Transformer classifies nodules using features directly inherited from the segmentation encoder. Rather than classifying from the final segmentation output alone, the MA-SwinT receives the full hierarchy of multilevel encoder feature maps, preserving both low-level structural detail and high-level semantic characteristics. This feature-level continuity between segmentation and classification stages eliminates information loss at the stage boundary.
The Multi-Scale Embedding Attention Mechanism computes cross-scale attention weights by projecting features from each scale into query, key, and value matrices. Attention coefficients between every pair of scales are computed via scaled dot-product attention, and the final fused representation is a weighted sum of value features across all scale pairs. This mechanism allows the model to adaptively emphasize diagnostically important regions -- such as irregular boundaries and heterogeneous texture -- while suppressing redundant information.
The shifted-window self-attention within Swin Transformer restricts attention computation to local M x M windows for computational efficiency, then cyclically shifts window boundaries in alternating layers so that edge-adjacent tokens interact across windows. This design captures both local texture patterns and global spatial relationships without the quadratic computational cost of full self-attention, making it practical for high-resolution CT feature maps.
The Fossa Optimization Algorithm tunes six hyperparameters of the MA-SwinT: learning rate, transformer head count, embedding dimension, dropout rate, batch size, and training epochs. The algorithm alternates between exploration (guided random search near the global best solution) and exploitation (neighborhood refinement), with dynamically decaying exploration intensity across iterations. A composite fitness function rewarding accuracy, precision, and recall equally guides the search toward solutions that balance sensitivity and specificity for medical classification tasks.
The full framework achieved near-perfect classification accuracy on both benchmark datasets. On LUNA16, the classification module achieved 99.15% accuracy, 98.50% precision, 99.00% recall, 98.75% F1 score, and 99.20% specificity. On LIDC-IDRI, performance was slightly higher with 99.40% accuracy, 99.00% precision, 99.20% recall, 99.10% F1 score, and 99.55% specificity -- representing a high level of discriminative ability between benign and malignant nodules.
Five-fold cross-validation on LUNA16 showed consistent mean accuracy of 98.17% with standard deviation of 0.16, and mean F1 score of 98.17% with standard deviation of 0.17. The narrow standard deviations across all metrics confirm that model performance is stable and not sensitive to specific data partitioning choices. Confusion matrix analysis showed that benign and malignant correct classification rates exceeded 97.8% and 98.1% respectively on both datasets.
An ablation analysis progressively evaluated the contribution of each architectural component on LUNA16 classification. The baseline DeepLabv3+ with ResNet-50 achieved 96.72% accuracy. Adding lung ROI extraction and CLAHE preprocessing improved accuracy to 97.41%. Adding hybrid loss improved it to 97.86%. Adding CBAM attention modules reached 98.03%. Tuned ASPP achieved 98.12%, and the full framework with test-time augmentation and CRF post-processing reached the final 98.17%, confirming that each component provides incremental and additive benefit.
Among the four backbone architectures tested, EfficientNetV2 consistently outperformed DenseNet-201, ResNet-101, and InceptionV3 in both segmentation and classification tasks across both datasets. This advantage is attributed to EfficientNetV2's compound scaling strategy, which optimally balances network depth, width, and resolution using inverted residual blocks with depth-wise separable convolutions, enabling superior feature extraction efficiency.
A unified multi-phase pipeline for precision lung nodule analysis. This study introduced a comprehensive framework that connects preprocessing (SEPE), attention-guided segmentation (enhanced DeepLabv3+), and transformer-based classification (MA-SwinT with MEAM) into a single end-to-end architecture with shared encoder features across stages. The framework was validated on two public benchmark datasets with rigorous patient-level data splitting to ensure unbiased generalization assessment.
The framework's key innovations -- adaptive gradient-based preprocessing, multi-scale boundary-aware segmentation, cross-scale embedding attention for classification, and evolutionary hyperparameter optimization -- work synergistically to address the core clinical challenges of nodule boundary ambiguity, size variability, and feature redundancy between pipeline stages.
Key limitations include the computational demands of the full pipeline, which require GPU resources comparable to an NVIDIA RTX 3080 for practical training times. The evaluation was limited to two publicly available datasets; clinical deployment would require prospective validation across diverse institutional CT protocols, scanner manufacturers, and patient demographics to confirm generalizability.
Future directions include integration of multimodal data combining CT with PET or clinical parameters, development of explainable AI visualizations to support radiologist interpretation, exploration of real-time deployment on edge computing hardware for clinical workflow integration, and extension to multi-class nodule subtype classification beyond the binary benign-malignant distinction evaluated here.