The development of deep learning technology has enabled machines to achieve high-level accuracy in interpreting medical images. While many previous studies have examined the detection of pulmonary nodules and cardiomegaly in chest X-rays using deep learning, the application of this technology to heart failure remains rare. In this study, we investigated the performance of a deep learning algorithm in terms of diagnosing heart failure using images obtained from chest X-rays. We used 952 chest X-ray images from a labeled database published by the National Institutes of Health. Two cardiologists respectively verified and relabeled these images, for a total of 260 "normal" and 378 "heart failure" images, and the remainder were discarded because they had been incorrectly labeled. In this study "heart failure" was defined as "cardiomegaly or congestion", in a chest X-ray with cardiothoracic ratio (CTR) over 50% or radiographic presence of pulmonary edema. To enable the machine to extract a sufficient number of features from the images, we used the general machine learning approach called data augmentation and transfer learning. Owing mostly to this technique and the adequate relabeling process, we established a model to detect heart failure in chest X-ray by applying deep learning, and obtained an accuracy of 82%. Sensitivity and specificity to heart failure were 75% and 94.4%, respectively. Furthermore, heatmap imaging allowed us to visualize decisions made by the machine. The figure shows randomly selected examples of the prediction probabilities and heatmaps of the chest X-rays from the dataset. The original image is on the left and its heatmap is on the right, with its prediction probability written below. The red areas on the heatmaps show important regions, according to which the machine determined the classification. While some images with ambiguous radiolucency such as (e) and (f) were prone to be misdiagnosed by this model, most of the images like (a)-(d) were diagnosed correctly. Deep learning can thus help support the diagnosis of heart failure using chest X-ray images.