# A Trustworthy Framework for Skin Cancer Detection Using a CNN with a Modified Attention Mechanism
## 3 Proposed DCAN-Net
### Preprocessing  
Data preprocessing is an important step in training machine learning approaches to enhance the quality of the input data. The classification accuracy can decrease when training a CNN model using raw input data such as images. To mitigate this problem, data augmentation was performed during the preprocessing phase. This involves the generation of new images derived from the original images, introducing variations in aspects such as brightness adjustments, contrast, orientation position, and scale, as shown in Figure 1. For skin cancer, we employed a dataset augmentation approach similar to that previously used by [PERSON] et al. [39], as shown in Figure 1. For contrast enhancement, we employed adaptive histogram equalization (CLAHE) with a clip limit of 2.0 and a tile grid size of 8 x 8 to evenly distribute intensity values across the image, enhancing visibility while avoiding noise amplification. Brightness adjustment involved linearly scaling the pixel intensity values within a range of \(-20\%\) to \(+20\%\) of the original brightness, enabling better model robustness under varying lighting conditions. For geometric transformations, we applied rotations of up to \(\pm 10\) degrees, along with horizontal and vertical flipping. These transformations were chosen to simulate natural variations in dermatoscopic images and improve the generalization of the proposed model. We will ensure that these details are clearly outlined in the revised manuscript to enhance clarity and precision. A two-step approach was used, preprocessing and training a CNN model, and the results were compared with other benchmarks with and without data augmentation. Our strategy is similar to that of [PERSON] et al. [39], in that it provides augmentation using brightness adjustment, contrast enhancement, and geometric transformations.  
Brightness adjustment: Various lighting conditions can lead to fluctuations in the image brightness, and the application of gamma correction transformations with different values, as given in Equation (1), can result in images that are either too bright or too dark. Therefore,  
Figure 1: Data preprocessing step to increase the number of samples in the skin cancer benchmark for adequate classification.  
the chosen images may exhibit variations caused by differences in illumination. Brightness adjustment transformations allowed us to address this illumination-induced variation.  
\[g(x,\ y)=\text{a}\times f(x,\ y) \tag{1}\]  
Contrast enhancement: This process mitigates the effect of contrast variations in images resulting from changing lighting conditions. The contrast stretching procedure described in Equation (2) was applied to modify the contrast variations using various factors, as illustrated in Figure 1.  
\[g(x,\ y)=\left\{\begin{aligned} a_{1}f(x,\ y)f(x,\ y)& <r_{1}a_{1}f(x,\ y)f(x,\ y)<r_{1}\\ a_{2}(f(x,\ y)-r_{1})+s_{1},\ r_{1}\geq f(x,\ y)&<r_{ 2}a_{2}(f(x,\ y)-r_{1})+s_{1},\ r_{1}\geq f(x,\ y)<r_{2}\\ a_{3}(f(x,\ y)-r_{2})+s_{2},\ f(x,\ y)&\geq r_{2}a_{3}( f(x,\ y)-r_{2})+s_{2},\ f(x,\ y)\geq r_{2}\end{aligned}\right\} \tag{2}\]  
where \(g(x,y)\) is the output pixels derived from the \(g(x,y)\) input pixel; \(s_{1},s_{2},r_{1}\), and \(r_{2}\), are the parameters used for contrast adjustment; \(a_{1}\), \(a_{2}\), and \(a_{3}\) are the scale factors for the rotations in grayscale image and formulated as \(s_{1}/r_{1}\), \((s_{2}-s_{1})/(r_{2}-r_{1})\), and \((\text{L}-s_{2})/(\text{L}-r_{2})\), respectively; L is the maximum range of the gray level value.  
Geometric transformations: This process encompasses scaling, translation, and rotation operations, which are used for each image within the dataset, resulting in the creation of new images. In the context of the CNN architecture, this process holds significant value because it enables the model to perceive the same object from various angles, bolstering its generalization capability. Therefore, all preprocessing steps are fundamental for performance enhancement.