Malignancy Detection in Lung and Colon Histopathology Images Using Transfer Learning With Class Selective Image Processing

Cancer accounts for a huge mortality rate due to its aggressiveness, colossal potential of metastasis, and heterogeneity (causing resistance against chemotherapy). Lung and colon cancers are among the most prevalent types of cancer around the globe that can occur in both males and females. Early and accurate diagnosis of these cancers can substantially improve the quality of treatment as well as the survival rate of cancer patients. We propose a highly accurate and computationally efficient model for the swift and accurate diagnosis of lung and colon cancers as an alternative to current cancer detection methods. In this study, a large dataset of lung and colon histopathology images was employed for training and the validation process. The dataset is comprised of 25000 histopathology images of lung and colon tissues equally divided into 5 classes. A pretrained neural network (AlexNet) was tuned by modifying the four of its layers before training it on the dataset. Initial classification results were promising for all classes of images except for one class with an overall accuracy of 89%. To improve the overall accuracy and keep the model computationally efficient, instead of implementing image enhancement techniques on the entire dataset, the quality of images of the underperforming class was improved by applying a contrast enhancement technique which is fairly simple and efficient. The implementation of the proposed methodology has not only improved the overall accuracy from 89% to 98.4% but has also proved computationally efficient.


I. INTRODUCTION
Worldwide, cancer ranks second in terms of causes of death. Well over 19 million new cases of cancer and 9.95 million deaths were reported worldwide in 2020 [1]. The human body is comprised of trillions of cells, these cells grow and multiply to form new cells as per body requirements through a process called cell division. It is normal for cells to die and be replaced by new ones when they reach a certain age or degree of damage. If this process breaks down, damaged cells start to The associate editor coordinating the review of this manuscript and approving it for publication was Abdullah Iliyasu . grow and multiply resulting in the formation of tumors. These tumors could be malignant (cancerous) or benign [2]. Cancer could affect any human body organ; however, the foremost common affected areas are the colon, lungs, liver, breasts, rectum, brain, prostate, stomach, and skin. The most common cancers to cause death equally in males and females are lung and colon cancers. In 2020, 4.14 million new instances of lung and colorectal cancer with 2.7 million deaths were recorded globally [3].
Behavioral characteristics such as a high BMI, use of cigarettes and alcohol may contribute to the development of cancer. Radiation and ultraviolet rays are physical VOLUME 10, 2022 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ carcinogens and some biological and hereditary ones [3]. Cancer symptoms include discomfort, exhaustion, nausea, chronic cough, breathlessness, loss of weight, muscle aches, bleeding, and bruises [4]. However, none of these symptoms is specific to cancer, nor are they present in every patient. Consequently, detecting cancer is difficult without a comprehensive diagnostic test for instance a biopsy, PET scan, CT scan, MRI scan, and ultrasound. Across many cases, patients develop no or few signs of the disease, although, by the time symptoms emerge, it is often too late. Some people inherit the gene responsible for cancer from their parents. People with an inherited risk of developing cancer should have regular checkups. These screening systems are highly expensive, and yet many people are unable to afford them. About 70 percent of cancer-related deaths are reported from low-and middle-income countries suggest the World Health Organization. [3]. These countries must build a large number of laboratories and diagnostic facilities with the required equipment, as well as train medical workers to execute diagnostic processes. Additionally, people who live below the poverty line must be able to afford the charges of these tests.
This problem may be solved by a field completely different from medicine and healthcare. Pathology utilizes Machine Learning (ML) in a wide variety of ways, such as the detection of diseases and the development of intelligent systems that, based on a patient's symptoms, prescribe conventional medicines [5]. Machine learning approaches have been used to classify and predict several kinds of biomedical data. Deep learning (DL) techniques enable machines to analyze high-dimensional data such as pictures, multidimensional anatomical representations, and video. As a subset of ML, DL deals with algorithms based on the anatomy and function of the brain [6].
In clinical practice, accurately categorizing histopathology pictures is critical for obtaining a trustworthy diagnosis of illnesses. This type of activity could be automated using ML algorithms, specifically DL, to replace the exhausting and expensive physical effort of human specialists while also meeting the demands for high accuracy, large data sets, and other factors. Transfer learning (TL) is used in visual categorization to solve cross-domain learning issues by transferring useful knowledge from the given dataset to the task domain [5]. Through TL, knowledge from different yet related sources is transferred to target learners for improved performance on target domains. This can decrease the need for an enormous amount of data to construct target learners. TL is becoming an increasingly prevalent and auspicious area within ML because of its broad range of application prospects [7]. Different types of TL approaches include feature representation transfer, which includes cross-domain and cross-view knowledge exchange, and classifier-based information exchange, which includes Support Vector Machine (SVM)-based, TrAdaboost, and generative models [8].
TL is often performed with DL models trained for the ImageNet competition, an image classification competition with a large and challenging dataset. Pre-trained AlexNet architecture is employed in this study. To utilize the elaborately learned features by AlexNet in a new image classification task, a few layers of the model are modified while the weights in the transferred layers are kept frozen.
The rest of this article is laid out as follows: A brief outline of previous research similar to ours is given in section 2. In section 3 employed dataset and its contents are described. Section 4 is dedicated to the elaboration of the proposed research model while the experimental environment and discussion on its results are presented in section 5. Finally, the article is concluded with a summary of the outcomes.

