A novel two-stage deep learning approach for lung cancer using enhanced ResNet50 segmentation and LungSwarmNet classification

Sci Rep 2025 AI 7 Explanations View Original
Original Paper (PDF)

Unable to display PDF. Download it here or view on PMC.

Plain-English Explanations
Pages 1-2
Early Detection Challenges and the Role of CT Imaging

Lung cancer remains the leading cause of cancer-related mortality worldwide. With a 5-year survival rate below 20%, lung cancer is responsible for over 1.8 million new cases and 1.6 million deaths annually. The poor prognosis is largely driven by late-stage diagnosis: approximately 70% of patients present with stage III or IV disease, where treatment options are primarily palliative rather than curative.

Computed tomography has become the primary imaging modality for early lung cancer detection, allowing radiologists to evaluate the kind, size, location, and stage of suspected tumors. However, accurate manual interpretation of CT scans is time-consuming, highly expertise-dependent, and subject to inter-reader variability, creating a clear need for automated diagnostic assistance.

Deep learning-based models have demonstrated strong performance in automatic segmentation and classification of medical images. Architectures including DenseNet, ResNet, U-Net, and their variants have been applied successfully to CT-based lung analysis, learning hierarchical feature representations directly from image data.

Transfer learning allows models pre-trained on large image datasets to be fine-tuned for specialized medical tasks with limited data. Architectures such as DenseNet-201 and ResNet50 have been benchmarked for lung cancer detection; this study combines them in a two-stage pipeline and integrates Particle Swarm Optimization to further enhance classification performance.

TL;DR: Lung cancer's high mortality is linked to late-stage diagnosis, motivating automated deep learning systems that can accurately segment and classify tumors in CT scans to accelerate and standardize early detection.
Pages 3-4
Dataset Selection and Image Preprocessing

Three publicly available CT datasets were used for evaluation. The IQ-OTH/NCCD Lung Cancer Dataset contains 1,190 CT scan images from 110 patients categorized as normal, benign, or malignant. The Chest CT-Scan Images Dataset includes four histological classes: adenocarcinoma, large cell carcinoma, squamous cell carcinoma, and normal. The LIDC-IDRI subset provides binary benign-versus-malignant CT region-of-interest images. All datasets used a 70:30 training-to-test split.

Image preprocessing was applied uniformly across all datasets to standardize inputs before model training. Rescaling normalized image dimensions to a consistent spatial resolution. Contrast enhancement techniques were applied to improve visibility of lung nodules and tumor boundaries. Pixel values were normalized to a mean of zero and standard deviation of one to ensure stable gradient flows during training.

Data augmentation techniques including horizontal flipping, rotation, and zooming were applied to the training sets to artificially expand dataset size and improve model generalization. This was particularly important given the moderate dataset sizes, where augmentation helps prevent overfitting by increasing the diversity of training examples.

The preprocessing pipeline ensured that all three datasets were treated consistently, allowing direct performance comparison across datasets and ensuring that reported accuracy improvements reflected model architecture quality rather than preprocessing differences.

TL;DR: Three Kaggle-sourced CT datasets with different classification tasks were preprocessed through rescaling, contrast enhancement, normalization, and augmentation to create standardized training and test splits for model evaluation.
Pages 4-5
ResNet50-Based Segmentation Architecture

A hybrid encoder-decoder architecture was used for lung lesion segmentation. The segmentation component uses ResNet50 as the encoder backbone, which employs residual blocks with identity shortcut connections to address the vanishing gradient problem in deep networks. These skip connections allow the network to learn residual mappings rather than full transformations, enabling training of very deep networks without accuracy degradation.

An Atrous Spatial Pyramid Pooling module follows the encoder, applying parallel dilated convolutions at multiple dilation rates. This multi-scale feature aggregation allows the network to simultaneously capture fine-grained local detail and broader contextual information, enabling accurate segmentation of lung lesions across a wide range of sizes.

