Multi-phase deep learning framework with Multiscale Adaptive Swin Transformer and embedding attention for precision lung nodule detection and classification Authors: Dhayalini M, Revathi alias Ponmozhi B Published: 2025 ABSTRACT Lung cancer remains a leading cause of cancer-related mortality worldwide, emphasizing the need for the accurate and efficient detection and classification of lung nodules. This study introduces an advanced multi-stage framework designed to address the challenges of precision, scalability, and adaptability in clinical diagnostics. This study presents a comprehensive framework for the detection, segmentation, and classification of lung nodules utilizing advanced preprocessing, segmentation, classification, and optimization techniques. The framework employs Sparse Edge-Preserving Enhancement (SEPE) for pre-processing, ensuring that critical nodule-specific features are retained while reducing noise. For segmentation, an enhanced DeepLabv3 + architecture integrates Atrous Spatial Pyramid Pooling (ASPP) and Refined Boundary Decoder (RBD) modules, supported by pretrained backbones, such as EfficientNetV2, DenseNet-201, ResNet-101, and InceptionV3. The classification phase leverages a Multiscale Adaptive Swin Transformer (MA-SwinT) with a Multi-Scale Embedding Attention Mechanism (MEAM) to accurately distinguish between benign and malignant nodules. Optimization using the Fossa Optimization Algorithm (FOA) fine-tunes the hyperparameters to ensure robust performance. The experimental results demonstrate the superiority of the framework on both the LUNA16 and LIDC-IDRI datasets. On the LUNA16 dataset, segmentation achieved a Dice Coefficient of 98.75%, IoU of 97.88%, Jaccard Index of 89.62%, and Hausdorff Distance of 2.025 mm, with an accuracy of 99.15%, precision of 98.50%, recall of 99.00%, F1 score of 98.75%, and specificity of 99.20%. For the LIDC-IDRI dataset, segmentation achieved a Dice Coefficient of 98.92%, IoU of 98.21%, Jaccard Index of 90.15%, and Hausdorff Distance of 2.010 mm, while the classification metrics achieved an accuracy of 99.40%, precision of 99.00%, recall of 99.20%, F1 score of 99.10%, and specificity of 99.55%. These results underline the ability of the framework to achieve high precision, recall, and overall accuracy, making it a reliable tool for lung nodule diagnosis in clinical applications. Introduction Lung cancer is one of the leading causes of cancer-related mortality globally, accounting for a significant number of deaths annually. The early detection and diagnosis of lung nodules, which often serve as precursors to malignant lung cancer, are essential for improving survival rates. Low-dose computed tomography (LDCT) has emerged as a valuable imaging technique that enables detailed analysis of pulmonary nodules. However, differentiating between benign and malignant nodules presents substantial challenges owing to their morphological similarities and the complexities of surrounding tissues, necessitating a high level of expertise and detailed evaluation by radiologists1. Although LDCT is widely used, it does not adequately address the intricate presentation of lung cancer, especially non-small cell lung cancer (NSCLC), which represents approximately 80% of cases. Structural and functional imaging modalities such as computed tomography (CT) and positron emission tomography (PET) are pivotal in lung cancer diagnosis. However, manual analysis of these imaging datasets is time-consuming and prone to variability owing to differences in imaging protocols and radiologists’ expertise. Deep learning (DL) techniques, particularly convolutional neural networks (CNNs), have emerged as transformative solutions for automating lung cancer diagnoses. These methods process large-scale imaging datasets, extract meaningful features, streamline tumor detection, subtype classification, and response-prediction tasks. DL systems have significantly improved clinical workflows by enhancing diagnostic reproducibility and reducing the number of false positives and negatives. However, challenges such as data imbalance, lack of generalizability, and limited explainability persist, underscoring the need for further advancements in explainable AI (XAI) and multimodal data integration2. Late detection of lung cancer remains a critical concern, with survival rates dropping significantly when diagnoses are made at advanced stages. Research indicates that early detection of pulmonary nodules can improve the five-year survival rate from < 15% to approximately 85%. However, the detection of nodules, which often measure 3–30 mm in diameter, is challenging owing to their small size and the extensive manual effort required for image analysis. Computer-aided detection (CAD) systems employing deep learning algorithms have demonstrated great potential for automating these processes, reducing the time and effort required for thorough evaluations, and enhancing diagnostic precision3. CT imaging is a cornerstone of lung cancer diagnostics, enabling the identification and segmentation of nodules that are critical for treatment planning and disease monitoring. However, manual segmentation is labor-intensive, inconsistent, and prone to errors stemming from subjective interpretation. Encoder-decoder architectures such as U-Net and its variants have addressed these challenges by automating segmentation processes and improving outcomes, particularly in identifying nodules in complex regions4. Diagnostic tools are further constrained by challenges such as limited annotated datasets, intraclass variability, and interclass similarities. Deep-learning models, particularly 3D CNNs, have emerged as powerful alternatives to traditional 2D methods, leveraging spatial depth and volumetric relationships to enhance diagnostic accuracy. These models effectively overcome the limitations of manual labeling and dataset imbalances, facilitating more reliable detection and classification of pulmonary nodules5. Advancements in artificial intelligence (AI) have significantly improved lung cancer detection by enabling early identification of malignant nodules and optimizing treatment strategies. AI-driven solutions, particularly those employing deep learning models, have demonstrated exceptional accuracy in malignancy detection, reducing diagnostic variability and establishing themselves as integral tools in clinical workflows6. Despite these advancements, the accurate detection of nodules in regions with complex intensity variations and structural intricacies remains a challenge. Hybrid optimization techniques, such as the Elephant-based Bald Eagle Optimization (EBEO) algorithm combined with Deep CNNs, have shown promise in enhancing feature extraction and improving segmentation and classification performance. These methodologies provide efficient and reliable solutions for clinical applications7. The diverse shapes and sizes of lung nodules, coupled with the complexity of the surrounding tissue structures, pose significant challenges for traditional diagnostic methods. Hybrid frameworks such as LNDC-HDL effectively address these limitations by integrating advanced segmentation, feature extraction, and classification techniques. Utilizing algorithms such as Chaotic Bird Swarm Optimization (CBSO) and Hybrid Differential Evolution Neural Networks (HDE-NN), these approaches improve the sensitivity, specificity, and classification accuracy while minimizing false positives8. Traditional manual feature extraction methods, which are widely used, are time intensive and prone to observer variability based on image quality and expertise. Advanced CNN architectures have automated these processes to achieve high accuracy and efficiency. By fine-tuning models through extensive parameter optimization, these systems have significantly enhanced early detection capabilities and facilitated more accurate treatment planning9. Addressing nodules located near critical lung structures such as blood vessels and bronchi presents additional diagnostic challenges. Advanced segmentation networks incorporating multistage filtering techniques and modified CNN classifiers have demonstrated improved performance in classifying nodules across various lung cancer stages, ensuring reliable and precise diagnostic outcomes10. The increasing prevalence of lung cancer has driven the development of hybrid classification systems that integrate pre-processing, segmentation, and classification techniques. These systems employ novel algorithms, such as Chaotic Population-Based Beetle Swarm Optimization (CP-BSA), to optimize CNN weights and significantly enhance diagnostic sensitivity, specificity, and accuracy, while reducing the burden on radiologists11. Lung cancer remains one of the leading causes of cancer-related deaths worldwide, largely due to delayed diagnosis and the difficulty of accurately distinguishing malignant nodules from benign ones in computed tomography (CT) scans. Early detection of lung nodules is clinically critical because subtle variations in size, texture, and morphology can determine the difference between curable and advanced disease. However, radiologists often face significant challenges in manually identifying and characterizing nodules due to inter-observer variability, low contrast between lesions and surrounding tissues, and the presence of imaging artifacts. These limitations highlight the urgent need for automated and highly accurate computer-aided diagnostic (CAD) systems that can assist clinicians in early and reliable lung cancer detection. To address these clinical challenges, this study proposes a multi-phase deep learning framework that integrates preprocessing, segmentation, and classification in a unified, end-to-end pipeline. Unlike traditional models that treat these tasks independently, the proposed approach enables feature-level interaction between phases, improving both diagnostic precision and interpretability. By combining a Sparse Edge-Preserving Enhancement (SEPE) technique, an attention-guided segmentation network, and a Multiscale Adaptive Swin Transformer (MA-SwinT) with a Multi-Scale Embedding Attention Mechanism (MEAM), the framework enhances boundary detection, captures multiscale contextual features, and achieves robust classification of malignant nodules. This integrated design directly addresses clinical pain points—enhancing early detection accuracy, reducing false positives, and supporting radiologists with consistent, high-confidence diagnostic insights. The contributions of this research to address these issues are as follows: A novel multi-phase deep learning framework is introduced for lung nodule analysis, integrating preprocessing, segmentation, and classification into a unified pipeline. This design ensures seamless feature flow across stages, improving overall diagnostic reliability.A Sparse Edge-Preserving Enhancement (SEPE) technique is proposed to enhance CT images by selectively emphasizing nodule boundaries while suppressing background noise, resulting in superior input quality for segmentation and classification.An attention-guided segmentation network is developed to generate precise and boundary-aware nodule masks. The encoder features extracted during this stage are reused in the classification phase, enabling feature-level continuity between tasks.A Multiscale Adaptive Swin Transformer (MA-SwinT) with an integrated Multi-Scale Embedding Attention Mechanism (MEAM) is designed to adaptively fuse multiscale features, enhancing the model’s ability to capture both fine-grained and contextual information for accurate malignancy prediction.A Fossa Optimization Algorithm (FOA) is introduced for automatic hyperparameter tuning, balancing exploration and exploitation during optimization to achieve robust convergence and prevent overfitting.Extensive evaluations on LUNA16 and LIDC-IDRI datasets demonstrate that the proposed framework achieves state-of-the-art performance in both segmentation and classification, validating its robustness, accuracy, and clinical applicability. A novel multi-phase deep learning framework is introduced for lung nodule analysis, integrating preprocessing, segmentation, and classification into a unified pipeline. This design ensures seamless feature flow across stages, improving overall diagnostic reliability. A novel multi-phase deep learning framework is introduced for lung nodule analysis, integrating preprocessing, segmentation, and classification into a unified pipeline. This design ensures seamless feature flow across stages, improving overall diagnostic reliability. A Sparse Edge-Preserving Enhancement (SEPE) technique is proposed to enhance CT images by selectively emphasizing nodule boundaries while suppressing background noise, resulting in superior input quality for segmentation and classification. A Sparse Edge-Preserving Enhancement (SEPE) technique is proposed to enhance CT images by selectively emphasizing nodule boundaries while suppressing background noise, resulting in superior input quality for segmentation and classification. An attention-guided segmentation network is developed to generate precise and boundary-aware nodule masks. The encoder features extracted during this stage are reused in the classification phase, enabling feature-level continuity between tasks. An attention-guided segmentation network is developed to generate precise and boundary-aware nodule masks. The encoder features extracted during this stage are reused in the classification phase, enabling feature-level continuity between tasks. A Multiscale Adaptive Swin Transformer (MA-SwinT) with an integrated Multi-Scale Embedding Attention Mechanism (MEAM) is designed to adaptively fuse multiscale features, enhancing the model’s ability to capture both fine-grained and contextual information for accurate malignancy prediction. A Multiscale Adaptive Swin Transformer (MA-SwinT) with an integrated Multi-Scale Embedding Attention Mechanism (MEAM) is designed to adaptively fuse multiscale features, enhancing the model’s ability to capture both fine-grained and contextual information for accurate malignancy prediction. A Fossa Optimization Algorithm (FOA) is introduced for automatic hyperparameter tuning, balancing exploration and exploitation during optimization to achieve robust convergence and prevent overfitting. A Fossa Optimization Algorithm (FOA) is introduced for automatic hyperparameter tuning, balancing exploration and exploitation during optimization to achieve robust convergence and prevent overfitting. Extensive evaluations on LUNA16 and LIDC-IDRI datasets demonstrate that the proposed framework achieves state-of-the-art performance in both segmentation and classification, validating its robustness, accuracy, and clinical applicability. Extensive evaluations on LUNA16 and LIDC-IDRI datasets demonstrate that the proposed framework achieves state-of-the-art performance in both segmentation and classification, validating its robustness, accuracy, and clinical applicability. This paper is organized to provide a comprehensive overview of the proposed research and its findings. Section “Related works” reviews related studies and highlights significant advancements and challenges in lung nodule detection, segmentation, and classification, with an emphasis on the role of deep-learning frameworks in addressing these challenges. Section “Methodology” details the methodology employed, including the preprocessing, segmentation, classification, and optimization approaches integrated into the framework. Section “Results and discussion” discusses the experimental setup and presents the results, offering a thorough analysis of the performance of the model on datasets such as LUNA16 and LIDC-IDRI. This section also evaluates key metrics to demonstrate the effectiveness of the proposed framework. Section “Discussion” concludes the paper by summarizing the findings, emphasizing the contributions of this study, and outlining potential directions for future work, including advancements in integrating multimodal datasets and enhancing real-time diagnostic capabilities. Related works Lung nodule segmentation and classification are pivotal components in the evolution of computer-aided diagnosis (CAD) systems, and significant advancements have been made over the past five years owing to the integration of deep learning techniques. Traditional methods, including morphological and convexity-based models, were initially employed for segmentation. However, these approaches rely heavily on manual processes, rendering them susceptible to challenges, such as noise, imaging artifacts, and heterogeneous nodule textures. These limitations have restricted their scalability and precision, particularly in complex imaging scenarios, prompting a shift toward deep learning and transfer learning methodologies that offer more robust solutions12. Encoder-decoder architectures such as U-Net, PSPNet, FPN, and LinkNet have demonstrated significant potential in improving segmentation precision, particularly when enhanced with pre-trained encoders. For example, U-Net combined with an EfficientNet-B3 backbone has been recognized for balancing computational efficiency with segmentation accuracy, making it an effective choice for complex datasets, such as LIDC-IDRI. Further optimization with algorithms, such as Adam, has ensured reliable convergence during training and improved model performance, highlighting the importance of transfer learning and advanced optimization techniques in CAD systems13. Building on these encoder-decoder models, novel architectures have advanced lung nodule segmentation and detection capabilities. RePointNet integrates an ((RPN) with PointNet, effectively addressing false positives and refining the detection of smaller nodules. Similarly, DBPNDNet utilizes a dual-branch 3D CNN with an attention-weighted feature fusion module to manage the segmentation and detection of complex nodules. These models, when applied to datasets such as LUNA16 and LIDC-IDRI, exemplify the growing sophistication of network designs that emphasize precision and robustness14. Hybrid and ensemble models have emerged as effective solutions for enhancing the classification accuracy by combining the strengths of diverse architectures. For instance, a hybrid framework incorporating the Markov Random Field (MRF)-based Artificial Hummingbird Cuckoo Algorithm (AHCA) for segmentation and ShuffleNet for classification achieved high sensitivity and accuracy. Additionally, ensemble strategies, such as integrating BEiT, DenseNet, and Sequential CNN models with techniques such as Weighted Box Fusion and Boosting, have demonstrated the advantages of leveraging complementary methodologies to improve the performance15,16. Attention mechanisms have revolutionized CAD systems, enabling more effective feature extraction and segmentation. Dual-attention-based CNNs that utilize both channel and spatial attention modules have achieved improved performance by suppressing noise and focusing on critical features. This is further illustrated by the Sailfish-based YOLO Segmentation Framework (SbYSF), which incorporates optimization techniques alongside attention mechanisms, demonstrating significant enhancements in segmentation and classification accuracy17,18. Multi-scale feature extraction techniques have proven to be particularly valuable for handling variability in nodule size and texture. Semi-supervised learning models that combine adversarial loss with labeled and unlabeled data have successfully mitigated the challenges of limited labeled datasets in medical imaging. These models underscore the importance of data-efficient learning strategies in CAD systems19. Classification frameworks have further evolved to incorporate multimodal data integration, combining clinical, radiomic, and deep-learning features. For example, stacked ensemble classifiers integrating 3D CNNs, radiomic features, and clinical parameters have achieved superior predictive accuracy, showcasing the value of diverse data sources for decision making. Cascade classification networks capable of categorizing lung nodules into multiple subtypes have further optimized the performance and enhanced diagnostic precision20,21. Specialized architectures, such as the Multi-level Dynamic Fusion Network (MDFN), have addressed segmentation challenges associated with heterogeneous textures and adhesive structures. By integrating Multi-Scale Spatial and Channel Feature Selection (MSCFS) modules with dynamic fusion decoders, MDFN has demonstrated its ability to manage intricate segmentation tasks, emphasizing the need for dynamic feature integration in medical imaging22. Contextual data have also proven critical in advancing classification capabilities. For instance, 3D attention-gated convolutional networks (3D AG-Net) that leverage contextual data, such as fibrosis metadata, have demonstrated improved accuracy and sensitivity in lung nodule classification. Emerging datasets with detailed annotations for small and complex nodules have enabled further advancements in classification, thereby supporting personalized diagnostic applications23–25. The advancements outlined in Table 1 highlight how these datasets contribute to improving the model performance in terms of sensitivity, specificity, and overall diagnostic accuracy. Recent advances in deep learning have significantly improved medical image analysis, particularly in lung nodule detection and classification tasks. InceptionV3 has been widely employed for high-level feature extraction due to its ability to capture complex spatial hierarchies within CT images, making it a reliable backbone for medical image classification frameworks26. Building upon this, advanced architectures have explored multiscale contextual learning to enhance lesion segmentation and recognition performance. For instance, the Multi-Level Context Attentional Feature Fusion (MLCA2F) framework introduces Multi-Scale Context-Attention Network (MSCA-Net) blocks that integrate Multi-Scale Contextual Feature Fusion (MC2F) and Multi-Context Attentional Feature (MCAF) modules to refine boundary localization and lesion characterization in COVID-19 CT scans27. Similarly, the Bidirectional Gated 3D Multi-Scale Feature Fusion (BG-3DM2F) model employs a 3D Multi-Scale Chained Network (3DMS-ChaineNet) and a Bidirectional Gated Recurrent Fusion Unit (Bi-GRFU) to capture volumetric dependencies and hippocampal atrophy patterns in neuroimaging28. In dermatological imaging, transfer learning-based multi-layer feature fusion networks have demonstrated robust performance in diagnosing complex skin diseases by leveraging pre-trained feature extractors to improve generalization and prevent overfitting29. Moreover, multi-scale representation strategies such as the Gaussian Pyramid-based Convolutional Neural Network (Pyramid-CNN) have been applied to discriminate medical patterns across multiple resolutions, ensuring the extraction of both global and localized features for precise classification30. Table 1Summary of recent advances in lung nodule detection and classification.AuthorsMethodologyAdvantagesLimitationsSun et al.1Proposed Nodule-CLIP modelincorporating U-Net forsegmentation, ResNet-34 asthe backbone for imageencoding, and contrastivelearning for feature alignmentAchieved improvedclassification accuracy(90.6%) and recall (92.81%)by integrating image andtext annotation featuresLimited specificity (92.6%)due to the inability to fullycapture key nodule featuresXiong et al.3Fusion of SAB-YOLO andYOLOv7 using WBF fordetection and adaptive 3DResNet-18 for false-positivereductionHigh sensitivity (97.4%) andlow false positives (9.67candidates/scan).Computationally efficientSensitivity decreases slightlyfor some false positives; modelfusion dependencyLavina Jean Crasta et al.5Proposed 3D-VNet forsegmentation and 3D-ResNet for classificationof lung nodulesHigh DSC (99.34%), robustclassification accuracy(99.2%), sensitivity (98.8%),specificity (99.6%)Computational complexitydue to 3D volumetricprocessingPrashanthi et al.6A Convolutional NeuralNetwork (CNN) for lungnodule segmentation andclassification using CT-guided biopsy imagesAchieved 99.3% accuracy inlung cancer detection; enablesearly diagnosis and improvedtreatment strategiesLack of multi-classclassification and unexploredexplainability tools formodel predictionsGedam et al.7EBEO-based Deep CNN forsegmentation andclassification of pulmonarynodules, leveraging hybridoptimizationEnhanced segmentationaccuracy by combiningelephant herding and baldeagle search behaviorLack of multi-classclassification and furtherimprovement required forreal-time applicationsKrishnakumar et al.11Improved BIRCH-basedsegmentation, LVP features,and hybrid CNN-LSTMclassifiers with CP-BSAoptimizationHigh accuracy, sensitivity,and reduced false positivesLimited dataset and inabilityto capture contextualinformation between slicesJenkin Suji et al.13Comparative analysis ofsegmentation methods usingU-Net and EfficientNet-B3Demonstrated best IoUscore for the LIDC-IDRIdataset with moderateresource requirementsand training timeLimited evaluation of metricslike Dice coefficient, accuracy,recall, and specificity; focusprimarily on IoU forperformance evaluationMuwei Jian et al.14Dual-branch 3D CNN withAWFM for nodule detectionEnhanced sensitivity andreduced false positivesSuboptimal performance forsmaller false positives ratesSpoorthi B et al.15AHFO + ShuffleNet: MRF-based AHCA for segmentationand AHFO-trained ShuffleNetfor classificationHigh classification accuracy,lightweight network, reducedcomputational complexityDoes not address cancergradingZia UrRehman et al.18Proposed a custom CNNwith dual attentionmechanisms for lung noduledetection using theLUNA 16 datasetAchieved high accuracy,precision, and sensitivityin lung nodule classificationtasksIncreased computationalrequirements due to theinclusion of dual attentionmechanismsQinlu He et al.19Semi-supervised lungnodule detection usingadversarial learningImproved FROC from 0.677to 0.717 using both labeledand unlabeled imagesRequires labeled andunlabeled images for training,limiting flexibility in datasetsLiu et al.21Proposed a cascadeclassification network usingResNet34 to classify sixdistinct lung nodule typesAchieved higher accuracy,precision, recall, and F1 scorecompared to traditionalmulti-classification modelsLimited dataset diversity andcomplexity of nodules withshared features mayimpact generalizationYu Cai et al.22Proposed a 2D Multi-levelDynamic Fusion Network(MDFN) with MSCFS, self-calibrated encoder, anddynamic fusion decoderDemonstrates superiorsegmentation performance,especially for challengingnodules with adhesivestructuresIncreased computationalcomplexity due to multiplebranches, requiringoptimization in future workRikhari et al.26Ensemble of 3D U-Net modelsusing Inception andResNet modulesImproved segmentationaccuracy and reducedfalse positivesLimited dataset size; inabilityto segment nodules < 5 mmNandeesh et al.27Integration of R2U-Net forsegmentation and SAE forclassificationHigh accuracy insegmentation and detection(96.25%)Limited dataset diversity andreliance on preprocessingquality Table 1Summary of recent advances in lung nodule detection and classification.AuthorsMethodologyAdvantagesLimitationsSun et al.1Proposed Nodule-CLIP modelincorporating U-Net forsegmentation, ResNet-34 asthe backbone for imageencoding, and contrastivelearning for feature alignmentAchieved improvedclassification accuracy(90.6%) and recall (92.81%)by integrating image andtext annotation featuresLimited specificity (92.6%)due to the inability to fullycapture key nodule featuresXiong et al.3Fusion of SAB-YOLO andYOLOv7 using WBF fordetection and adaptive 3DResNet-18 for false-positivereductionHigh sensitivity (97.4%) andlow false positives (9.67candidates/scan).Computationally efficientSensitivity decreases slightlyfor some false positives; modelfusion dependencyLavina Jean Crasta et al.5Proposed 3D-VNet forsegmentation and 3D-ResNet for classificationof lung nodulesHigh DSC (99.34%), robustclassification accuracy(99.2%), sensitivity (98.8%),specificity (99.6%)Computational complexitydue to 3D volumetricprocessingPrashanthi et al.6A Convolutional NeuralNetwork (CNN) for lungnodule segmentation andclassification using CT-guided biopsy imagesAchieved 99.3% accuracy inlung cancer detection; enablesearly diagnosis and improvedtreatment strategiesLack of multi-classclassification and unexploredexplainability tools formodel predictionsGedam et al.7EBEO-based Deep CNN forsegmentation andclassification of pulmonarynodules, leveraging hybridoptimizationEnhanced segmentationaccuracy by combiningelephant herding and baldeagle search behaviorLack of multi-classclassification and furtherimprovement required forreal-time applicationsKrishnakumar et al.11Improved BIRCH-basedsegmentation, LVP features,and hybrid CNN-LSTMclassifiers with CP-BSAoptimizationHigh accuracy, sensitivity,and reduced false positivesLimited dataset and inabilityto capture contextualinformation between slicesJenkin Suji et al.13Comparative analysis ofsegmentation methods usingU-Net and EfficientNet-B3Demonstrated best IoUscore for the LIDC-IDRIdataset with moderateresource requirementsand training timeLimited evaluation of metricslike Dice coefficient, accuracy,recall, and specificity; focusprimarily on IoU forperformance evaluationMuwei Jian et al.14Dual-branch 3D CNN withAWFM for nodule detectionEnhanced sensitivity andreduced false positivesSuboptimal performance forsmaller false positives ratesSpoorthi B et al.15AHFO + ShuffleNet: MRF-based AHCA for segmentationand AHFO-trained ShuffleNetfor classificationHigh classification accuracy,lightweight network, reducedcomputational complexityDoes not address cancergradingZia UrRehman et al.18Proposed a custom CNNwith dual attentionmechanisms for lung noduledetection using theLUNA 16 datasetAchieved high accuracy,precision, and sensitivityin lung nodule classificationtasksIncreased computationalrequirements due to theinclusion of dual attentionmechanismsQinlu He et al.19Semi-supervised lungnodule detection usingadversarial learningImproved FROC from 0.677to 0.717 using both labeledand unlabeled imagesRequires labeled andunlabeled images for training,limiting flexibility in datasetsLiu et al.21Proposed a cascadeclassification network usingResNet34 to classify sixdistinct lung nodule typesAchieved higher accuracy,precision, recall, and F1 scorecompared to traditionalmulti-classification modelsLimited dataset diversity andcomplexity of nodules withshared features mayimpact generalizationYu Cai et al.22Proposed a 2D Multi-levelDynamic Fusion Network(MDFN) with MSCFS, self-calibrated encoder, anddynamic fusion decoderDemonstrates superiorsegmentation performance,especially for challengingnodules with adhesivestructuresIncreased computationalcomplexity due to multiplebranches, requiringoptimization in future workRikhari et al.26Ensemble of 3D U-Net modelsusing Inception andResNet modulesImproved segmentationaccuracy and reducedfalse positivesLimited dataset size; inabilityto segment nodules < 5 mmNandeesh et al.27Integration of R2U-Net forsegmentation and SAE forclassificationHigh accuracy insegmentation and detection(96.25%)Limited dataset diversity andreliance on preprocessingquality Summary of recent advances in lung nodule detection and classification. Proposed Nodule-CLIP model incorporating U-Net for segmentation, ResNet-34 as the backbone for image encoding, and contrastive learning for feature alignment Achieved improved classification accuracy (90.6%) and recall (92.81%) by integrating image and text annotation features Limited specificity (92.6%) due to the inability to fully capture key nodule features Fusion of SAB-YOLO and YOLOv7 using WBF for detection and adaptive 3D ResNet-18 for false-positive reduction High sensitivity (97.4%) and low false positives (9.67 candidates/scan). Computationally efficient Sensitivity decreases slightly for some false positives; model fusion dependency Proposed 3D-VNet for segmentation and 3D- ResNet for classification of lung nodules High DSC (99.34%), robust classification accuracy (99.2%), sensitivity (98.8%), specificity (99.6%) Computational complexity due to 3D volumetric processing A Convolutional Neural Network (CNN) for lung nodule segmentation and classification using CT- guided biopsy images Achieved 99.3% accuracy in lung cancer detection; enables early diagnosis and improved treatment strategies Lack of multi-class classification and unexplored explainability tools for model predictions EBEO-based Deep CNN for segmentation and classification of pulmonary nodules, leveraging hybrid optimization Enhanced segmentation accuracy by combining elephant herding and bald eagle search behavior Lack of multi-class classification and further improvement required for real-time applications Improved BIRCH-based segmentation, LVP features, and hybrid CNN-LSTM classifiers with CP-BSA optimization High accuracy, sensitivity, and reduced false positives Limited dataset and inability to capture contextual information between slices Comparative analysis of segmentation methods using U-Net and EfficientNet-B3 Demonstrated best IoU score for the LIDC-IDRI dataset with moderate resource requirements and training time Limited evaluation of metrics like Dice coefficient, accuracy, recall, and specificity; focus primarily on IoU for performance evaluation Dual-branch 3D CNN with AWFM for nodule detection Enhanced sensitivity and reduced false positives Suboptimal performance for smaller false positives rates AHFO + ShuffleNet: MRF- based AHCA for segmentation and AHFO-trained ShuffleNet for classification High classification accuracy, lightweight network, reduced computational complexity Does not address cancer grading Proposed a custom CNN with dual attention mechanisms for lung nodule detection using the LUNA 16 dataset Achieved high accuracy, precision, and sensitivity in lung nodule classification tasks Increased computational requirements due to the inclusion of dual attention mechanisms Semi-supervised lung nodule detection using adversarial learning Improved FROC from 0.677 to 0.717 using both labeled and unlabeled images Requires labeled and unlabeled images for training, limiting flexibility in datasets Proposed a cascade classification network using ResNet34 to classify six distinct lung nodule types Achieved higher accuracy, precision, recall, and F1 score compared to traditional multi-classification models Limited dataset diversity and complexity of nodules with shared features may impact generalization Proposed a 2D Multi-level Dynamic Fusion Network (MDFN) with MSCFS, self- calibrated encoder, and dynamic fusion decoder Demonstrates superior segmentation performance, especially for challenging nodules with adhesive structures Increased computational complexity due to multiple branches, requiring optimization in future work Ensemble of 3D U-Net models using Inception and ResNet modules Improved segmentation accuracy and reduced false positives Limited dataset size; inability to segment nodules < 5 mm Integration of R2U-Net for segmentation and SAE for classification High accuracy in segmentation and detection (96.25%) Limited dataset diversity and reliance on preprocessing quality Despite these advancements, many existing frameworks fail to integrate pre-processing, segmentation, feature extraction, classification, and optimization into a unified pipeline. Static architectures often lack the adaptability to handle heterogeneous datasets and varying imaging conditions, resulting in inconsistent performance. To address these limitations, this study proposes a novel framework that combines a Multiscale Adaptive Swin Transformer (MA-SwinT) with a Multi-Scale Embedding Attention Mechanism (MEAM)31,32. This framework adaptively fuses spatial and contextual features, while the integration of the Fossa Optimization Algorithm (FOA) ensures dynamic hyperparameter tuning, balancing exploration, and exploitation for robust performance33. By unifying these components, this approach bridges critical gaps in scalability and adaptability, and establishes a new standard for lung nodule segmentation and classification. Methodology The proposed framework for lung nodule analysis is designed as a three-phase pipeline, consisting of (i) preprocessing, (ii) segmentation, and (iii) classification. Each phase performs a distinct yet complementary role, and all components are integrated to ensure efficient information flow and feature consistency throughout the network. In the preprocessing stage, a Sparse Edge-Preserving Enhancement (SEPE) technique is applied to the raw CT images to enhance boundary contrast while minimizing noise amplification. Unlike conventional sharpening filters, SEPE selectively strengthens edges corresponding to nodule regions without degrading soft tissue structures. This step improves the visual clarity of the nodule boundaries, which is essential for precise segmentation and robust feature extraction in subsequent phases. The enhanced images are normalized to a fixed intensity range and resized to a uniform spatial resolution to maintain consistency across the dataset. The segmentation phase aims to accurately delineate lung nodules by learning both textural and structural characteristics. Both the original CT image and its corresponding mask image are jointly provided as inputs to the segmentation network. The encoder-decoder architecture extracts multi-level spatial and contextual features, producing a segmentation map that highlights nodule boundaries with high precision. The encoder component generates a hierarchy of feature maps \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${F_{enc}}=\left\{ {{f_1},{f_2}, \ldots ,{f_n}} \right\}$$\end{document}, capturing information from fine-grained details to abstract semantic features. These encoder-derived features are not only used to generate the segmentation output but are also directly transferred to the classification phase, enabling a continuous flow of spatially meaningful representations across stages. In the classification phase, the Multiscale Adaptive Swin Transformer (MA-SwinT) is employed to analyze the encoder-derived feature maps from the segmentation stage. This design allows the classifier to operate on deep multiscale embeddings that preserve structural, morphological, and contextual characteristics of the nodules. The MA-SwinT incorporates a Multi-Scale Embedding Attention Mechanism (MEAM), which adaptively fuses feature representations across different scales to emphasize diagnostically important regions while suppressing redundant information. The classifier then predicts the malignancy of the detected nodules, producing high-confidence decisions supported by feature-level interpretability. The proposed model is shown in Fig. 1. The interaction between the phases ensures end-to-end consistency and learning efficiency. The SEPE-enhanced images guide the segmentation network toward better edge localization, while the segmentation encoder features provide the classification module with rich spatial and semantic cues. This interconnected design minimizes feature loss between phases and ensures that both pixel-level and region-level information contribute to the final diagnosis. As a result, the framework achieves superior performance in distinguishing benign and malignant nodules while maintaining strong generalization across datasets. Fig. 1Comprehensive framework for lung nodule detection, segmentation, and classification. Comprehensive framework for lung nodule detection, segmentation, and classification. Preprocessing The Sparse Edge-Preserving Enhancement (SEPE) technique is introduced to improve the quality of lung CT images prior to segmentation and classification. Its primary goal is to highlight fine nodule boundaries and suppress noise without blurring diagnostically relevant structures. Conventional preprocessing filters, such as Gaussian or median smoothing, often reduce random noise at the cost of erasing subtle intensity transitions that define nodule margins. SEPE overcomes this limitation by applying adaptive, gradient-based weighting, which enhances edges selectively while maintaining smoothness in uniform areas. Let the input CT image be denoted as \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$I\left( {x,y} \right)$$\end{document}. The enhanced output \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${I_{{\mathrm{enh}}}}\left( {x,y} \right)$$\end{document}is computed as:1\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${I_{{\mathrm{enh}}}}\left( {x,y} \right)=I\left( {x,y} \right)+\alpha \cdot W\left( {x,y} \right) \cdot \left( {I\left( {x,y} \right) - {G_\sigma }\left( {x,y} \right)} \right)$$\end{document} Where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$I\left( {x,y} \right)$$\end{document} is the original grayscale image, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${G_\sigma }\left( {x,y} \right)$$\end{document} is a Gaussian-smoothed version of the same image with standard deviation \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sigma$$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\alpha$$\end{document} is a scaling parameter controlling the enhancement intensity, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$W\left( {x,y} \right)$$\end{document} is an adaptive weighting function that regulates how much enhancement is applied based on local edge strength. The weighting function \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$W\left( {x,y} \right)$$\end{document}is defined as:2\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$W\left( {x,y} \right)={\mathrm{exp}}\left( { - \frac{{\parallel \nabla I\left( {x,y} \right){\parallel ^2}}}{{\sigma _{e}^{2}}}} \right)$$\end{document} where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\nabla I\left( {x,y} \right)$$\end{document} represents the image gradient magnitude, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\sigma _e}$$\end{document} determines the sensitivity to edge variations. Regions with low gradients (smooth areas) receive a higher weighting, leading to stronger smoothing, while high-gradient areas (edges) receive lower weights, preserving their structure. To further enhance sparsity in edge representation, SEPE can also incorporate an edge-suppression term that penalizes excessive enhancement in textured regions:3\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${I_{{\mathrm{SEPE}}}}\left( {x,y} \right)={I_{{\mathrm{enh}}}}\left( {x,y} \right) - \lambda \cdot \left\| {{\nabla ^2}I\left( {x,y} \right)} \right\|$$\end{document} Here, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\lambda$$\end{document} controls the influence of this regularization, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\nabla ^2}I\left( {x,y} \right)$$\end{document} denotes the Laplacian operator, which identifies rapid intensity fluctuations. This step ensures that enhancement remains confined to meaningful edges rather than noise artifacts. The combined effect of Eqs. (1–3) is that SEPE amplifies fine nodule edges, suppresses random background variations, and maintains the spatial continuity of tissue textures. Unlike traditional filters that apply uniform smoothing, SEPE adapts locally to the anatomical structure, which is especially advantageous in regions containing small, irregular nodules or low-contrast lesions. Empirical results confirmed that SEPE significantly improves contrast-to-noise ratio (CNR) and structural similarity (SSIM) compared to standard filters. Qualitatively, it produces sharper and more distinguishable nodule boundaries, providing the segmentation and classification modules with cleaner, more informative inputs. This adaptive, gradient-aware formulation establishes SEPE as a robust and reproducible preprocessing step for medical image enhancement. Segmentation The enhanced DeepLabv3 + architecture was specifically developed to address the complex challenges associated with lung-nodule segmentation. It incorporates two key components: the Atrous Spatial Pyramid Pooling (ASPP) module and Refined Boundary Decoder (RBD) module. These components work collaboratively to extract contextual features across multiple scales, refine segmentation boundaries, and manage variability in the size, shape, and poorly defined edges of the lung nodules. To further strengthen the encoder phase, four advanced pretrained backbone networks, EfficientNetV2, DenseNet-201, ResNet-101, and InceptionV3, were evaluated within this framework to understand their contributions to feature extraction and overall segmentation performance. The encoder phase integrates these pretrained backbones, each offering distinct advantages for hierarchical feature extraction. EfficientNetV2 stands out for its scalable architecture, which employs a compound scaling method to simultaneously optimize the depth, width, and resolution of the network. It uses inverted residual blocks combined with depth-wise separable convolutions to capture fine-grained local details alongside high-level semantic features. This design ensures computational efficiency and enables the network to extract critical features such as texture patterns, spatial relationships, and shape descriptors. These attributes are crucial for accurately differentiating nodule regions and for identifying subtle morphological variations that may indicate malignancy. DenseNet-201 enhances feature extraction by utilizing densely connected layers, where each layer connects to all the preceding layers. This dense connectivity maximizes feature reuse, improves the gradient flow, and ensures efficient learning. DenseNet-201’s ability to extract detailed spatial relationships and fine-grained textures makes it particularly adept at handling lung nodules with irregular shapes and complex boundaries. This backbone ensures that even subtle structural details are captured effectively. ResNet-101 is a deep architecture designed to overcome the vanishing gradient problem through residual connections. These connections allow the network to train deeper layers, while maintaining effective learning. ResNet-101’s depth of 101 layers enables it to extract hierarchical features, including high-level semantic representations. These features are vital for modeling the texture and spatial relationships of the lung nodules. Pre-trained weights for ResNet-101 facilitate robust generalization across various medical imaging applications, making it a strong candidate for this segmentation framework. InceptionV3 employs a unique design with multiscale convolutions, including 1 × 1, 3 × 3, and 5 × 5 filters, to capture the features at varying resolutions. This architecture allows the network to model diverse patterns in lung nodules, accommodating variability in their sizes and shapes. InceptionV3’s factorized convolutions improve the computational efficiency while maintaining the ability to capture multiscale contextual information. This flexibility makes it well suited for identifying both small and large nodules with complex structures. The ASPP module enhances the feature extraction by capturing information across multiple spatial scales. It employs parallel atrous (dilated) convolutions with varying dilation rates, enabling the model to effectively aggregate fine-grained details and the global context. The feature map generated by the ASPP module is defined as 4\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${F_{ASPP}}\left( x \right)=\mathop \sum \limits_{{i=1}}^{N} {F_{atrous}}\left( {x,{r_i}} \right)$$\end{document} where N represents the number of atrous convolutions, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${r_i}$$\end{document}denotes the dilation rate for the ith convolution, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${F_{atrous}}\left( {x,{r_i}} \right)$$\end{document}denotes the output feature map at a specific dilation rate.Smaller dilation rates capture fine-grained details, whereas larger dilation rates aggregate broader contextual information, enabling the model to handle the diverse appearances of lung nodules effectively. Following atrous convolutions, a 1 × 1 convolution was applied to integrate features and reduce their dimensionality, thereby enhancing computational efficiency. A global average pooling (GAP) layer computes a single value per channel across spatial dimensions, thereby capturing the overall context of the image. The GAP output is then upsampled and concatenated with the atrous convolution results to provide a balanced representation of the local and global details. Batch normalization and ReLU activation functions were used throughout the ASPP module to ensure consistent feature distributions and introduce nonlinearity, improving the model’s ability to learn complex patterns. The Refined Boundary Decoder (RBD) module complements the ASPP by focusing on the refinement of the segmentation boundaries. It begins with an edge detection layer that generates a gradient map, highlighting the high-contrast regions corresponding to the nodule boundaries. The gradient magnitude was calculated as follows:5\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$G\left( x \right)=\sqrt {{{\left( {\frac{{\partial I\left( x \right)}}{{\partial x}}} \right)}^2}+{{\left( {\frac{{\partial I\left( x \right)}}{{\partial y}}} \right)}^2}}$$\end{document} where I(x) is the input image and G(x) represents the edge magnitude. This edge map is fused with the decoder’s output, enhancing the focus on the boundaries while retaining contextual information from the encoder. The fused features are processed through multiple 3 × 3 convolutional layers, refining both the edge and segmentation maps and enabling precise boundary delineation, even for irregularly shaped nodules. The refined feature map was upsampled using bilinear interpolation to align its resolution with the original input image, ensuring accurate spatial alignment. To further optimize the segmentation performance, the RBD module incorporates a boundary-aware loss function defined as6\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${L_{boundary}}={{{\varvec{\uplambda}}}_1} \cdot {L_{segmentation}}+{{{\varvec{\uplambda}}}_2} \cdot {L_{edge}}$$\end{document} where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${L_{segmentation}}$$\end{document} minimizes pixel-wise classification errors; \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${L_{edge}}$$\end{document} penalizes inaccuracies in boundary predictions; and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${{{\varvec{\uplambda}}}_1}$$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${{{\varvec{\uplambda}}}_2}$$\end{document} are weights that balance segmentation accuracy and boundary precision.This loss function prioritizes accurate boundary predictions that are essential for precise delineation in medical imaging. The synergy between the ASPP and RBD modules enhanced the overall segmentation framework. The ASPP module provides a robust multiscale feature representation that captures both local details and the global context, whereas the RBD module ensures precise boundary refinement. The integration of the EfficientNetV2 backbone within the encoder further strengthened the framework by extracting detailed and hierarchical semantic features. Together, these components enable the framework to effectively segment lung nodules, support downstream classification, and facilitate accurate differentiation between benign and malignant nodules (Fig. 2).This comprehensive approach established a framework as a reliable tool for clinical diagnostic applications. Fig. 2Architecture of enhanced DeepLabv3 + with atrous spatial pyramid pooling and refined boundary decoder. Architecture of enhanced DeepLabv3 + with atrous spatial pyramid pooling and refined boundary decoder. Classification In the proposed framework, both the original CT image and its corresponding mask image are jointly utilized as inputs during the segmentation stage. The segmentation network processes these dual inputs to extract spatially consistent and boundary-aware feature representations, producing a precise segmentation output that delineates the lung nodule regions. The mask image acts as a spatial prior that guides the network in identifying nodule boundaries with improved accuracy, while the original image provides the underlying intensity and textural information necessary for contextual interpretation. During this process, the encoder component of the segmentation network generates a rich hierarchy of multilevel feature maps, denoted as7\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${F_{{\mathrm{enc}}}}=\left\{ {{f_1},{f_2}, \ldots ,{f_n}} \right\},$$\end{document} which capture both low-level structural cues and high-level semantic characteristics of the nodules. Instead of using only the segmentation output as input for the next stage, these encoder-derived features are directly passed to the classification module. This ensures that the classifier receives comprehensive and discriminative representations that preserve both contextual and morphological information, which are essential for accurate malignancy prediction. The Multiscale Adaptive Swin Transformer (MA-SwinT) classifier then processes these encoder-derived features to perform the final nodule classification. The use of \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${F_{{\mathrm{enc}}}}$$\end{document}as input enables the MA-SwinT to operate on feature embeddings that capture texture, shape, and spatial dependencies across multiple scales. This seamless, feature-level integration between the segmentation and classification stages ensures an efficient information flow throughout the framework, allowing the classifier to make context-aware and anatomically precise decisions. As a result, the proposed system achieves superior consistency, robustness, and diagnostic accuracy in differentiating between benign and malignant lung nodules. Multi-scale embedding attention mechanism (MEAM) The MEAM module is designed to adaptively integrate features from multiple scales to improve the discriminative power of the classifier. By employing a multiscale attention strategy, it ensures that the model dynamically focuses on regions of greater diagnostic importance while suppressing redundant information. Let \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${F_i} \in {{\mathbb{R}}^{{H_i} \times {W_i} \times C}}$$\end{document} represent the feature map obtained at scale i, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${H_i}$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${W_i}$$\end{document} denote the spatial dimensions and C represents the channel depth. For each scale i, the query, key, and value matrices are obtained through linear transformations of \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${F_i}$$\end{document}:8\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${Q_i}={F_i}{W_Q},{K_i}={F_i}{W_K},{V_i}={F_i}{W_V}$$\end{document} where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${W_Q},~{W_K},$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${W_V}$$\end{document} are learnable projection matrices of dimensions \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${{\mathbb{R}}^{C \times {d_k}}}$$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${{\mathbb{R}}^{C \times {d_k}}}$$\end{document}, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${{\mathbb{R}}^{C \times {d_v}}}$$\end{document}, respectively. The attention coefficients between scales i and j are computed as:9\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${A_{i,j}}=\frac{{{\mathrm{exp}}\left( {\frac{{{Q_i}K_{j}^{ \top }}}{{\sqrt {{d_k}} }}} \right)}}{{\mathop \sum \nolimits_{{m=1}}^{N} exp\left( {\frac{{{Q_i}K_{m}^{ \top }}}{{\sqrt {{d_k}} }}} \right)}}$$\end{document} Here, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${A_{i,j}}$$\end{document} denotes the attention weight that quantifies the relationship between the query vector from scale i and the key vector from scale j. The factor \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sqrt {{d_k}}$$\end{document} acts as a normalization constant to prevent large dot products from saturating the softmax function. The denominator ensures that the resulting attention weights are normalized within the range [0,1]. Once the attention weights are determined, the multiscale fusion is carried out through a weighted summation of value features, producing a unified embedding representation:10\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${F_{{\mathrm{MEAM}}}}=\mathop \sum \limits_{{i=1}}^{N} \mathop \sum \limits_{{j=1}}^{N} {A_{i,j}} \cdot {V_j}$$\end{document} where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${F_{{\mathrm{MEAM}}}}$$\end{document} denotes the final multiscale embedding output. This formulation allows MEAM to integrate both fine-grained spatial details and broader contextual cues by adaptively learning the relative contribution of each scale. The fused feature map \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${F_{{\mathrm{MEAM}}}}$$\end{document} thus encapsulates the most informative characteristics of lung nodules necessary for malignancy classification. The attention maps in MEAM are optimized jointly with the overall objective, enabling the network to automatically identify features corresponding to malignant textures, irregular boundaries, and heterogeneous intensity distributions that distinguish cancerous nodules from benign ones. Shifted-window self-attention in MA-SwinT The MA-SwinT classifier employs a shifted-window self-attention mechanism that enables efficient processing of large feature maps by restricting self-attention computation to local regions while still capturing long-range dependencies through window shifting. Initially, the input feature map \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${F_{{\mathrm{MEAM}}}}$$\end{document}is partitioned into non-overlapping windows of size \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$M \times M$$\end{document}. Within each window, self-attention is performed as follows:11\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Z={\mathrm{Softmax}}\,\left( {\frac{{Q{W_q}{{(K{W_k})}^ \top }}}{{\sqrt {{d_k}} }}+B} \right)\left( {V{W_v}} \right)$$\end{document} Here, Z represents the self-attention output, while \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Q,K,V$$\end{document} are the query, key, and value matrices derived from \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${F_{{\mathrm{MEAM}}}}$$\end{document}. The matrices \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${W_q},~{W_k},$$\end{document}and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${W_v}$$\end{document}are trainable linear projections. B denotes a positional bias term that encodes the spatial relationships between tokens inside each window. The normalization term \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sqrt {{d_k}}$$\end{document} stabilizes gradient magnitudes during training. The shifted-window mechanism is applied in subsequent layers by cyclically shifting the window partitioning by half the window size. This design ensures that tokens located at the edges of different windows in one layer can interact in the next, effectively extending the receptive field and enabling global contextual modeling without quadratic computational complexity. Formally, the final output representation \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${F_{{\mathrm{SwinT}}}}$$\end{document} after multiple attention layers is expressed as:12\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${F_{{\mathrm{SwinT}}}}={\mathrm{Concat}}\left[ {\,{Z_1},{Z_2}, \ldots ,{Z_L}\,} \right]{W_o}$$\end{document} where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${Z_l}$$\end{document} denotes the output from the \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$l{\mathrm{th}}$$\end{document} transformer block, L represents the total number of layers, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${W_o}$$\end{document} is a trainable projection used to merge outputs from all hierarchical stages. Fig. 3Multiscale adaptive Swin transformer with multi-scale embedding attention mechanism. Multiscale adaptive Swin transformer with multi-scale embedding attention mechanism. Hierarchical integration and classification The multiscale transformer outputs \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${F_{{\mathrm{SwinT}}}}$$\end{document} are aggregated using global average pooling to form a compact feature vector. This vector is passed through fully connected layers to produce the final classification probabilities:13\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{array}{*{20}{c}} {}&{\hat {y}={\mathrm{Softmax}}\left( {{W_c}{F_{{\mathrm{SwinT}}}}+{b_c}} \right)}&{}&{} \end{array}$$\end{document} where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${W_c}$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${b_c}$$\end{document} denote the learnable weights and bias parameters of the classification head, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\hat {y} \in {[0,1]^2}$$\end{document} represents the predicted probabilities for benign and malignant classes. Through this multistage mechanism, the MA-SwinT model captures both localized details (such as boundary irregularities and texture heterogeneity) and global contextual features (such as spatial arrangement and structural coherence). The integration of MEAM ensures that feature fusion occurs adaptively across scales, allowing the model to maintain sensitivity to subtle nodular variations. The shifted-window strategy in Swin Transformer further enhances efficiency, enabling the processing of high-resolution CT feature maps with manageable computational resources. By combining the detailed and refined representations derived from the segmentation module with the adaptive fusion capability of MEAM, the classification phase achieves a balanced integration of spatial precision and contextual comprehension, as depicted in Fig. 3. This design provides a robust foundation for the accurate and reproducible discrimination between benign and malignant lung nodules, contributing to reliable computer-aided diagnostic performance. Optimization The Fossa Optimization Algorithm (FOA) is an evolutionary metaheuristic strategy integrated into the proposed framework to fine-tune the hyperparameters of the classification model, thereby enhancing its overall accuracy, convergence stability, and generalization capability. The FOA is inspired by the predatory behavior of the fossa (Cryptoprocta ferox), a mammalian carnivore native to Madagascar known for its adaptive hunting strategies and ability to dynamically switch between exploration and exploitation while pursuing prey. This behavioral analogy is mathematically formulated into a robust optimization process that ensures effective navigation through complex and high-dimensional search spaces such as those associated with deep learning hyperparameter tuning. The algorithm alternates between two key phases: exploration (global search for diverse candidate solutions) and exploitation (local refinement of the best-known solutions). The balanced transition between these two phases prevents premature convergence and ensures that the optimization process efficiently escapes local minima while steadily progressing toward the global optimum. Exploration phase In the exploration phase, the fossa explores a wide region of the search space to identify promising zones where optimal solutions might exist. This behavior is mathematically represented as:14\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{array}{*{20}{c}} {}&{{X_{{\mathrm{new}}}}={X_{{\mathrm{current}}}}+{r_1} \cdot \left( {{X_{{\mathrm{best}}}} - {X_{{\mathrm{current}}}}} \right)+{r_2} \cdot \delta }&{}&{} \end{array}$$\end{document} where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${X_{{\mathrm{new}}}} \in {{\mathbb{R}}^d}$$\end{document} represents the new candidate position in the search space of dimension d, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${X_{{\mathrm{current}}}}$$\end{document} is the current position vector (representing the current set of hyperparameters), \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${X_{{\mathrm{best}}}}$$\end{document} is the global best position discovered so far, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${r_1}\sim U\left( {0,1} \right)$$\end{document} is a uniformly distributed random variable that determines the degree of attraction toward the best-known position, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${r_2}$$\end{document} is a small random coefficient that introduces stochasticity, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\delta \sim \mathcal{N}\left( {0,{\sigma ^2}} \right)$$\end{document} represents a Gaussian perturbation factor with standard deviation \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sigma$$\end{document} that diversifies the search process. This formulation ensures that the algorithm performs wide-ranging searches guided by the global best solution while maintaining random perturbations to explore unseen regions. As the iterations progress, the stochastic influence of \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\delta$$\end{document}gradually decreases to balance the exploration intensity and maintain controlled convergence. To adaptively manage the balance between exploration and exploitation, a control parameter \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\lambda \left( t \right)$$\end{document}is introduced:15\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{array}{*{20}{c}} {}&{\lambda \left( t \right)={\lambda _{{\mathrm{max}}}} - \left( {\frac{{{\lambda _{{\mathrm{max}}}} - {\lambda _{{\mathrm{min}}}}}}{T}} \right)t}&{}&{} \end{array}$$\end{document} where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\lambda _{{\mathrm{max}}}}$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\lambda _{{\mathrm{min}}}}$$\end{document} are the maximum and minimum exploration rates, t is the current iteration, and T is the total number of iterations. This dynamic adjustment reduces exploration as the algorithm proceeds, guiding the search from a global to a local focus. Exploitation phase The exploitation phase refines the search around the most promising candidate solutions found during exploration. The fossa focuses on exploiting local areas to converge toward the global optimum. The process is expressed mathematically as:16\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{array}{*{20}{c}} {}&{{X_{{\mathrm{new}}}}={X_{{\mathrm{current}}}}+\alpha \cdot \left( {{X_{{\mathrm{neighbor}}}} - {X_{{\mathrm{current}}}}} \right)+\eta \cdot \left( {{X_{{\mathrm{best}}}} - {X_{{\mathrm{current}}}}} \right)}&{}&{} \end{array}$$\end{document} Where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${X_{{\mathrm{neighbor}}}}$$\end{document} is a neighboring candidate solution selected randomly from the population, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\alpha \in \left[ {0,1} \right]$$\end{document} is the learning coefficient that controls the intensity of local exploitation, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\eta$$\end{document}is a small adaptive coefficient that biases the search toward the global best, and\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${X_{{\mathrm{best}}}}$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${X_{{\mathrm{current}}}}$$\end{document} retain their earlier definitions. The inclusion of both neighbor-based and best-solution attraction terms ensures that the search combines local refinement (via \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${X_{{\mathrm{neighbor}}}}$$\end{document}) and global convergence pressure (via \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${X_{{\mathrm{best}}}}$$\end{document}). To avoid stagnation, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\alpha$$\end{document}is dynamically updated as:17\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\alpha \left( t \right)={\alpha _0} \cdot {e^{ - \gamma t/T}}$$\end{document} where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\alpha _0}$$\end{document} is the initial learning rate and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\gamma$$\end{document} is a decay constant that gradually reduces the step size, leading to fine-grained tuning near convergence. Fitness function evaluation The FOA evaluates each candidate solution by computing a fitness function, which quantifies the overall classification performance of the model during the optimization process. The objective is to maximize a composite performance score based on key evaluation metrics such as accuracy, precision, and recall. The fitness function is formally defined as:18\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$F={\beta _1} \cdot {\mathrm{Accuracy}}+{\beta _2} \cdot {\mathrm{Precision}}+{\beta _3} \cdot {\mathrm{Recall}}$$\end{document} where F denotes the overall fitness value of a candidate solution, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\beta _1},{\beta _2},{\beta _3} \in \left[ {0,1} \right]$$\end{document} are weight coefficients that determine the relative importance of each performance metric and satisfy \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\beta _1}+{\beta _2}+{\beta _3}=1$$\end{document}. The three performance terms are computed as:19\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathrm{Accuracy}}=\frac{{TP+TN}}{{TP+TN+FP+FN}}$$\end{document}20\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathrm{Precision}}=\frac{{TP}}{{TP+FP}}$$\end{document}21\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathrm{Recall}}=\frac{{TP}}{{TP+FN}}$$\end{document} where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$TP$$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$TN$$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$FP$$\end{document}, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$FN~$$\end{document} represent true positives, true negatives, false positives, and false negatives, respectively. This formulation ensures that the algorithm prioritizes solutions that not only achieve high accuracy but also maintain balanced precision and recall, which are critical for medical classification tasks involving benign and malignant nodules. The fitness value F serves as the primary criterion for comparing candidate solutions. The fossa population updates their positions iteratively based on fitness feedback until the termination condition (either maximum iteration count or convergence tolerance) is met. Hyperparameter optimization and convergence The FOA dynamically optimizes the key hyperparameters of the MA-SwinT classifier, including: the learning rate \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\eta _{{\mathrm{lr}}}}$$\end{document}, number of transformer heads \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${H_t}$$\end{document}, embedding dimension \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${D_e}$$\end{document}, dropout rate \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${p_d}$$\end{document}, batch size \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${B_s}$$\end{document}, and total epochs \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${E_t}$$\end{document}. These hyperparameters form the multidimensional search vector \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$X=\left[ {{\eta _{{\mathrm{lr}}}},{H_t},{D_e},{p_d},{B_s},{E_t}} \right]$$\end{document}. At each iteration t, the best-performing configuration \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$X_{{{\mathrm{best}}}}^{{\left( t \right)}}$$\end{document} is determined by:22\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$X_{{{\mathrm{best}}}}^{{\left( t \right)}}={\mathrm{arg}}\mathop {{\mathrm{max}}}\limits_{{{X^{\left( i \right)}}}} F\left( {{X^{\left( i \right)}}} \right),i=1,2, \ldots ,{N_p}$$\end{document} where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${N_p}$$\end{document} denotes the total number of candidate solutions in the population. The convergence criterion of FOA is defined as:23\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\left| {F_{{{\mathrm{best}}}}^{{\left( t \right)}} - F_{{{\mathrm{best}}}}^{{\left( {t - 1} \right)}}} \right|<\varepsilon {\mathrm{or}}t=T$$\end{document} where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\epsilon$$\end{document} is a small tolerance threshold and T is the maximum number of iterations. This ensures that the optimization process halts either when convergence is achieved or when computational limits are reached. By maintaining a dynamic equilibrium between exploration and exploitation, the FOA efficiently searches the high-dimensional hyperparameter space, fine-tuning the parameters most critical to the model’s learning and generalization behavior. This adaptive search mechanism avoids premature convergence, mitigates overfitting, and enhances robustness to noisy or imbalanced data. The optimized configuration ensures that the MA-SwinT classifier achieves peak performance in terms of accuracy, precision, and recall. The FOA’s capability to balance adaptive search intensity and convergence stability makes it particularly effective for complex deep learning models. Its integration into the proposed framework significantly improves classification reliability, producing consistent and clinically interpretable results for benign and malignant lung nodule detection, as illustrated in Fig. 4. Fig. 4Fossa optimization algorithm workflow. Fossa optimization algorithm workflow. Results and discussion The performance of the proposed framework was analyzed in terms of its ability to detect, segment, and classify lung nodules using LUNA16 and LIDC-IDRI datasets. This evaluation highlights the role of advanced preprocessing techniques, optimized deep learning architectures, and effective classification methods in achieving high accuracy and reliability. Comparative assessments with existing methodologies illustrated the improvements brought about by the proposed components. Additionally, fold-wise evaluations confirm the robustness and consistency of the model across multiple iterations, while the integration of efficient computational resources ensures seamless handling of complex tasks. These results demonstrate the capability of the framework to address the critical challenges in lung nodule analysis. Dataset The proposed framework was developed and evaluated using two publicly available benchmark datasets for lung nodule analysis: LUNA16 and LIDC-IDRI. Both datasets provide high-resolution chest computed tomography (CT) scans with expert-annotated nodule labels, serving as reliable references for research on lung cancer detection and classification. The LUNA16 dataset34 was specifically developed for the Lung Nodule Analysis challenge and comprises 888 low-dose thoracic CT scans that were originally derived from the LIDC-IDRI dataset. These scans emphasize nodules with a diameter of 3 mm or larger and contain 1,186 annotated nodules used for detection and analysis tasks. Nodules smaller than 3 mm were excluded to ensure a focus on clinically significant findings and to reduce ambiguity in diagnosis. The CT scans were acquired using multi-detector CT scanners with an in-plane resolution ranging from 0.5 mm to 0.8 mm and a slice thickness between 1.0 mm and 2.5 mm, ensuring fine-grained anatomical detail suitable for deep learning-based nodule detection. Each CT scan was preprocessed to remove irrelevant anatomical structures such as the chest wall and trachea, retaining only the lung parenchyma. All image intensities were normalized within the Hounsfield Unit (HU) range of [-1000, 400], followed by resampling to an isotropic voxel spacing of 1 mm3. This standardization step ensured uniform spatial resolution across all cases. The LUNA16 dataset serves as a critical benchmark for evaluating lung nodule segmentation and detection algorithms in realistic clinical scenarios, as illustrated in Fig. 5. Fig. 5Representative CT scan images from the LUNA16 dataset displaying diverse nodule appearances and structures. Representative CT scan images from the LUNA16 dataset displaying diverse nodule appearances and structures. The LIDC-IDRI dataset35 comprises 1,018 chest CT scans containing 2,529 annotated nodules, making it one of the most comprehensive public datasets available for lung nodule analysis. Each scan in this dataset was independently reviewed by four experienced radiologists, who provided annotations and malignancy ratings for every identified nodule. These annotations include both malignant and benign lesions, as well as non-nodule regions, offering an extensive ground truth for both detection and classification tasks. The inclusion of multiple expert opinions allows for the assessment of inter-observer variability, a key factor in developing clinically reliable AI models. The CT scans were acquired under diverse imaging protocols using multi-detector CT scanners, with parameters such as tube voltage (120–140 kVp) and slice thickness (1.0–3.0 mm) varying slightly across institutions. For consistency, all scans were resampled to isotropic resolution and intensity-normalized using the same HU windowing applied to the LUNA16 dataset. The LIDC-IDRI dataset provides a rich foundation for evaluating the generalization capability of the proposed model in distinguishing between benign and malignant nodules, as illustrated in Fig. 6. Fig. 6Representative CT scans from the LIDC-IDRI dataset showing annotated lung nodules. Representative CT scans from the LIDC-IDRI dataset showing annotated lung nodules. To prevent any possibility of data leakage and ensure genuine model generalization, the data partitioning strategy was revised to operate strictly at the patient level rather than at the image or nodule level. In the LUNA16 and LIDC-IDRI datasets, each patient contributes multiple CT slices and nodule instances. To avoid overlapping patient data across subsets, all slices and corresponding nodules belonging to a single patient were grouped together and assigned exclusively to either the training, validation, or testing set. The dataset was thus divided into 70% training, 15% validation, and 15% testing subsets, maintaining balanced class representation. This approach ensures that the model evaluates performance only on unseen patients, thereby eliminating any risk of feature memorization or patient-specific bias. All results presented in this study are based on this corrected and rigorously patient-level split, guaranteeing a valid and unbiased assessment of model generalization capability. Experimental configuration An experimental setup was designed to evaluate the proposed model in a controlled and consistent environment. The system used for the experiments featured an Intel Core i7 processor, 16GB of RAM, and an NVIDIA RTX 3080 GPU, ensuring computational capability to handle intensive tasks effectively. The software framework employed for the experiments included Python 3.9 as the programming foundation, along with specialized libraries aligned with the research objectives. TensorFlow 2.8 and PyTorch 1.12 were utilized to implement and train the deep learning architectures. NumPy and Pandas provide robust tools for efficient data processing and manipulation. OpenCV was integrated for image preprocessing tasks, including resizing, normalization, and edge enhancement, with a specific application to the Sparse Edge-Preserving Enhancement (SEPE) technique. Scikit-learn facilitated dataset splitting and metric evaluations, whereas Matplotlib and Seaborn were used for data visualization. Additionally, the CUDA Toolkit 11.7 and cuDNN supported GPU acceleration, significantly enhancing the speed of computations during both the training and testing phases. These optimizations, as detailed in Table 2, ensured the efficient execution of the CTs required for the evaluation of the proposed framework. Table 2Hyperparameter configuration.HyperparametersValuesASPP dilation rates(r1, r2, r3)[6, 12, 18]Batch normalization momentum0.9Learning rate (Segmentation)0.001Transformer heads (MA-SwinT)8Embedding dimensions512Dropout rate0.3Learning rate (classification)0.0001FOA exploration factor (r)0.2–0.8FOA exploitation learning rate (α)0.05FOA fitness function weights(β1, β2, β3)[0.4, 0.3, 0.3] Table 2Hyperparameter configuration.HyperparametersValuesASPP dilation rates(r1, r2, r3)[6, 12, 18]Batch normalization momentum0.9Learning rate (Segmentation)0.001Transformer heads (MA-SwinT)8Embedding dimensions512Dropout rate0.3Learning rate (classification)0.0001FOA exploration factor (r)0.2–0.8FOA exploitation learning rate (α)0.05FOA fitness function weights(β1, β2, β3)[0.4, 0.3, 0.3] Hyperparameter configuration. ASPP dilation rates (r1, r2, r3) FOA fitness function weights (β1, β2, β3) To ensure a rigorous and unbiased assessment of the proposed framework, a well-defined evaluation protocol was established for both detection and classification stages. The experimental evaluation was performed using patient-level partitioning, ensuring that all CT slices and nodules belonging to a single patient were assigned exclusively to either the training, validation, or testing subsets. This approach eliminates data leakage and guarantees that performance metrics reflect true model generalization to unseen patients. For the detection and segmentation stages, quantitative evaluation was conducted using standard image-based metrics, including the Dice Similarity Coefficient (DSC), Intersection over Union (IoU), Precision, Recall (Sensitivity), and F1-score. The Dice coefficient and IoU measure the degree of overlap between the predicted nodule masks and ground truth annotations, thereby quantifying segmentation accuracy and boundary alignment. Additionally, sensitivity was computed to assess the model’s capability to correctly identify all nodule regions, while precision evaluated the proportion of correctly segmented nodules among all detected regions. For the classification stage, performance was measured using a comprehensive set of statistical and diagnostic metrics: Accuracy, Precision, Recall (Sensitivity), Specificity, F1-score, and Area Under the Receiver Operating Characteristic Curve (AUC-ROC). These metrics collectively evaluate the model’s ability to correctly discriminate between benign and malignant nodules. The ROC curve was generated by plotting the true positive rate against the false positive rate across various decision thresholds, with AUC values close to 1.0 indicating superior discriminative capability. Additionally, the confusion matrix was analyzed to visualize class-wise prediction performance and identify potential misclassification patterns. Model validation was performed through a three-phase evaluation process: Training phase, where the model learns feature representations from the training data;Validation phase, used for hyperparameter tuning and early stopping to prevent overfitting; and.Testing phase, used solely for final performance reporting on unseen data. Training phase, where the model learns feature representations from the training data; Training phase, where the model learns feature representations from the training data; Validation phase, used for hyperparameter tuning and early stopping to prevent overfitting; and. Validation phase, used for hyperparameter tuning and early stopping to prevent overfitting; and. Testing phase, used solely for final performance reporting on unseen data. Testing phase, used solely for final performance reporting on unseen data. All experiments were repeated three times with different random seeds, and the mean and standard deviation of the performance metrics were reported to ensure statistical reliability. This comprehensive evaluation procedure guarantees that the reported results reflect the true robustness, reliability, and generalization capability of the proposed framework. Segmentation results – Luna 16 dataset The segmentation results from the LUNA16 dataset, shown in Fig. 7, highlight the effectiveness of the proposed segmentation framework in accurately delineating lung nodules. The images illustrate the progression from the original CT images through mask generation, extraction of the region of interest (ROI), and final segmentation overlay with Dice coefficient values. Achieving Dice coefficients ranging from 97.79% to 99.49%, the approach demonstrated its robustness in identifying nodule boundaries with precision. Advanced preprocessing techniques, such as Sparse Edge-Preserving Enhancement (SEPE), preserve critical nodule-specific details while reducing noise. In addition, the integration of the enhanced DeepLabv3 + architecture ensures superior segmentation performance, effectively handling varying nodule shapes, sizes, and textures. These results underline the capability of the model to provide reliable segmentation, which is critical for further classification and clinical evaluation of lung nodules. Table 3 provides a comparative analysis of the segmentation performance across various backbone architectures based on key metrics. EfficientNetV2 outperformed other backbones with a Dice Coefficient of 98.75%, an IoU of 97.88%, a Jaccard Index of 89.62%, and a Hausdorff Distance (HD) of 2.025 mm, reflecting superior segmentation accuracy and minimal boundary discrepancies. DenseNet-201 followed closely with a Dice Coefficient of 97.92% and an IoU of 96.85%, whereas ResNet-101 and InceptionV3 achieved slightly lower metrics, with Dice Coefficients of 97.58% and 97.36%, respectively. The results emphasize the effectiveness of EfficientNetV2 in achieving precise segmentation, showing its suitability for tasks requiring high accuracy and reliability. Fig. 7Segmentation results from the LUNA16 dataset, illustrating original images, mask images, extracted ROI, segmented outputs, and segmented outputs with Dice coefficients. Segmentation results from the LUNA16 dataset, illustrating original images, mask images, extracted ROI, segmented outputs, and segmented outputs with Dice coefficients. Table 3Performance metrics for different backbones.BackboneDice coefficient (%)IoU (%)Jaccard index (%)HD (mm)EfficientNetV298.7597.8889.622.025DenseNet-20197.9296.8588.372.135ResNet-10197.5896.4287.942.175InceptionV397.3696.1987.722.21 Table 3Performance metrics for different backbones.BackboneDice coefficient (%)IoU (%)Jaccard index (%)HD (mm)EfficientNetV298.7597.8889.622.025DenseNet-20197.9296.8588.372.135ResNet-10197.5896.4287.942.175InceptionV397.3696.1987.722.21 Performance metrics for different backbones. Segmentation results – LIDC-IDRI dataset The segmentation outcomes obtained from the LIDC-IDRI dataset, as shown in Fig. 8, illustrate the efficiency of the proposed framework in accurately identifying and delineating lung nodules. The displayed sequence captures the transformation from the original CT scans to the corresponding mask images, extracted ROI, segmented outputs, and segmented results with overlaid Dice coefficients. With Dice coefficients ranging from 97.68% to 99.08%, the results highlight the ability of the framework to precisely segment nodule boundaries despite the inherent complexity and variability in nodule size and texture. The segmentation performances of the different backbone architectures were compared using key metrics, as highlighted in Table 4. EfficientNetV2 achieved the best results with a Dice Coefficient of 98.92%, IoU of 98.21%, Jaccard Index of 90.15%, and Hausdorff Distance (HD) of 2.01 mm, demonstrating its superior capability in delivering accurate and precise segmentation.DenseNet-201 followed with a Dice Coefficient of 98.11% and IoU of 97.42%, reflecting a strong but slightly lower performance.ResNet-101 and InceptionV3 yielded ice Coefficients of 97.85% and 97.62%, respectively, indicating reliable but comparatively lower accuracy. These results emphasize EfficientNetV2’s effectiveness for segmentation tasks that require high accuracy and minimal boundary deviations. Fig. 8Segmentation results from the LIDC-IDRI dataset, showing original images, mask images, extracted ROI, segmented outputs, and segmented results with Dice coefficients. Segmentation results from the LIDC-IDRI dataset, showing original images, mask images, extracted ROI, segmented outputs, and segmented results with Dice coefficients. Table 4Performance metrics for backbone architectures for LIDC-IDRI dataset.BackboneDice coefficient (%)IoU (%)Jaccard index (%)HD (mm)EfficientNetV298.9298.2190.152.01DenseNet-20198.1197.4289.372.095ResNet-10197.8597.1389.092.12InceptionV397.6296.8788.812.15 Table 4Performance metrics for backbone architectures for LIDC-IDRI dataset.BackboneDice coefficient (%)IoU (%)Jaccard index (%)HD (mm)EfficientNetV298.9298.2190.152.01DenseNet-20198.1197.4289.372.095ResNet-10197.8597.1389.092.12InceptionV397.6296.8788.812.15 Performance metrics for backbone architectures for LIDC-IDRI dataset. Classification – Luna 16 dataset The confusion matrix in Fig. 9 demonstrates that the proposed model achieves strong classification reliability for the LUNA16 dataset. The majority of benign and malignant samples are accurately recognized, with correct prediction rates of 98.52% and 97.82%, respectively, indicating high discriminative ability between classes. Only minimal misclassification occurs (1.48% of benign labeled as malignant and 2.18% of malignant labeled as benign), reflecting effective feature learning and generalization. Overall, the pattern highlights a balanced sensitivity and specificity, confirming that the network maintains robustness across both categories without significant bias. Fig. 9Confusion matrix for LUNA16 dataset. Confusion matrix for LUNA16 dataset. The graphical summary in Fig. 10 highlights the comparative evaluation of various performance indicators for the LUNA16 model. The nearly uniform elevation of all metrics demonstrates that the system maintains a high degree of consistency across classification measures. With precision at 98.40% and specificity slightly higher at 98.45%, the model effectively limits false positives, while the recall value of 97.90% indicates strong sensitivity in detecting malignant cases. The overall balance between accuracy, recall, and precision produces a robust F1-score of 98.15%, confirming that the algorithm performs reliably under diverse validation conditions and generalizes well across samples. Fig. 10Performance metrics for LUNA16 dataset. Performance metrics for LUNA16 dataset. The progression shown in Fig. 11 reveals a stable convergence trend, where both training and validation accuracy increase steadily and approach saturation as the epochs advance. The validation accuracy ultimately reaches 98.17%, confirming that the model effectively generalizes beyond the training data without overfitting. Simultaneously, the loss curves decline smoothly, with the final validation loss stabilizing near 0.0735, indicating efficient optimization and consistent gradient updates. The minimal gap between training and validation curves highlights a balanced learning process, demonstrating that the model maintains reliability and robustness throughout the training phase. Fig. 11Training and validation metrics for LUNA16 dataset. Training and validation metrics for LUNA16 dataset. The comparative analysis summarized in Table 5 presents the influence of different backbone architectures on classification performance for the LUNA16 dataset. Among all tested networks, EfficientNetV2 exhibits the highest effectiveness with an accuracy of 98.17% and balanced improvements across precision, recall, F1-score, and specificity, confirming its superior feature extraction capacity. DenseNet-201 follows closely, maintaining strong consistency while slightly lagging in recall. In contrast, ResNet-101 and InceptionV3 produce comparatively lower yet stable outcomes, reflecting limited optimization depth and representational strength. Table 5Classification performance metrics for backbone architectures on LUNA16 dataset.BackboneAccuracy (%)Precision (%)Recall (%)F1 Score (%)Specificity (%)EfficientNetV298.17 ± 0.1698.33 ± 0.1598.01 ± 0.1698.17 ± 0.1798.45 ± 0.12DenseNet-20197.86 ± 0.1898.05 ± 0.1797.68 ± 0.1897.86 ± 0.1798.10 ± 0.15ResNet-10197.42 ± 0.2097.60 ± 0.1997.28 ± 0.2097.44 ± 0.1997.85 ± 0.16InceptionV397.18 ± 0.2297.35 ± 0.2197.05 ± 0.2397.20 ± 0.2297.60 ± 0.18 Table 5Classification performance metrics for backbone architectures on LUNA16 dataset.BackboneAccuracy (%)Precision (%)Recall (%)F1 Score (%)Specificity (%)EfficientNetV298.17 ± 0.1698.33 ± 0.1598.01 ± 0.1698.17 ± 0.1798.45 ± 0.12DenseNet-20197.86 ± 0.1898.05 ± 0.1797.68 ± 0.1897.86 ± 0.1798.10 ± 0.15ResNet-10197.42 ± 0.2097.60 ± 0.1997.28 ± 0.2097.44 ± 0.1997.85 ± 0.16InceptionV397.18 ± 0.2297.35 ± 0.2197.05 ± 0.2397.20 ± 0.2297.60 ± 0.18 Classification performance metrics for backbone architectures on LUNA16 dataset. Table 6Fold-wise classification metrics for LUNA16 dataset.FoldAccuracy (%)Precision (%)Recall (%)F1Score (%)Specificity (%)197.9298.1097.7597.9298.20298.1298.2597.9598.1098.35398.2598.4598.1098.2798.40498.3698.5098.2598.3798.55598.2098.3598.0098.1798.45Mean ± SD98.17 ± 0.1698.33 ± 0.1598.01 ± 0.1898.17 ± 0.1798.39 ± 0.13 Table 6Fold-wise classification metrics for LUNA16 dataset.FoldAccuracy (%)Precision (%)Recall (%)F1Score (%)Specificity (%)197.9298.1097.7597.9298.20298.1298.2597.9598.1098.35398.2598.4598.1098.2798.40498.3698.5098.2598.3798.55598.2098.3598.0098.1798.45Mean ± SD98.17 ± 0.1698.33 ± 0.1598.01 ± 0.1898.17 ± 0.1798.39 ± 0.13 Fold-wise classification metrics for LUNA16 dataset. The cross-validation findings summarized in Table 6 reveal the model’s consistency and robustness across all five folds, reflecting its stable learning behavior under varied data partitions. Each fold maintains high performance, with accuracies ranging from 97.92% to 98.36%, and only minimal variation observed across metrics. The calculated mean accuracy of 98.17% with a standard deviation of 0.16 indicates exceptional uniformity and low sensitivity to data distribution changes. Similarly, precision, recall, F1-score, and specificity values show steady alignment, confirming that the model’s predictive capability remains balanced between correctly identifying malignant and benign nodules. The progressive evaluation summarized in Table 7 demonstrates how each enhancement incrementally strengthens the overall performance of the segmentation framework. Starting from the baseline DeepLabv3 + with a ResNet-50 backbone, the inclusion of preprocessing techniques such as lung ROI extraction and CLAHE notably improves accuracy and recall, indicating better input normalization. The adoption of a hybrid loss function further refines boundary learning, enhancing the model’s ability to distinguish lesion edges. Incorporating channel and spatial attention modules (CBAM) contributes to more effective feature weighting, while the tuned ASPP module facilitates multi-scale context aggregation for finer segmentation. Finally, integrating test-time augmentation and CRF post-processing yields the highest accuracy of 98.17%, confirming that the complete architecture achieves optimal balance between precision, recall, and generalization performance. Table 7Component-wise performance metrics for the proposed framework on LUNA16 dataset.Model configurationAccuracy (%)Precision (%)Recall (%)F1-Score (%)Specificity (%)Baseline: DeepLabv3+ (ResNet-50)96.72 ± 0.2296.80 ± 0.2496.42 ± 0.2796.61 ± 0.2597.05 ± 0.21+ Lung ROI cropping + CLAHE preprocessing97.41 ± 0.1897.58 ± 0.2097.18 ± 0.2297.38 ± 0.1997.82 ± 0.18+ Hybrid loss (CE + Dice, 0.5 / 0.5)97.86 ± 0.1697.95 ± 0.1797.63 ± 0.2097.79 ± 0.1898.15 ± 0.16+ Channel & spatial attention (CBAM)98.03 ± 0.1598.18 ± 0.1597.84 ± 0.1798.01 ± 0.1698.28 ± 0.14+ Multi-scale fusion (tuned ASPP)98.12 ± 0.1498.30 ± 0.1497.95 ± 0.1698.12 ± 0.1598.38 ± 0.13+ Test-time augmentation + CRF post-processing (Full Proposed)98.17 ± 0.1698.33 ± 0.1598.01 ± 0.1698.17 ± 0.1798.45 ± 0.12 Table 7Component-wise performance metrics for the proposed framework on LUNA16 dataset.Model configurationAccuracy (%)Precision (%)Recall (%)F1-Score (%)Specificity (%)Baseline: DeepLabv3+ (ResNet-50)96.72 ± 0.2296.80 ± 0.2496.42 ± 0.2796.61 ± 0.2597.05 ± 0.21+ Lung ROI cropping + CLAHE preprocessing97.41 ± 0.1897.58 ± 0.2097.18 ± 0.2297.38 ± 0.1997.82 ± 0.18+ Hybrid loss (CE + Dice, 0.5 / 0.5)97.86 ± 0.1697.95 ± 0.1797.63 ± 0.2097.79 ± 0.1898.15 ± 0.16+ Channel & spatial attention (CBAM)98.03 ± 0.1598.18 ± 0.1597.84 ± 0.1798.01 ± 0.1698.28 ± 0.14+ Multi-scale fusion (tuned ASPP)98.12 ± 0.1498.30 ± 0.1497.95 ± 0.1698.12 ± 0.1598.38 ± 0.13+ Test-time augmentation + CRF post-processing (Full Proposed)98.17 ± 0.1698.33 ± 0.1598.01 ± 0.1698.17 ± 0.1798.45 ± 0.12 Component-wise performance metrics for the proposed framework on LUNA16 dataset. + Test-time augmentation + CRF post-processing (Full Proposed) Classification – LIDC-IDRI dataset The visualization in Fig. 12 indicates that the model maintains strong predictive reliability for the LIDC-IDRI dataset, successfully distinguishing between benign and malignant nodules with high accuracy. Correct classification rates of 98.51% for benign and 98.11% for malignant samples reveal that the framework performs consistently across both categories. The minor misclassification percentages (1.49% and 1.89%) suggest minimal overlap between the feature spaces, reflecting efficient representation learning and robust decision boundaries. Overall, the matrix pattern demonstrates balanced sensitivity and specificity, confirming that the model generalizes effectively without exhibiting class bias. Fig. 12Confusion matrix for LIDC-IDRI dataset. Confusion matrix for LIDC-IDRI dataset. The comparative evaluation illustrated in Fig. 13 demonstrates that the model consistently achieves high classification performance on the LIDC-IDRI dataset across all evaluation metrics. The accuracy of 98.31% confirms reliable overall prediction capability, while a precision of 98.55% highlights the model’s strong control over false positives. Similarly, a recall of 98.10% indicates effective detection of malignant samples, complemented by an F1-score of 98.32% that reflects balanced precision–recall performance. The specificity value of 98.60% further shows that the framework accurately identifies benign instances, verifying that the learning process maintains stability and generalization without compromising detection reliability. Fig. 13Performance metrics for LIDC-IDRI dataset. Performance metrics for LIDC-IDRI dataset. The performance trend displayed in Fig. 14 illustrates a smooth and consistent improvement in both training and validation accuracy, which converge closely as the epochs progress. The model achieves a final validation accuracy of 98.31%, demonstrating reliable generalization and minimal variance between training and validation phases. Concurrently, the training and validation loss curves show a steady reduction, reaching a final validation loss of 0.0638, signifying that the optimization process effectively minimizes error without signs of overfitting. The near-parallel behavior of both accuracy and loss curves reflects a stable learning process and a well-regularized model capable of maintaining strong predictive precision across iterations. Fig. 14Training and validation metrics for LIDC-IDRI dataset. Training and validation metrics for LIDC-IDRI dataset. The comparative evaluation in Table 8 clearly illustrates that the EfficientNetV2 backbone achieves the best overall performance, attaining an accuracy of 98.31%, precision of 98.55%, recall of 98.15%, F1-score of 98.34%, and specificity of 98.60%. These values demonstrate its superior balance between sensitivity and reliability in detecting nodules. DenseNet-201 follows closely with an accuracy of 98.05% and F1-score of 98.10%, showing consistent but slightly reduced stability compared to EfficientNetV2. ResNet-101 records 97.73% accuracy and 97.80% F1-score, while InceptionV3 performs the lowest with 97.45% accuracy and 97.50% F1-score, reflecting limited adaptability to complex feature variations. Overall, the numerical outcomes emphasize that EfficientNetV2 delivers the most robust and consistent results across all evaluation measures, confirming its effectiveness for precise and generalized nodule classification. Table 8Classification metrics for backbone architectures on LIDC-IDRI dataset.BackboneAccuracy (%)Precision (%)Recall (%)F1 Score (%)Specificity (%)EfficientNetV298.31 ± 0.0898.55 ± 0.0998.15 ± 0.1098.34 ± 0.0998.60 ± 0.09DenseNet-20198.05 ± 0.1198.25 ± 0.1297.95 ± 0.1298.10 ± 0.1198.35 ± 0.10ResNet-10197.73 ± 0.1397.95 ± 0.1497.65 ± 0.1597.80 ± 0.1498.10 ± 0.12InceptionV397.45 ± 0.1597.65 ± 0.1697.35 ± 0.1697.50 ± 0.1597.85 ± 0.13 Table 8Classification metrics for backbone architectures on LIDC-IDRI dataset.BackboneAccuracy (%)Precision (%)Recall (%)F1 Score (%)Specificity (%)EfficientNetV298.31 ± 0.0898.55 ± 0.0998.15 ± 0.1098.34 ± 0.0998.60 ± 0.09DenseNet-20198.05 ± 0.1198.25 ± 0.1297.95 ± 0.1298.10 ± 0.1198.35 ± 0.10ResNet-10197.73 ± 0.1397.95 ± 0.1497.65 ± 0.1597.80 ± 0.1498.10 ± 0.12InceptionV397.45 ± 0.1597.65 ± 0.1697.35 ± 0.1697.50 ± 0.1597.85 ± 0.13 Classification metrics for backbone architectures on LIDC-IDRI dataset. The detailed analysis in Table 9 demonstrates that the proposed framework maintains consistent performance across all five folds, reflecting its strong generalization ability and stable optimization. The accuracy values range from 98.20% to 98.40%, with a mean of 98.31% ± 0.08, confirming minimal variation between runs. Precision also remains high at 98.55% ± 0.11, indicating effective reduction of false positives, while the recall of 98.15% ± 0.07 verifies reliable identification of positive cases. The F1-score, averaging 98.34% ± 0.09, highlights a balanced trade-off between precision and recall. Additionally, the specificity of 98.60% ± 0.07 confirms excellent discrimination in identifying non-nodular instances. Table 9Fold-wise performance metrics for LIDC-IDRI dataset.FoldAccuracy (%)Precision (%)Recall (%)F1Score (%)Specificity (%)198.2098.4098.0598.2298.50298.2898.5598.1098.3298.60398.3398.6098.1598.3798.65498.4098.7098.2598.4598.70598.3598.5098.2098.3298.55Mean ± SD98.31 ± 0.0898.55 ± 0.1198.15 ± 0.0798.34 ± 0.0998.60 ± 0.07 Table 9Fold-wise performance metrics for LIDC-IDRI dataset.FoldAccuracy (%)Precision (%)Recall (%)F1Score (%)Specificity (%)198.2098.4098.0598.2298.50298.2898.5598.1098.3298.60398.3398.6098.1598.3798.65498.4098.7098.2598.4598.70598.3598.5098.2098.3298.55Mean ± SD98.31 ± 0.0898.55 ± 0.1198.15 ± 0.0798.34 ± 0.0998.60 ± 0.07 Fold-wise performance metrics for LIDC-IDRI dataset. The incremental improvements summarized in Table 10 clearly illustrate how each modification enhances the model’s overall performance on the LIDC-IDRI dataset. The baseline DeepLabv3 + with ResNet-50 backbone begins with an accuracy of 96.92% and an F1-score of 96.87%. When lung ROI cropping and CLAHE preprocessing are introduced, the accuracy rises to 97.63%, indicating improved input contrast and clarity. The addition of the hybrid loss function (CE + Dice) further boosts accuracy to 98.02% and F1-score to 98.02%, reflecting better boundary optimization and segmentation precision. Integrating CBAM attention refines spatial and channel-wise feature weighting, increasing accuracy to 98.18%. The multi-scale fusion with tuned ASPP achieves 98.26% accuracy and 98.28% F1-score, strengthening contextual representation. Finally, test-time augmentation with CRF post-processing attains the highest accuracy of 98.31% and specificity of 98.60%, confirming that the full configuration produces the most reliable, well-generalized segmentation and classification outcomes. Table 10Component-wise performance metrics for the proposed framework on LIDC-IDRI dataset.Model configurationAccuracy (%)Precision (%)Recall (%)F1-Score (%)Specificity (%)Baseline: DeepLabv3+ (ResNet-50)96.92 ± 0.1997.05 ± 0.2096.70 ± 0.2396.87 ± 0.2097.22 ± 0.18+ Lung ROI cropping + CLAHE preprocessing97.63 ± 0.1797.75 ± 0.1897.40 ± 0.2097.57 ± 0.1897.95 ± 0.16+ Hybrid loss (CE + Dice, 0.5 / 0.5)98.02 ± 0.1598.15 ± 0.1697.88 ± 0.1798.02 ± 0.1698.32 ± 0.14+ Channel & spatial attention (CBAM)98.18 ± 0.1398.35 ± 0.1498.00 ± 0.1598.18 ± 0.1498.45 ± 0.13+ Multi-scale fusion (tuned ASPP)98.26 ± 0.1098.48 ± 0.1298.08 ± 0.1398.28 ± 0.1198.55 ± 0.11+ Test-time augmentation + CRF post-processing (Full Proposed)98.31 ± 0.0898.55 ± 0.0998.15 ± 0.1098.34 ± 0.0998.60 ± 0.09 Table 10Component-wise performance metrics for the proposed framework on LIDC-IDRI dataset.Model configurationAccuracy (%)Precision (%)Recall (%)F1-Score (%)Specificity (%)Baseline: DeepLabv3+ (ResNet-50)96.92 ± 0.1997.05 ± 0.2096.70 ± 0.2396.87 ± 0.2097.22 ± 0.18+ Lung ROI cropping + CLAHE preprocessing97.63 ± 0.1797.75 ± 0.1897.40 ± 0.2097.57 ± 0.1897.95 ± 0.16+ Hybrid loss (CE + Dice, 0.5 / 0.5)98.02 ± 0.1598.15 ± 0.1697.88 ± 0.1798.02 ± 0.1698.32 ± 0.14+ Channel & spatial attention (CBAM)98.18 ± 0.1398.35 ± 0.1498.00 ± 0.1598.18 ± 0.1498.45 ± 0.13+ Multi-scale fusion (tuned ASPP)98.26 ± 0.1098.48 ± 0.1298.08 ± 0.1398.28 ± 0.1198.55 ± 0.11+ Test-time augmentation + CRF post-processing (Full Proposed)98.31 ± 0.0898.55 ± 0.0998.15 ± 0.1098.34 ± 0.0998.60 ± 0.09 Component-wise performance metrics for the proposed framework on LIDC-IDRI dataset. + Test-time augmentation + CRF post-processing (Full Proposed) Comparison of metrics Table 11 compares the key classification metrics between the LUNA16 and LIDC-IDRI datasets, showing the performance of the model across different datasets. The false positive rate (FPR) was lower for LIDC-IDRI (0.009) than for LUNA16 (0.012), whereas the false negative rate (FNR) was slightly higher for LIDC-IDRI (0.022) than for LUNA16 (0.018), indicating a trade-off in handling false negatives and positives across datasets. The Fowlkes-Mallows score (FMS) was higher for LUNA16 (0.512) than for LIDC-IDRI (0.428), reflecting a stronger correlation in LUNA16. Negative predictive value (NPV) remained high for both datasets, with 0.982 for LUNA16 and 0.978 for LIDC-IDRI, indicating a reliable prediction of negative cases. Matthews correlation coefficient (MCC) values were nearly identical, with 0.968 for LUNA16 and 0.967 for LIDC-IDRI, reflecting a strong overall classification performance. Finally, the false discovery rate (FDR) was marginally lower for LIDC-IDRI (0.011) than for LUNA16 (0.013), underscoring the model’s ability to minimize incorrect positive classifications. This comparative analysis highlights the robustness and consistency of the model across datasets. Table 11Comparative metrics for LUNA16 and LIDC-IDRI datasets.MetricsLuna16LIDC-IDRIFPR0.0120.009FNR0.0180.022FMS0.5120.428NPV0.9820.978MCC0.9680.967FDR0.0130.011 Table 11Comparative metrics for LUNA16 and LIDC-IDRI datasets.MetricsLuna16LIDC-IDRIFPR0.0120.009FNR0.0180.022FMS0.5120.428NPV0.9820.978MCC0.9680.967FDR0.0130.011 Comparative metrics for LUNA16 and LIDC-IDRI datasets. The comparative analysis presented in Fig. 15 highlights the discriminative efficiency of the proposed framework across both datasets, demonstrating smooth ROC curves that remain consistently close to the upper boundary. The LIDC-IDRI dataset attains an AUC of 96.70%, marginally higher than the 96.11% observed for LUNA16, indicating strong sensitivity and an effective balance between true positive and false positive rates. The minimal separation between the two curves signifies the model’s stability and adaptability to different data distributions. Overall, the results affirm that the system maintains high classification confidence and consistent diagnostic reliability across distinct medical imaging datasets. Fig. 15ROC Curves for LUNA16 and LIDC-IDRI Datasets. ROC Curves for LUNA16 and LIDC-IDRI Datasets. Fig. 16Qualitative visualization of the proposed model’s detection and classification performance. Qualitative visualization of the proposed model’s detection and classification performance. The Fig. 16 presents representative CT slices from the test set. The left column shows the original CT images, while the right column shows the corresponding model predictions. Green-bordered examples represent successful detections and correct classifications, where the predicted nodules align accurately with the true regions and are correctly labeled. The red-bordered examples indicate failure cases, including false positives and false negatives, where the model either misclassified benign nodules as malignant or missed small, low-contrast nodules. These visual examples provide insight into the model’s strengths in capturing clinically significant structures and its limitations when dealing with subtle or ambiguous regions. State of Art methods Table 12 compares the performance of the proposed framework with existing methods across various segmentation metrics. The proposed framework outperformed other approaches on both the LUNA16 and LIDC-IDRI datasets. For LUNA16, a Dice Coefficient of 98.75%, IoU of 97.88%, Jaccard Index of 89.62%, and Hausdorff Distance (HD) of 2.025 mm were obtained. On the LIDC-IDRI dataset, the proposed method demonstrated even higher metrics, with a Dice Coefficient of 98.92%, IoU of 98.21%, Jaccard Index of 90.15%, and HD of 2.010 mm. In comparison, the existing methods reported significantly lower values, such as a maximum Dice Coefficient of 97.95%22 and Jaccard Index of 80.84%11. These results emphasize the effectiveness of the proposed framework in delivering superior segmentation accuracy and reduced boundary errors compared with previously reported methods. Table 12Comparative performance metrics for segmentation of proposed and existing methods.ReferencesDice coefficient (%)IoU (%)Jaccard index (%)HD (mm)Sun et al.188.1782.16------Agnes et al.493.787.8------Krishnakumar et al.1189.16---80.84---Nandeesh et al.2297.9595.81------Yu Cai et al.2889.1980.782.353Proposed (Luna 16)98.7597.8889.622.025Proposed (LIDC)98.9298.2190.152.010 Table 12Comparative performance metrics for segmentation of proposed and existing methods.ReferencesDice coefficient (%)IoU (%)Jaccard index (%)HD (mm)Sun et al.188.1782.16------Agnes et al.493.787.8------Krishnakumar et al.1189.16---80.84---Nandeesh et al.2297.9595.81------Yu Cai et al.2889.1980.782.353Proposed (Luna 16)98.7597.8889.622.025Proposed (LIDC)98.9298.2190.152.010 Comparative performance metrics for segmentation of proposed and existing methods. The proposed framework demonstrated significant improvements in classification performance compared to existing methods across the LUNA16 and LIDC-IDRI datasets. For LUNA16, the framework achieved an accuracy of 98.17%, precision of 98.40%, recall of 97.90%, F1 score of 98.15%, and a specificity of 98.45%. For the LIDC-IDRI dataset, it further improved to 98.31% accuracy, 98.55% precision, 98.10% recall, F1 score of 98.32%, and 98.60% specificity. In contrast, existing methods report lower metrics, such as a maximum accuracy of 98.00%16 and a maximum recall of 96.60%11. Table 13 summarizes these comparisons, highlighting the superiority of the proposed method in achieving a high precision, recall, and overall classification performance. These findings underline the robustness and efficiency of the proposed framework for lung nodule classification. Table 13Comparative classification metrics for proposed and existing methods.ReferencesAccuracy (%)Precision (%)Recall (%)F1Score (%)Specificity (%)Sun et al.190.60---92.81---92.60Gugulothu et al.896.39---95.25---96.12Krishnakumar et al.1193.7196.5796.6095.8495.13Spoorthi B et al.1590.71---91.37---90.39Quasar et al.1698.0098.4098.7098.5097.30UrRehman et al.2795.4095.8094.6995.2493.17Proposed (Luna 16)98.1798.4097.9098.1598.45Proposed (LIDC)98.3198.5598.1098.3298.60 Table 13Comparative classification metrics for proposed and existing methods.ReferencesAccuracy (%)Precision (%)Recall (%)F1Score (%)Specificity (%)Sun et al.190.60---92.81---92.60Gugulothu et al.896.39---95.25---96.12Krishnakumar et al.1193.7196.5796.6095.8495.13Spoorthi B et al.1590.71---91.37---90.39Quasar et al.1698.0098.4098.7098.5097.30UrRehman et al.2795.4095.8094.6995.2493.17Proposed (Luna 16)98.1798.4097.9098.1598.45Proposed (LIDC)98.3198.5598.1098.3298.60 Comparative classification metrics for proposed and existing methods. The proposed framework demonstrates superior performance compared to state-of-the-art methods due to its integrated multistage design and advanced feature representation mechanisms. Unlike conventional CNN- or single-scale transformer-based architectures, the proposed model leverages the Sparse Edge-Preserving Enhancement (SEPE) technique to enhance critical nodule boundaries while suppressing background noise, ensuring precise structural preservation during preprocessing. Furthermore, the Multiscale Adaptive Swin Transformer (MA-SwinT) combined with the Multi-Scale Embedding Attention Mechanism (MEAM) enables adaptive fusion of spatial and contextual information across multiple resolutions, allowing the model to effectively capture both fine-grained texture variations and global contextual dependencies essential for differentiating benign and malignant nodules. The inclusion of the Fossa Optimization Algorithm (FOA) further refines hyperparameters dynamically, achieving optimal convergence and minimizing overfitting. Comparative results with existing approaches such as traditional CNNs, DenseNet, and Vision Transformer variants show that the proposed method attains higher accuracy, Dice coefficient, and AUC scores. This improvement stems from its ability to maintain structural consistency, enhance attention-based feature learning, and adaptively optimize model parameters, thereby providing more robust and clinically reliable predictions for lung nodule detection and classification. Discussion The superior performance of the proposed framework can be attributed to the synergistic effect of its multiscale and attention-driven architectural components. The multiscale design enables the network to capture features at varying spatial resolutions, allowing it to represent both fine-grained nodule boundaries and broader contextual information within the lung regions. Small-scale features emphasize localized texture variations and subtle edge patterns that are critical for identifying early-stage or low-contrast nodules, whereas large-scale features contribute to understanding the global anatomical context, such as nodule position and surrounding tissue morphology. The incorporation of the Multi-Scale Embedding Attention Mechanism (MEAM) further enhances this process by dynamically weighting the relative importance of features across these scales. Through its adaptive attention computation, MEAM allows the model to selectively emphasize diagnostically relevant regions while suppressing redundant or background information. This selective focus improves the model’s sensitivity to malignant nodules that exhibit irregular textures or heterogeneous intensity distributions, which are often challenging for conventional CNN-based methods. Moreover, the hierarchical self-attention mechanism within the Multiscale Adaptive Swin Transformer (MA-SwinT) effectively models long-range dependencies and spatial correlations that extend beyond local receptive fields. By employing the shifted-window attention strategy, the model maintains computational efficiency while achieving global contextual understanding. This balance between local detail preservation and global feature integration is a key factor behind the observed improvement in accuracy, precision, and generalization across datasets. Overall, the combination of multiscale representation and adaptive attention mechanisms allows the proposed framework to mimic a radiologist’s diagnostic reasoning process—focusing on both the fine structural cues and the broader anatomical context. This integrated design explains the consistent enhancement in performance over traditional convolutional architectures and validates the effectiveness of the proposed components in capturing clinically meaningful features for robust lung nodule detection and classification. Despite the strong performance demonstrated by the proposed framework, several limitations must be acknowledged. First, the size and diversity of the datasets used—LUNA16 and LIDC-IDRI—while substantial, remain limited compared to the wide variability seen in real-world clinical environments. Both datasets primarily contain high-quality CT scans obtained under standardized acquisition conditions, which may not fully represent the heterogeneity of scans produced across different scanners, institutions, or patient populations. Consequently, the model’s generalization to unseen CT protocols or populations with varying disease prevalence and imaging parameters may be constrained. Another limitation arises from the potential risk of overfitting due to the complexity of the architecture and the relatively small number of malignant cases compared to benign ones. Although extensive regularization strategies, dropout layers, and the Fossa Optimization Algorithm (FOA) were employed to mitigate overfitting, complete elimination of this risk is challenging. Future work will involve incorporating larger, multi-center datasets and applying advanced data augmentation and domain adaptation techniques to improve robustness and generalization. Finally, while the current framework demonstrates high classification accuracy, its interpretability in clinical contexts remains limited. Integrating explainable AI (XAI) methods, such as Grad-CAM or attention heatmaps, could enhance transparency and facilitate clinical adoption. Addressing these limitations will be crucial for translating the proposed model from research settings to practical diagnostic workflows in diverse clinical environments. Conclusion This study introduced a comprehensive multistage deep learning framework that integrates Sparse Edge-Preserving Enhancement (SEPE), an attention-guided segmentation network, and a Multiscale Adaptive Swin Transformer (MA-SwinT) classifier for precise lung nodule detection and classification. The proposed framework effectively leverages multi-scale and attention-driven feature representations, enabling accurate identification of both benign and malignant nodules. Experimental evaluations on the LUNA16 and LIDC-IDRI datasets demonstrated outstanding segmentation and classification performance. The segmentation module achieved Dice coefficients of 98.75% and 98.92%, Intersection-over-Union (IoU) scores of 97.88% and 98.21%, Jaccard indices of 89.62% and 90.15%, and Hausdorff Distances (HD) of 2.025 mm and 2.01 mm for LUNA16 and LIDC-IDRI respectively, indicating high boundary precision and consistency. Similarly, the classification phase achieved accuracies of 98.17% (LUNA16) and 98.31% (LIDC-IDRI), with corresponding F1-scores of 98.15% and 98.32%, confirming the robustness of the MA-SwinT model in distinguishing malignant from benign cases. These results demonstrate the framework’s strong potential for clinical application, offering radiologists an interpretable and highly reliable tool for early lung cancer detection. Future research will focus on validating the model using larger and multi-center datasets acquired from diverse CT scanners and imaging protocols to enhance generalization. Additionally, integrating explainable AI techniques will improve model transparency, enabling clinicians to better understand decision rationale and support real-world diagnostic workflows.