II. RELATED WORK
Sirinukunwattana et al. [10] proposed a spatially constrained neural network for detecting the nucleus in histopathology images of colon cancer. For the classification of cell nuclei, a novel adjacent group predictor was used. The maximum accuracy attained was 97.1%. Although their model obtained good results, its computational efficiency did not measure up since it took an average of 50 minutes to run a single slide. Shein et al. [11] developed an ML architecture for the classification of lung nodule malignancy. A pooling method has been used to crop different areas of interest from feature maps and max-pooling was used multiple times to extract features from CT scans of lung nodules. This approach is distinct in that it did not employ any segmentation or feature extraction methods on the CT scan images used. Based solely on their machine learning model for lung nodule identification, they obtained an accuracy of 87.14 percent. Three deep structured algorithms have been used to automatically extract features from CT images of a lung nodule in [11], including stacked denoising autoencoder (SDAE), convolutional neural network (CNN), and deep belief network (DBN). The highest accuracy achieved was 89% by applying CNN. Selvanambi et al. [12] performed lung cancer detection by employing recurrent neural network (RNN) with damped least-squares (DLS) method and glowworm swarm optimization algorithm and achieved 98% accuracy.
Filho et al. [13] utilized image segmentation for the preprocessing of Lung nodule CT images. Authors applied index basic taxic weights along with standardized taxic weights for recognition of malignant and benign patterns and CNN for classification and attained an accuracy of 92.6%. Yuan et al. [14] presented a CNN-based model for the automatic detection of polyps in colonoscopy videos using AlexNet architecture. Before the application of CNN for classification several preprocessing operations namely, edge detection, morphology, and intensity adjustments were performed. Their model acquired an accuracy of 91.4%. The FP per frame result suggests that this method may still be improved. It may fail to locate a polyp if its border is the same color as the backdrop. In an informative frame, a large number of non-polyp candidates may also be created. This will increase execution time while also increasing the chance of decreased accuracy. For the classification of benign and malignant lung nodules in CT images in [15], RestNet50 and SVM with Radial Basis Function (RBF) kernel were used. The employed methodology obtained an accuracy of 92.8%. Masood et al. [16] proposed the DFCNet model, which is based on a deep CNN, for classifying pulmonary nodules in CT images into four stages of lung cancer and reached 84.5% accuracy. In the case of malignant tumors, the study is flawed in that it employs several datasets with different scan settings, which results in false-positive results. Using the same scan parameters on every dataset will maximize classification results. For the detection of polyps in colonoscopy videos, Mo et al. [17] used a faster region-based convolutional neural network (Faster R-CNN) on four distinct datasets and acquired 98.5% average accuracy. Urban et al. [18] developed and implemented deep CNNs for the detection of polyps in expert-labeled pictures extracted from over 2000 colonoscopies. Their model accomplished an accuracy of 96.4%. To reduce the network size, binarized weights were applied with convolutional neural networks by the model proposed in [19] for the classification of colonoscopy frames with an accuracy of 90.28%. In [20] to reduce dimensionality and complexity, Wolf heuristic features using minimum repetition were selected. A joint learning comprehensive neural network optimized for AdaBoost was used to identify the normal and anomalous lung structures with high accuracy of 98.42%.
Suresh and Mohan [21] proposed an eight-layer CNN architecture for categorizing CT images of lung lesions into one of three groups. Segmentation was applied on images to extract nodule regions of interest in collaboration with experts. In addition, generative adversarial networks were used to augment the dataset. The classification accuracy of their proposed model was 93.9%. For the detection of pulmonary nodules, Masud et al. [22] proposed a light deep learning approach relying on CNN architecture with only four convolutional layers. Each convolutional layer is comprised of two successive convolutional blocks, a connecting convolutional block, non-linear activation functions after each block, and a pooling block. The authors found their proposed model suitable for real-time CT image analysis because it has fewer flops and parameters than state-of-theart CNN architectures. The proposed model acquired 97.9% accuracy. In [23] lung cancer CT scans were preprocessed by utilizing an approach that preserves the brightness of images at multiple levels and eliminates noise. An improved neural network was employed for the segmentation of the affected regions and extraction of features. An ensemble classifier was used to perform feature classification. Classification accuracy achieved by the model was 96.2%. Bukhari et al. [24] applied three pre-trained CNNs (ResNet-50, ResNet-34, and ResNet-18) to evaluate the histopathology images of colonic adenocarcinoma from two different databases and acquired 96.4% accuracy. Mangal et al. [25] analyzed digital pathology images of adenocarcinoma and squamous cell carcinoma of the colon and lung and trained a shallow neural network for its classification, and achieved an accuracy of 97.8%. B.K. Hatuwal and H.C. Thapa employed a convolutional neural network to classify Lung cancer histopathology images and achieved an accuracy of 96.11% and 97.2% for training and validation respectively [26].