The decoder component is inspired by U-Net architecture, progressively upsampling multi-scale feature maps to the original image resolution. Skip connections from matching encoder levels to decoder layers restore spatial information lost during downsampling, preserving precise boundary information critical for accurate lesion delineation.

The segmentation network terminates with an average pooling layer, a fully connected layer, and two sigmoid-activated outputs. This design integrates ResNet50's deep feature extraction, ASPP's multi-scale aggregation, and U-Net's precise spatial reconstruction into a unified pipeline optimized for automated lung lesion segmentation from CT images.

TL;DR: The segmentation stage combines ResNet50 encoding with Atrous Spatial Pyramid Pooling for multi-scale feature capture and a U-Net decoder for precise spatial reconstruction, enabling accurate lung lesion boundary detection across varied tumor sizes.
Pages 5-7
LungSwarmNet: DenseNet-201 Combined with Particle Swarm Optimization

LungSwarmNet integrates DenseNet-201's feature extraction with PSO-driven hyperparameter optimization. DenseNet-201 is a 201-layer densely connected convolutional network where every layer receives feature maps from all preceding layers in a dense block. This dense connectivity strengthens feature propagation, reduces vanishing gradients, and enables efficient parameter reuse, achieving high accuracy with fewer parameters than traditional architectures.

The LungSwarmNet architecture begins with a 7x7 convolutional layer with 64 channels and stride 2 for initial low-level feature detection, followed by 3x3 max pooling for spatial dimensionality reduction. Four DenseNet-201 dense blocks extract progressively higher-level features, with feature maps concatenated across blocks to preserve information from all abstraction levels. Global average pooling and fully connected layers with 256 and 64 neurons perform non-linear feature fusion, with a 0.5-rate dropout layer for regularization.

Particle Swarm Optimization was applied to select the most discriminative features from DenseNet-201's output layer. Inspired by swarm foraging behavior, PSO represents each potential feature subset as a particle with a position and velocity, iteratively updated based on each particle's personal best solution and the global best solution found by the swarm. A fitness function rewards feature sets that maximize classification accuracy while preferring smaller feature subsets for efficiency.

PSO eliminates the need for manual hyperparameter search by systematically exploring the hyperparameter space in parallel. Compared to exhaustive grid search, PSO converges to high-quality solutions faster with fewer control parameters, while maintaining swarm diversity to avoid premature convergence. The result is a classification model that focuses exclusively on the most informative DenseNet features.

TL;DR: LungSwarmNet couples DenseNet-201's dense feature connectivity with Particle Swarm Optimization, which automatically selects the most discriminative features and optimizes hyperparameters without manual tuning, producing a streamlined and accurate lung cancer classifier.
Pages 9-11
Classification Performance Across Three Datasets

LungSwarmNet consistently outperformed comparison models across all three datasets. On Dataset-I (IQ-OTH/NCCD, three-class), LungSwarmNet achieved an overall accuracy of 92.88%, with malignant class F-score of 94.58% (precision 95.73%, recall 93.45%) and benign recall of 91.67%. Normal cases showed balanced performance with 87.22% precision, 92.80% recall, and 89.92% F-score.

On Dataset-II (Chest CT-Scan, four-class), LungSwarmNet achieved overall accuracy of 92.59%. Adenocarcinoma classification was particularly strong, with precision, recall, and F-score all at 94.06%. Large cell carcinoma recall reached 91.07%, squamous cell carcinoma achieved an F-score of 92.19% with 94.81% specificity, and normal cases showed 92.31% recall. Only the normal class showed a precision-recall gap (83.72% vs 92.31%), indicating occasional over-prediction of malignancy in normal images.

On Dataset-III (LIDC-IDRI binary classification), LungSwarmNet achieved 93.21% accuracy with balanced performance between benign (precision 92.26%, recall 94.08%, F-score 93.16%) and malignant classes (precision 94.17%, recall 92.38%, F-score 93.27%). The model correctly classified 291 malignant cases with only 24 false negatives and 18 false positives.

