## 2 Proposed Method  
### Feature Extraction and Reduction  
In general, auto-encoders converts higher dimensional input data into lower dimensional more abstract information through encoding data into another form. Then, the encoded data can be reconstructed to an approximate shape of the original input data depending on the reconstruction error [8; 36]. In our work, we utilize the encoding process only and apply post-processing steps to increase the diagnosis accuracy. To avoid learning everything from scratch, we propose an efficient method through feature reuse to extract high spatial information characteristics deduced through abstract features utilizing ResNet auto-encoder bottleneck layers. ResNet has shown exceptional performance in several challenging classification task competitions such as the competition on ImageNet dataset [37]. The encoding process can be defined as a feature-extraction function denoted as \(\xi_{\phi}\) applied on training data \(\{\mathbf{x}_{1},\mathbf{x}_{2},\dots,\mathbf{x}_{N}\}\) as:  
\[\xi_{\phi}(\mathbf{x}_{n})=\sigma(\mathbf{W}\mathbf{x}_{n}+\mathbf{b}), \tag{1}\]  
where \(\mathbf{x}\) represents the input image data vector and \(N\) is the number of images producing \(\mathbf{c}_{n}=\xi_{\phi}(\mathbf{x}_{n})\) which is the first coded representation of the \(n\) input image. The parameters \(\mathbf{b}\) and \(\mathbf{W}\) are the encoder bias vector and weights matrices, respectively, whereas \(\sigma\) is the activation function which typically is either sigmoid or Rectified Linear Unit (RELU) function. Given that a CXR image has a size of \(a\times b\), the image is first resized to the size of the ResNet input image layer, i.e., \(224\times 224\), and is then passed to the building blocks of the ResNet network to extract the raw features from that image. Each block, which is denoted as \(F_{l}(\mathbf{c}_{n})\) where \(l\) is the number of bottleneck blocks, consists of 3 weighted convolution layers with Batch Normalization (BN) and RELU as shown in Figure 2. Since a skip connection has some advantages such as no extra parameters, proven to improve deep network performance [6], and can smooth information propagation, therefore, we propose adding more skip connections in a dense-fashion way [18] which allow feature reuse and leading to more accurate and compact learning. Thus, we can define the resulted code for one image after \(F_{l}\) blocks with skip connections known as identity mapping from previous blocks as:  
\[\mathbf{c}_{n,l}=\sum_{i=2}^{l}(h(\mathbf{c}_{n,l;i-1}),F_{i}(\mathbf{c}_{n})), \tag{2}\]  
where \(h(\mathbf{c}_{n})\) represents the identity mapping. As depicted in Figure 3, each residual block has an identity mapping as shown in sub-Figure 3a and each layer in the dense block is  
Figure 2: The proposed pneumonia diagnosis system depicting feature extraction via residual building blocks, feature reduction, SVM classifier training with Bayesian optimization, and score fusion. fed with information from all previous layers as shown in sub-Figure 3b, whereas the proposed feature extraction descriptor takes advantage of both paradigms where each residual block is fed with information from previous blocks through skip connections as shown in sub-Figure 3c. For instance, \(\mathbf{c}_{n,3}\) is the sum of \(h(\mathbf{c}_{n,1})\), \(h(\mathbf{c}_{n,2})\), and \(F_{2}(\mathbf{c}_{n})\). As a consequence of many input images being processed through the ResNet layers each having different convolution and batch size, stride, and padding, leading to a higher data dimensionality. To alleviate this problem, feature reduction techniques are performed on each slide of the 3D data resulting in reduced feature points for each input image. These techniques include calculating one point for each slide based on four rules, i.e., \(\{\min,\max,\sigma,\mu\}\), where \(\mu\) is the mean and \(\sigma\) is the standard deviation.