A. LIMITATIONS OF THE RELATED WORK
The previous studies have the following limitations: • Inefficient algorithms, resulting in higher computational cost and time utilization [10], [11], [14].
• Multiple datasets with varying scan settings, resulting in false-positive results [16].
• Reported low accuracy [11], [13], [14], [19], [21] The major contributions of this paper are outlined below: • Most earlier cancer detection studies focused on a single form of cancer, however in this study, we used our model to identify lung and colon cancer at the same time.
• Although few studies implemented image processing techniques to improve the quality of images before classification, however, in these studies, image processing was applied to the whole dataset resulting in higher time utilization and computing cost. We proposed Class Selective Image Processing (CSIP) which is a novel strategy. Instead of preprocessing all images in a data set, images of a selected class are improved. This strategy not only improves the classification accuracy of the model but also saves time and computing costs.
• Improved learning of the pre-trained deep learning model by employing CSIP on histopathological slide images which enhanced their contrast using histogram equalization.
• Presented state-of-the-art results for automated lung and colon cancer detection using histopathological slide images.
• The experiment was conducted on a comprehensive and balanced dataset comprised of 25000 histopathology images divided equally into five classes of lungs and colon. The multiple classes and a large number of images included in the proposed method made the model more accurate and reliable.

III. EMPLOYED CANCER DATASET
In this study, we used A. Borkowski and his colleagues' new dataset LC25000, published in 2020 [27]. There are 25000 images of lung and colon tissues in this collection, which are classified into five categories. Three types of lung tissue images are adenocarcinoma, squamous cell carcinoma, and benign. While colon images are of two categories adenocarcinoma and benign tissues.
The LC25000 dataset was primarily comprised of 1250 images of pathology slides of lung and colon tissues. The dataset was augmented by flipping and rotating the images in a variety of conditions as a result, the dataset was expanded to 25,000 images divided into five categories, with 5000 images per category. Images were resized to 768 × 768  before applying the augmentation. To ensure privacy and free use, these images are validated and are compliant with Health Insurance Portability and Accountability Act (HIPAA). Sample images from the dataset are presented in figure1. Table1 exhibits the assigned names and IDs to each class of images in the dataset.

