Abstract
Computed tomography (CT) scan pictures are routinely employed in the automatic identification and classification of lung cancer. The texture distribution of lung nodules can vary widely over the CT scan space and requires accurate detection. The evaluation of discriminative information in this volume can tremendously aid the classification process. A convolutional neural network, the Attention Gate Residual U-Net model, and KNN classifiers are utilized to detect lung cancer. The dataset of 1097 computed tomography (CT) images utilized in this study was obtained from the Iraq-Oncology Teaching Hospital/National Centre for Cancer Diseases (IQ-OTH/NCCD) to segment and classify lung tumors from CT images using the novel Attention Gate Residual U-Net model, i.e., AGResU-Net and CNN architecture. The initial step is applying CNN to detect normal, benign, and malignant patients in CT images. Second, use AGResU-Net to partition lung tumour areas. In the third section of the project, a KNN classifier is used to determine if an instance is malignant or benign. In the initial phase, CNN was proposed to classify three distinct regions. Three optimization strategies are used in this work: Adam, RMSP, and SGDM. The classifier’s accuracy is 97%, 85%, and 82%, respectively. When compared to the RMSP optimizer, the Adams optimizer predicts probability rates more accurately. In the second phase, AGResU-Net is used for schematic segmentation of the tumor region. In the third phase, a KNN classifier is used to classify benign and malignant tumor from the segmented tumor regions. A new segmentation of the lung tumor model is proposed. In this developed algorithm, the labelled classified data set and the segmented tumor output result provide the same accuracy. The study results demonstrate high tumour classification accuracy and high probability of detection in benign and malignant cases.
Introduction
Lung cancer patients have a 5-year survival rate ranging from 10% to 20%. Low-dose computed tomography (CT) screening can help detect lung cancer earlier, making the disease more curable, Smita Raut and colleagues [3]. In general, it has been observed that if a cancer case is discovered early, diagnosed, and treated successfully, the patient’s chances of living a long life enhance N.Camarlinghi [4]. Medical experts are required to analyze medical data and diagnose disorders, and expert opinions frequently disagree while analyzing medical images due to their intricacies.
In the last decade, Computer-Aided Detection (CAD) and diagnostic technologies, as well as their applications, have evolved. CAD applications have traditionally focused on finding regions of interest (ROI) in pictures, such as lung nodules, and analyzing object attributes. CAD technologies use computer systems, as well as image processing and analysis techniques, to overcome radiologists’ perceptual and interpretive flaws during the image observation and interpretation process. Figure 1 depicts the structure of the lungs.

