## 2 Materials and Methods
### Image Preprocessing  
Not every image we found could be used in this work. A couple of constraints were imposed in an attempt to obtain a solid classifier. Firstly, not every image found in the repositories was an X-ray radiograph. Some of them were computed tomograms, and since this work only aimed to develop a classifier for RX, the CT images were removed from the collected set. Three types of views were found among the RX images: posterior-anterior (PA), anterior-posterior (AP), and lateral views. Among the images found, the number of lateral views was much lower than the number of AP and PA ones. Moreover, lateral views are usually less useful for diagnosis. Therefore, we discarded the lateral views and pursued the construction of a classifier that handles only PA and AP views.  
In general, convolutional neural networks (and other types of neural networks) require inputs of a fixed and predefined size. However, among the collected PA and AP images, there were images of multiple sizes and aspect ratios \(AR=h/w\), where \(h\) is the height of the image and \(w\) denotes its width, both measured by their numbers of pixels. Therefore, the images had to be resized to a common size for appropriate usage. If images with different original aspect ratios are resized to a common aspect ratio, at least one will necessarily lose its initial \(AR\). This might affect the appearance of distinct features that might indicate the presence of COVID-19. Hence, we tried to avoid significant changes in the aspect ratios with respect to their original values. We decided to use images that originally had square (or almost square) shapes--i.e., an equal number of pixels for the width and height. Since we resized the images into square ones, in order to avoid the images becoming highly distorted, we selected only images whose original aspect ratios were very close to 1: \(0.95\leq AR\leq 1.05\). These images were resized to a new width and height of \(h=w=400\) pixels each. We picked the value of \(h=w=400\) because, among the images that satisfied the constraint on \(AR\), there were many good-quality images with a \(h\) and \(w\) both larger than 400 (in this statement, the quality that we refer to is a quality assessed visually, avoiding blurred images, images with too many annotations, or images where the lungs appeared significantly shifted from the center). In order to avoid expanding the images, possibly generating pixelation and misleading information, we only allowed images whose sizes could be maintained or reduced. Hence, images that initially did not satisfy the constraint on the aspect ratio or that had at least one dimension smaller than 400 pixels were removed from the set.  
Lastly, to achieve more robust results in every iteration of the training process, the images were rotated by random angles of up to 5 degrees clockwise or counterclockwise. Figure 3 illustrates the whole process sequence.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline \multirow{2}{*}{**Ref.**} & **Num. of** & **Images Satisfying** & \\  & **Retrieved Images** & **Size Constraints** & **Label Details** \\ \hline
[53] & 238 & 11 & 2 images labeled as “COVID-19” \\  & 238 & 11 & 6 image labeled as “No Finding” \\  & & & 3 images labeled “Unclassified” \\ \hline
[54] & 5906 & 151 & 18 images labeled as “COVID-19” \\  & 5906 & 151 & 100 images labeled as “No Finding” \\  & & & 21 images labeled as “Bacteria” \\  & & & 12 images labeled as “Other Viruses” \\ \hline
[55] & 2683 & 2683 & 205 images labeled as “COVID-19” \\  & & & 1341 image labeled as “No Finding” \\  & & & 1137 images labeled as “Pneumonia” \\ \hline \hline \end{tabular}
\end{table}
Table 1: _Cont._