IV. MATERIALS AND METHODS
TL is a machine learning technique that entails adapting a model created for one task to another. DL encompasses using networks that have been pre-trained on a large dataset to build a new network architecture that can then be used on a new dataset after fine-tuning. Given the time and resources required to train deep CNNs, the TL method massively reduces the training effort. It is quite often faster and easier than building and training a network from the ground up. TL is typically performed with DL models trained for a large image classification task, ImageNet competition [7].
A pretrained model AlexNet is used in this study for the classification of cancer images. AlexNet developed in 2012 by Alex Khrizveski is an award-winning convolutional neural network well known for its high accuracy on challenging datasets. This network is comprised of 65,000 neurons and has more than 60 million parameters. ImageNet database is a huge database of images with over 14 million images of over 20,000 classes. AlexNet has been trained on the ImageNet database using over a million images of more than one thousand classes. The architecture of the network is comprised of five convolutional layers along with three fully connected layers [28].
The first layer and the last three layers of the model are modified to tune the model according to the requirement of this research. To match the size limitations of the model, images were resized to 227×227×3. The data set was divided in such a way that eighty percent of the whole images were reserved for the training and twenty percent for the validation. Training options and other parameters employed for training are shown in Table 2.
The proposed methodology is exhibited in figure 2. As a first step, the histopathology images are acquired and converted to 227 × 227 × 3 size as per the model's specification. Providing the model with resized images for training and validation is the next step. The preliminary results are evaluated in terms of accuracy, precision, F1-score, recall, specificity, and misclassification rate. In case of unsatisfactory results, CSIP strategy is applied. The suggested CSIP technique identifies the underperforming class and uses Histogram Equalization (HE) to improve the picture quality of the identified class. The model is executed again with improved images. The proposed approach focuses on improving the images of the underperforming classes only instead of processing the entire dataset, as this reduces processing time and effort. Image contrast enhancement is one of the most effective techniques for image quality improvement. The histogram equalization process is applied to the selected images as it is an efficient and computationally fast technique for contrast enhancement [29]. Histogram equalization redistributes the intensity values to accomplish contrast enhancement [30]. All images of the underperforming class were replaced with histogram equalized images and then the dataset was reused for training and validation.