Lung CT image and its various structures.
In this paper, we propose an automated lung cancer classification. The major contributions of our work are as follows: A deep CNN model is designed to classify lung tumors and normal tissues from CT-labelled images. A three-class classification using suitable optimizer is proposed to detect a specific type of lung tumour that is benign, malignant, and normal. The Attention Gate Residual U-Net model, i.e., AGResU-Net, is proposed in this method because it not only extracts more abundant semantic information but also pays more attention to the information about small-scale lung tumors, which improves the segmentation effect of lung tumors. Furthermore, the tumors in the lung are identified using the KNN-Classifier and classified as benign or malignant. The proposed model is trained on an open source dataset from IQ-OTH/NCCD, and the comparisons are drawn by considering various state-of-the-art deep CNN models and ML schemes.
I. Naseer et al. [1] proposed a lung cancer classification that uses a modified U-Net-based nodular and segmentation detection model consisting of three stages. The first stage segmented the lobe using CT slice and prediction mask using the modified U-Net architecture and the second stage extracted the candidate node using the prediction mask and the card uses a modified U-Net architecture. The proposed CAD (computer-aided design) model identifies cross-sectional soft tissue physiological and pathological changes in lung cancer lesions. The model is first trained to detect lung cancer by measuring and comparing selected profile values in the CT images of patients and controls at diagnosis. The model is then tested and validated using the CT scans of patients and control patients not shown in the training phase presented by I.Shafi et al. [2].
Pankaj Nanglia et al. [5] introduced a novel hybrid technique termed a Kernel Attribute Selected Classifier in which they combined SVM with Feedforward Back Propagation Neural Network (FFBPNN), which aids in decreasing classification computational complexity. They developed three block methods for categorization, the first of which is pre-processing the dataset. The second block is feature extraction using the SURF approach, followed by optimization using a genetic algorithm, and the third block is classification using FFBPNN. The proposed algorithm has an overall accuracy of 98.08%. Chao Zhang et al. [6] presented a sensitivity analysis using a multicenter data set in their paper. They have divided the results into two categories: Diameter and Pathological outcome. Diameters were classified into three classes: 0–10 mm, 10–20 mm, and 20–30 mm are the available sizes. The algorithm achieved the highest accuracy for adenocarcinoma at 85.7% and 65.0% for squamous cell carcinoma.
Nidhi S. Nadkarni and Prof. SangamBorkar’s [7] paper focuses on the classification of lung pictures as normal or pathological. A median filter was utilized in their proposed method to remove impulse noise from the photographs. Mathematical morphological techniques allow for accurate lung segmentation and cancer detection. Three geometrical features were retrieved from the segmented region and input into the SVM classifier for classification: area, perimeter, and eccentricity. RuchitaTekade and K. Rajeswari [8] investigated the notion of lung nodule detection and malignancy level prediction utilizing lung CT scan pictures in their article. The LIDC_IDRI, LUNA16, and Data Science Bowl 2017 datasets were used in this experiment, which was carried out using a CUDA-enabled GPU, the Tesla K20. The dataset was analyzed using an Artificial Neural Network, which extracted characteristics for classification purposes. They employed the U-NET architecture to segment lung nodules from CT scan images and the 3D multigraph VGG-like architecture to identify lung nodules and forecast malignancy levels. The combination of these two procedures produced the best outcomes. This method has 95.66% accuracy, a loss of 0.09, a dice coefficient of 90%, and a 38% prediction of log loss.
Li et al. [9] discussed the detection of lung nodules in three-dimensional pictures using deep learning. The input images are first extracted using resnett101, VGG16, and resnet50. For classification, a faster region-CNN approach is applied. Rahman et al. [10] presented the use of a deep neural network to detect CT lung nodules. The CT lung images are first preprocessed using the blurring and thresholding methods. Deep neural network features such as Inception v3, mobile net, and visual geometry group are employed for categorization.
Zuo et al. [11] examined the detection of lung nodules using multi-resolution CNN and the classification of knowledge transfer candidates. CNN is used to extract the features of the lung image. For classification, a multi-resolution CNN model is used. Wang et al. [12] described utilizing CNN to detect and classify pulmonary nodules in chest CT data. CNN extracts the photos from the input. False positive and false negative rates are used to detect nodules. The nodules are identified by their sizes, locations, and different sorts. For segmentation, the clustering technique is applied. Faster-RCNN is used to classify the data. Cao et al. [13] presented a multi-branch ensemble learning architecture based on three-dimensional CNN for reducing false positives [26, 27] in lung nodule detection. For feature extraction, an offline hard mining technique is applied. The rate of false positives is also calculated. The three-dimensional CNN is utilized for multi-branch ensemble learning architecture identification.
Gunaydin et al. [14] compared lung cancer detection algorithms. Principal component analysis (PCA) is a statistical technique that can be used to discover new patterns. For extraction, eigenvector and entropy characteristics are used. For classification, classifiers such as KNN, SVM, Naive Bayes, and decision tree algorithms are utilized. Paing et al. [15] discussed a random forest classifier [28] for unbalanced lung nodule classification. The features of the input lung nodules are extracted using three feature selection algorithms: relief, genetic algorithm, and particle swarm optimization. The random forest classifier is used to make the classification.
Patnaik et al. [16] proposed an accurate CAD system for detecting lung nodules using CT images. Preprocessing, Two-Successive Segmentation Process (TS²P), Rule-Based Refinement Pass (RBRP), and Detection Module (D.M.DM) are the four phases. In the preprocessing module, the Wiener filter is used to de-noise the lung CT picture. The TS²P module first segments the right and left lungs before moving on to segment the nodules and arteries. The RBRP module is then developed to eliminate the vessels using geometrical features. Finally, using a deep learning approach, the nodules are recognized. The suggested approach was validated on 888 lung CT scan pictures, with a mean average precision of 96.75% and sensitivity of 97%, with only two false positives.
Mukherjee et al. [17] demonstrated lung nodule segmentation and classification using a thresholding method. Traditional histograms and iterative thresholding are used to segment the input lung images. The rule-based filtering method is used to discover lung nodules. For classification, KNN and SVM classifiers are utilized. S. Anitha and T.R. Ganesh Babu [18] presented an efficient method for detecting Oblique fissures in CT images of the lungs. The lung structures are strengthened utilizing morphological operations in the preprocessing module, and lung images are de-noised using the Wiener filter. In the second module, lung areas are segregated using thresholding and background subtraction techniques. In the third module, the fissure regions are first segmented using the active contour model, and then oblique fissures are segmented by applying the rule-based approach to the fissure regions. The suggested technique was tested using 50 photos from the Lung Image Database Consortium (LIDC) and 30 images from the Early Lung Cancer Action Programme (ELCAP).
Ahmed Saihood et al. [19] reported a lung nodule classification approach using Multi-Orientation Local Texture features for guided attention-based fusion, which allows for greater flexibility in focusing on significant information retrieved from multiple locations of the nodule in a non-local way.Furthermore, locally tailored local texture feature descriptors (TFDs) are derived from nodule slices in multiple orientations to provide the model with finer-grained discriminative information from the nodule volume. The LIDC-IDR dataset [25] is used in this work.
According to the research, the accuracy of the system using classifiers such as KNN, ANN, and SVM is primarily determined by the features. It is difficult to establish parameters such as population size and the number of generations in GA in order to find the best optimal solution to a given problem. The precision of segmentation in the Toboggan search method is dependent on the seed point selection, which is critical for the detection of lung nodules. As region-based segmentation systems are local in nature, there is no global solution to the problem, and they are also particularly sensitive to noise. If the number ‘k’ is not chosen correctly, over- and under-segmentation results in K-means clustering. To overcome the aforesaid disadvantage, we designed AGResU-Net paired with the KNN architecture.
Materials and methods
This section deals with information on datasets, CNN architecture, optimization techniques, AGResU-Net, KNN classifier and the Confusion Matrix (CM).
Dataset description
The dataset used in this study was obtained from Iraq-Oncology Teaching Hospital/National Centre for Cancer Diseases (IQ-OTH/NCCD) over a three-month period in autumn 2019. The dataset is divided into three stages: benign cases, malignant cases, and normal instances. Figure 2 depicts the various stages of lung cancer. In this work, 1097 lung CT image samples are used. Out of 1097 samples, 416 are normal, 120 are benign, and 561 are malignant. The dataset is imbalanced because there are not equally distributed classes, so augmentation is done by benign classes. In this work, the augment process consists of vertical flipping and image rotation by 10 and 20 degrees, respectively. After augmentation, benign cases increased to 480. The total image consists of 1457 samples after augmentation. Of the 1457 samples, 1058 were used for training, and 399 were used for testing the proposed CNN architecture. In the second phase, all images are used for the schematic segmentation process. A total of 1097 images are used for the schematic segmentation process using AGResU-Net. In the third phase, consider benign and malignant samples only. The total number of sample images is 681. These samples are used in the KNN classifier. In the KNN classifier, 430 images are used for training and 251 images are used for testing, which acts as a binary classifier giving either benign or malignant cases.

