The state of the art of artificial intelligence (AI) for various medical imaging applications leads to enhanced accuracy, analysis, visualization, and interpretation of chest Xray (CXR) images for diagnosis. Many diseases are diagnosed based on CXR images. In this paper, two types of abnormalities are diagnosed based on AI techniques. The two classes are atelectasis and cardiomegaly. The acquired images are segmented to localize the chest region and then enhanced using gray-level transformation methods. The enhanced images are passed to two pretrained convolutional neural networks (CNNs): shuffle and mobile net. The transfer learning approach is utilized in this stage. The automated features are extracted from the last fully connected layer. Each CNN deserves to have the two most representative features for the two classes. These four features are passed to support the vector machine classifier. The training accuracy reached 100% and the test accuracy was 96.7%. The proposed method can be extended to be a milestone in the classification of all heart-lung diseases that can be diagnosed using chest X-ray images.