###### Abstract
Some researchers have promising results, such as [PERSON] et al. [18], [PERSON] et al. [28], [PERSON] et al. [29], and [PERSON] et al. [30]. Some groups have combined CNN with rib suppression and lung filed segmentation for other classification tasks, while some highlighted a visualization technique in CNN to find the region of interest (ROI) that can be used to identify pneumonia and distinguish between bacterial and viral types in pediatric chest X-rays. The concept of transfer learning in deep learning framework was used by [PERSON] et al. [28] for the detection of pneumonia using pre-trained ImageNet models [31] and their ensembles. A customized VGG16 model was used in [PERSON] et al. [30], which consists of two parts, lung region identification with a fully convolutional network (FCN) model and pneumonia category classification using a deep convolutional neural network (DCNN). A dataset containing 32,717 patients' X-rays were used in a deep learning technique by [PERSON] et al. [12] producing promising results. In [13] the authors further went on using data augmentation along with CNN to get better results by training on a small set of images. [PERSON] et al. [32] reported a 121-layer CNN on chest X-rays to detect 14 different pathologies, including pneumonia using an ensemble of different networks. [PERSON] et al. [33] used a 3D Deep CNN with shortcuts and dense connections which help in solving the gradient vanishing problem. [PERSON] et al. [17] and [PERSON] et al. [34] used a deep neural network called Mask-RCNN (Region based Convolutional Neural Network) for the segmentation of pulmonary images. This was used along with image augmentation for pneumonia identification, which was ensembled with RetinaNet to localize pneumonia. A pretrained DenseNet-121 and feature extraction techniques were used in the accurate identification of 14 thoracic diseases in [16]. [PERSON] et al. [35] used AlexNet and GoogLeNet [36] with data augmentation to obtain an Area Under the Curve (AUC) of 0.94-0.95. The same authors had better results of AUC of 0.99 using modified two-network ensemble architecture. The highest accuracy reported in the above-mentioned literatures in classifying the normal vs. pneumonia patients and bacterial vs. viral pneumonia using X-ray images using deep learning algorithms was 96.84% and 93.6%, respectively. Therefore, there is significant room for improving the result either by using different deep learning algorithms or modifying the existing outperforming algorithms or combining several outperforming algorithms as an ensemble model to produce a better classification accuracy, particularly in classifying viral and bacterial pneumonia. The proposed study is reporting a transfer learning approach using four different pre-trained network architectures (AlexNet, ResNet18, DenseNet201, and SqueezeNet) and analyzed their performances. The key contribution of this work is to provide a CNN-based transfer-learning approach using different pre-trained models to detect pneumonia and classify bacterial and viral pneumonia with higher accuracy compared to the recent works. In addition, the paper also provides the methodological details of the work, which can be utilized by any research group to take the benefit of this work. Moreover, radiographic findings are poor indicators for the diagnosis of the cause of pneumonia until now. Therefore, the motivation of the present study was to utilize the power of machine learning, firstly to diagnose pneumonia by analyzing radiograph and secondly to differentiate viral and bacterial pneumonia with better accuracy. The rest of the paper is divided in the following section: Section 2 summarizes different pre-trained networks used for this study and Section 3 describes the methodology used in the study, where the details of the dataset and the pre-processing steps to prepare the data for training and testing are provided. Section 4 provides the results of the classification algorithms, which is compared with some other recent studies, and the results are discussed in this section.