## 1 Introduction  
GI tract diseases are disorders related to the digestive system. Diagnoses of these diseases are highly dependent on medical imaging. The processing of large visual data is difficult for medical professionals and radiologists; this renders it subject to incorrect medical evaluation [1]. The most common diseases that occur in the digestive system are ulcerative colitis, ulcers, esophagitis, and polyps, which can transform into colorectal cancer. These diseases are the key causes of mortality around the globe [2]. As per the survey conducted on colorectal cancer for the year 2019, 26% of men, as well as 11% of women, around the globe are diagnosed with this cancer [3]. In 2021, more than 0.3 million cases of colorectal cancer were diagnosed in the US, and the death toll rose to 44% [4]. Roughly 0.7 million new instances of diseases are reported each year worldwide [5]. Alongside GI malignant growth [6, 7], ulcer advancement in the GI tract is additionally a significant illness. The authors of [8] announced that the most noteworthy yearly predominance of ulcers was 141 per 1000 people in Spain, and the least was around 57 in Sweden. During a routine endoscopic checkup, many lesions are missed due to the factors like the presence of stool and because of the organ's multifaceted topology. Although the bowel is cleansed for improvement in the detection of cancer or its predecessor lesions, still, the ratio of missed polyps is immoderate, from 21.4-26.8% [9]. Moreover, the interclass similarity between lesions also plays a challenging role in identifying them. A recent procedure called wireless capsule endoscopy (WCE) [10] empowers specialists to see inside the intestinal tract, a region that is undeniably challenging to reach with regular endoscopy. In WCE, the patient swallows a camera-containing capsule that catches many images as it travels through the GI tract. These images are stitched together to form a video, which is then, at that point, examined by the specialists (expert gastroenterologists) to track down deformations. This manual strategy requires 2-3 h overall, so analysts are currently creating different computerized techniques [11; 12]. Therefore, an automated system is required that not only classifies the diseases, but also highlights the diseased area. Several techniques for identifying colorectal cancer and other diseases using endoscopic images have been proposed in the literature by computer vision (CV) and machine learning (ML) researchers. In [13], the authors proposed a technique with which they established a feature matrix, and then classified these features using a support vector machine (SVM) and decision trees. The maximum achieved accuracy using this method was 93.64%. Similarly, in another paper [7], the authors employed the information of local as well as global features and fused them. Deep discriminant features were obtained using an adaptive aggregation feature module. The best achieved accuracy using the stated techniques was 96.37%. The challenge has persisted up to this point due to the similarities between many symptoms, such as color, shape, and texture of lesions. Moreover, many researchers have focused on single disease detection and binary classification [14; 15; 16]. Furthermore, the localization of diseases is also a major challenge that requires addressing. Hence, in this paper, we propose a technique to address these challenges and perform multiclass classification after the localization of diseases. The major diseases analyzed in our research are polyps, esophagitis, ulcers, and ulcerative colitis, as well as a normal class. The following summarizes the paper's primary contributions:  
* Development of an encoder-decoder-based model for segmentation and localization of diseases. * Development of an explainable AI-based model that is utilized for the classification of endoscopic images with contours into four main diseases. * Development of an efficient and robust framework having better accuracy, precision, and recall rate.