Using machine learning to process lung medical images can greatly improve hospital efficiency and save costs. With the increase in the number of patients, the demand for pneumonia pathologic recognition systems is increasing. Therefore, the organic combination of the two is of great significance to reduce the pressure on the medical and health systems. This paper presents a deep-learning method to identify and predict pneumonia. Using Convolutional Neural Networks, ResNet, and DenseNet as well as improved and integrated models, the known pneumonia images and normal lung images were used as training sets to identify lung images and determine whether pneumonia is present. The results showed that the original CNN and the improved ResNet network had the best effect, and the F1-score for pneumonia recognition reached 0.88. Therefore, this paper integrated these two neural networks. Finally, the F1-score of the integrated model reached 0.89, which was able to predict more accurately. This paper provides a new idea for selecting, integrating, and applying the model in the medical field.