V. RESULTS AND DISCUSSIONS
When compared to existing studies on cancer detection in the lungs and colon, our proposed methodology produced promising results. There are 25000 images in our dataset equally divided into 5 classes. We alienated the dataset in such a way that 80% of images in each class were used for the training of the AlexNet model and 20% of images for testing. In the performance analysis, we considered precision, sensitivity, specificity, f-1 score, recall, and misclassification rate in addition to accuracy. Listed below are the performance metrics utilized in this study.
The training progress and confusion matrix in Figure 3 and Figure 4, depicts the model's performance before the application of CSIP. The confusion matrix presents the overall accuracy, it also depicts the precision, and recall values of each class. Overall accuracy achieved by the model is 89.9%, precision of colon_aca, colon_n, lung_aca, lung_n, lung_scc, are 98.8%, 99.7%, 67.4%, 99.9%, and 96% respectively. Recall values of colon_aca, colon_n, lung_aca, lung_n, and lung_scc are 99.1%, 99.9%,97.1%,99.8%, and 53.3% respectively. Table 3 and figure 5 present the model's accuracy, precision, F-1 score, recall, specificity, and misclassification rate achieved for each class of the dataset. The highest accuracy is obtained by lung_n class which is 99.94% along with the lowest misclassification rate of 0.0006. The colon_n class attained an accuracy of 99.92% with 0.0008 misclassification rate. The accuracy achieved by colon_aca is 99.58% and the misclassification rate is 0.0042. When compared to the aforementioned classes, the lung_scc and lung_aca classes performed poorly, with an accuracy of 90.22 percent and 89.84 percent, respectively, and misclassification rates of 0.978 and 0.1016. In the case of F1-score lung_n, colon_n, and colon_aca classes obtained 99.85%,99.80%, and 98.80% respectively while lung_aca and lung_scc scored 79.56% and 68.55%.
To improve the overall classification accuracy of the model we implemented the contrast enhancement technique (HE) on the images of underperforming classes only so that the time and computational cost could be saved. HE technique was applied on all 5000 images of the lung_scc class. Essentially, the HE technique straightens the histogram by uniformly spreading all grey levels. As a result, the enhanced image's mean brightness changes dramatically. The following steps make up the HE's fundamental procedure. Suppose the input image S(i, j) contains a sum of Y pixels in the dynamic range ∈ [Z 0 , Z G−1 ], where G denotes the number of distinct grey levels. Following expression calculates the normalized histogram (NH) or the probability density function (PDF) F(Z k ) of the image's intensity level Z k : VOLUME 10, 2022  where n k denotes the sum of pixels and Z k represents the intensity level. The histogram of image S is the plot of Z k vs. n k while the cumulative density function (CDF) is given by [31]: The relevant image is projected into the whole dynamic range ∈ [Z 0 , Z G−1 ], by HE using the CDF, which is denoted by the following relation [32], [33]:  If the image has been processed using the classic, HE method, the statistical expectation E(.) of the resulting picture S is determined by: where S m denotes the average intensity of the resulting picture. Consequently, the image's intensity is substantially shifted to the grey level's mean. To illustrate the results of the applied image processing technique Figure 6 shows the original image and histogram equalized image along with their respective histograms. It is evident in the confusion matrix that AlexNet performed very well on all classes of cancer images except the lung_scc class and attained an overall accuracy of 89.8%. Colon_aca class acquired 99.58%, 98.80%, and 98.95% accuracy, precision, and F-1 score respectively. The accuracy, precision, and F-1 scores achieved by Colon_n class are 99.92%, 99.70%, and 99.80% respectively. Lung_aca class obtained 90.02% accuracy, 67.38% precision, and 79.56% F-1 score. Accuracy, precision and F-1 score in the case of Lung_n reached 99.94%, 99.90%, and 99.85% respectively. In the case of Lung_scc class accuracy is 90.22%, precision is 96.04% while the F-1 score is 68.55% only. Therefore, images in lung_scc need to be processed for quality improvement. The HE technique has been applied to all 5000 images in the lung_scc class. Figure 6 presents sample images before and after the application of HE. The difference of contrast is visible in the sample images. After optimizing the picture quality of the selected class, the dataset is updated and the model is run for additional 60 epochs. The adoption of CSIP resulted in a considerable increase in terms of accuracy and other parameters in the experimental findings. Figure 7 depicts the training progress and Figure 8 presents the confusion matrix after CSIP. Accuracy of Lung_scc class reached 100% after implementation of the proposed CSIP. Figure 9 and Table 4 show the comparison of accuracy and other parameters among all five classes of images in the dataset. To determine how well the proposed model performs on previously undiscovered data, it has been rigorously tested on test data. As part of ensuring an unbiased evaluation, the test data was also pre-processed and structured the same way. The model has excellent performance across all categories but stands out in identifying lung squamous cell cancer with 100% prediction accuracy, precision, recall, f1-score, and specificity. Similarly, the model has a 99.94%, 99.64%, 99.12%, and 98.98% accuracy for lung benign, lung adenocarcinomas, colon benign, and colon adenocarcinoma  respectively. All of the classes demonstrated high sensitivity and specificity as well.
The key rationale for the enhanced performance is the quality of the features obtained as a consequence of the used CSIP approach, which enabled the model to function better. Table 5 compares the model's performance in terms of classification accuracy and misclassification before and after the application of CSIP. We compare the obtained results to the outcomes of cutting-edge techniques to substantiate the effectiveness of the suggested model. However, because we employed a unique dataset that is substantially distinct from the ones used in the mentioned publications, these results are largely incomparable. They have nevertheless been put in comparison because of the same objective.   The proposed model outperforms state-of-the-art methods in terms of classification accuracy when lung and colon anomalies are classified concurrently, as shown in Table 6.
Our approach outperforms most known methods for cancer detection, as shown in Table 6; the only exception is the research described in [20]. The dataset utilized in [20] VOLUME 10, 2022  only included CT scan pictures of the lungs, whereas our dataset includes both lung and colon histopathological images, making a direct comparison impossible. Studies cited in [24]- [26], [39] worked on the LC25000 dataset. A study in reference [24] only looked at the colon samples and demonstrated lower accuracy and a lower F-measure than the proposed method. Even though relatively better accuracy was reported by [25], [26], they classified either lung images or colon images. The obtained findings are not precisely comparable since we considered all classes of the dataset images for classification. In the case of reference [39], multiclass classification is performed on the LC25000 dataset but reported accuracy, precision, and F-1 score are lower than the proposed model. As a result of the discussions in this section, it may be inferred that the suggested approach is successful in accurately identifying lung and colon cancer tissue.