LungSwarmNet consistently recorded the lowest mean squared error across all three datasets: 0.1008, 0.0862, and 0.0668 respectively, compared to PSO+SVM errors of 0.1568, 0.1441, and 0.1276. The ROC curve analysis showed an AUC approaching 1.0 with steep initial rise toward the top-left corner, indicating high sensitivity at low false positive rates.

TL;DR: LungSwarmNet achieved accuracies of 92.88%, 92.59%, and 93.21% across three datasets, with the lowest mean squared error in all comparisons, demonstrating consistent superiority in lung cancer detection, subtype classification, and benign-malignant discrimination.
Pages 11-12
Comparison Against Baseline Methods

LungSwarmNet outperformed PSO+SVM, ResNet, and DenseNet on all datasets. On Dataset-I, LungSwarmNet achieved 92.88% accuracy versus 70.79% for PSO+SVM, 76.78% for ResNet, and 82.77% for DenseNet. In confusion matrix terms, LungSwarmNet correctly identified 102 cancer cases with only 8 false negatives and 11 false positives, compared to 84 true positives and 52 false positives for PSO+SVM.

On Dataset-II, LungSwarmNet achieved 92.59% accuracy versus 79.89% for PSO+SVM, 82.01% for ResNet, and 87.83% for DenseNet. LungSwarmNet produced 69 true positives, 6 false negatives, and 8 false positives, while PSO+SVM had 56 true positives and 19 false positives -- indicating that LungSwarmNet substantially improved both sensitivity and precision simultaneously.

On Dataset-III, the performance gap narrowed but LungSwarmNet still achieved 93.21% accuracy versus 89.34% for PSO+SVM, 90.31% for ResNet, and 91.92% for DenseNet. LungSwarmNet had 291 true positives with 24 false negatives compared to 277 true positives and 38 false negatives for PSO+SVM, demonstrating meaningfully fewer missed cancer cases.

The systematic improvement in both true positive rates and true negative rates across all three datasets confirms that LungSwarmNet's advantages are not achieved by simply shifting the classification threshold toward positive predictions. Instead, the combined ResNet50 segmentation and PSO-optimized DenseNet-201 pipeline improves genuine discriminative capability across all cancer types and classification tasks.

TL;DR: LungSwarmNet outperformed all three comparison methods on every dataset, with accuracy gains of up to 22 percentage points over PSO+SVM and the fewest false negatives in cancer detection across all three benchmarks.
Pages 15-16
Conclusions and Future Directions

A two-stage deep learning pipeline for lung cancer diagnosis from CT scans. This study introduced a novel architecture that combines Enhanced ResNet50 for automated segmentation and LungSwarmNet for multi-class classification in a sequential pipeline. The system demonstrated competitive performance across three diverse CT datasets, outperforming PSO+SVM, standalone ResNet, and standalone DenseNet baselines consistently.

The PSO integration into DenseNet-201 provides a principled mechanism for automatic feature selection and hyperparameter optimization without manual tuning, making the model more robust and computationally efficient. The two-stage design separates the segmentation and classification challenges, allowing each component to be optimized independently for its specific task.

Key limitations include relatively small dataset sizes for each benchmark, potential susceptibility to CT image quality variations, and the absence of explainability mechanisms for clinical interpretability. The current evaluation relied on public datasets with specific imaging protocols, which may not generalize uniformly to different CT scanners or clinical settings.

Future work should focus on validation using larger multi-institutional datasets, integration of multimodal imaging sources for richer feature extraction, and incorporation of explainable AI techniques such as Grad-CAM or SHAP to provide radiologists with interpretable visualizations of model decisions. Hybrid transfer learning approaches and 3D volumetric analysis may further improve sensitivity for small or subtle pulmonary lesions.

TL;DR: LungSwarmNet's combination of ResNet50 segmentation and PSO-optimized DenseNet-201 classification consistently outperformed existing methods, with future validation needed on larger multicenter datasets and explainability tools for clinical adoption.
Citation: Open Access, 2025. Available at: PMC12796376.