## 3 Materials and Methods
### Proposed SkinSwinViT Architecture  
The SkinSwinViT model, as proposed in this study, is designed for the purpose of identifying skin disorders classified into seven distinct categories. Figure 3 presents the architectural design of the SkinSwinViT model. Drawing inspiration from SwinViT [32], the model primarily integrates components including data preprocessing, SwinTransformer Block, Global Attention Block, and Classifier Block. To address the imbalance within the skin lesion dataset during data preprocessing, augmentation techniques are employed to enrich the segmented training set. Subsequently, the parameters of the pre-trained model serve as initial values. Following this, the proposed methodology utilizes a two-layer encoder, comprising SwinTransformer Block and Global Attention Block, to extract nuanced features across various dimens \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline
**Category** & **NV** & **MEL** & **BKL** & **BCC** & **AKIEC** & **VASC** & **DF** & **Total** \\ \hline Training set & 5364 & 5226 & 5188 & 5129 & 5186 & 5083 & 5029 & 36205 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Sample distribution of the training set after data enhancement. Figure 3: The architecture of SkinSwinViT. proposed method employs a Classifier Block to ascertain the categorical outcome of skin lesion images. The detailed framework is expounded below. 1. SwinTransformer Block: Derived from the SwinViT model, the SwinTransformer Block initially conducts patching to segment skin lesion images into smaller patches, facilitating localized processing and computational efficiency. Embedding preserves spatial relationships among patches, facilitating comprehensive feature capture. Subsequently, Windowed Multi-Head Self-Attention (W-MSA) and Shifted Windowed Multi-Head Self-Attention (SW-MSA) are employed to capture local features and inter-patch relationships. These attention mechanisms enable contextual comprehension of local information, enhancing feature extraction efficacy. By integrating W-MSA and SW-MSA, contextual dependencies between neighboring patches are effectively captured, bolstering feature extraction. Moreover, employing multiple Swin Blocks within the SwinTransformer Block facilitates the learning of complex, abstract-level features. Each Swin Block comprises layers of W-MSA and SW-MSA. Additionally, patch merging reduces image resolution and integrates multi-scale information, enhancing overall comprehension. Specifically, the Patching and Embedding layer divides the input image \(x\in R^{H\times W\times 3}\) into non-overlapping patches of size \(4\times 4\), mapping dimensions to C dimensions to produce an embedded image \(x^{\prime}\in R^{H/4\times W/4\times C}\). Subsequently, \(x^{\prime}\) is normalized using Layer Normalization and forwarded to the Swin Block for feature extraction. The SwinTransformer Block consists of four stages, with patch merging operations at the conclusion of the first three stages to alter input feature dimensions. [1, 1, 3, 1] Swin Blocks are utilized across four stages, with channel counts per stage as [C, 2C, 4C, 8C]. The attention mechanism within each Swin Block is detailed as follows:  
\[z_{l}^{\prime}=F_{W-MSA}\big{(}LN\big{(}z_{l-1}^{\prime}\big{)}\big{)}+z_{l-1}^ {\prime} \tag{1}\]  
\[z_{l}=MLP\big{(}LN\big{(}z_{l}^{\prime}\big{)}\big{)}+z_{l}^{\prime} \tag{2}\]  
\[z_{l+1}^{\prime}=F_{SW-MSA}(LN(z_{l}))+z_{l} \tag{3}\]  
\[z_{l+1}=MLP\big{(}LN\big{(}z_{l+1}^{\prime}\big{)}\big{)}+z_{l+1}^{\prime} \tag{4}\]  
\[z=F_{STB}\big{(}x^{\prime}\big{)} \tag{5}\]  
where \(z_{l}^{\prime}\) and \(z_{l}\) represent output features of W-MSA and Multi-Layer Perceptron (MLP) modules, respectively. \(F_{W-MSA}\) and \(F_{SW-MSA}\) denote functions of W-MSA and SW-MSA, respectively. \(F_{STB}\) represents the transformation function of the SwinTransformer Block. 2. Global Attention Block: Compprising multi-head self-attention mechanisms, layer normalization, and MLP layers, the Global Attention Block integrates spatial and semantic information.