Various stages of lung cancer CT Image.
In numerous studies and researches, Artificial neural network (ANN) models have been preferred as one of the most powerful soft computing prediction methods, particularly in recent decades. Feedforward neural networks, recurrent neural networks (RNN), and convolutional neural networks (CNN) are the most often used neural network types for engineering applications. This study also used feedforward neural networks, which have an input layer, one or more hidden layers, and an output layer. A neural network gathers and mixes inputs from external data sources. The result is then operated on in a concealed layer or layers. The output is reported at the end. Figure 3 depicts the suggested algorithm’s block diagram of the lung tumor detection system. The first phase of the process involves resizing the CT lung pictures and applying them to the input of the proposed DL network. The classifier distinguishes between normal, benign, and malignant stages. The classified labelled images are applied to the AGResU-Net in the second stage of the job to segregate lung areas from input CT images in this network. The identified lung regions are fed into the KNN classifier. The classifier is used to differentiate between benign and maligned regions.

Block diagram of proposed Lung tumor detection systems.
In the first phase classification is done by labelled images from the dataset. The proposed method employs CNN architecture to classify normal, benign, and malignant cases in lung CT images. CNN is a Multi-Layer Perceptron (MLP) improvement. CNN’s applications include image processing and video analytics. Figure 4 depicts the many layers used by CNN for feature extraction and classification. The CNN is a supervised feedforward multi-layered network with multi-layer convolutional layers (CL), a pooling layer (PL), and fully connected layers (FC).

