# COVID-19 CXR Classification: Applying Domain Extension Transfer Learning and Deep Learning
## 3 Materials and Methods
### Domain Extension Transfer Learning  
Pretraining and Fine-Tuning  
We proposed an effective methodology for classifying COVID-19 X-ray images based on domain extension transfer learning which was conducted using a pretrained ResNet-50 model. Each pretraining process was carried out according to the target data using the MIMIC CXR and MIMIC CXR (PA) datasets. To classify COVID-19 and non-COVID-19 CXR successfully, we matched the source domain and target domain in the medical area using a similar CXR dataset. Generally, data are limited, and it is expensive to get expert annotation in the medical area. Deep CNN training takes a long time as it needs a lot of computing and memory resources. In the absence of sufficient data, transfer learning (TL) offers a feasible option to fine-tune a CNN that has previously been pretrained on a huge collection of accessible labeled datasets from some other category. The collected COVID-19 dataset was deemed insufficient to train the CNN, which involves a sizable number of trainable parameters, from scratch to learn the complicated representative features for differentiating between COVID-19 and non-COVID-19 CXRs. Therefore, transfer learning was used to train final models for the target domain (\(D_{T}\)) and target task (\(T_{T}\)) with less annotated data by utilizing the information obtained from the source domain (\(D_{S}\)) and source task (\(T_{S}\)). The general idea of transfer learning is as follows. A tuple of the form \(\{\chi,\ P(X)\}\), where \(\chi\) and \(P(X)\) (\(X=x_{1},\ x_{2},\dots,x_{n}\ \in\chi\)) represent the feature space and associated marginal probability distribution can be used to describe a domain (\(D\)). A task \(T\) consists of a label space \(Y\) and a conditional probability distribution \(P(Y|\ X)\) that is typically learned from the training data, given a domain \(D=\{\chi,\ P(X)\}\). The idea of transfer learning is to learn the target conditional probability distribution \(P(Y_{T}|X_{T})\) in the target domains (\(D_{T}\)), using the knowledge gained from the source (\(D_{S}\)) by troubleshooting the tasks (\(T_{S}\)) [29]. Figure 3 shows the basic description of transfer learning. The recent research has shown that transfer learning has a very limited role to play when the source and target domains are quite different in nature, such as in natural and medical images, as the networks may obtain quite distinct high-level features in the two cases. Therefore, we used each MIMIC CXR and MIMIC CXR(PA) dataset as the source data (\(D_{S}\)) to pretrain the network first, and then by using pretrained model, we applied the knowledge obtained from solving source task (\(T_{S}\)) with source dataset to the target dataset (\(D_{T}\)), the Mendeley dataset. Therefore, we proposed a deep learning methodology that solves the target task (\(T_{T}\)) with domain extension transfer learning. Transfer learning was implemented to build up the final model to solve the target task including scarce target data (\(D_{T}\)) by utilizing the knowledge learned from the source data (\(D_{S}\)). Figure 3: Transfer learning. Fine-tuning is a deep learning technique to increase classification performance by fitting pretrained model weights to target data. Various fine-tuning strategies are also used in the field of imaging diagnostics [36]. In the biomedical field, there is a case where the classification performance was shown to improve by applying fine-tuning [37]. In this study, the ResNet-50 model was pretrained using MIMIC CXR and MIMIC CXR(PA) data based on domain extension transfer learning. Additionally, the performance of the models that were fitted to the target dataset was compared with that of ResNet-50, and the CNN models that had already been pretrained using natural images were pretrained using MIMIC CXR and MIMIC CXR(PA) data, respectively. In this study, a fine-tuning strategy was used when the target domain dataset was insufficient and when the data in the source and target domains were similar.