# A Transfer Learning Method for Pneumonia Classification and Visualization
## 6 Discussion  
In this section, an analysis of the baseline CNN models compared with the proposed model will be established based on the results exposed in Section 4. We will argue about the advantages of our model for the classification of the Pneumonia dataset. In addition, we evaluate the performance of the model with Gradient-weighted Class Activation Mapping (Grad-CAM) [50], which offers a heat-map of the possible localization of pneumonia manifestations. Grad-CAM is a technique used to produce \"visual explanations\" of CNN models using the gradient of a target concept. The target flows into the final convolutional layer to produce a coarse localization map highlighting the important regions in the image of the prediction concept. In this research, the radiopaque segments that are correctly detected by the filters, and represented in the feature maps of the Xception mode when classifying between NORMAL and PNEUMONIA are highlighted using the gradients of the last Convolutional layer inside the 14 th convolutional block. A brief explanation will be stated about the problems of Grad-CAM on the pneumonia images. In Figure 12, examples of both correctly and incorrectly classified images with their corresponding heat-map are displayed. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline \multirow{2}{*}{**Model**} & \multirow{2}{*}{**Confusion Matrix**} & \multirow{2}{*}{**Precision**} & \multirow{2}{*}{**Recall**} & \multirow{2}{*}{**F1-Score**} & \multicolumn{2}{c}{**ROC Curve**} & \multicolumn{2}{c}{**Precision–Recall**} \\  & & & & & & **AUC** & **AUC** \\ \hline \multirow{2}{*}{VGG-16} & 184 & 50 & \multirow{2}{*}{0.874} & \multirow{2}{*}{0.892} & \multirow{2}{*}{0.883} & \multirow{2}{*}{0.913} & \multirow{2}{*}{0.942} \\  & 42 & 348 & & & & & \\ \multirow{2}{*}{ResNet50-v2} & 156 & 78 & \multirow{2}{*}{0.832} & \multirow{2}{*}{0.990} & \multirow{2}{*}{0.904} & \multirow{2}{*}{0.946} & \multirow{2}{*}{0.955} \\  & 4 & 386 & & & & & \\ \multirow{2}{*}{DenseNet121} & 159 & 75 & \multirow{2}{*}{0.838} & \multirow{2}{*}{0.992} & \multirow{2}{*}{0.908} & \multirow{2}{*}{0.951} & \multirow{2}{*}{0.954} \\  & 3 & 387 & & & & & \\ \multirow{2}{*}{LZNet2019} & 18 & 46 & \multirow{2}{*}{0.891} & \multirow{2}{*}{0.967} & \multirow{2}{*}{0.927} & \multirow{2}{*}{0.953} & \multirow{2}{*}{-} \\  & 13 & 377 & & & & & \\ \multirow{2}{*}{Cho2020} & 207 * & 31 * & \multirow{2}{*}{**0.932**} & \multirow{2}{*}{**0.996**} & \multirow{2}{*}{**0.959 * & **0.993** & - \\  & 4 * & 386 * & & & & & \\ \multirow{2}{*}{Our model} & 162 & 72 & \multirow{2}{*}{0.843} & \multirow{2}{*}{0.992} & \multirow{2}{*}{0.912} & \multirow{2}{*}{0.968} & \multirow{2}{*}{0.973} \\  & 3 & 387 & & & & & \\ \hline \hline \end{tabular}  
* Numbers obtained by reverse engineer of the results offered in the corresponding paper.  
\end{table} 
Table 4: Confusion Matrices (CMs) and performance measures of different models for pneumonia classification on the test set. Green fields were found by reverse engineering of paper metrics. Figure 11: Metrics and curves of the implemented models where **(a)** shows the reception operating characteristic (ROC) curve and area under the curve (AUC); **(b)** shows the precision–recall curve with its respective area. Figure 12: Heat maps for classified test examples using Grad-CAM. (**a**,**c**,**e**,**g**) show a preprocessed CXRAYS; (**b**,**d**,**f**,**g**), show their respective Grad-CAM. On the validation results at training time (Table 3), the proposed model outperformed all the baseline models. Our proposal achieved a validation loss of 0.0453 at epoch 14. On the contrary, VGG16 obtained a loss of 0.1928 at epoch 97; ResNet50v2 obtained a loss of 0.0514 at epoch 93; DenseNet121 obtained a loss of 0.0496 at epoch 98. The training time of a DL algorithm is an important factor in order to select a specific model for a specific task. As mentioned in Section 5.1, our model took 53 s for the epoch.