Network architecture of convolutional neural networks.
These layers are connected from input to output, with one layer’s output feature map serving as the input to the next layer, resulting in natural inter-layer flow characteristics. The parameters of the proposed CNN are shown in Table 1. In this study, the optimization techniques Adaptive Moment Estimation (Adam), Stochastic Gradient Descent with Momentum (SGDM), and Root Mean Square Propagation (RMSProp) are employed to train the model, and the predicting results are compared. T.R. Ganesh Babu and D. Divya [20] have discussed the optimization algorithms in detail.
Parameters for convolutional layers in DRAIN-NETS
Equation for Adam
Equation for RMSPR
Equation for SGDM
η : Learning coefficient;
∇θJ (θ t ; x(i) ; y(i)) : The slope of the target Function depending on the parameters. G_t,ii: each diagonal element represents the sum of the squares of the slope values obtained up to t iterations, according to parameter θi;€: the constant value assigned to prevent the learning coefficient from dividing by 0 as suggested by V. Sudha et al. [21].
Adam can be thought of as a cross between RMSprop and Stochastic Gradient Descent with momentum. It scales the learning rate using squared gradients, similar to RMSprop, and it takes advantage of momentum by using the moving average gradient rather than the gradient itself, similar to SGD with momentum. Adam is relatively simple to configure where the default setting is concerned. Figure 5 depicts the model’s accuracy and loss over 10 epochs in the RMSP optimizer, whereas Fig. 6 depicts a confusion matrix.

Accuracy Vs Loss plot (RMSP).

Confusion matrix (RMSP).
Figures 7 and 8 show the SGDM optimizer’s loss versus accuracy graph and confusion matrix. Figures 9 and 10 depicts the Adam optimizer for the loss Vs accuracy plot and confusion matrix.

Accuracy Vs Loss plot (SGDM).

Confusion matrix (SGDM).

Accuracy Vs Loss plot (Adam).

Confusion matrix(Adam).
The Table 2 indicates the performance analysis of various optimizers. In the first phase of the work, three optimizers, namely Adam, RMSprop, and SGDM, are proposed. The parameters of accuracy, precision, and specificity are determined. From Table 2, it is observed that Adam’s optimizer has high accuracy, that is, 97% compared to the other two optimizers. In the first phase, a CNN classifier with an Adam optimizer is used.
Performance analysis of various optimizers
Performance analysis of various optimizers
Performance analysis of various optimizers
In the second phase, lung regions and tumor present in the lung regions are identified. In this work, AGResU-Net is proposed to identify lung region. U-Net, a deep learning method used for image analysis, is a well-known technology that has shown exceptional success in medical picture segmentation. The U-Net model, introduced by Ronneberger O, et al. [22] to rapidly segment biological microscope pictures, is widely used in medical image segmentation tasks due to its simple and flexible structure and ability to produce high-quality pixel level segmentation results. The U-Net architecture is a symmetrical model that was named after the letter U when the layers were united. The U-Net architecture includes both a contracting path (encoder) and an expanding path (decoder). Suting Pengetal et al. [23]. In this paper, a novel Attention Gate Residual U-Net model, i.e., AGResU-Net is proposed.
AGResU-Net espouses residual modules and attention gates with a primeval and single U-Net architecture, in which a series of attention gate units are added into the skip connection for highlighting salient feature information while disambiguating irrelevant and noisy feature responses. On the one hand, residual modules enhance the ability of feature extraction and expression and contribute to classification in the process of downsampling. On the other hand, attention gates pay more attention to small-scale tumors and obtain more information about the location of small-scale tumors, so the up-sampling process is helpful to restore the location information of small-scale tumors. Figure 11 depicts the end-to-end network architecture of AGResU-Net. Figure 12 shows the basic schematic of the attention gate.

The end-to-end network architecture of AGResU-Net.

The basic schematic of the attention gate.
The multi-dimensional attention coefficient can be expressed as follows,
First, manually segmented 70% samples (768 images) of lung regions are taken from the dataset. The AGResU-Net was trained using these manually segmented images and tested with 30% of the samples (329 images). The AGResU-Net gives out an accuracy rate of 97%. The Adam optimizer and binary cross-entropy loss function are employed in this network. The loss rate is 0.02 while the learning rate is 0.0001. Figure 13 depicts the manuay segmented lung sections, while Fig. 14 depicts the AGResU-Net segmented lung regions. Farahani, A., and Mohseni, H. [24].

Segmented lungs regions from Manual.

