# A Self-Supervised Detail-Sensitive ViT-Based Model for COVID-19 X-ray Image Diagnosis: SDViT
###### Abstract  
COVID-19 has led to a severe impact on the society and healthcare system, with early diagnosis and effective treatment becoming critical. The Chest X-ray (CXR) is the most time-saving and cost-effective tool for diagnosing COVID-19. However, manual diagnosis through human eyes is time-consuming and tends to introduce errors. With the challenge of a large number of infections and a shortage of medical resources, a fast and accurate diagnosis technique is required. Manual detection is time-consuming, depends on individual experience, and tends to easily introduce errors. Deep learning methods can be used to develop automated detection and computer-aided diagnosis. However, they require a large amount of data, which is not practical due to the limited annotated CXR images. In this research, SDViT, an approach based on transformers, is proposed for COVID-19 diagnosis through image classification. We propose three innovations, namely, self-supervised learning, detail correction path (DCP), and domain transfer, then add them to the ViT Transformer architecture. Based on experimental results, our proposed method achieves an accuracy of 95.2381%, which is better performance compared to well-established methods on the X-ray Image dataset, along with the highest precision (0.952310), recall (0.963964), and F1-score (0.958102). Extensive experiments show that our model achieves the best performance on the synthetic-covid-cx dataset as well. The  
methods (fastText-based (ft), domain-specific (ds), and domain-agnostic (da)) were used to the represent these tweets. Three different convolution neural networks (CNNs) were proposed to implement the proposed features. Then, the ensemble CNN was used to combine the three CNNs for the end results. In the designed experiments in [2], these CNN models demonstrated stable and robust performance. The feature extraction methods proved effective for sentiment classification based on the discriminating characteristics. The diversity of the dataset, along with greyscale X-ray images with only one informational difference, presents huge challenges to human classification. Therefore, automated detection methods such as computer-aided diagnosis techniques have attracted increasing attention. In particular, deep learning-based detection methods have been used for image classification in an effort to achieve fast and accurate classification. However, public access to annotated CXR images is limited, which presents challenges to detection based on deep learning methods. Our research proposes a Transformer-based model, SDViT, for COVID-19 diagnosis through X-ray image classification. Our design has demonstrated its advantage in experiments. Our SDViT design outperforms the current state-of-the-art models for COVID-19 CXR image classification. The following are our main contributions:  
1. In our model, we propose a self-supervised strategy that allows the model to repair ambiguous and defective parts using information from other parts. We add this design to address the issue of the COVID-19 dataset being relatively small, as well as to drive full learning of intrinsic features instead of focusing only on the final classification results. This approach can improve understanding of the intrinsic logic and enhance the robustness of the model. 2. We use the MagNet model to migrate the data distribution, allowing the practice and training data to be compared more closely. 3. We propose a new structure, the Detail Correction Path, to repair the possible loss of original key features caused by MagNet. The DCP passes the original details to the location after MagNet transformation, preserving relevant information for the classification task. 4. We modify the original ViT structure for data features and combine different strategies to obtain our SDViT model. We have open-sourced our code at [[https://github.com/ankang1115/SDVIT](https://github.com/ankang1115/SDVIT)]([https://github.com/ankang1115/SDVIT](https://github.com/ankang1115/SDVIT)) (accessed on 21 December 2022) for public access.