Tuberculosis is a chronic respiratory infectious disease that seriously endangers human health. Diagnosis of pulmonary tuberculosis usually depend on the analysis of chest X-rays by radiologists. However, there is a certain misdiagnosis rate with time consuming. Therefore, the purpose of this study is to propose a low-cost and automatic detection method of pulmonary tuberculosis images on chest X-rays to help primary radiologists. A pulmonary tuberculosis classification algorithm based on convolution neural network is proposed, which uses deep learning to classify chest X-ray images. Our method introduces coordinate attention mechanism into convolutional neural network (VGG16), so that the algorithm can capture not only cross-channel information, but also direction sensing and position sensing information, in order to better identify and classify pulmonary tuberculosis images. During the training process, we use the method of transfer learning and freeze network to make the model fit faster. The performance of our method is evaluated on the public dataset of tuberculosis classification of Shenzhen Third Hospital, China. We take the average data through 5-fold cross validation: accuracy= 92.73%, AUC= 97.71%, precision= 92.73%, recall= 92.83%, F1 score = 92.82%. Compared with the existing end-to-end method based on convolutional neural network (CNN), our method is superior to ConvNet, FPN + Faster RCNN and other methods. The comparison results with other methods show that our method has better accuracy, which can help radiologists make auxiliary diagnosis.