
learn underlying patterns, making it more adaptable
to new data. Finally, the decoder reconstructs images
from this compressed information while preserving
critical lesion details. To ensure accuracy, we use
Reconstruction Loss to keep generated images close
to the originals and KL Divergence Loss to prevent
overfitting and maintain a well-structured feature
space.
6.3 Enhancing Feature Learning with
Self-Supervised Contrastive
Learning
Since labeling medical images is time-consuming
and requires expert annotation, contrastive learning
helps the model differentiate between similar and
different lung lesions without relying on manual
labels. The process begins by creating positive pairs
(two slightly modified versions of the same CT scan)
and negative pairs (images from different patients).
These pairs are then processed through a Siamese
Network or SimCLR framework, which teaches the
model to pull similar images closer in the feature
space while pushing dissimilar ones apart. To refine
this learning, we use Contrastive Loss (NT-Xent
Loss), which strengthens feature representations.
This approach enhances the model’s ability to
accurately identify lung lesions, even in cases where
labeled data is scarce, improving segmentation
performance and generalization.
6.4 Performing Segmentation with U-
Net
For the final segmentation step, we integrate the
learned features into a U-Net model, a widely used
deep learning architecture for medical image
segmentation. The encoder (backbone) is initialized
with contrastive learning-pretrained weights,
allowing it to extract meaningful high-level features
from CT scans. The decoder then reconstructs a
pixel-wise segmentation mask, accurately outlining
necrotic lung lesions. To preserve fine details, skip
connections are used, ensuring that important spatial
information from the encoder is retained throughout
the network. To optimize segmentation accuracy, we
employ a combination of Dice Loss, which measures
overlap accuracy between the predicted mask and
actual lesion, and Binary Cross-Entropy (BCE) Loss,
which ensures accurate classification of lesion and
non-lesion regions, improving overall model
performance.
6.5 Evaluating Performance and
Testing on New Data
To ensure our model performs well across various
datasets, we evaluate it using key performance
metrics. The Dice Similarity Coefficient (DSC)
measures how accurately the predicted lesion mask
overlaps with the actual ground truth, ensuring
precise segmentation. Intersection over Union (IoU)
further assesses segmentation accuracy by comparing
the predicted and actual lesion areas. Additionally,
we analyze precision, recall, and F1-score to detect
false positives and false negatives, ensuring reliable
performance. To confirm the model’s robustness, we
test it on unseen external datasets, verifying its ability
to generalize across different imaging conditions,
scanner types, and patient variations for real-world
applicability.
7 CONCLUSIONS
The proposed deep learning-based generative AI
approach provides an effective solution for
segmenting necrotic lung lesions in CT images by
integrating Variational Autoencoders (VAEs), self-
supervised contrastive learning, and U-Net
segmentation. VAEs help extract meaningful features
from medical images, enabling the model to learn rich
representations of lung structures. Contrastive
learning, on the other hand, strengthens the model’s
ability to differentiate between healthy and diseased
lung tissue without relying on extensive manually
labeled data. This significantly enhances the model’s
generalization capability, making it more adaptable to
real-world clinical applications.
By incorporating U-Net, which is well-suited for
medical image segmentation, the framework ensures
highly accurate, pixel-level detection of necrotic lung
lesions. The encoder, pretrained with contrastive
learning, extracts high-level features, while the
decoder reconstructs precise segmentation masks. To
validate performance, we use key evaluation metrics
such as Dice Similarity Coefficient (DSC),
Intersection over Union (IoU), precision, and recall,
which confirm the model’s reliability.
By reducing dependence on large annotated
datasets, this scalable, automated, and highly accurate
approach offers an advanced tool for early diagnosis
and treatment planning, ultimately improving
healthcare outcomes for lung disease patients.
Deep Learning-Based Generative Al for Segmenting Necrotic Lung Lesions in CT Images Using Self-Supervised Contrastive Learning
517