VI. CONCLUSION
Lung and colon cancers are among the leading causes of fatality worldwide. Early and accurate diagnosis of these cancers can significantly improve therapeutic outcomes and survival rates. The goal of this study was to detect lung and colon cancer accurately and efficiently. Transfer learning is employed for this detection on a dataset of 25000 histopathology images of lung and colon tissues. Our deployed DL network's overall accuracy was initially 89. %, however, after applying the proposed CSIP approach, accuracy was significantly enhanced and reached 98.8%. The proposed methodology has not only outperformed state-ofthe-art methods for lung and colon cancer detection in terms of accuracy but has also reduced the time and computational cost. We believe that our proposed methodology can also be implicated in the effective diagnosis of other diseases. His research interests include multimedia analysis and processing with focus on medical, information security, machine learning, and deep learning.
TAUQEER FAIZ received the master's degree from Staffordshire University, U.K. He is a Researcher in the area of information systems. He holds a rich experience of teaching, research, and consultancy. He has taught subjects like business analytics, machine learning, data structures, mobile applications development, 3D games development, and virtual reality. He has also served as a Senior IT Trainer for Microsoft, Android, and Apple at different institutions of Unite Arab Emirates. He is working as an Instructor at Skyline University College, Al Sharjah, where he conducts the laboratory sessions and assist students in their projects. His research interests include business analytics and virtual reality with a focus on gamification, shareholder engagement, sustainability, and e-commerce start-ups. He is an active member of Microsoft, Android, and Unity official platforms.
MUNIR AHMAD (Member, IEEE) received the Master of Computer Science degree from the Virtual University of Pakistan, in 2018. He is currently pursuing the Ph.D. degree in computer science with the School of Computer Science, National College of Business Administration and Economics. He has spent several years in industry. He is currently working as the Executive Director/Head of the IT Department, United International Group, Lahore, Pakistan. He has vast experience in data management and efficient utilization of resources at multinational organizations. He has conducted many research studies on sentiment analysis and utilization of AI for prediction on various healthcare issues. His research interests include data mining, big data, and artificial intelligence.