Report
Report
May 2024
VISVESVARAYA TECHNOLOGICAL UNIVERSITY
Jnana Sangama, Belagavi-590 018.
JNN College of Engineering
Department of Electronics and Communication Engineering
Shimoga-577 204.
CERTIFICATE
This is to certify that the project work entitled ““Lung Cancer Detection and Classi-
fication using Deep Learning”” is carried out by Jeevan Kumar S (4JN00EC039),
Karthik L M (4JN00EC040), Koushik M T (4JN00EC042), Sathyanarana S
R (4JN00EC065) , the bonafide students of JNN College of Engineering, Shimoga in
partial fulfillment for the award of “Bachelor of Engineering” in department of “Elec-
tronics and Communication Engineering” of the Visvesvaraya Technological University,
Belagavi, during the year 2023-24. It is certified that all the corrections/suggestions
indicated for internal assessment have been incorporated in the report deposited in the
departmental library. The project report has been approved as it satisfies the academic
requirements in respect of project work prescribed for the said degree.
2.
ABSTRACT
Lung cancer is one of the most prevalent and fatal cancers worldwide, with early detec-
tion playing a crucial role in improving patient outcomes. In this project, we propose a
Deep Learning-based approach for the detection and classification of lung cancer from
medical imaging data using CT scans. Our model leverages Convolutional Neural Net-
works (CNNs) to automatically extract features from lung images, enabling accurate
classification of cancerous and non-cancerous regions.
The proposed system consists of three main stages: preprocessing, feature extraction,
and classification. In the preprocessing stage, we employ various image enhancement
techniques to standardize and improve the quality of input images. Next, a pre-trained
CNN architecture is utilized to extract discriminative features from the preprocessed
images. Finally, these features are fed into a classifier to distinguish between different
types of lung cancer, including adenocarcinoma, squamous cell carcinoma,large cell car-
cinoma and normal one. CT screening has been proven to be effective for diagnosing
lung cancer at its early manifestation in the form of pulmonary nodules, thus decreasing
the [Link] proposed model achieves high accuracy, sensitivity, and specificity in
identifying various types of lung cancer, thereby aiding clinicians in making timely and
informed treatment decisions. Additionally, the proposed framework can be easily inte-
grated into existing medical imaging systems, providing a valuable tool for early diagnosis
and personalized treatment of lung cancer.
Keywords: Lung cancer,CT scan,CNN,Image Processing,Deep Learning;
i
ACKNOWLEDGEMENTS
The satisfaction and euphoria that accompany the successful completion of any task
would be incomplete without the mention of the people who made it possible whose
constant guidance and encouragement crowned the efforts with success. I thank Dr.Y
Vijaya Kumar, Principal, and Dr. Manjunatha P, Dean Academics JNNCE, Shiv-
amogga for giving facilities to undertake internship work. I would like to express my
gratitude to Dr. S.V Sathyanarayana, Head of Department, Electronics and Com-
munication Engineering for providing a good working environment and for his constant
support and encouragement. It gives me great pleasure in placing on record a deep sense
of gratitude to our guide Dr. Manjunatha P, Professor and Dean Academics and to our
Project coordinator, Mrs. Nalina S B, Assistant Professor, Department of Electronics
and Communication Engineering for their expert guidance, initiative and encouragement
that led me through the presentation. And lastly, I would hereby acknowledge and thank
my parents who have been a source of inspiration and also instrumental in the successful
completion of the technical seminar.
Jeevan Kumar S
Karthik L M
Koushik M T
Satyanarayana S R
ii
Contents
Abstract i
Acknowledgements ii
List of Figures v
1 Preamble 1
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Aim of the project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.5 Scope of the project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.6 Limitation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.7 Organization of the report . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 Theoretical Background 7
2.1 Literature survey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Conclusion of the literature . . . . . . . . . . . . . . . . . . . . . . . . . 11
iii
5 Conclusion 28
A Appendix 29
A.1 Program for training the model . . . . . . . . . . . . . . . . . . . . . . . 29
A.2 Program for testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
References 41
iv
List of Figures
v
Chapter 1
Preamble
1.1 Introduction
Lung cancer is a significant public health concern globally, accounting for a substantial
portion of cancer-related deaths each year. Early detection and accurate classification
of lung cancer are crucial for timely intervention and improved patient outcomes. Tra-
ditional methods for diagnosing lung cancer, such as visual inspection of medical images
by radiologists, are time-consuming and subject to inter-observer variability.
The mortality rate for lung cancer in past 4 years is estimated to be 1,761,007, which
will increase to 3,104,704 in 2040. As seen in the figure, the incidence of lung cancer in
men and women will also increase and the number of deaths from lung cancer in men in
recent years will increase up to 2,372,239 and in women from 725,352 to 1,238,657 Based
on the results of cancer registries in past 4 years, the highest incidence and mortality
rates are from lung cancer (42.2 percent of new cases and 38.1 perecnt of deaths)[Link]
development of this type of models will help in the early screening and treatment of the
In recent years, Deep Learning has emerged as a promising tool for medical image anal-
ysis, offering the potential to automate and enhance the accuracy of cancer detection and
classification tasks. Deep Learning algorithms, particularly Convolutional Neural Net-
works (CNNs), excel at learning intricate patterns and features from complex image data,
making them well-suited for tasks such as lung cancer detection and [Link]
project focuses on the development of a Deep Learning-based system for the automated
detection and classification of lung cancer from medical imaging data. By harnessing
the power of CNNs, we aim to create a robust and efficient solution capable of accu-
rately identifying various types of lung cancer, including adenocarcinoma, squamous cell
carcinoma,large cell carcinoma and normal [Link] proposed system comprises several
key components, including preprocessing techniques to enhance image quality, feature
extraction using CNNs to capture relevant patterns, and classification algorithms to dif-
ferentiate between different types of lung cancer. By integrating these components into
a unified framework, we seek to streamline the diagnosis process and provide clinicians
with valuable insights for personalized treatment planning.
Through this project, we envision contributing to the advancement of lung cancer
diagnosis by leveraging state-of-the-art Deep Learning techniques. The ultimate goal is
to facilitate early detection, improve treatment outcomes, and reduce the burden of lung
cancer on individuals and healthcare systems worldwide.
1.3 Objectives
To collect the different CT scaned images of lung cancer patients to form data set.
1.4 Methodology
The methodology of detection and classification of lung cancer by deploying a CNN model
for training and softmax for prediction and also classification involves several steps.
Data Collection:
The first step is to collect a large dataset of CT scan images, some labeled as lung
cancer-positive and others as [Link] a dataset for a project like lung cancer
classification using CT scan images involves several steps, including acquiring the images,
labeling them, and organizing them into appropriate directories.
Label each CT scan image according to its diagnosis ( adenocarcinoma(a), squamous cell
carcinoma(s),large cell carcinoma(l) and normal(n)). This can be a time-consuming pro-
cess and may require input from medical professionals or radiologists to ensure accuracy
for the model training process.
Data Preprocessing: Large images cannot be fed directly into convolutional neural
network architecture because of the limit on the computation power. At first, we con-
verted all the images into similar size and format. To reduce the size of the input data,
we have segmented the [Link] have to find the regions that are more probable of
having cancer. We have reduced our search space by first segmenting the lungs and then
removing the low intensity regions(also called as the non-data regions).
Model Architecture: Design a CNN architecture suitable for image classification tasks.
The architecture of the CNN model consists of several layers, including convolution lay-
ers, rectified linear unit (ReLU) layers, response normalization layers, and pooling layers.
The input images are down-sampled to reduce the computational complexity of the deep
learning architecture.
Training the Model: The CNN model is trained using the preprocessed images and
their corresponding labels. During training, the model learns to extract relevant features
from the images and map them to their corresponding labels. The training process also
involves optimizing the model’s parameters to minimize the loss function.
Model Evaluation: After training, the model’s performance is evaluated using a sep-
arate validation dataset to ensure it generalizes well to unseen data. Additionally, it is
tested on another set of unseen data to measure its performance metrics such as accu-
racy, [Link] model can be further fine-tuned by adjusting the hyperparameters or
adding regularization techniques to improve its performance.
Prediction: After rigorous training and evaluation, the deep learning model demon-
strates promising performance in the task of lung cancer detection and classification.
Leveraging a diverse dataset comprising CT scans. the model exhibits high accuracy,
sensitivity, and specificity in identifying various types of lung cancer, including adeno-
carcinoma, squamous cell carcinoma, small cell carcinoma, and large cell carcinoma.
Through the integration of advanced preprocessing techniques, such as normalization,
noise reduction, and contrast enhancement, the model effectively extracts relevant fea-
tures and discriminates between cancerous and non-cancerous regions within the lung
images.
Assess the performance of the trained model using appropriate evaluation metrics,
such as accuracy, sensitivity, [Link] the model through cross-validation
and external validation on independent datasets to ensure robustness and general-
izability.
Compare the performance of the deep learning model with existing methods and
clinical standards for lung cancer detection and classification. Conduct thorough
benchmarking studies to highlight the strengths and limitations of the developed
approach.
Identify opportunities for further research and development to enhance the model’s
performance, scalability, and applicability. Explore potential collaborations with
industry partners, academic institutions, and healthcare organizations to advance
the field of lung cancer diagnosis and improve patient care outcomes.
1.6 Limitation
[Link] Dataset Size: The project mentions a dataset of 547 images for training
and testing the CNN model. A small dataset may limit the model’s ability to generalize
well to unseen data and may lead to overfitting which some times also give an false
positive. Moreover, variations in imaging protocols and quality across different healthcare
institutions can introduce bias and affect model performance.
Generalizability to Clinical Practice: While the model may demonstrate high per-
formance in controlled research settings, its real-world applicability and generalizability
to diverse patient populations and clinical environments remain uncertain. Validation
in real-world clinical settings is necessary to assess the model’s efficacy and feasibility in
routine practice.
Resource Requirements: Training deep learning models for medical image analysis
requires substantial computational resources, including high-performance computing in-
frastructure and specialized hardware (e.g., GPUs).
Theoretical Background
This study underscores the pressing need for improved methods in lung cancer diagno-
sis, given its dire prognosis and significant impact on patient outcomes. The conventional
reliance on manual interpretation of CT images for detecting lung cancer underscores the
urgency for more sophisticated approaches. The proposed CCDC-HNN method, coupled
with the utilization of deep neural networks for feature extraction, represents a significant
step forward in this endeavor. By enabling the detection of cancerous cells at early stages,
this approach holds promise for potentially altering disease trajectories and improving
patient survival rates. Furthermore, the integration of an advanced 3D-CNN augments
the diagnostic accuracy, thereby facilitating the crucial distinction between benign and
malignant tumors. The validation of results through rigorous statistical analysis under-
scores the reliability and effectiveness of the hybrid DL technique proposed in this study.
In summary, this research contributes to the ongoing quest for more precise and timely
lung cancer diagnosis, offering hope for better outcomes and enhanced patient care.
The results of our study unveil the transformative potential of deep learning in the
realm of early lung cancer detection, heralding a new era in clinical practice where timely
intervention becomes a tangible reality. By elucidating our methodology, presenting our
experimental findings, and discussing the implications of our research, we underscore the
profound impact that deep learning stands to make in the fields of medical imaging and
cancer diagnostics. This research not only sheds light on the promising strides made in
lung cancer detection but also serves as a beacon of hope for the future of patient care,
offering prospects for improved treatment outcomes and bolstered survival rates in the
battle against this formidable disease.
plore and implement new evolutionary algorithms to address the challenges associated
with medical image segmentation.
Lung cancer ranks as one of the most commonly diagnosed cancers worldwide, partic-
ularly among men, emphasizing the importance of early detection for timely treatment
and improved patient outcomes. CT imaging stands as a valuable tool in lung cancer
diagnosis. In this study, the performance of five optimization algorithms—k-means clus-
tering, k-median clustering, particle swarm optimization, inertia-weighted particle swarm
optimization, and guaranteed convergence particle swarm optimization (GCPSO)—is
evaluated for tumor extraction from lung images. Additionally, the effectiveness of me-
dian, adaptive median, and average filters in the preprocessing stage is compared, with
the adaptive median filter demonstrating superior suitability for medical CT images.
Furthermore, image contrast is enhanced through adaptive histogram equalization. The
preprocessed images of enhanced quality are then subjected to the four algorithms for
segmentation. Practical validation is conducted on 20 sample lung images using MAT-
LAB, revealing GCPSO to achieve the highest accuracy, at 95.89
Given the resource-intensive nature of 3-D convolutional neural networks (CNNs), ne-
cessitating ample graphic memory and sliding windows, we introduce a patch size strat-
egy for both training and testing phases. To evaluate our framework, we employ fivefold
cross-validation, yielding promising results. Notably, our proposed method achieves a
sensitivity of 0.96 and a false positive per scan (FPPS) rate of 1.04, surpassing the per-
formance of the baseline 3-D CenterNet particularly in terms of sensitivity. Moreover, our
multimodality attention module exhibits potential applicability beyond NSCLC detec-
tion, showcasing competitive performance against other lung cancer detection methods.
3.1 Introduction
The design and implementation of a detection and classification system for lung cancer
detection using Convolutional Neural Networks (CNN) involves several steps.
A CNN is a type of deep neural network that is designed to process and analyze the
data that has a grid-like topology, such as an image . As shown in the Figure 3.1, the
network consists of a series of convolutional layers that apply filters to the input data
followed by pooling layers that down sample the output which completes feature extrac-
tion. The final layers of the network typically include one or more fully connected layers
that perform classification.
Input layer: This layer takes in the raw image data as input and prepares it for
processing by the rest of the network, that is the input layer would take in an image of
lungs CT scan. The input image can be represented as a 3D tensor of shape.
a b c
!
X X X
h[i, j, k] = f kernel[l, m, n] · x[i + l, j + m, n] + bias[k] (3.1)
l=−a m=−b n=−c
Where, h[i,j,k] is the output activation at position (i,j) for the k-th filter, f is a non-
linear activation function, kernel[l,m,n] is the weight for the filter at position (l,m) and
channel n, x[i+l,j+m,n] is the pixel value at position (i+l,j+m) and channel n in the input
image, bias[k] bias term. Activation function rectified linear unit (ReLU): The output
of the convolutional layer is subjected to an activation function known as the ReLU layer.
2D layer (Max Pooling): This layer reduces the dimensionality of the feature maps
with 2*2 or 3*3 by down sampling using maximum.
Fully connected layer: This layer takes the flattened feature maps from the previous
layers and applies a set of weights and biases to produce an output which has been passed
through one or more fully connected layers that is hidden layers such as dense layer for
classification.
Output layer This layer produces the final output of the network, which is a probability
distribution over the different disease classes. The SoftMax function is applied to the
output to convert the probabilities into a probability distribution that sums to one. The
predicted class is the class with the highest probability in the output of the model.
This is the class that the model predicts the input image that it belongs to. After
designing the model, the dataset is divided into training, validation, and testing sets.
The training set is used to train the model, the validation set is used to tune the model’s
hyperparameters, and the testing set is used to evaluate the model’s performance. The
model is then trained using a suitable loss function, such as categorical cross-entropy,
and an optimization function, such as Adam. The model is trained for a certain number
of epochs, and the model’s performance is monitored during training to detect overfitting
or underfitting. After training the model, the model’s performance is evaluated using the
testing set.
The block diagram you sent shows the process of classifying CT images. This is the
first step, where the CT image is uploaded into the system.
Input CT Image: This is the starting point, where the CT scan (computed tomogra-
phy) image is fed into the system.
Pre-processing: The CT image may undergo some preprocessing steps to enhance the
image quality and prepare it for further analysis. This may involve techniques like noise
reduction, contrast enhancement, or normalization.
[Link] Segmentation: In this stage, the relevant region of interest (ROI) is identified
and segmented from the background of the CT image. This ROI could be a specific organ
or tissue that the doctor is interested in examining.
[Link] Extraction: Key features are extracted from the segmented ROI, such as the
edges of the lung including the all the non data part like rib-cages,blood-vessels etc,...
These features could be mathematical properties or characteristics of the image that can
be used to differentiate between normal and abnormal [Link] the preprocessing
stage is carried out in these mentioned steps:
3. Edge Detection
4. Threshold Detection
[Link] Image input:The original CT scan image is [Link] image likely rep-
resents a cross-sectional view of the [Link] contains various structures, including bones,
organs, and lung tissue.
[Link] scale image:The selected image is converted into grayscale. Grayscale images
use intensity values (shades of gray) instead of color. This step simplifies the image and
helps focus on structural details.
[Link] Detection:Edges within the grayscale image are highlighted. Edge detection
algorithms identify abrupt changes in intensity (such as boundaries between different
tissues). The goal is to outline structures like blood vessels, airways, and lung tissue.
[Link] Detection:A threshold value is applied to segment the image. Pixels with
intensity values above the threshold are considered part of the region of interest (ROI).
This step separates the lung tissue from the background.
[Link] Sharpening (first instance):The thresholded image is sharpened. Sharp-
ening enhances edges and fine details. It improves clarity and makes structures more
distinct.
[Link] Sharpening (second instance):The edge-detected image (from step 3) is
also sharpened. This further enhances the visibility of structures. Both the thresholded
and edge-detected versions benefit from sharpening.
In the final processed version, specific areas (likely representing lung tissue) are high-
lighted in green for easier identification.
Classification: Finally, a classification algorithm is applied to categorize the extracted
features and classify the image. The output could be a binary classification (normal vs.
abnormal) or a multi-class classification (different types of abnormalities).
The CNN applies a series of filters (kernels) to the input image. These filters slide over
the image, element-wise multiplying the corresponding pixels with the weights in the ker-
[Link] kernel slides over the input image, extracting features by performing element-wise
multiplication and summing the results. The purpose of the convolution is to extract
features from the image. In map creation, these features could be edges, lines, shapes, or
other patterns that might represent roads, buildings, or other features relevant to creat-
ing a [Link]: After the first convolution, there’s a step labeled “Pooling.” Pooling
reduces the spatial dimensions of the featured map by selecting the maximum or average
value within a small window (e.g., 3x3). The result is a “Pooled Featured Map.”Second
Convolution: The process continues with another convolution step, resulting in a new
set of “Featured Maps.” Second Pooling: Finally, there’s another pooling step, creating
the “Pooled Featured Maps” after the second convolution. The overall process helps ex-
tract hierarchical features from the input image, making CNNs effective for classification,
affected area of lung’s detection, and segmentation.
A kernel is applied across the input tensor, and an element-wise product between each
element of the kernel and the input tensor is calculated at each location and summed
to obtain the output value in the corresponding position of the output tensor, called a
feature [Link] process of training a CNN model with regard to the convolution layer is
to identify the kernels that work best for a given task based on a given training dataset.
Kernels are the only parameters automatically learned during the training process in the
convolution layer; on the other hand, the size of the kernels, number of kernels, padding,
and stride are hyper parameters that need to be set before the training process starts.
A set of 32/64/128 filters of size 3*3 to the dataset, which helps to extract features from
the image. The resulting feature maps highlight important patterns and edges in the
image that can be used for classification.
ically, NumPy enables developers to store and manipulate the extracted features from
captured images.
3. os:This library allows you to interact with the operating system for tasks like access-
ing and managing CT scan image files. You can use it to navigate directories containing
the data and potentially define file paths for loading and saving [Link] offers function-
alities for checking file existence and handling potential errors during file access. This
can be useful for ensuring the code can gracefully handle situations where data files are
missing or [Link] libraries like cv2 are better suited for image loading itself,
os can indirectly aid in the process. By providing file paths and potentially listing files
within a directory, os can help prepare the groundwork for loading images using OpenCV
or other libraries.
4. random (shuffle):Shuffling the data before training helps prevent the model from
learning biases based on the order of data presentation. This is particularly important
for ensuring the model generalizes well to unseen data.
5. tqdm:Training a deep learning model on medical images can take time. Tqdm pro-
vides a progress bar that displays the training progress, making it easier to track the
ongoing process.
one after another. This is likely how you’ll construct your CNN architecture for lung
cancer classification.
[Link] Set:The process starts with a dataset. In the context of machine learning,
this dataset typically contains labeled [Link] row in the dataset represents an
instance (e.g., an image), and each column represents a feature.
[Link] Layers (Python Code Snippet):In context of our project the provided
Python code snippet appears to be related to creating training data. It defines two
functions: create-train-data() and process-test-data(). The create-train-data() function
reads images from different directories (presumably corresponding to different classes),
resizes them, and appends them to a training dataset. The process-test-data() function
processes test images similarly. The code snippet likely prepares data for training a CNN
model.
[Link] and Feature Extraction: The final diamond represents the training pro-
cess, where a machine learning model (possibly a CNN) is trained on the prepared data.
Feature extraction occurs within the convolutional layers of the model. The extracted
features are used for classification.
Figure 3.8: flow chart for the testing of the unseen data
tion. Unfortunately, the image doesn’t provide further details about the specific remedies
or treatment.
3.8 Summary
This project aims to develop a deep learning system for lung cancer detection and clas-
sification using CT scan images. The approach leverages convolutional neural networks
(CNNs) built with TensorFlow. CT scan data undergoes preprocessing steps like resizing
and normalization to prepare it for the model. TensorFlow serves as the computational
engine. The CNN extracts features from the CT scans using convolutional layers, which
identify relevant patterns in the images. Pooling layers then reduce the data dimen-
sionality while capturing the presence of these features. Activation functions introduce
non-linearity, allowing the model to learn complex relationships. Finally, fully-connected
layers classify the CT scan as normal or cancerous. By training the model with labeled
data, the system learns to differentiate between healthy and cancerous and also the type
of the cancer and aim to create a robust and efficient solution capable of accurately
identifying various types of lung cancer, including adenocarcinoma, squamous cell car-
cinoma,large cell carcinoma and normal one, based on the extracted features from CT
scans.
The results of project are generalized in to three sections namely the collection of the
data samples for training the model,and preprocessing of the input ct scan image of the
lung cancer patient and at last the detection of the type of the lung cancer the input has
or normal [Link] additionally with the display of the remedies that should be taken for
a particular type of cancer detected
The above shown figure shows the preprocessing stages of the given input of an CT scan
image of the lung,which follows the different steps,the main aim is to make the data more
accurate for the prediction of the cancer from the given set of pre-trained values.
Conclusion
Overall, this lung cancer detection project has the potential to make a significant con-
tribution to the fight against lung cancer. This project explored the potential of deep
learning for lung cancer detection and classification using CT scan images. A convo-
lutional neural network (CNN) architecture built with TensorFlow was implemented to
differentiate between normal lung tissue and various cancer types, including squamous cell
carcinoma, adenocarcinoma, and large cell carcinoma. The CNN successfully extracted
features from the CT scans using convolutional and pooling layers. Activation functions
introduced non-linearity, allowing the model to learn complex relationships between these
features. Finally, fully-connected layers classified the lung tissue. By training the model
with labeled data, the system achieved promising results in identifying and classifying
different lung cancer types. This approach holds promise for aiding medical professionals
in lung cancer diagnosis and potentially improving patient outcomes. However, further
research with larger datasets and validation on real-world clinical data is necessary to
ensure the model’s generalizability and clinical [Link] further research and
development, this technology could become a valuable tool for the detection of the lung
cancer. The proposed system with a accuracy of 93.89%. Consequently, this approach
helps in encouraging radiologists to engage in intelligent detection and giving them the
better remedial key notes to over come the disease.
Appendix
IMG SIZE = 50
LR = 1e-3
MODEL NAME = ’[Link]’.format(LR, ’2conv-basic’)
return [0,1,0,0]
print(label)
path = [Link](TRAIN DIR,img)
img = [Link](path,[Link] COLOR)
img = [Link](img, (IMG SIZE,IMG SIZE))
training [Link]([[Link](img),[Link](label)])
shuffle(training data)
[Link](’train [Link]’, training data)
return training data
shuffle(testing data)
[Link](’test [Link]’, testing data)
return testing data
import tflearn
from [Link] import conv 2d, max pool 2d
from [Link] import input data, dropout, fully connected
from [Link] import regression
import tensorflow as tf
from [Link] import ops
[Link] default graph()
if [Link](’.meta’.format(MODEL NAME)):
[Link](MODEL NAME)
print(’model loaded!’)
[Link](MODEL NAME)
import sqlite3
import cv2
import shutil
app = Flask(name)
[Link](’/’)
def index():
return render template(’[Link]’)
name = [Link][’name’]
password = [Link][’password’]
query = ”SELECT name, password FROM user WHERE name = ’”+name+”’ AND pass-
word= ’”+password+”’”
[Link](query)
result = [Link]()
if len(result) == 0:
return render template(’[Link]’, msg=’Sorry, Incorrect Credentials Provided, Try Again’)
else:
return render template(’[Link]’)
name = [Link][’name’]
password = [Link][’password’]
mobile = [Link][’phone’]
email = [Link][’email’]
dirPath = ”static/images”
fileList = [Link](dirPath)
for fileName in fileList:
tumor area image[tumor mask == 255] = [0, 255, 0] / Mark tumor area in green
Calculate area of the tumor
tumor area pixel = sum([Link](contour) for contour in contours)
tumor area mm = tumor area pixel * pixel to mm conversion ** 2
tumor area mm, tumor diameter mm, tumor area image = segment tumor(gray image, lower gray thres
upper white threshold, pixel to mm conversion)
print(”Area of Tumor:”, tumor area mm, ”mm”)
print(”Diameter of Tumor:”, tumor diameter mm, ”mm”)
[Link](’static/[Link]’,tumor area image)
if [Link](’.meta’.format(MODEL NAME)):
[Link](MODEL NAME)
print(’model loaded!’)
fig = [Link]()
str label=” ”
accuracy=””
rem=””
rem1=””
for num, data in enumerate(verify data):
if [Link](model out) == 0:
str label = ”Adenocarcinoma”
print(”The predicted image of the Adenocarcinoma is with a accuracy of ”.format(model out[0]∗100))
accuracy=”The predicted image of the Adenocarcinoma is with a accuracy of”.format(model out[0]∗100)
rem = ”The treatment for Adenocarcinoma are: ”
rem1 = [”Surgery: Often the primary treatment for early-stage cancer to remove the tumor.”,
”Chemotherapy: Used to kill cancer cells and shrink tumors, sometimes before or after surgery.”,
”Radiation therapy: Targets cancer cells.”,
”Targeted therapy: Addresses specific mutations.”,
”Immunotherapy: Boosts the immune system.”,
”Individualized treatment plans.”,
”Collaboration with healthcare team crucial.”]
area count = [”:.2f”.format(tumor area mm), ”:.2f”.format(tumor diameter mm),tumor area image]
/Result
print(f”Area of Tumor: tumor area mm:.2f”,”mm”)
print(f”Diameter of Tumor: tumor diameter mm:.2f”,”mm”)
@[Link](’/logout’)
def logout():
return render template(’[Link]’)
if name == ”main”:
[Link](debug=True)
[1] S. Wankhade and S. Vigneshwari, “A novel hybrid deep learning method for early de-
tection of lung cancer using neural networks,” Healthcare Analytics, vol. 3, p. 100195,
2023.
[5] L. Chen, K. Liu, H. Shen, H. Ye, H. Liu, L. Yu, J. Li, K. Zhao, and W. Zhu,
“Multimodality attention-guided 3-d detection of nonsmall cell lung cancer in 18 f-
fdg pet/ct images,” IEEE Transactions on Radiation and Plasma Medical Sciences,
vol. 6, no. 4, pp. 421–432, 2021.