Segmented lungs regions from AGResU-Net.
The g i and x l are represented as the gating signal vector and the feature map of the layer l, respectively. The σ1 and σ2 denote the Relu function and Sigmoid function. W x , W g and ψ are linear transformations. The α i indicates the attention coefficient.
The image obtained from AGResU-Net shows a masked region of the lungs. The masked image is a pixel-by-pixel, bit-by-bit AND operation with the original image to get lung tumour regions. Figure 15 shows the segmented lung regions for normal, benign, and malignant cases. The white spot (Fig. 15) present inside the lung regions indicates a tumour. The benign and malignant stages exhibit more white spots compared to the normal stage. Figure 16 shows the histograms of normal, benign and malignant regions of lung regions.

Segmented lung regions.

Histogram of segmented lung regions.
The pixel counts from inside the lung region (Fig. 15) are listed in Table 3. Ten samples from 1097 photos were tabulated in each case. In most cases, the pixels range from 260847 to 495972. In benign, the range is 471249 to 717120. In a malignant state, it ranges from 463248 to 861685.
Pixel counts of the segmented lung regions
The pixel counts from Table 3 are applied as input to the KNN classifier. This pixel count is considered a feature in the KNN classifier. In this work, the K value is assigned to 2 because the proposed system is for two-class problems. The main advantages of the KNN classifier are that if the training data is large, the classifier’s accuracy is high and implementation is simple compared to other classifiers. In the KNN classifier, only benign and malignant samples are considered. The total number of sample images is 681. Out of these samples, 430 images are used for training and 251 images are used for testing, so a binary classifier is used in this phase. The Fig. 17 shows the Confusion matrix of KNN classifier.

Confusion matrix (KNN Classifier).
The dataset used in this study was obtained from the Iraq-Oncology Teaching Hospital/National Centre for Cancer Diseases (IQ-OTH/NCCD). In total, 1097 CT scans were used in the investigation. The dataset contains three types of cases: normal, benign, and malignant. In the initial phase, CNN was proposed to classify three distinct regions. Three optimization strategies are used in this work: Adam, RMSP, and SGDM. The classifier’s accuracy is 97%, 85%, and 82%, respectively. When compared to the RSMP optimizer, the Adams optimizer predicts probability rates more accurately. AGResU-Net receives the manually segmented lung region. The masked lung areas are obtained from the AGResU-Net output. To obtain lung areas, the masked regions were removed from the original picture. A KNN classifier is used to classify the observed lung areas. We explored many models, and the most difficult location to segment in all of them was the enhancing tumour. By better segmenting this region, the proposed strategy enhanced our overall performance. We believe that several pre- and post-processing strategies would aid in improving forecasts in this area. Even when we did not notice overfitting, we might improve our model’s performance by picking appropriate design settings.
Discussion
This work compares the suggested system against several researcher-developed algorithms. Sensitivity in the medical area refers to the system’s capacity to identify abnormalities appropriately. As a result, the comparison is done using the sensitivity measure. Figure 18 depicts a comparison of the lung nodule detection system with existing technologies. In this work, in the first phase, labelled images are used to classify lung tumor and calculate accuracy, sensitivity, and specificity values. In the second phase of the work, the tumor affected regions are segmented using the AGResU-Net architecture. In the third phase, the KNN binary classifier is used to classify benign and malignant cases. The labelled image classification from the dataset and the proposed segmented image classification produced 97% accuracy. The main advantage of this proposed algorithm is that it visualizes tumor size exactly.

Comparative study of lung nodule detection system with existing technologies.
In this work, we used the AGResU-Net architecture to separate a lung tumor from CT images. CNN is utilized in the initial phase to classify normal, benign, and malignant stages of tumors. The classifier accuracy of Adam, RMSP, and SGDM optimizers is 97%, 85% and 82% respectively. Since Adam’s optimizer has high accuracy compared to the other two optimizers, it is used with the CNN classifier. The detected image is then applied to AGResU-Net in the second phase of work. AGResU-Net outputs mask lung areas. To obtain precise lung regions, the masked lung regions are placed on the original picture. The lung areas are classified as benign or malignant using a KNN classifier with a K value of 2. The classifier’s accuracy is 97% .
The following are additional improvements to the CAD system’s capabilities:
The detection of oblique fissure modules can be improved further by segmenting horizontal and oblique fissures in both normal and severe pathological instances. Deep learning is used by the CAD system, which leverages AGResU-Net models. However, more research is needed to see whether using alternative deep learning models increases the diagnostic and prognostic efficacy of the CAD tool. Further research is advised to increase the ability of deep learning and refinement rules to pass imprecise and low-quality CT lung images.
