# A Trustworthy Framework for Skin Cancer Detection Using a CNN with a Modified Attention Mechanism
## 3 Proposed DCAN-Net
### Proposed Model Selection  
The proposed model incorporates key modifications to the ConvNeXt architecture [40], enhancing its capability to detect skin cancer in dermatoscopic images. A significant improvement involves integrating a modified channel attention mechanism inspired by the dual-fire attention network (DFAN) [41]. Unlike the original ConvNeXt architecture, which primarily focuses on extracting features using standard convolutional layers, the proposed model replaces the conventional \(7\times 7\) convolution layer with a \(5\times 5\) separable convolution. This substitution reduces the computational overhead while maintaining the feature extraction efficiency. Additionally, the spatial attention module was fused with the intermediate outputs of the channel attention module via element-wise product operations. This dual-attention mechanism, illustrated in Figure 2, improved the model's ability to localize and emphasize critical regions within the input images, enabling more precise detection of cancerous lesions. The modified architecture diverges from the original ConvNeXt by employing stacked dual-attention modules after every two successive convolutional layers, a novel design that optimizes feature representation. While the base ConvNeXt architecture relies on depthwise and \(1\times 1\) convolutions with GELU activation and layer normalization [42], the proposed model integrates channel attention to weigh the importance of RGB channels in the feature maps (denoted as \(Att_{C}\)) as well as spatial attention to focus on the most salient image regions. This synergistic attention fusion offers a unique advantage over the standard ConvNeXt by refining the model's sensitivity to the subtle visual cues in dermatoscopic images. Moreover, the patchy stem cell design of ConvNeXt is preserved, ensuring efficient multi-scale feature extraction while the attention mechanisms enhance the representation capabilities, particularly for medical image analysis. The two-phase (offline and online) framework introduced further differentiation from the original ConvNeXt. In the offline phase, preprocessing steps, such as augmentation with variations in brightness, contrast, and orientation, are applied to improve the model's generalizability on the HAM10000 dataset. Grad-CAM is utilized to identify critical regions in the training images, with these features fused into the attention mechanism for improved specialization in dermatoscopic analysis. In the online phase, DCAN-Net leverages the pre-trained dual-attention-enhanced model for real-time predictions, combining accuracy with explainability by using Grad-CAM visualizations. This ensures that clinicians can trust the system's diagnostic outputs, a feature absent in the original ConvNeXt. Overall, the proposed design achieves a balance between high diagnostic precision and computational efficiency, making it highly suitable for resource-constrained medical environments. To capture the improved feature maps F_(M\"), we combined the spatial attention feature maps \(Att_{S}\) with the input feature maps F_M using a residual skip connection, accomplished through elementwise addition. This approach notably increased the feature representation capability, allowing for a more accurate recognition of essential regions.